Package cdc.graphs.impl
Class RestrictionSubGraph<N,E>
- java.lang.Object
-
- cdc.graphs.impl.GraphFilter<N,E>
-
- cdc.graphs.impl.ExplicitSubGraph<N,E>
-
- cdc.graphs.impl.RestrictionSubGraph<N,E>
-
- Type Parameters:
N- Node classE- Edge class
- All Implemented Interfaces:
GraphAdapter<N,E>
public class RestrictionSubGraph<N,E> extends ExplicitSubGraph<N,E>
Explicit subgraph defined by restriction. At creation time the subgraph is full. Nodes and edges are then removed and can be added again.SubGraph built from an underlying graph. It can be constructed by removing nodes and edges from the full graph or by adding nodes and edges to an empty graph.
- Author:
- Damien Carbonne
-
-
Field Summary
Fields Modifier and Type Field Description (package private) Set<E>removedEdgesSet of removed edges.(package private) Set<N>removedNodesSet of removed nodes.-
Fields inherited from class cdc.graphs.impl.GraphFilter
delegate
-
-
Constructor Summary
Constructors Constructor Description RestrictionSubGraph(GraphAdapter<N,E> delegate)Creates a full subgraph from a delegate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(E edge)Add an edge and the associated nodes to the subgraph.voidaddNode(N node)Add a node to the subgraph.voidclear()Make the subgraph empty.booleancontainsEdge(E edge)booleancontainsNode(N node)Iterable<? extends E>getEdges()Iterable<? extends E>getEdges(N node, EdgeDirection direction)Iterable<? extends N>getNodes()Set<E>getRemovedEdges()Set<N>getRemovedNodes()NgetTip(E edge, EdgeTip tip)booleanisEmpty()Return whether the subgraph is empty or not.voidremoveEdge(E edge)Remove one edge.voidremoveEdges(N source, N target)Remove all edges between a source and a target node.voidremoveNode(N node)Remove one node and the associated edges.voidreset()Makes the subgraph equals the underlying graph.StringtoString()-
Methods inherited from class cdc.graphs.impl.GraphFilter
checkEdgeValidity, checkNodeValidity, getDelegate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cdc.graphs.GraphAdapter
getConnectedNodes, getConnectedNodes, getConnectivity, getEdges, getEdges, getEdges, getEdges, getEdgesCount, getEdgesCount, getEdgesCount, getEdgesStream, getEdgesStream, getEdgesStream, getLeaves, getNodes, getNodesCount, getNodesStream, getRoots, hasEdge, hasEdges, hasEdges, hasEdges, hasNodes, isLeaf, isRoot
-
-
-
-
Constructor Detail
-
RestrictionSubGraph
public RestrictionSubGraph(GraphAdapter<N,E> delegate)
Creates a full subgraph from a delegate.- Parameters:
delegate- The delegate.
-
-
Method Detail
-
clear
public final void clear()
Description copied from class:ExplicitSubGraphMake the subgraph empty.- Specified by:
clearin classExplicitSubGraph<N,E>
-
reset
public final void reset()
Makes the subgraph equals the underlying graph.
-
isEmpty
public final boolean isEmpty()
Description copied from class:ExplicitSubGraphReturn whether the subgraph is empty or not.- Specified by:
isEmptyin classExplicitSubGraph<N,E>- Returns:
- whether the subgraph is empty or not.
-
addNode
public final void addNode(N node)
Description copied from class:ExplicitSubGraphAdd a node to the subgraph.- Specified by:
addNodein classExplicitSubGraph<N,E>- Parameters:
node- The node to add. Must belong to delegate.
-
removeNode
public final void removeNode(N node)
Description copied from class:ExplicitSubGraphRemove one node and the associated edges. If node does not belong to subgraph, does nothing.- Specified by:
removeNodein classExplicitSubGraph<N,E>- Parameters:
node- The node to remove.
-
addEdge
public final void addEdge(E edge)
Description copied from class:ExplicitSubGraphAdd an edge and the associated nodes to the subgraph.- Specified by:
addEdgein classExplicitSubGraph<N,E>- Parameters:
edge- The edge to add. Must belong to delegate.
-
removeEdge
public final void removeEdge(E edge)
Description copied from class:ExplicitSubGraphRemove one edge. If edge does not belong to subgraph, does nothing.- Specified by:
removeEdgein classExplicitSubGraph<N,E>- Parameters:
edge- The edge to remove.
-
removeEdges
public final void removeEdges(N source, N target)
Description copied from class:ExplicitSubGraphRemove all edges between a source and a target node. If source or edge does not belong to subgraph, does nothing.- Specified by:
removeEdgesin classExplicitSubGraph<N,E>- Parameters:
source- The source node.target- The target node.
-
containsNode
public final boolean containsNode(N node)
-
containsEdge
public final boolean containsEdge(E edge)
-
getEdges
public final Iterable<? extends E> getEdges(N node, EdgeDirection direction)
-
-