Skip to content

Commit

Permalink
hasChanges -> hasPropertyChanges and hasRelatsionshipChanges
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusmelke committed Dec 4, 2017
1 parent e56ab3a commit 50e17c8
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 42 deletions.
Expand Up @@ -78,7 +78,7 @@ void nodeRemoveFromExplicitIndex( String indexName, long node, String key ) thro
*
* @param indexName The name of the index
* @param relationship The id of the relationship to add
* @param key The key to associate with the node
* @param key The key to associate with the relationship
* @param value The value to associate with the relationship and key
* @throws ExplicitIndexNotFoundKernelException If there is no explicit index with the given name
*/
Expand All @@ -90,7 +90,7 @@ void relationshipAddToExplicitIndex( String indexName, long relationship, String
*
* @param indexName The name of the index
* @param relationship The id of the relationship to remove
* @param key The key to associate with the node
* @param key The key to associate with the relationship
* @param value The value to associate with the relationship and key
* @throws ExplicitIndexNotFoundKernelException If there is no explicit index with the given name
*/
Expand All @@ -102,7 +102,7 @@ void relationshipRemoveFromExplicitIndex( String indexName, long relationship, S
*
* @param indexName The name of the index
* @param relationship The id of the relationship to remove
* @param key The key to associate with the node
* @param key The key to associate with the relationship
* @throws ExplicitIndexNotFoundKernelException If there is no explicit index with the given name
*/
void relationshipRemoveFromExplicitIndex( String indexName, long relationship, String key )
Expand Down
Expand Up @@ -212,9 +212,9 @@ else if ( diff.getRemoved().contains( nodeId ) )
}

@Override
public boolean hasChanges()
public boolean hasRelationshipChanges()
{
return super.hasChanges() || hasAddedRelationships() || hasRemovedRelationships();
return hasAddedRelationships() || hasRemovedRelationships();
}

@Override
Expand Down Expand Up @@ -318,13 +318,13 @@ public long getId()
}

@Override
public boolean hasChanges()
public boolean hasPropertyChanges()
{
return false;
}

@Override
public boolean hasPropertyChanges()
public boolean hasRelationshipChanges()
{
return false;
}
Expand Down Expand Up @@ -364,6 +364,7 @@ public PrimitiveLongIterator getAddedRelationships( Direction direction, int[] r
{
return null;
}

};
}
}
Expand Up @@ -202,12 +202,6 @@ public void accept( Visitor visitor ) throws ConstraintValidationException
}
}

@Override
public boolean hasChanges()
{
return hasPropertyChanges();
}

@Override
public boolean hasPropertyChanges()
{
Expand Down
Expand Up @@ -125,13 +125,6 @@ public void accept( Visitor visitor ) throws ConstraintValidationException
{
}

@Override
public boolean hasChanges()
{
return false;
}

@Override
public boolean hasPropertyChanges()
{
return false;
Expand Down
Expand Up @@ -731,15 +731,15 @@ public Cursor<NodeItem> augmentSingleNodeCursor( Cursor<NodeItem> cursor, long n
public Cursor<PropertyItem> augmentPropertyCursor( Cursor<PropertyItem> cursor,
PropertyContainerState propertyContainerState )
{
return propertyContainerState.hasChanges() ?
return propertyContainerState.hasPropertyChanges() ?
propertyCursor.get().init( cursor, propertyContainerState ) : cursor;
}

@Override
public Cursor<PropertyItem> augmentSinglePropertyCursor( Cursor<PropertyItem> cursor,
PropertyContainerState propertyContainerState, int propertyKeyId )
{
return propertyContainerState.hasChanges() ?
return propertyContainerState.hasPropertyChanges() ?
singlePropertyCursor.get().init( cursor, propertyContainerState, propertyKeyId ) : cursor;
}

Expand Down Expand Up @@ -767,7 +767,7 @@ public Cursor<RelationshipItem> augmentNodeRelationshipCursor( Cursor<Relationsh
NodeState nodeState,
Direction direction )
{
return nodeState.hasChanges()
return nodeState.hasPropertyChanges() || nodeState.hasRelationshipChanges()
? iteratorRelationshipCursor.get().init( cursor, nodeState.getAddedRelationships( direction ) )
: cursor;
}
Expand All @@ -777,7 +777,7 @@ public Cursor<RelationshipItem> augmentNodeRelationshipCursor( Cursor<Relationsh
Direction direction,
int[] relTypes )
{
return nodeState.hasChanges()
return nodeState.hasPropertyChanges() || nodeState.hasRelationshipChanges()
? iteratorRelationshipCursor.get().init( cursor, nodeState.getAddedRelationships( direction, relTypes ) )
: cursor;
}
Expand Down
Expand Up @@ -431,7 +431,12 @@ public Map<String,Object> getProperties( String... keys )
int[] propertyIds = new int[itemsToReturn];
for ( int i = 0; i < itemsToReturn; i++ )
{
propertyIds[i] = token.propertyKey( keys[i] );
String key = keys[i];
if ( key == null )
{
throw new NullPointerException( String.format( "Key %d was null", i + 1 ) );
}
propertyIds[i] = token.propertyKey( key );
}
try ( NodeCursor nodes = cursors.allocateNodeCursor();
PropertyCursor propertyCursor = cursors.allocatePropertyCursor() )
Expand Down
Expand Up @@ -157,26 +157,26 @@ static long setNodeFlag( long reference )
/**
* Checks if the property reference really is a node reference
*
* @param reference The reference to check
* @param nodeReference The reference to check
* @return <tt>true</tt>if the reference refers to a node otherwise <tt>false</tt>
*/
static boolean hasNodeFlag( long reference )
static boolean hasNodeFlag( long nodeReference )
{
assert reference != NO_ID;
return (reference & NODE_MARKER) != 0L;
assert nodeReference != NO_ID;
return (nodeReference & NODE_MARKER) != 0L;
}

/**
* Encode a relationship id as a property reference.
*
* This allows us to encode a relationship reference as a property reference so that we can do lookups of changes in the
* transaction state.
* @param reference the reference to encode
* @param relationshipReference the reference to encode
* @return The encoded reference
*/
static long setRelationshipFlag( long reference )
static long setRelationshipFlag( long relationshipReference )
{
return reference | RELATIONSHIP_MARKER | FLAG_MARKER;
return relationshipReference | RELATIONSHIP_MARKER | FLAG_MARKER;
}

/**
Expand Down
Expand Up @@ -26,8 +26,6 @@
import org.neo4j.kernel.api.exceptions.schema.ConstraintValidationException;
import org.neo4j.storageengine.api.Direction;

import static java.util.Collections.emptyIterator;

/**
* Represents the transactional changes to a node:
* <ul>
Expand Down Expand Up @@ -61,4 +59,5 @@ void visitLabelChanges( long nodeId, Set<Integer> added, Set<Integer> removed )

PrimitiveLongIterator getAddedRelationships( Direction direction, int[] relTypes );

boolean hasRelationshipChanges();
}
Expand Up @@ -55,8 +55,6 @@ void visitPropertyChanges( long entityId, Iterator<StorageProperty> added,
Iterator<Integer> removed ) throws ConstraintValidationException;
}

boolean hasChanges();

boolean hasPropertyChanges();

StorageProperty getChangedProperty( int propertyKeyId );
Expand Down Expand Up @@ -106,12 +104,6 @@ public void accept( Visitor visitor ) throws ConstraintValidationException
{
}

@Override
public boolean hasChanges()
{
return false;
}

@Override
public boolean hasPropertyChanges()
{
Expand Down

0 comments on commit 50e17c8

Please sign in to comment.