Interface ILcdGraph<N,E>

All Known Subinterfaces:
ILcdEditableGraph<N,E>, ILcdLimitedEditablePartitionedGraph<N,E>, ILcdPartitionedGraph<N,E>
All Known Implementing Classes:
TLcdGraph, TLcdLimitedEditablePartitionedGraph, TLcdNumericGraph, TLcdPartitionedGraph

public interface ILcdGraph<N,E>
An ILcdGraph represents a general graph, which can contain nodes, connected by edges.

The following invariants should always hold for every ILcdGraph object:

  • an edge will be contained in a graph no more than once.
  • a node will be contained in a graph no more than once.
  • the start node and end node of an edge that is contained in a graph, should both be part of that graph.
Since:
5.1
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Registers the given ILcdGraphListener with this graph.
    boolean
    containsEdge(E aEdge)
    Returns true if aEdge is contained in this graph, false otherwise.
    boolean
    containsNode(N aNode)
    Returns true if aNode is part of this graph, false otherwise.
    Returns an Enumeration containing all edges in this graph.
    getEdges(N aNode)
    Returns an Enumeration containing all edges connected to the given node.
    getEndNode(E aEdge)
    Returns the end node of the given edge in this graph.
    Returns an Enumeration containing all nodes in this graph.
    getOppositeNode(E aEdge, N aNode)
    If aNode is one of the two nodes connected by the given edge in this graph, returns the other node, otherwise throws IllegalArgumentException.
    getStartNode(E aEdge)
    Returns the start node of the given edge in this graph.
    boolean
    isConnected(E aEdge, N aNode)
    Returns true if aNode is one the nodes to which this edge is connected.
    void
    Unregisters the given ILcdGraphListener from this graph.
  • Method Details

    • containsNode

      boolean containsNode(N aNode)
      Returns true if aNode is part of this graph, false otherwise.
      Parameters:
      aNode - the node to be checked.
      Returns:
      true if aNode is part of the graph, false otherwise.
      Throws:
      NullPointerException - if the node is null.
    • getNodes

      Enumeration<N> getNodes()
      Returns an Enumeration containing all nodes in this graph.
      Returns:
      an Enumeration containing all nodes in this graph.
    • containsEdge

      boolean containsEdge(E aEdge)
      Returns true if aEdge is contained in this graph, false otherwise.
      Parameters:
      aEdge - the edge to be checked
      Returns:
      true if aEdge is part of the graph, false otherwise.
      Throws:
      NullPointerException - if the edge is null.
    • getEdges

      Enumeration<E> getEdges()
      Returns an Enumeration containing all edges in this graph.
      Returns:
      an Enumeration containing all edges in this graph.
    • getEdges

      Enumeration<E> getEdges(N aNode)
      Returns an Enumeration containing all edges connected to the given node.
      Parameters:
      aNode - the node whose connected edges should be returned.
      Returns:
      an Enumeration containing all edges connected to the given node.
      Throws:
      IllegalArgumentException - aNode is not part of this graph.
      NullPointerException - if the node is null.
    • getStartNode

      N getStartNode(E aEdge)
      Returns the start node of the given edge in this graph.
      Parameters:
      aEdge - the edge whose start node should be returned.
      Returns:
      the start node.
      Throws:
      IllegalArgumentException - aEdge is not part of this graph.
      NullPointerException - if the edge is null.
    • getEndNode

      N getEndNode(E aEdge)
      Returns the end node of the given edge in this graph.
      Parameters:
      aEdge - the edge whose end node should be returned.
      Returns:
      the end node.
      Throws:
      IllegalArgumentException - aEdge is not part of this graph.
      NullPointerException - if the edge is null.
    • getOppositeNode

      N getOppositeNode(E aEdge, N aNode)
      If aNode is one of the two nodes connected by the given edge in this graph, returns the other node, otherwise throws IllegalArgumentException.
      Parameters:
      aEdge - the edge whose opposite node should be returned.
      aNode - one of the two Object's connected by the given edge.
      Returns:
      if aNode is one of the two nodes connected by this edge, returns the other node connected by this edge.
      Throws:
      IllegalArgumentException - aNode is not connected by this edge or aEdge is not part of this graph.
      NullPointerException - if one of the arguments is null.
    • isConnected

      boolean isConnected(E aEdge, N aNode)
      Returns true if aNode is one the nodes to which this edge is connected.
      Parameters:
      aEdge - the edge whose connectivity should be checked.
      aNode - the node whose connectivity should be checked.
      Returns:
      true if aNode is one the nodes to which this edge is connected.
      Throws:
      IllegalArgumentException - aEdge is not part of this graph.
      NullPointerException - if one of the arguments is null.
    • addGraphListener

      void addGraphListener(ILcdGraphListener<N,E> aGraphListener)
      Registers the given ILcdGraphListener with this graph. All events generated by this graph afterwards will be sent to the given listener, until it is removed from this graph.
      Parameters:
      aGraphListener - the graph listener to be registered with this graph.
      Throws:
      NullPointerException - if the given listener is null.
    • removeGraphListener

      void removeGraphListener(ILcdGraphListener<N,E> aGraphListener)
      Unregisters the given ILcdGraphListener from this graph. After it has been unregistered, no events generated by this graph will be sent to the given listener anymore.
      Parameters:
      aGraphListener - the graph listener to be unregistered from this graph.
      Throws:
      NullPointerException - if the given listener is null.
      IllegalArgumentException - if the given listener is not currently registered as a listener of this graph.