JavaScript is disabled on your browser.
Direct Known Subclasses:
NodeReferenceWithVector
public class NodeReference
extends Object
Represents a reference to a node, uniquely identified by its primary key. It provides fundamental operations such as
equality comparison, hashing, and string representation based on this key. It also serves as a base class for more
specialized node references.
Constructor Summary
Constructors
Constructs a new NodeReference with the specified primary key.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
boolean
Compares this NodeReference to the specified object for equality.
Gets the primary key for this object.
int
Generates a hash code for this object based on the primary key.
Helper to extract the primary keys from a given collection of node references.
Returns a string representation of the object.
Constructor Details
NodeReference
public NodeReference (@Nonnull
Tuple primaryKey)
Constructs a new NodeReference with the specified primary key.
Parameters:
primaryKey - the primary key of the node to reference; must not be null.
Method Details
getPrimaryKey
@Nonnull
public Tuple getPrimaryKey ()
Gets the primary key for this object.
Returns:
the primary key as a Tuple object, which is guaranteed to be non-null.
asNodeReferenceWithVector
Casts this object to a
NodeReferenceWithVector.
This method is intended to be used on subclasses that actually represent a node reference with a vector. For this
base class or specific implementation, it is not a valid operation.
Returns:
this instance cast as a NodeReferenceWithVector
Throws:
IllegalStateException - always, to indicate that this object cannot be
represented as a NodeReferenceWithVector .
equals
public boolean equals (Object o)
Compares this
NodeReference to the specified object for equality.
The result is true if and only if the argument is not null and is a NodeReference object
that has the same primaryKey as this object.
Overrides:
equals in class Object
Parameters:
o - the object to compare with this NodeReference for equality.
Returns:
true if the given object is equal to this one;
false otherwise.
hashCode
public int hashCode ()
Generates a hash code for this object based on the primary key.
Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
toString
Returns a string representation of the object.
Overrides:
toString in class Object
Returns:
a string representation of this object.
primaryKeys
Helper to extract the primary keys from a given collection of node references.
Parameters:
neighbors - an iterable of NodeReference objects from which to extract primary keys.
Returns:
a lazily-evaluated Iterable of Tuple s, representing the primary keys of the input nodes.