Class AbstractEdge

All Implemented Interfaces:
Comparable<GraphElement>, Attributable, Edge, GraphElement
Direct Known Subclasses:
AdjListEdge

public abstract class AbstractEdge
extends AbstractGraphElement
implements Edge
Provides default implementations of methods on edges.
Version:
$Revision: 1.6 $
  • Constructor Details

    • AbstractEdge

      public AbstractEdge​(Graph graph)
      Constructs a new AbstractEdge. Also sets the graph.
      Parameters:
      graph - the Graph the AbstractGraphElement belongs to.
    • AbstractEdge

      public AbstractEdge​(Graph graph, CollectionAttribute coll)
      Constructs a new AbstractEdge. Sets the graph of the new AbstractEdge.
      Parameters:
      graph - the Graph the new AbstractEdge instance shall belong to.
      coll - the CollectionAttribute of the newly created AbstractEdge instance.
  • Method Details

    • setDirected

      public void setDirected​(boolean directed)
      Determines if an Edge is directed (true) or not. Informs the ListenerManager that the direction has been modified.
      Specified by:
      setDirected in interface Edge
      Parameters:
      directed - true, if the Edge is destined to be directed, false otherwise.
    • setSource

      public void setSource​(Node source) throws GraphElementNotFoundException
      Sets the source of the current Edge to source. source must be contained in the same Graph as the current Edge. Informs the ListenerManager about the change.
      Specified by:
      setSource in interface Edge
      Parameters:
      source - the source to be set.
      Throws:
      GraphElementNotFoundException - if source cannot be found in the Graph.
    • setTarget

      public void setTarget​(Node target) throws GraphElementNotFoundException
      Sets the target of the current Edge to target. Target must be contained in the same Graph as the Edge. Informs the ListenerManager about the change.
      Specified by:
      setTarget in interface Edge
      Parameters:
      target - the target to be set.
      Throws:
      GraphElementNotFoundException - if the target cannot be found in the Graph.
    • reverse

      public void reverse()
      Swaps source and target of the edge. Informs the listtenerManager about the change.
      Specified by:
      reverse in interface Edge