org.neo4j.kernel
Class ExtendedPath

java.lang.Object
  extended by org.neo4j.kernel.ExtendedPath
All Implemented Interfaces:
Iterable<PropertyContainer>, Path

public class ExtendedPath
extends Object
implements Path


Constructor Summary
ExtendedPath(Path start, Relationship lastRelationship)
           
 
Method Summary
 Node endNode()
          Returns the end node of this path.
static Path extend(Path path, Relationship withRelationship)
           
 Iterator<PropertyContainer> iterator()
          Iterates through both the Nodes and Relationships of this path in order.
 Relationship lastRelationship()
          Returns the last Relationship in this path.
 int length()
          Returns the length of this path.
 Iterable<Node> nodes()
          Returns all the nodes in this path starting from the start node going forward towards the end node.
 Iterable<Relationship> relationships()
          Returns all the relationships in between the nodes which this path consists of.
 Iterable<Node> reverseNodes()
          Returns all the nodes in this path in reversed order, i.e.
 Iterable<Relationship> reverseRelationships()
          Returns all the relationships in between the nodes which this path consists of in reverse order, i.e.
 Node startNode()
          Returns the start node of this path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.neo4j.graphdb.Path
toString
 

Constructor Detail

ExtendedPath

public ExtendedPath(Path start,
                    Relationship lastRelationship)
Method Detail

startNode

public Node startNode()
Description copied from interface: Path
Returns the start node of this path. It's also the first node returned from the Path.nodes() iterable.

Specified by:
startNode in interface Path
Returns:
the start node.

endNode

public Node endNode()
Description copied from interface: Path
Returns the end node of this path. It's also the last node returned from Path.nodes() iterable. If the Path.length() of this path is 0 the end node returned by this method is the same as the start node. If a path is emitted from a traverser the end node is the current node where the traverser is at the moment.

Specified by:
endNode in interface Path
Returns:
the end node.

lastRelationship

public Relationship lastRelationship()
Description copied from interface: Path
Returns the last Relationship in this path.

Specified by:
lastRelationship in interface Path
Returns:
the last Relationship in this path, or null if this path contains no Relationships.

relationships

public Iterable<Relationship> relationships()
Description copied from interface: Path
Returns all the relationships in between the nodes which this path consists of. For a path with Path.length() 0 this will be an empty Iterable.

Specified by:
relationships in interface Path
Returns:
the relationships in this path.

reverseRelationships

public Iterable<Relationship> reverseRelationships()
Description copied from interface: Path
Returns all the relationships in between the nodes which this path consists of in reverse order, i.e. starting from the Path.lastRelationship() going backwards towards the first relationship in the path. For a path with Path.length() 0 this will be an empty Iterable.

Specified by:
reverseRelationships in interface Path
Returns:
the relationships in this path in reverse order.

nodes

public Iterable<Node> nodes()
Description copied from interface: Path
Returns all the nodes in this path starting from the start node going forward towards the end node. The first node is the same as Path.startNode() and the last node is the same as Path.endNode(). In between those nodes there can be an arbitrary number of nodes. The shortest path possible is just one node, where also the the start node is the same as the end node.

Specified by:
nodes in interface Path
Returns:
the nodes in this path.

reverseNodes

public Iterable<Node> reverseNodes()
Description copied from interface: Path
Returns all the nodes in this path in reversed order, i.e. starting from the end node going backwards instead of from the start node going forwards. The first node is the same as Path.endNode() and the last node is the same as Path.startNode(). In between those nodes there can be an arbitrary number of nodes. The shortest path possible is just one node, where also the the start node is the same as the end node.

Specified by:
reverseNodes in interface Path
Returns:
the nodes in this path starting from the end node going backwards towards the start node.

length

public int length()
Description copied from interface: Path
Returns the length of this path. That is the number of relationships (which is the same as the number of nodes minus one). The shortest path possible is of length 0.

Specified by:
length in interface Path
Returns:
the length (i.e. the number of relationships) in the path.

iterator

public Iterator<PropertyContainer> iterator()
Description copied from interface: Path
Iterates through both the Nodes and Relationships of this path in order. Interleaving Nodes with Relationships, starting and ending with a Node (the Path.startNode() and Path.endNode() respectively).

Specified by:
iterator in interface Iterable<PropertyContainer>
Specified by:
iterator in interface Path
See Also:
Iterable.iterator()

extend

public static Path extend(Path path,
                          Relationship withRelationship)


Copyright © 2002-2013 The Neo4j Graph Database Project. All Rights Reserved.