private void writeArrayHeaderTo( byte[] bytes ) { bytes[0] = (byte) PropertyType.TEMPORAL.intValue(); bytes[1] = (byte) temporalType; }
public static long[] encodeDateTime( int keyId, long epochSecond, long nanoOfSecond, int secondOffset ) { int idBits = StandardFormatSettings.PROPERTY_TOKEN_MAXIMUM_ID_BITS; long keyAndType = keyId | (((long) (PropertyType.TEMPORAL.intValue()) << idBits)); long temporalTypeBits = TemporalType.TEMPORAL_DATE_TIME.temporalType << (idBits + 4); long[] data = new long[BLOCKS_DATETIME]; // nanoOfSecond will never require more than 30 bits data[0] = keyAndType | temporalTypeBits | (1L << 32) | (nanoOfSecond << 33); data[1] = epochSecond; data[2] = secondOffset; return data; }
public static long[] encodeTime( int keyId, long nanoOfDayUTC, int secondOffset ) { int idBits = StandardFormatSettings.PROPERTY_TOKEN_MAXIMUM_ID_BITS; long keyAndType = keyId | (((long) (PropertyType.TEMPORAL.intValue()) << idBits)); long temporalTypeBits = TemporalType.TEMPORAL_TIME.temporalType << (idBits + 4); long[] data = new long[BLOCKS_TIME]; // Offset are always in the range +-18:00, so secondOffset will never require more than 17 bits data[0] = keyAndType | temporalTypeBits | ((long) secondOffset << 32); data[1] = nanoOfDayUTC; return data; }
public static long[] encodeLocalDateTime( int keyId, long epochSecond, long nanoOfSecond ) { int idBits = StandardFormatSettings.PROPERTY_TOKEN_MAXIMUM_ID_BITS; long keyAndType = keyId | (((long) (PropertyType.TEMPORAL.intValue()) << idBits)); long temporalTypeBits = TemporalType.TEMPORAL_LOCAL_DATE_TIME.temporalType << (idBits + 4); long[] data = new long[BLOCKS_LOCAL_DATETIME]; // nanoOfSecond will never require more than 30 bits data[0] = keyAndType | temporalTypeBits | (nanoOfSecond << 32); data[1] = epochSecond; return data; }
public static long singleBlockLongValue( int keyId, PropertyType type, long longValue ) { return keyId | (((long) type.intValue()) << StandardFormatSettings.PROPERTY_TOKEN_MAXIMUM_ID_BITS) | (longValue << 28); }
public static long[] encodeDuration( int keyId, long months, long days, long seconds, int nanos ) { int idBits = StandardFormatSettings.PROPERTY_TOKEN_MAXIMUM_ID_BITS; long keyAndType = keyId | (((long) (PropertyType.TEMPORAL.intValue()) << idBits)); long temporalTypeBits = TemporalType.TEMPORAL_DURATION.temporalType << (idBits + 4); long[] data = new long[BLOCKS_DURATION]; data[0] = keyAndType | temporalTypeBits | ((long) nanos << 32); data[1] = months; data[2] = days; data[3] = seconds; return data; }
public int intValue() { return type.intValue(); }
@Override public void writeFloatingPoint( double value ) throws IllegalArgumentException { block.setValueBlocks( new long[]{ keyId | (((long) PropertyType.DOUBLE.intValue()) << StandardFormatSettings.PROPERTY_TOKEN_MAXIMUM_ID_BITS), Double.doubleToRawLongBits( value ) } ); }
public static long[] encodeDateTime( int keyId, long epochSecond, long nanoOfSecond, String zoneId ) { int idBits = StandardFormatSettings.PROPERTY_TOKEN_MAXIMUM_ID_BITS; short zoneNumber = TimeZones.map( zoneId ); long keyAndType = keyId | (((long) (PropertyType.TEMPORAL.intValue()) << idBits)); long temporalTypeBits = TemporalType.TEMPORAL_DATE_TIME.temporalType << (idBits + 4); long[] data = new long[BLOCKS_DATETIME]; // nanoOfSecond will never require more than 30 bits data[0] = keyAndType | temporalTypeBits | (nanoOfSecond << 33); data[1] = epochSecond; data[2] = zoneNumber; return data; }
public static DynamicRecord string( DynamicRecord record ) { record.setType( PropertyType.STRING.intValue() ); return record; }
public static DynamicRecord array( DynamicRecord record ) { record.setType( PropertyType.ARRAY.intValue() ); return record; }
@Override public void writeInteger( long value ) throws IllegalArgumentException { long keyAndType = keyId | (((long) PropertyType.LONG.intValue()) << StandardFormatSettings.PROPERTY_TOKEN_MAXIMUM_ID_BITS); if ( ShortArray.LONG.getRequiredBits( value ) <= 35 ) { // We only need one block for this value, special layout compared to, say, an integer block.setSingleBlock( keyAndType | (1L << 28) | (value << 29) ); } else { // We need two blocks for this value block.setValueBlocks( new long[]{keyAndType, value} ); } }
private void writeArrayHeaderTo( byte[] bytes ) { bytes[0] = (byte) PropertyType.GEOMETRY.intValue(); bytes[1] = (byte) geometryType; bytes[2] = (byte) dimension; bytes[3] = (byte) crs.getTable().getTableId(); bytes[4] = (byte) (crs.getCode() >> 8 & 0xFFL); bytes[5] = (byte) (crs.getCode() & 0xFFL); }
private static void writeHeader( Bits bits, int keyId, int encoding, int stringLength ) { // [][][][ lll,llle][eeee,tttt][kkkk,kkkk][kkkk,kkkk][kkkk,kkkk] bits.put( keyId, 24 ).put( PropertyType.SHORT_STRING.intValue(), 4 ).put( encoding, 5 ).put( stringLength, 6 ); }
public static PropertyBlock propertyBlock( PropertyKeyTokenRecord key, PropertyType type, long value ) { PropertyBlock block = new PropertyBlock(); block.setSingleBlock( key.getId() | (((long) type.intValue()) << 24) | (value << 28) ); return block; }
private DynamicRecord dynamicRecord() { DynamicRecord dynamicRecord = new DynamicRecord( 42 ); dynamicRecord.setType( PropertyType.STRING.intValue() ); dynamicRecord.setCreated(); return dynamicRecord; }
private void removeProperty( PrimitiveRecord primitive, PropertyRecord host, PropertyBlock block ) { host.removePropertyBlock( block.getKeyIndexId() ); host.setChanged( primitive ); for ( DynamicRecord record : block.getValueRecords() ) { assert record.inUse(); record.setInUse( false, block.getType().intValue() ); host.addDeletedRecord( record ); } }
private PropertyBlock propertyBlockWith( DynamicRecord dynamicRecord ) { PropertyBlock propertyBlock = new PropertyBlock(); PropertyKeyTokenRecord key = new PropertyKeyTokenRecord( 10 ); propertyBlock.setSingleBlock( key.getId() | (((long) PropertyType.STRING.intValue()) << 24) | (dynamicRecord .getId() << 28) ); propertyBlock.addValueRecord( dynamicRecord ); return propertyBlock; } }
@Override protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next ) { DynamicRecord string = new DynamicRecord( next.stringProperty() ); string.setInUse( true ); string.setCreated(); string.setType( PropertyType.STRING.intValue() ); string.setNextBlock( next.stringProperty() ); string.setData( UTF8.encode( "hello world" ) ); PropertyBlock block = new PropertyBlock(); block.setSingleBlock( (((long) PropertyType.STRING.intValue()) << 24) | (string.getId() << 28) ); block.addValueRecord( string ); PropertyRecord property = new PropertyRecord( next.property() ); property.addPropertyBlock( block ); tx.create( property ); } } );