uk.ed.inf.graph.basic
Interface IModifiableGraph<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>

All Known Implementing Classes:
Graph

public interface IModifiableGraph<N extends IBasicNode<N,? extends IBasicEdge<N,?>>,E extends IBasicEdge<N,E>>


Method Summary
 boolean canCopyHere(IBasicSubgraph<? extends N,? extends E> subGraph)
          Tests whether the subGraph can be copied to this graph.
 void copyHere(IBasicSubgraph<? extends N,? extends E> subGraph)
          Copies a subgraph into this graph.
 IBasicEdgeFactory<N,E> edgeFactory()
          Gets the edgeFactory for this class.
 IBasicSubgraph<N,E> getCopiedComponents()
          Retrieves the nodes and edges created in this graph by the last copy operation.
 IBasicNodeFactory<N,E> nodeFactory()
          Gets the nodeFactory for this class.
 void removeSubgraph(IBasicSubgraph<? extends N,? extends E> subgraph)
          Removes the nodes and edges defined in the subgraph from this graph.
 IBasicSubgraphFactory<N,E> subgraphFactory()
          Gets the subgraphFactory for this class.
 

Method Detail

nodeFactory

IBasicNodeFactory<N,E> nodeFactory()
Gets the nodeFactory for this class. This factory is a singleton so this method must always return the same instance of the factory. The factory is the only way that new nodes can be added to this graph.

Returns:
The node factory.
Throws:
java.lang.UnsupportedOperationException - if this graph implementation does support new node creation and so a factory is not provided, i.e. canCreateNodes() == false.

edgeFactory

IBasicEdgeFactory<N,E> edgeFactory()
Gets the edgeFactory for this class. The factory is the only way that new edges can be added to this graph.

Returns:
The edge factory.
Throws:
java.lang.UnsupportedOperationException - if this graph implementation does support new edge creation and so a factory is not provided, i.e. canCreateEdges() == false.

subgraphFactory

IBasicSubgraphFactory<N,E> subgraphFactory()
Gets the subgraphFactory for this class.

Returns:
The subgraph factory.
Throws:
java.lang.UnsupportedOperationException - if this graph implementation does support new subgraph creation and so a factory is not provided, i.e. canCreateSubgraphs() == false.

removeSubgraph

void removeSubgraph(IBasicSubgraph<? extends N,? extends E> subgraph)
Removes the nodes and edges defined in the subgraph from this graph. The subgraph must be consistent with this graph and be a subgraph of this graph.

Parameters:
subgraph - The subgraph to remove, cannot be null.
Throws:
java.lang.NullPointerException - if subgraph is null.
java.lang.UnsupportedOperationException - if removal is not supported, i.e. when canRemoveSubgraph() == false.
java.lang.IllegalArgumentException - if the subgraph does not belong to this graph: subgraph.getOwningGraph() != this.
java.lang.IllegalArgumentException - if the subgraph is not consistent with this graph: subgraph.isConsistentSnapshot() == false.

canCopyHere

boolean canCopyHere(IBasicSubgraph<? extends N,? extends E> subGraph)
Tests whether the subGraph can be copied to this graph. To be true the subgraph must be an induced subgraph that is a consistent of the super graph. It must also be not null.

Parameters:
subGraph - the subgraph to test, can be null.
Returns:
true if the subgraph is valid to copy from, false otherwise.

copyHere

void copyHere(IBasicSubgraph<? extends N,? extends E> subGraph)
Copies a subgraph into this graph. Note that the subgraph can be from a different graph or subgraph of this graph, since the structure of the graph is copied not the nodes and edges instances themselves. Note that the subgraph must be valid to be copied.

Parameters:
subGraph - the subgraph to copy

getCopiedComponents

IBasicSubgraph<N,E> getCopiedComponents()
Retrieves the nodes and edges created in this graph by the last copy operation. The subgraph is not guaranteed to be a consistent snapshot of this graph. If not copy operation has been performed then an empty subset will be returned.

Returns:
the subgraph of copied components, or an empty subset of not copy operation has been perfromed.