Class DirectedEdge<V>

  • Type Parameters:
    V - The type of vertex
    All Implemented Interfaces:
    Serializable

    public class DirectedEdge<V>
    extends Edge<V>
    A directed weighted edge implementation.
    See Also:
    Serialized Form
    • Constructor Detail

      • DirectedEdge

        protected DirectedEdge​(V vertex1,
                               V vertex2,
                               double weight)
    • Method Detail

      • getWeight

        public double getWeight()
        Overrides:
        getWeight in class Edge<V>
        Returns:
        The weight of the edge or 1 if none
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isDirected

        public boolean isDirected()
        Specified by:
        isDirected in class Edge<V>
        Returns:
        True if the edge is directed, False if not
      • isWeighted

        public boolean isWeighted()
        Overrides:
        isWeighted in class Edge<V>
        Returns:
        True if the edge has a weight, false otherwise
      • setWeight

        public void setWeight​(double weight)
        Description copied from class: Edge
        Sets the weight of the edge
        Overrides:
        setWeight in class Edge<V>
        Parameters:
        weight - the weight