Module graph

Class ArrayPath

java.lang.Object
de.grogra.graph.ArrayPath
All Implemented Interfaces:
Path

public final class ArrayPath extends Object implements Path
  • Field Details

  • Constructor Details

    • ArrayPath

      public ArrayPath(Graph graph)
    • ArrayPath

      public ArrayPath(Path path)
  • Method Details

    • getGraph

      public Graph getGraph()
      Description copied from interface: Path
      Returns the graph which contains this path.
      Specified by:
      getGraph in interface Path
      Returns:
      graph of path
    • indexOf

      public int indexOf(Object object, boolean asNode)
    • clear

      public void clear(Graph graph)
    • set

      public void set(Path path)
    • pushNode

      public void pushNode(Object node, long id)
    • pushEdgeSet

      public void pushEdgeSet(Object edge, long id, boolean instancing)
    • pushEdges

      public void pushEdges(int e, boolean dir, long id, boolean instancing)
    • popNode

      public Object popNode()
    • popEdgeSet

      public Object 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 interface Path
      Returns:
      number of nodes and edges
    • endsInNode

      public boolean endsInNode()
    • getObject

      public Object getObject(int index)
      Description copied from interface: Path
      Returns the node or edge at index. Because a path always starts with a node, even values of index address nodes, while odd values address edges. Edges may be returned as null, in this case only the information provided by Path.getEdgeBits(int) and Path.isInEdgeDirection(int) is available for the edge. If index is negative, it is relative to the end of the list, i.e., it is incremented by Path.getNodeAndEdgeCount().
      Specified by:
      getObject in interface Path
      Parameters:
      index - node or edge index
      Returns:
      node or edge at index
    • getObjectId

      public long getObjectId(int index)
      Specified by:
      getObjectId in interface Path
    • getEdgeBits

      public int getEdgeBits(int index)
      Description copied from interface: Path
      Returns the edge bits (see Graph.getEdgeBits(Object)) of the edge at index. If index is negative, it is relative to the end of the list, i.e., it is incremented by Path.getNodeAndEdgeCount(). The actual index has to be odd because edges have odd indices.
      Specified by:
      getEdgeBits in interface Path
      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 at index in edge direction or in reverse edge direction. If index is negative, it is relative to the end of the list, i.e., it is incremented by Path.getNodeAndEdgeCount(). The actual index has to be odd because edges have odd indices.
      Specified by:
      isInEdgeDirection in interface Path
      Parameters:
      index - edge index
      Returns:
      true iff path traverses edge in its direction
    • isInstancingEdge

      public boolean isInstancingEdge(int index)
      Specified by:
      isInstancingEdge in interface Path
    • getNode

      public Object getNode(int index)
    • toString

      public String toString()
      Overrides:
      toString in class Object