private static SchemaDescriptor readMultiTokenSchema( ByteBuffer source ) throws MalformedSchemaRuleException { byte schemaDescriptorType = source.get(); EntityType type; switch ( schemaDescriptorType ) { case SIMPLE_LABEL: type = EntityType.NODE; break; case SIMPLE_REL_TYPE: type = EntityType.RELATIONSHIP; break; default: throw new MalformedSchemaRuleException( format( "Got unknown schema descriptor type '%d'.", schemaDescriptorType ) ); } int[] entityTokenIds = readTokenIdList( source ); int[] propertyIds = readTokenIdList( source ); return SchemaDescriptorFactory.multiToken( entityTokenIds, type, propertyIds ); }
private static SchemaDescriptor readSchema( ByteBuffer source ) throws MalformedSchemaRuleException { int[] propertyIds; byte schemaDescriptorType = source.get(); switch ( schemaDescriptorType ) { case SIMPLE_LABEL: int labelId = source.getInt(); propertyIds = readTokenIdList( source ); return SchemaDescriptorFactory.forLabel( labelId, propertyIds ); case SIMPLE_REL_TYPE: int relTypeId = source.getInt(); propertyIds = readTokenIdList( source ); return SchemaDescriptorFactory.forRelType( relTypeId, propertyIds ); case GENERIC_MULTI_TOKEN_TYPE: return readMultiTokenSchema( source ); default: throw new MalformedSchemaRuleException( format( "Got unknown schema descriptor type '%d'.", schemaDescriptorType ) ); } }
private static SchemaDescriptor readMultiTokenSchema( ByteBuffer source ) throws MalformedSchemaRuleException { byte schemaDescriptorType = source.get(); EntityType type; switch ( schemaDescriptorType ) { case SIMPLE_LABEL: type = EntityType.NODE; break; case SIMPLE_REL_TYPE: type = EntityType.RELATIONSHIP; break; default: throw new MalformedSchemaRuleException( format( "Got unknown schema descriptor type '%d'.", schemaDescriptorType ) ); } int[] entityTokenIds = readTokenIdList( source ); int[] propertyIds = readTokenIdList( source ); return SchemaDescriptorFactory.multiToken( entityTokenIds, type, propertyIds ); }
private static SchemaDescriptor readSchema( ByteBuffer source ) throws MalformedSchemaRuleException { int[] propertyIds; byte schemaDescriptorType = source.get(); switch ( schemaDescriptorType ) { case SIMPLE_LABEL: int labelId = source.getInt(); propertyIds = readTokenIdList( source ); return SchemaDescriptorFactory.forLabel( labelId, propertyIds ); case SIMPLE_REL_TYPE: int relTypeId = source.getInt(); propertyIds = readTokenIdList( source ); return SchemaDescriptorFactory.forRelType( relTypeId, propertyIds ); case GENERIC_MULTI_TOKEN_TYPE: return readMultiTokenSchema( source ); default: throw new MalformedSchemaRuleException( format( "Got unknown schema descriptor type '%d'.", schemaDescriptorType ) ); } }