edu.uci.ics.jung.graph.impl
Class AbstractArchetypeGraph

java.lang.Object
  extended by edu.uci.ics.jung.utils.UserDataDelegate
      extended by edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph
All Implemented Interfaces:
ArchetypeGraph, UserDataContainer, Cloneable
Direct Known Subclasses:
AbstractSparseGraph, HypergraphBPG, SetHypergraph

public abstract class AbstractArchetypeGraph
extends UserDataDelegate
implements ArchetypeGraph, Cloneable

Author:
Joshua O'Madadhain

Nested Class Summary
protected  class AbstractArchetypeGraph.Requirements
           
 
Nested classes/interfaces inherited from interface edu.uci.ics.jung.utils.UserDataContainer
UserDataContainer.CopyAction
 
Field Summary
protected  AbstractArchetypeGraph.Requirements edge_requirements
           
protected  Map mEdgeIDs
          ID -> Edge lookup table.
protected  GraphListenerHandler mGraphListenerHandler
          GraphEventType -> Graph Listener list table
protected  Map mVertexIDs
          ID -> Vertex lookup table.
protected  AbstractArchetypeGraph.Requirements vertex_requirements
           
 
Fields inherited from class edu.uci.ics.jung.utils.UserDataDelegate
factory, udc_delegate
 
Fields inherited from interface edu.uci.ics.jung.graph.ArchetypeGraph
SUBSET_MANAGER
 
Constructor Summary
AbstractArchetypeGraph()
           
 
Method Summary
protected  void addAllNotInitializers(Collection targetPredicates, Collection sourcePredicates)
          Adds all the predicates in source to the list in target, except those that answer to isInitializationPredicate.
 void addListener(GraphEventListener gel, GraphEventType get)
          Tells the graph to add gel as a listener for changes in the graph structure
protected  void checkConstraints(Object o, Collection c)
           
 ArchetypeGraph copy()
          Creates a replica of this graph.
 Collection getEdgeConstraints()
          Returns the Collection of requirements that each edge must satisfy when it is added to this graph.
 Collection getVertexConstraints()
          Returns the Collection of constraints that each vertex must satisfy when it is added to this graph.
protected  void initialize()
          Initializes all of the graph's internal data structures.
protected  boolean listenersExist(GraphEventType type)
           
 ArchetypeGraph newInstance()
          Creates a new empty graph of the same type as this graph, by cloning this graph and then clearing the extraneous fields.
 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.
 void removeAllVertices()
          Removes all vertices (and, therefore, all edges) from this graph.
 void removeListener(GraphEventListener gel, GraphEventType get)
          Tells the graph to remove gel as a listener for changes in the graph structure
 String toString()
          Returns a human-readable representation of this graph.
 
Methods inherited from class edu.uci.ics.jung.utils.UserDataDelegate
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDataFactory, setUserDatum
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.uci.ics.jung.graph.ArchetypeGraph
getEdges, getVertices, removeEdges, removeVertices
 
Methods inherited from interface edu.uci.ics.jung.utils.UserDataContainer
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum
 

Field Detail

mGraphListenerHandler

protected GraphListenerHandler mGraphListenerHandler
GraphEventType -> Graph Listener list table


mVertexIDs

protected Map mVertexIDs
ID -> Vertex lookup table.


mEdgeIDs

protected Map mEdgeIDs
ID -> Edge lookup table.


edge_requirements

protected AbstractArchetypeGraph.Requirements edge_requirements

vertex_requirements

protected AbstractArchetypeGraph.Requirements vertex_requirements
Constructor Detail

AbstractArchetypeGraph

public AbstractArchetypeGraph()
Method Detail

initialize

protected void initialize()
Initializes all of the graph's internal data structures. Should always be called by any mechanism that creates a new instance of AbstractSparseGraph (for example, constructors and implementations of newInstance()). If you add predicates here, please set their isInitializeFlag to TRUE.

Note: this method is not a substitute for removeAllVertices(), as it will not notify the vertices and edges that they have been removed from the graph.


newInstance

public ArchetypeGraph newInstance()
Creates a new empty graph of the same type as this graph, by cloning this graph and then clearing the extraneous fields.

Specified by:
newInstance in interface ArchetypeGraph
Returns:
ArchetypeGraph
See Also:
ArchetypeGraph.newInstance()

addAllNotInitializers

protected void addAllNotInitializers(Collection targetPredicates,
                                     Collection sourcePredicates)
Adds all the predicates in source to the list in target, except those that answer to isInitializationPredicate.

Parameters:
targetPredicates -
sourcePredicates -

toString

public String toString()
Returns a human-readable representation of this graph.

Overrides:
toString in class Object
See Also:
Object.toString()

numVertices

public int numVertices()
Description copied from interface: ArchetypeGraph
Returns the number of vertices in this graph.

Specified by:
numVertices in interface ArchetypeGraph
See Also:
ArchetypeGraph.numVertices()

numEdges

public int numEdges()
Description copied from interface: ArchetypeGraph
Returns the number of edges in this graph.

Specified by:
numEdges in interface ArchetypeGraph
See Also:
ArchetypeGraph.numEdges()

getVertexConstraints

public Collection getVertexConstraints()
Description copied from interface: ArchetypeGraph
Returns the 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.

Specified by:
getVertexConstraints in interface ArchetypeGraph
See Also:
ArchetypeGraph.getVertexConstraints()

getEdgeConstraints

public Collection getEdgeConstraints()
Description copied from interface: ArchetypeGraph
Returns the 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.

Specified by:
getEdgeConstraints in interface ArchetypeGraph
See Also:
ArchetypeGraph.getEdgeConstraints()

addListener

public void addListener(GraphEventListener gel,
                        GraphEventType get)
Description copied from interface: ArchetypeGraph
Tells the graph to add gel as a listener for changes in the graph structure

Specified by:
addListener in interface ArchetypeGraph
Parameters:
gel - the graph event listener
get - the type of graph events the listeners wants to listen for
See Also:
ArchetypeGraph.addListener(edu.uci.ics.jung.graph.event.GraphEventListener, edu.uci.ics.jung.graph.event.GraphEventType)

removeListener

public void removeListener(GraphEventListener gel,
                           GraphEventType get)
Description copied from interface: ArchetypeGraph
Tells the graph to remove gel as a listener for changes in the graph structure

Specified by:
removeListener in interface ArchetypeGraph
Parameters:
gel - the graph event listener
get - the type of graph events the listeners wants to not listen for
See Also:
ArchetypeGraph.removeListener(edu.uci.ics.jung.graph.event.GraphEventListener, edu.uci.ics.jung.graph.event.GraphEventType)

listenersExist

protected boolean listenersExist(GraphEventType type)

copy

public ArchetypeGraph copy()
Creates a replica of this graph. Creates a new instance, then copies all vertices, then all edges, and finally all user data.

Specified by:
copy in interface ArchetypeGraph
See Also:
ArchetypeGraph.copy(), AbstractSparseEdge.copy(ArchetypeGraph), AbstractSparseVertex.copy(ArchetypeGraph)

checkConstraints

protected void checkConstraints(Object o,
                                Collection c)

removeAllVertices

public void removeAllVertices()
Removes all vertices (and, therefore, all edges) from this graph. Syntactic sugar for a loop that calls removeVertex on all vertices of this graph.

Specified by:
removeAllVertices in interface ArchetypeGraph
See Also:
ArchetypeGraph.removeAllVertices()

removeAllEdges

public void removeAllEdges()
Removes all edges from this graph. Syntactic sugar for a loop that calls removeEdge on all edges of this graph.

Specified by:
removeAllEdges in interface ArchetypeGraph
See Also:
ArchetypeGraph.removeAllEdges()