Class Edge

  • All Implemented Interfaces:
    KeyedObject, java.lang.Comparable<Edge>

    public final class Edge
    extends java.lang.Object
    implements KeyedObject, java.lang.Comparable<Edge>
    An Edge joins a pair of vertices. The from and to vertex of an edge can not be changed.
    • Constructor Summary

      Constructors 
      Constructor Description
      Edge​(Vertex from, Vertex to)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(Edge edge)
      Compare one edge to another.
      boolean equals​(java.lang.Object obj)
      Overides equals method by comparing keys.
      Vertex from()
      Returns from vertex.
      int hashCode()  
      long key()
      Returns the key of this edge.
      Vertex to()
      Returns to vertex.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Edge

        public Edge​(Vertex from,
                    Vertex to)
        Parameters:
        from - The from or parent vertex.
        to - The to or child vertex.
    • Method Detail

      • from

        public Vertex from()
        Returns from vertex.
      • to

        public Vertex to()
        Returns to vertex.
      • key

        public long key()
        Returns the key of this edge.
        Specified by:
        key in interface KeyedObject
      • compareTo

        public int compareTo​(Edge edge)
        Compare one edge to another. Based on time of creation.
        Specified by:
        compareTo in interface java.lang.Comparable<Edge>
      • equals

        public boolean equals​(java.lang.Object obj)
        Overides equals method by comparing keys.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object