Package com.luciad.network.graph
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 TypeMethodDescriptionvoidaddGraphListener(ILcdGraphListener<N, E> aGraphListener) Registers the givenILcdGraphListenerwith this graph.booleancontainsEdge(E aEdge) Returns true ifaEdgeis contained in this graph, false otherwise.booleancontainsNode(N aNode) Returns true ifaNodeis part of this graph, false otherwise.getEdges()Returns an Enumeration containing all edges in this graph.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.getNodes()Returns an Enumeration containing all nodes in this graph.getOppositeNode(E aEdge, N aNode) IfaNodeis one of the two nodes connected by the given edge in this graph, returns the other node, otherwise throwsIllegalArgumentException.getStartNode(E aEdge) Returns the start node of the given edge in this graph.booleanisConnected(E aEdge, N aNode) Returns true ifaNodeis one the nodes to which this edge is connected.voidremoveGraphListener(ILcdGraphListener<N, E> aGraphListener) Unregisters the givenILcdGraphListenerfrom this graph.
-
Method Details
-
containsNode
Returns true ifaNodeis part of this graph, false otherwise.- Parameters:
aNode- the node to be checked.- Returns:
trueifaNodeis part of the graph,falseotherwise.- Throws:
NullPointerException- if the node isnull.
-
getNodes
Enumeration<N> getNodes()Returns an Enumeration containing all nodes in this graph.- Returns:
- an Enumeration containing all nodes in this graph.
-
containsEdge
Returns true ifaEdgeis contained in this graph, false otherwise.- Parameters:
aEdge- the edge to be checked- Returns:
trueifaEdgeis part of the graph,falseotherwise.- Throws:
NullPointerException- if the edge isnull.
-
getEdges
Enumeration<E> getEdges()Returns an Enumeration containing all edges in this graph.- Returns:
- an Enumeration containing all edges in this graph.
-
getEdges
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-aNodeis not part of this graph.NullPointerException- if the node isnull.
-
getStartNode
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-aEdgeis not part of this graph.NullPointerException- if the edge isnull.
-
getEndNode
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-aEdgeis not part of this graph.NullPointerException- if the edge isnull.
-
getOppositeNode
IfaNodeis one of the two nodes connected by the given edge in this graph, returns the other node, otherwise throwsIllegalArgumentException.- Parameters:
aEdge- the edge whose opposite node should be returned.aNode- one of the twoObject's connected by the given edge.- Returns:
- if
aNodeis one of the two nodes connected by this edge, returns the other node connected by this edge. - Throws:
IllegalArgumentException-aNodeis not connected by this edge oraEdgeis not part of this graph.NullPointerException- if one of the arguments isnull.
-
isConnected
Returns true ifaNodeis 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
aNodeis one the nodes to which this edge is connected. - Throws:
IllegalArgumentException-aEdgeis not part of this graph.NullPointerException- if one of the arguments isnull.
-
addGraphListener
Registers the givenILcdGraphListenerwith 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 isnull.
-
removeGraphListener
Unregisters the givenILcdGraphListenerfrom 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 isnull.IllegalArgumentException- if the given listener is not currently registered as a listener of this graph.
-