@Test public void createTupleArrayTest() throws Exception { DirectTupleSchema schema = TupleSchema.builder(). addField("aByte", Byte.TYPE). addField("aChar", Character.TYPE). addField("aInt", Integer.TYPE). addField("aShort", Short.TYPE). addField("aFloat", Float.TYPE). addField("aLong", Long.TYPE). addField("aDouble", Double.TYPE). directMemory(). build(); FastTuple[] tuples = schema.createTupleArray(10); assertEquals(10, tuples.length); for (int i=0; i < 10; i++) { assertNotNull(tuples[i]); tuples[i].setByte(1, (byte) 1); tuples[i].setChar(2, 'b'); tuples[i].setInt(3, 4); tuples[i].setShort(4, (short) 6); tuples[i].setFloat(5, 0.125f); tuples[i].setLong(6, 1000000l); tuples[i].setDouble(7, 0.125); assertEquals(1, tuples[i].getByte(1)); assertEquals('b', tuples[i].getChar(2)); assertEquals(4, tuples[i].getInt(3)); assertEquals(6, tuples[i].getShort(4)); assertEquals(0.125f, tuples[i].getFloat(5), 0.001); assertEquals(1000000l, tuples[i].getLong(6)); assertEquals(0.125, tuples[i].getDouble(7), 0.001); } }
@Override public FastTuple[] createTupleArray(int size) throws Exception { long address = createRecordArray(size); FastTuple[] tuples = new FastTuple[size]; for (int i=0; i<size; i++) { tuples[i] = createTuple(address + byteSize * i); } return tuples; }
DirectTupleSchema extends TupleSchema { @Override public FastTuple[] createTupleArray(int size) throws Exception { long address = createRecordArray(size); FastTuple[] tuples = new FastTuple[size]; for (int i=0; i<size; i++) { tuples[i] = createTuple(address + byteSize * i); } return tuples; } }
DirectTupleSchema extends TupleSchema { @Override public FastTuple[] createTupleArray(int size) throws Exception { long address = createRecordArray(size); FastTuple[] tuples = new FastTuple[size]; for (int i=0; i<size; i++) { tuples[i] = createTuple(address + byteSize * i); } return tuples; } DirectTupleSchema(Builder builder); }
DirectTupleSchema extends TupleSchema { @Override public FastTuple[] createTupleArray(int size) throws Exception { long address = createRecordArray(size); FastTuple[] tuples = new FastTuple[size]; for (int i=0; i<size; i++) { tuples[i] = createTuple(address + byteSize * i); } return tuples; } DirectTupleSchema(Builder builder); long getLong(long address, int index); int getInt(long address, int index); short getShort(long address, int index); char getChar(long address, int index); byte getByte(long address, int index); double getDouble(long address, int index); float getFloat(long address, int index); void setLong(long address, int index, long value); void setInt(long address, int index, int value); void setShort(long address, int index, short value); void setChar(long address, int index, char value); void setByte(long address, int index, byte value); void setFloat(long address, int index, float value); void setDouble(long address, int index, double value); int[] getLayout(); int getByteSize(); FastTuple createTuple(long address); long createRecord(); long createRecordArray(long size); FastTuple createTuple(); @Override FastTuple[] createTupleArray(int size); @Override void destroyTuple(FastTuple tuple); @Override void destroyTupleArray(FastTuple[] ary); void destroy(FastTuple tuple); void destroy(long address); }
DirectTupleSchema extends TupleSchema { @Override public FastTuple[] createTupleArray(int size) throws Exception { long address = createRecordArray(size); FastTuple[] tuples = new FastTuple[size]; for (int i=0; i<size; i++) { tuples[i] = createTuple(address + byteSize * i); } return tuples; } DirectTupleSchema(Builder builder); long getLong(long address, int index); int getInt(long address, int index); short getShort(long address, int index); char getChar(long address, int index); byte getByte(long address, int index); double getDouble(long address, int index); float getFloat(long address, int index); void setLong(long address, int index, long value); void setInt(long address, int index, int value); void setShort(long address, int index, short value); void setChar(long address, int index, char value); void setByte(long address, int index, byte value); void setFloat(long address, int index, float value); void setDouble(long address, int index, double value); int[] getLayout(); int getByteSize(); FastTuple createTuple(long address); long createRecord(); long createRecordArray(long size); FastTuple createTuple(); @Override FastTuple[] createTupleArray(int size); @Override void destroyTuple(FastTuple tuple); @Override void destroyTupleArray(FastTuple[] ary); void destroy(FastTuple tuple); void destroy(long address);  }