com.kuka.graph.impl
Class AbstractBaseListenableGraph<N,E extends Edge<N>>

java.lang.Object
  extended by com.kuka.graph.impl.AbstractGraph<N,E>
      extended by com.kuka.graph.impl.AbstractBaseGraph<N,E>
          extended by com.kuka.graph.impl.AbstractBaseListenableGraph<N,E>
Type Parameters:
N - the node types.
E - the edge types.
All Implemented Interfaces:
Graph<N,E>, ListenableGraph<N,E>, Serializable, Cloneable, Iterable<N>
Direct Known Subclasses:
DefaultGraph

public abstract class AbstractBaseListenableGraph<N,E extends Edge<N>>
extends AbstractBaseGraph<N,E>
implements ListenableGraph<N,E>

Super class for all directed graphs that support listeners on structural change events.

See Also:
Serialized Form

Constructor Summary
AbstractBaseListenableGraph()
           
 
Method Summary
 boolean addEdge(E edge)
          Adds the specified edge to this graph if it is not already present (optional operation).
 void addListener(GraphListener<N,E> listener)
          Adds the specified graph listener.
 boolean addNode(N node)
          Adds the specified node to this graph if it is not already present (optional operation).
 boolean hasListeners()
          Indicates whether this graph contains any listeners.
 boolean removeEdge(E edge)
          Removes the specified edge e from this graph if it is present (optional operation).
 void removeListener(GraphListener<N,E> listener)
          Removes the specified listener.
 boolean removeNode(N node)
          Removes the specified node n from this graph if it is present (optional operation).
 
Methods inherited from class com.kuka.graph.impl.AbstractBaseGraph
clone, containsEdge, containsNode, edges, getEdge, incomingEdges, neighbors, nodes, outgoingEdges
 
Methods inherited from class com.kuka.graph.impl.AbstractGraph
addAllEdges, addAllNodes, clear, containsAllEdges, containsAllNodes, containsEdge, edges, edgeSize, isEmpty, iterator, nodes, nodeSize, removeAllEdges, removeAllNodes, removeEdge, retainAllEdges, retainAllNodes, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.kuka.graph.Graph
addAllEdges, addAllNodes, clear, containsAllEdges, containsAllNodes, containsEdge, containsEdge, containsNode, createEdge, createNode, edges, edges, edgeSize, getEdge, incomingEdges, isEmpty, neighbors, nodes, nodes, nodeSize, outgoingEdges, removeAllEdges, removeAllNodes, removeEdge, retainAllEdges, retainAllNodes
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

AbstractBaseListenableGraph

public AbstractBaseListenableGraph()
Method Detail

hasListeners

public final boolean hasListeners()
Description copied from interface: ListenableGraph
Indicates whether this graph contains any listeners.

Specified by:
hasListeners in interface ListenableGraph<N,E extends Edge<N>>
Returns:
true, if this graph has listeners

addListener

public final void addListener(GraphListener<N,E> listener)
Description copied from interface: ListenableGraph
Adds the specified graph listener.

Specified by:
addListener in interface ListenableGraph<N,E extends Edge<N>>
Parameters:
listener - the listener for graph events

removeListener

public final void removeListener(GraphListener<N,E> listener)
Description copied from interface: ListenableGraph
Removes the specified listener.

Specified by:
removeListener in interface ListenableGraph<N,E extends Edge<N>>
Parameters:
listener - listener to remove

addNode

public boolean addNode(N node)
Description copied from interface: Graph
Adds the specified node to this graph if it is not already present (optional operation).

More formally, adds the specified node n to this graph if the graph contains no element n2 such that n.equals(n2)) . If this graph already contains the element, the call leaves the graph unchanged and returns false.

Specified by:
addNode in interface Graph<N,E extends Edge<N>>
Overrides:
addNode in class AbstractBaseGraph<N,E extends Edge<N>>
Parameters:
node - node to be added to this graph
Returns:
true if this graph did not already contain the specified node

addEdge

public boolean addEdge(E edge)
Description copied from interface: Graph
Adds the specified edge to this graph if it is not already present (optional operation).

More formally, adds the specified edge e to this graph if the graph contains no element e2 such that e.equals(e2)) . If this graph already contains the element, the call leaves the graph unchanged and returns false.

Specified by:
addEdge in interface Graph<N,E extends Edge<N>>
Overrides:
addEdge in class AbstractBaseGraph<N,E extends Edge<N>>
Parameters:
edge - edge to be added to this graph
Returns:
true if this graph did not already contain the specified edge

removeNode

public boolean removeNode(N node)
Description copied from interface: Graph
Removes the specified node n from this graph if it is present (optional operation).

More formally, removes a node n* such that n.equals(n*) , if this graph contains such a node. Furthermore, all edges incident to this node are removed. Returns true if this graph contained the node (or equivalently, if this graph changed as a result of the call).

Specified by:
removeNode in interface Graph<N,E extends Edge<N>>
Overrides:
removeNode in class AbstractBaseGraph<N,E extends Edge<N>>
Parameters:
node - node to be removed from this graph, if present
Returns:
true if this graph contained the specified node

removeEdge

public boolean removeEdge(E edge)
Description copied from interface: Graph
Removes the specified edge e from this graph if it is present (optional operation).

More formally, removes an edge e* such that e.equals(e*), if this graph contains such an edge. Returns true if this graph contained the edge (or equivalently, if this graph changed as a result of the call).

Specified by:
removeEdge in interface Graph<N,E extends Edge<N>>
Overrides:
removeEdge in class AbstractBaseGraph<N,E extends Edge<N>>
Parameters:
edge - edge to be removed from this graph, if present
Returns:
true if this graph contained the specified edge


Copyright © 2019. All rights reserved.