public static boolean hasLabel( AnyValue entity, int labelToken, DbAccess access ) { if ( entity instanceof NodeValue ) { return access.isLabelSetOnNode( labelToken, ((NodeValue) entity).id() ); } else { throw new ParameterWrongTypeException( "Expected a Node, got: " + entity, null ); } }
public static ListValue labels( AnyValue item, DbAccess access ) { if ( item instanceof NodeValue ) { return access.getLabelsForNode( ((NodeValue) item).id() ); } else { throw new ParameterWrongTypeException( "Expected a Node, got: " + item, null ); } }
private void writeNodesForPath( NodeValue[] nodes ) throws IOException { nodeIndexes.reset( nodes.length ); for ( NodeValue node : nodes ) { nodeIndexes.putIfAbsent( node.id(), nodeIndexes.size() ); } int size = nodeIndexes.size(); packListHeader( size ); if ( size > 0 ) { NodeValue node = nodes[0]; for ( long id : nodeIndexes.keys() ) { int i = 1; while ( node.id() != id ) { node = nodes[i++]; } node.writeTo( this ); } } }
@Override public <E extends Exception> void writeTo( AnyValueWriter<E> writer ) throws E { MapValue p; try { p = properties(); } catch ( NotFoundException e ) { p = VirtualValues.EMPTY_MAP; } if ( id() < 0 ) { writer.writeVirtualRelationshipHack( relationship ); } writer.writeRelationship( id(), startNode().id(), endNode().id(), type(), p ); }
public static MapValue asMapValue( AnyValue value, DbAccess access ) { if ( value instanceof MapValue ) { return (MapValue) value; } else if ( value instanceof NodeValue ) { return access.nodeAsMap( ((NodeValue) value).id() ); } else if ( value instanceof RelationshipValue ) { return access.relationshipAsMap( ((RelationshipValue) value).id() ); } else { throw cantCoerce( value, "Map" ); } }
@Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj instanceof CoreAPIPath ) { return value.equals( ((CoreAPIPath) obj).value ); } else if ( obj instanceof Path ) { Path other = (Path) obj; if ( value.nodes()[0].id() != other.startNode().getId() ) { return false; } return iteratorsEqual( this.relationships().iterator(), other.relationships().iterator() ); } else { return false; } }
for ( int i = 0; i < nodes.length; i++ ) nodeProxies[i] = proxySpi.newNodeProxy( nodes[i].id() );
for ( int i = 0; i < nodes.length; i++ ) nodeProxies[i] = newNodeProxyById( nodes[i].id() );
public static ListValue labels( AnyValue item, DbAccess access ) { if ( item instanceof NodeValue ) { return access.getLabelsForNode( ((NodeValue) item).id() ); } else { throw new ParameterWrongTypeException( "Expected a Node, got: " + item, null ); } }
public static boolean hasLabel( AnyValue entity, int labelToken, DbAccess access ) { if ( entity instanceof NodeValue ) { return access.isLabelSetOnNode( labelToken, ((NodeValue) entity).id() ); } else { throw new ParameterWrongTypeException( "Expected a Node, got: " + entity, null ); } }
@Override public <E extends Exception> void writeTo( AnyValueWriter<E> writer ) throws E { MapValue p; try { p = properties(); } catch ( NotFoundException e ) { p = VirtualValues.EMPTY_MAP; } if ( id() < 0 ) { writer.writeVirtualRelationshipHack( relationship ); } writer.writeRelationship( id(), startNode().id(), endNode().id(), type(), p ); }
private void writeNodesForPath( NodeValue[] nodes ) throws IOException { nodeIndexes.reset( nodes.length ); for ( NodeValue node : nodes ) { nodeIndexes.putIfAbsent( node.id(), nodeIndexes.size() ); } int size = nodeIndexes.size(); packListHeader( size ); if ( size > 0 ) { NodeValue node = nodes[0]; for ( long id : nodeIndexes.keys() ) { int i = 1; while ( node.id() != id ) { node = nodes[i++]; } node.writeTo( this ); } } }
public static MapValue asMapValue( AnyValue value, DbAccess access ) { if ( value instanceof MapValue ) { return (MapValue) value; } else if ( value instanceof NodeValue ) { return access.nodeAsMap( ((NodeValue) value).id() ); } else if ( value instanceof RelationshipValue ) { return access.relationshipAsMap( ((RelationshipValue) value).id() ); } else { throw cantCoerce( value, "Map" ); } }
@Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj instanceof CoreAPIPath ) { return value.equals( ((CoreAPIPath) obj).value ); } else if ( obj instanceof Path ) { Path other = (Path) obj; if ( value.nodes()[0].id() != other.startNode().getId() ) { return false; } return iteratorsEqual( this.relationships().iterator(), other.relationships().iterator() ); } else { return false; } }