/** * Changes the size to the specified length. Equivalent to calling {@link #growArray} and this.size = N. * @param length The new size of the queue */ public void resize(int length) { growArray(length); this.size = length; }
public void add( T object ) { if( size >= data.length ) { growArray((data.length+1)*2); } data[size++] = object; }
public void add( T object ) { if( size >= data.length ) { growArray((data.length+1)*2); } data[size++] = object; }
/** * Changes the size to the specified length. Equivalent to calling {@link #growArray} and this.size = N. * @param length The new size of the queue */ public void resize(int length) { growArray(length); this.size = length; }
/** * Returns a new element of data. If there are new data elements available then array will * automatically grow. * * @return A new instance. */ public T grow() { if( size < data.length ) { return data[size++]; } else { growArray((data.length+1)*2); return data[size++]; } }
/** * Returns a new element of data. If there are new data elements available then array will * automatically grow. * * @return A new instance. */ public T grow() { if( size < data.length ) { return data[size++]; } else { growArray((data.length+1)*2); return data[size++]; } }
@Override public void initialize(int imageWidth, int imageHeight, int sensorOrientation) { // predeclare some memory synchronized (contours) { contours.growArray(5000); edgeLengths.resize(1000); contours.size = 0; edgeLengths.size = 0; } }
conn.growArray(N); for( int i = 0; i < N; i++ ) { conn.data[i].reset();
@Test public void growArray() { FastQueue<DummyData> alg = new FastQueue<DummyData>(1,DummyData.class,true); alg.grow().value = 10; int before = alg.getMaxSize(); alg.growArray(before+5); assertEquals(10,alg.get(0).value); }