Skip to content

Commit

Permalink
Small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
davidegrohmann committed May 8, 2017
1 parent 14c39a5 commit 75ec737
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 25 deletions.
Expand Up @@ -283,9 +283,10 @@ public boolean nodeHasProperty( long nodeId, int propertyKeyId ) throws EntityNo
{ {
return false; return false;
} }
try ( Cursor<NodeItem> node = dataRead().nodeCursorById( statement, nodeId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<NodeItem> node = dataRead.nodeCursorById( statement, nodeId ) )
{ {
return dataRead().nodeHasProperty( statement, node.get(), propertyKeyId ); return dataRead.nodeHasProperty( statement, node.get(), propertyKeyId );
} }
} }


Expand All @@ -297,9 +298,10 @@ public Object nodeGetProperty( long nodeId, int propertyKeyId ) throws EntityNot
{ {
return null; return null;
} }
try ( Cursor<NodeItem> node = dataRead().nodeCursorById( statement, nodeId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<NodeItem> node = dataRead.nodeCursorById( statement, nodeId ) )
{ {
return dataRead().nodeGetProperty( statement, node.get(), propertyKeyId ); return dataRead.nodeGetProperty( statement, node.get(), propertyKeyId );
} }
finally finally
{ {
Expand All @@ -312,9 +314,10 @@ public RelationshipIterator nodeGetRelationships( long nodeId, Direction directi
throws EntityNotFoundException throws EntityNotFoundException
{ {
statement.assertOpen(); statement.assertOpen();
try ( Cursor<NodeItem> node = dataRead().nodeCursorById( statement, nodeId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<NodeItem> node = dataRead.nodeCursorById( statement, nodeId ) )
{ {
return new CursorRelationshipIterator( dataRead() return new CursorRelationshipIterator( dataRead
.nodeGetRelationships( statement, node.get(), direction( direction ), deduplicate( relTypes ) ) ); .nodeGetRelationships( statement, node.get(), direction( direction ), deduplicate( relTypes ) ) );
} }
} }
Expand All @@ -335,30 +338,33 @@ public RelationshipIterator nodeGetRelationships( long nodeId, Direction directi
throws EntityNotFoundException throws EntityNotFoundException
{ {
statement.assertOpen(); statement.assertOpen();
try ( Cursor<NodeItem> node = dataRead().nodeCursorById( statement, nodeId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<NodeItem> node = dataRead.nodeCursorById( statement, nodeId ) )
{ {
return new CursorRelationshipIterator( return new CursorRelationshipIterator(
dataRead().nodeGetRelationships( statement, node.get(), direction( direction ) ) ); dataRead.nodeGetRelationships( statement, node.get(), direction( direction ) ) );
} }
} }


@Override @Override
public int nodeGetDegree( long nodeId, Direction direction, int relType ) throws EntityNotFoundException public int nodeGetDegree( long nodeId, Direction direction, int relType ) throws EntityNotFoundException
{ {
statement.assertOpen(); statement.assertOpen();
try ( Cursor<NodeItem> node = dataRead().nodeCursorById( statement, nodeId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<NodeItem> node = dataRead.nodeCursorById( statement, nodeId ) )
{ {
return dataRead().degree( statement, node.get(), direction( direction ), relType ); return dataRead.degree( statement, node.get(), direction( direction ), relType );
} }
} }


@Override @Override
public int nodeGetDegree( long nodeId, Direction direction ) throws EntityNotFoundException public int nodeGetDegree( long nodeId, Direction direction ) throws EntityNotFoundException
{ {
statement.assertOpen(); statement.assertOpen();
try ( Cursor<NodeItem> node = dataRead().nodeCursorById( statement, nodeId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<NodeItem> node = dataRead.nodeCursorById( statement, nodeId ) )
{ {
return dataRead().degree( statement, node.get(), direction( direction ) ); return dataRead.degree( statement, node.get(), direction( direction ) );
} }
} }


Expand All @@ -376,9 +382,10 @@ public boolean nodeIsDense( long nodeId ) throws EntityNotFoundException
public PrimitiveIntIterator nodeGetRelationshipTypes( long nodeId ) throws EntityNotFoundException public PrimitiveIntIterator nodeGetRelationshipTypes( long nodeId ) throws EntityNotFoundException
{ {
statement.assertOpen(); statement.assertOpen();
try ( Cursor<NodeItem> node = dataRead().nodeCursorById( statement, nodeId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<NodeItem> node = dataRead.nodeCursorById( statement, nodeId ) )
{ {
return dataRead().relationshipTypes( statement,node.get() ).iterator(); return dataRead.relationshipTypes( statement,node.get() ).iterator();
} }
} }


Expand All @@ -390,9 +397,10 @@ public boolean relationshipHasProperty( long relationshipId, int propertyKeyId )
{ {
return false; return false;
} }
try ( Cursor<RelationshipItem> relationship = dataRead().relationshipCursorById( statement, relationshipId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<RelationshipItem> relationship = dataRead.relationshipCursorById( statement, relationshipId ) )
{ {
return dataRead().relationshipHasProperty( statement, relationship.get(), propertyKeyId ); return dataRead.relationshipHasProperty( statement, relationship.get(), propertyKeyId );
} }
} }


Expand All @@ -404,9 +412,10 @@ public Object relationshipGetProperty( long relationshipId, int propertyKeyId )
{ {
return null; return null;
} }
try ( Cursor<RelationshipItem> relationship = dataRead().relationshipCursorById( statement, relationshipId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<RelationshipItem> relationship = dataRead.relationshipCursorById( statement, relationshipId ) )
{ {
return dataRead().relationshipGetProperty( statement, relationship.get(), propertyKeyId ); return dataRead.relationshipGetProperty( statement, relationship.get(), propertyKeyId );
} }
finally finally
{ {
Expand Down Expand Up @@ -440,9 +449,10 @@ public Object graphGetProperty( int propertyKeyId )
public PrimitiveIntIterator nodeGetPropertyKeys( long nodeId ) throws EntityNotFoundException public PrimitiveIntIterator nodeGetPropertyKeys( long nodeId ) throws EntityNotFoundException
{ {
statement.assertOpen(); statement.assertOpen();
try ( Cursor<NodeItem> node = dataRead().nodeCursorById( statement, nodeId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<NodeItem> node = dataRead.nodeCursorById( statement, nodeId ) )
{ {
return dataRead().nodeGetPropertyKeys( statement, node.get() ).iterator(); return dataRead.nodeGetPropertyKeys( statement, node.get() ).iterator();
} }
finally finally
{ {
Expand All @@ -454,9 +464,10 @@ public PrimitiveIntIterator nodeGetPropertyKeys( long nodeId ) throws EntityNotF
public PrimitiveIntIterator relationshipGetPropertyKeys( long relationshipId ) throws EntityNotFoundException public PrimitiveIntIterator relationshipGetPropertyKeys( long relationshipId ) throws EntityNotFoundException
{ {
statement.assertOpen(); statement.assertOpen();
try ( Cursor<RelationshipItem> relationship = dataRead().relationshipCursorById( statement, relationshipId ) ) EntityReadOperations dataRead = dataRead();
try ( Cursor<RelationshipItem> relationship = dataRead.relationshipCursorById( statement, relationshipId ) )
{ {
return dataRead().relationshipGetPropertyKeys( statement, relationship.get() ).iterator(); return dataRead.relationshipGetPropertyKeys( statement, relationship.get() ).iterator();
} }
finally finally
{ {
Expand Down
Expand Up @@ -41,13 +41,11 @@ public abstract class StoreAbstractIteratorRelationshipCursor extends StoreAbstr
super( relationshipRecord, cursors, lockService ); super( relationshipRecord, cursors, lockService );
} }


protected StoreAbstractIteratorRelationshipCursor internalInitTxState( ReadableTransactionState state, void internalInitTxState( ReadableTransactionState state, PrimitiveLongIterator addedRelationshipIterator )
PrimitiveLongIterator addedRelationshipIterator )
{ {
this.state = state; this.state = state;
this.addedRelationshipIterator = addedRelationshipIterator; this.addedRelationshipIterator = addedRelationshipIterator;
this.fromStore = true; this.fromStore = true;
return this;
} }


@Override @Override
Expand Down

0 comments on commit 75ec737

Please sign in to comment.