Class Edge

  • Direct Known Subclasses:
    LineMergeEdge

    public class Edge
    extends GraphComponent
    Represents an undirected edge of a PlanarGraph. An undirected edge in fact simply acts as a central point of reference for two opposite DirectedEdges.

    Usually a client using a PlanarGraph will subclass Edge to add its own application-specific data and methods.

    Version:
    1.7
    • Constructor Detail

      • Edge

        public Edge​(DirectedEdge de0,
                    DirectedEdge de1)
        Constructs an Edge initialized with the given DirectedEdges, and for each DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node.
    • Method Detail

      • setDirectedEdges

        public void setDirectedEdges​(DirectedEdge de0,
                                     DirectedEdge de1)
        Initializes this Edge's two DirectedEdges, and for each DirectedEdge: sets the Edge, sets the symmetric DirectedEdge, and adds this Edge to its from-Node.
      • getDirEdge

        public DirectedEdge getDirEdge​(int i)
        Returns one of the DirectedEdges associated with this Edge.
        Parameters:
        i - 0 or 1. 0 returns the forward directed edge, 1 returns the reverse
      • getDirEdge

        public DirectedEdge getDirEdge​(Node fromNode)
        Returns the DirectedEdge that starts from the given node, or null if the node is not one of the two nodes associated with this Edge.
      • getOppositeNode

        public Node getOppositeNode​(Node node)
        If node is one of the two nodes associated with this Edge, returns the other node; otherwise returns null.
      • isRemoved

        public boolean isRemoved()
        Tests whether this edge has been removed from its containing graph
        Specified by:
        isRemoved in class GraphComponent
        Returns:
        true if this edge is removed