java.lang.Object
de.grogra.graph.ArrayPath
- All Implemented Interfaces:
Path
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
int
getEdgeBits
(int index) Returns the edge bits (seeGraph.getEdgeBits(Object)
) of the edge atindex
.getGraph()
Returns the graph which contains this path.getNode
(int index) int
Returns the number of nodes and edges of this path.getObject
(int index) Returns the node or edge atindex
.long
getObjectId
(int index) int
boolean
isInEdgeDirection
(int index) Checks whether the path traverses the edge atindex
in edge direction or in reverse edge direction.boolean
isInstancingEdge
(int index) popNode()
void
pushEdges
(int e, boolean dir, long id, boolean instancing) void
pushEdgeSet
(Object edge, long id, boolean instancing) void
void
toString()
-
Field Details
-
stack
-
-
Constructor Details
-
ArrayPath
-
ArrayPath
-
-
Method Details
-
getGraph
Description copied from interface:Path
Returns the graph which contains this path. -
indexOf
-
clear
-
set
-
pushNode
-
pushEdgeSet
-
pushEdges
public void pushEdges(int e, boolean dir, long id, boolean instancing) -
popNode
-
popEdgeSet
-
getNodeAndEdgeCount
public int getNodeAndEdgeCount()Description copied from interface:Path
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.- Specified by:
getNodeAndEdgeCount
in interfacePath
- Returns:
- number of nodes and edges
-
endsInNode
public boolean endsInNode() -
getObject
Description copied from interface:Path
Returns the node or edge atindex
. Because a path always starts with a node, even values ofindex
address nodes, while odd values address edges. Edges may be returned asnull
, in this case only the information provided byPath.getEdgeBits(int)
andPath.isInEdgeDirection(int)
is available for the edge. Ifindex
is negative, it is relative to the end of the list, i.e., it is incremented byPath.getNodeAndEdgeCount()
. -
getObjectId
public long getObjectId(int index) - Specified by:
getObjectId
in interfacePath
-
getEdgeBits
public int getEdgeBits(int index) Description copied from interface:Path
Returns the edge bits (seeGraph.getEdgeBits(Object)
) of the edge atindex
. Ifindex
is negative, it is relative to the end of the list, i.e., it is incremented byPath.getNodeAndEdgeCount()
. The actual index has to be odd because edges have odd indices.- Specified by:
getEdgeBits
in interfacePath
- Parameters:
index
- edge index- Returns:
- edge bits of edge
-
isInEdgeDirection
public boolean isInEdgeDirection(int index) Description copied from interface:Path
Checks whether the path traverses the edge atindex
in edge direction or in reverse edge direction. Ifindex
is negative, it is relative to the end of the list, i.e., it is incremented byPath.getNodeAndEdgeCount()
. The actual index has to be odd because edges have odd indices.- Specified by:
isInEdgeDirection
in interfacePath
- Parameters:
index
- edge index- Returns:
true
iff path traverses edge in its direction
-
isInstancingEdge
public boolean isInstancingEdge(int index) - Specified by:
isInstancingEdge
in interfacePath
-
getNode
-
toString
-