Class Arc<T>

java.lang.Object
it.unimi.di.prog2.h25.digraph.Arc<T>
Type Parameters:
T - the type of the graph nodes.

public class Arc<T> extends Object
An arc of a directed graph with nodes of type T.

This is an immutable value class: arcs with the same sources and destinations are equal.

  • Field Details

    • source

      public final T source
    • destination

      public final T destination
  • Constructor Details

    • Arc

      public Arc(T source, T destination)
      Creates an arc.
      Parameters:
      source - the arc source.
      destination - the arc destination.
  • Method Details

    • equals

      public boolean equals(Object obj)
      Tells whether this arc is equal to the given object, or not.

      This arc is equal to obj iff it is an Arc with the same source and destination of this one.

      Overrides:
      equals in class Object
      Parameters:
      obj - the object to compare to.
      Returns:
      whether this arc is equal to the given object.
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object