- All Known Implementing Classes:
ArrayPath
public interface Path
A
Path consists of an alternating sequence of nodes and edges
(starting with a node) of a graph. An edge of a graph is incident with
its neighbouring nodes in the path.
The nodes and edges of this path are accessed using their index. Because
a path starts with a node, nodes have even indices, while edges haves odd
indices. If the index parameter to one of the methods of
Path is negative, it is interpreted as an index relative
to the end of the path, i.e., the actual index is
path.getNodeAndEdgeCount () + index.
- Author:
- Ole Kniemeyer
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintgetEdgeBits(int index) Returns the edge bits (seeGraph.getEdgeBits(Object)) of the edge atindex.getGraph()Returns the graph which contains this path.intReturns the number of nodes and edges of this path.getObject(int index) Returns the node or edge atindex.longgetObjectId(int index) booleanisInEdgeDirection(int index) Checks whether the path traverses the edge atindexin edge direction or in reverse edge direction.booleanisInstancingEdge(int index)
-
Field Details
-
PATH_0
A constant array of length 0.
-
-
Method Details
-
getGraph
Graph getGraph()Returns the graph which contains this path.- Returns:
- graph of path
-
getNodeAndEdgeCount
int getNodeAndEdgeCount()Returns the number of nodes and edges of this path. If this is even, the path ends in an edge; if this is odd, the path ends in a node.- Returns:
- number of nodes and edges
-
getEdgeBits
int getEdgeBits(int index) Returns the edge bits (seeGraph.getEdgeBits(Object)) of the edge atindex. Ifindexis negative, it is relative to the end of the list, i.e., it is incremented bygetNodeAndEdgeCount(). The actual index has to be odd because edges have odd indices.- Parameters:
index- edge index- Returns:
- edge bits of edge
-
isInEdgeDirection
boolean isInEdgeDirection(int index) Checks whether the path traverses the edge atindexin edge direction or in reverse edge direction. Ifindexis negative, it is relative to the end of the list, i.e., it is incremented bygetNodeAndEdgeCount(). The actual index has to be odd because edges have odd indices.- Parameters:
index- edge index- Returns:
trueiff path traverses edge in its direction
-
getObject
Returns the node or edge atindex. Because a path always starts with a node, even values ofindexaddress nodes, while odd values address edges. Edges may be returned asnull, in this case only the information provided bygetEdgeBits(int)andisInEdgeDirection(int)is available for the edge. Ifindexis negative, it is relative to the end of the list, i.e., it is incremented bygetNodeAndEdgeCount().- Parameters:
index- node or edge index- Returns:
- node or edge at
index
-
getObjectId
long getObjectId(int index) -
isInstancingEdge
boolean isInstancingEdge(int index)
-