/** @return the maximum number of indices this IndexBufferObject can store. */ public int getNumMaxIndices () { return empty ? 0 : buffer.capacity(); }
/** @return the maximum number of indices this IndexBufferObject can store. */ public int getNumMaxIndices () { return empty ? 0 : buffer.capacity(); }
/** @return the maximum number of indices this IndexBufferObject can store. */ public int getNumMaxIndices () { return buffer.capacity(); }
/** @return the maximum number of indices this IndexArray can store. */ public int getNumMaxIndices () { return empty ? 0 : buffer.capacity(); }
/** @return the maximum number of indices this IndexBufferObject can store. */ public int getNumMaxIndices () { return buffer.capacity(); }
/** @return the maximum number of indices this IndexArray can store. */ public int getNumMaxIndices () { return empty ? 0 : buffer.capacity(); }
private void increaseCapacity() { int newCapacity = (valueslength.capacity() == 0) ? DEFAULT_INIT_SIZE : valueslength.capacity() < 64 ? valueslength.capacity() * 2 : valueslength.capacity() < 1024 ? valueslength.capacity() * 3 / 2 : valueslength.capacity() * 5 / 4; final ShortBuffer nv = ShortBuffer.allocate(newCapacity); valueslength.rewind(); nv.put(valueslength); valueslength = nv; }
/** Returns a string representing the state of this short buffer. * * @return a string representing the state of this short buffer. * @since Android 1.0 */ public String toString () { StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()); sb.append(", status: capacity="); //$NON-NLS-1$ sb.append(capacity()); sb.append(" position="); //$NON-NLS-1$ sb.append(position()); sb.append(" limit="); //$NON-NLS-1$ sb.append(limit()); return sb.toString(); } }
/** Returns a string representing the state of this short buffer. * * @return a string representing the state of this short buffer. * @since Android 1.0 */ public String toString () { StringBuilder sb = new StringBuilder(); sb.append(getClass().getName()); sb.append(", status: capacity="); //$NON-NLS-1$ sb.append(capacity()); sb.append(" position="); //$NON-NLS-1$ sb.append(position()); sb.append(" limit="); //$NON-NLS-1$ sb.append(limit()); return sb.toString(); } }
protected void ensureCapacity(int minNbRuns) { final int minCapacity = 2 * minNbRuns; if (valueslength.capacity() < minCapacity) { int newCapacity = valueslength.capacity(); while (newCapacity < minCapacity) { newCapacity = (newCapacity == 0) ? DEFAULT_INIT_SIZE : newCapacity < 64 ? newCapacity * 2 : newCapacity < 1024 ? newCapacity * 3 / 2 : newCapacity * 5 / 4; } final ShortBuffer nv = ShortBuffer.allocate(newCapacity); valueslength.rewind(); nv.put(valueslength); valueslength = nv; } }
private void copyToOffset(int offset) { final int minCapacity = 2 * (offset + nbrruns); if (valueslength.capacity() < minCapacity) { // expensive case where we need to reallocate int newCapacity = valueslength.capacity(); while (newCapacity < minCapacity) { newCapacity = (newCapacity == 0) ? DEFAULT_INIT_SIZE : newCapacity < 64 ? newCapacity * 2 : newCapacity < 1024 ? newCapacity * 3 / 2 : newCapacity * 5 / 4; } ShortBuffer newvalueslength = ShortBuffer.allocate(newCapacity); copyValuesLength(this.valueslength, 0, newvalueslength, offset, nbrruns); this.valueslength = newvalueslength; } else { // efficient case where we just copy copyValuesLength(this.valueslength, 0, this.valueslength, offset, nbrruns); } }
private void makeRoomAtIndex(int index) { if (2 * (nbrruns + 1) > valueslength.capacity()) { increaseCapacity(); } copyValuesLength(valueslength, index, valueslength, index + 1, nbrruns - index); nbrruns++; }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { // little endian this.nbrruns = 0xFFFF & Short.reverseBytes(in.readShort()); if (this.valueslength.capacity() < 2 * this.nbrruns) { this.valueslength = ShortBuffer.allocate(2 * this.nbrruns); } for (int k = 0; k < 2 * this.nbrruns; ++k) { this.valueslength.put(k, Short.reverseBytes(in.readShort())); } }
public static ShortBuffer ensureLargeEnough(ShortBuffer buffer, int required) { if (buffer != null) { buffer.limit(buffer.capacity()); } if (buffer == null || (buffer.remaining() < required)) { int position = (buffer != null ? buffer.position() : 0); ShortBuffer newVerts = createShortBuffer(position + required); if (buffer != null) { buffer.flip(); newVerts.put(buffer); newVerts.position(position); } buffer = newVerts; } return buffer; }
short[] arr = new short[b.capacity()]; b.rewind(); b.get(arr);
}); for (int i = 0, len = sib.capacity(); i < len; i++) { int ind = sib.get(i); if (ind < 0) {
public void testGet_io() throws IOException { assertEquals(-1, ArbitraryInstances.get(InputStream.class).read()); assertEquals(-1, ArbitraryInstances.get(ByteArrayInputStream.class).read()); assertEquals(-1, ArbitraryInstances.get(Readable.class).read(CharBuffer.allocate(1))); assertEquals(-1, ArbitraryInstances.get(Reader.class).read()); assertEquals(-1, ArbitraryInstances.get(StringReader.class).read()); assertEquals(0, ArbitraryInstances.get(Buffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(CharBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(ByteBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(ShortBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(IntBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(LongBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(FloatBuffer.class).capacity()); assertEquals(0, ArbitraryInstances.get(DoubleBuffer.class).capacity()); ArbitraryInstances.get(PrintStream.class).println("test"); ArbitraryInstances.get(PrintWriter.class).println("test"); assertNotNull(ArbitraryInstances.get(File.class)); assertFreshInstanceReturned( ByteArrayOutputStream.class, OutputStream.class, Writer.class, StringWriter.class, PrintStream.class, PrintWriter.class); assertEquals(ByteSource.empty(), ArbitraryInstances.get(ByteSource.class)); assertEquals(CharSource.empty(), ArbitraryInstances.get(CharSource.class)); assertNotNull(ArbitraryInstances.get(ByteSink.class)); assertNotNull(ArbitraryInstances.get(CharSink.class)); }
/** * Draw wave. */ public void draw() { GLES20.glUseProgram(getProgram()); int positionHandle = GLES20.glGetAttribLocation(getProgram(), VERTEX_POSITION); GLES20.glEnableVertexAttribArray(positionHandle); GLES20.glVertexAttribPointer(positionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, COORDS_PER_VERTEX * SIZE_OF_FLOAT, vertexBuffer); int colorHandle = GLES20.glGetUniformLocation(getProgram(), VERTEX_COLOR); GLES20.glUniform4fv(colorHandle, 1, getColor(), 0); GLES20.glDrawElements(GLES20.GL_TRIANGLE_FAN, shortBuffer.capacity(), GLES20.GL_UNSIGNED_SHORT, shortBuffer); GLES20.glDisableVertexAttribArray(positionHandle); } }
/** * Draw rectangle. */ public void draw() { GLES20.glUseProgram(getProgram()); int positionHandle = GLES20.glGetAttribLocation(getProgram(), VERTEX_POSITION); GLES20.glEnableVertexAttribArray(positionHandle); GLES20.glVertexAttribPointer(positionHandle, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, COORDS_PER_VERTEX * SIZE_OF_FLOAT, vertexBuffer); int colorHandle = GLES20.glGetUniformLocation(getProgram(), VERTEX_COLOR); GLES20.glUniform4fv(colorHandle, 1, getColor(), 0); GLES20.glDrawElements(GLES20.GL_TRIANGLE_FAN, shortBuffer.capacity(), GLES20.GL_UNSIGNED_SHORT, shortBuffer); GLES20.glDisableVertexAttribArray(positionHandle); } }