public interface ArchetypeGraph extends UserDataContainer
ArchetypeVertex
set and an ArchetypeEdge
set.
This interface permits, but does not enforce, any of the following common variations of graphs:
ArchetypeGraph
may enforce or disallow any or all of these variations.
A graph consists of a set of vertices, and a set of edges. Each edge
connects a set of vertices.
For details on the process of adding vertices and edges to a graph,
see the documentation for ArchetypeVertex
and
ArchetypeEdge
.
The implementations of the graph, vertex and edge classes are responsible for ensuring that their individual bookkeeping information is kept mutually consistent. (For instance, a sparse graph implementation may have separate references to a single edge stored in each of its incident vertices and in the graph itself. If the edge is removed from the graph, each of these references must also be removed to maintain consistency.)
ArchetypeEdge
,
ArchetypeVertex
UserDataContainer.CopyAction
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
SUBSET_MANAGER |
Modifier and Type | Method and Description |
---|---|
void |
addListener(GraphEventListener gel,
GraphEventType get)
Tells the graph to add gel as a listener for changes in the graph structure
|
ArchetypeGraph |
copy()
Performs a deep copy of the graph and its contents.
|
java.util.Collection |
getEdgeConstraints()
Returns the
Collection of requirements that each edge
must satisfy when it is added to this graph. |
java.util.Set |
getEdges()
Returns a Set view of all edges in this graph.
|
java.util.Collection |
getVertexConstraints()
Returns the
Collection of constraints that each vertex
must satisfy when it is added to this graph. |
java.util.Set |
getVertices()
Returns a Set view of all vertices in this graph.
|
ArchetypeGraph |
newInstance()
Returns a graph of the same type as the graph on which this
method is invoked.
|
int |
numEdges()
Returns the number of edges in this graph.
|
int |
numVertices()
Returns the number of vertices in this graph.
|
void |
removeAllEdges()
Removes all edges from this graph, leaving the vertices intact.
|
void |
removeAllVertices()
Removes all vertices (and, therefore, edges) from this graph.
|
void |
removeEdges(java.util.Set edges)
Deprecated.
As of version 1.7, replaced by
GraphUtils.removeEdges(graph, edges) . |
void |
removeListener(GraphEventListener gel,
GraphEventType get)
Tells the graph to remove gel as a listener for changes in the graph structure
|
void |
removeVertices(java.util.Set vertices)
Deprecated.
As of version 1.7, replaced by
GraphUtils.removeVertices(graph, vertices) . |
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum
static final java.lang.String SUBSET_MANAGER
ArchetypeGraph newInstance()
java.util.Set getVertices()
java.util.Set getEdges()
int numVertices()
int numEdges()
void removeVertices(java.util.Set vertices)
GraphUtils.removeVertices(graph, vertices)
.vertices
from this graph.
If any element of vertices
is not part of this graph,
then throws IllegalArgumentException
. If this
exception is thrown, any vertices that may have been removed already
are not guaranteed to be restored to the graph. Prunes any resultant
ill-formed edges.vertices
- the set of vertices to be removedvoid removeEdges(java.util.Set edges)
GraphUtils.removeEdges(graph, edges)
.edges
from this graph.
If any element of edges
is not part of this graph,
then throws IllegalArgumentException
. If this
exception is thrown, any edges that may have been removed already
are not guaranteed to be restored to the graph.void removeAllEdges()
removeEdges(getEdges())
.void removeAllVertices()
removeVertices(getVertices())
.ArchetypeGraph copy()
void addListener(GraphEventListener gel, GraphEventType get)
gel
- the graph event listenerget
- the type of graph events the listeners wants to listen forvoid removeListener(GraphEventListener gel, GraphEventType get)
gel
- the graph event listenerget
- the type of graph events the listeners wants to not listen forjava.util.Collection getVertexConstraints()
Collection
of constraints that each vertex
must satisfy when it is added to this graph. This collection may
be viewed and modified by the user to add or remove constraints.java.util.Collection getEdgeConstraints()
Collection
of requirements that each edge
must satisfy when it is added to this graph. This collection may
be viewed and modified by the user to add or remove requirements.