|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This interface defines the responsibilities for containers of objects
of type GraphObject. By providing
this interface, different component types are able to play this role.
Constructing a GraphObjectContainer is done
by means of a GraphModelFactory,
which will hide the particular implementation classes from client code.
The interfaces Graph and Subgraph are the
concrete interface types that you will request from this factory.
Orphaned nodes and edges are of no use in a graph model. Although such
objects may be allocated on their own, they are usually added to a
particular Graph instance, which internally assigns them a
unique identifier within the scope of the Graph itself.
Moreover, when
an Edge is added to a Graph, additional checks
are performed. For example, it is not permitted to add an Edge
that refers to a Node not already contained by the
Graph.
GraphObjectContainer instances that are dereferenced will
be garbage collected.
This interface has methods which you can use to control the propagation of model events to listeners.
Node,
Edge,
Graph,
Subgraph,
Port,
GraphObject| Method Summary | |
void |
addEdge(Edge edge)
Adds the given edge to the GraphObjectContainer.
|
void |
addEdges(Edge[] edges)
Convenience method to add several edges to the GraphObjectContainer in one go.
|
void |
addNode(Node node)
Adds the given node to the GraphObjectContainer. |
void |
addNodes(Node[] nodes)
Convenience method to add several nodes to a GraphObjectContainer in one go.
|
int[] |
buildAdjacencyMatrix()
Builds the adjacency matrix for this GraphObjectContainer.
|
void |
disableGraphEvents(int eventmask)
Disables all of the events specified in the given eventmask. |
void |
disableGraphEventsInternal(int eventmaskInternal)
Disables all of the events specified in the given eventmask. |
void |
enableGraphEvents(int eventmask)
Enables all of the events specified in the given eventmask. |
void |
enableGraphEventsInternal(int eventmaskInternal)
Enables all of the events specified in the given eventmask. |
Edge |
findMultiEdge(Edge edge)
Finds a multi edge for the given edge (the given edge is not added to the GraphObjectContainer at this point in time).
|
GraphEvent |
fireCascadeNodeDeleteInternal(Node node,
Edge newEdge,
GraphObjectContainer newEdgeGOC,
Edge oldEdge1,
GraphObjectContainer oldEdge1GOC,
Edge oldEdge2,
GraphObjectContainer oldEdge2GOC)
Fires a cascade node delete event. |
GraphEvent |
fireEdgeSplitInternal(Node node,
long oldEdgeID,
Edge oldEdge,
GraphObjectContainer oldEdgeGOC,
Edge newEdge1,
GraphObjectContainer newEdge1GOC,
Edge newEdge2,
GraphObjectContainer newEdge2GOC)
Fires an edge split event. |
void |
fireNodePreRemove(Node node)
Fires a fireNodePreRemove event. |
void |
fireNodeRemoved(Node node,
long previd)
Fires a fireNodeRemoved event. |
void |
firePreCascadeNodeDeleteInternal(Node node,
Edge newEdge,
GraphObjectContainer newEdgeGOC,
Edge oldEdge1,
GraphObjectContainer oldEdge1GOC,
Edge oldEdge2,
GraphObjectContainer oldEdge2GOC)
Fires a pre-cascade node delete event. |
void |
firePreEdgeSplitInternal(Node node,
long oldEdgeID,
Edge oldEdge,
GraphObjectContainer oldEdgeGOC,
Edge newEdge1,
GraphObjectContainer newEdge1GOC,
Edge newEdge2,
GraphObjectContainer newEdge2GOC)
Fires a pre-edge split event. |
Edge[] |
getEdgeArray()
Returns an array of all edges, which is suitable for random access. |
Edge |
getEdgeByID(long localId)
Returns the Edge with the given id. |
int |
getEdgeCount()
Retrieves the number of edges from the GraphObjectContainer. |
java.util.Iterator |
getEdges()
Retrieves an Iterator for all edges in the
GraphObjectContainer. |
int |
getEventmask()
Returns the current event mask of the GraphObjectContainer. |
int |
getEventmaskInternal()
Returns the current internal event mask of the GraphObjectContainer.
|
Node[] |
getNodeArray()
Returns an array of all nodes, which is suitable for random access. |
Node |
getNodeByID(long localId)
Returns the Node with the given id. |
int |
getNodeCount()
Retrieves the number of nodes from the GraphObjectContainer. |
java.util.Iterator |
getNodes()
Retrieves an Iterator for all nodes. |
GraphObject |
getObjectByID(long localId)
Gets an identified GraphObject |
GraphObjectContainer |
getParentContainer()
GraphObjectContainer instances can be nested
inside of each other by means of the
Subgraph class. |
GraphObjectContainer |
getRootContainer()
GraphObjectContainer instances can be nested
inside of each other by means of the
Subgraph class. |
boolean |
isDirected()
Indicates whether or not the GraphObjectContainer is directed. |
boolean |
isMultiEdge(Edge edge)
Before adding an Edge to the GraphObjectContainer,
it might be necessary to find out
whether the Edge would be a multiedge. |
boolean |
isMultiGraph()
Querries whether the GraphObjectContainer is a
multigraph or not. |
void |
removeEdge(Edge edge)
Removes the given edge from the GraphObjectContainer.
|
void |
removeNode(Node node)
Removes the given node from the GraphObjectContainer. |
void |
setDirected(boolean directed)
Changes the fundamental property of the GraphObjectContainer
whether it is an undirected
or a directed GraphObjectContainer (digraph). |
void |
setMultiGraph(boolean multigraph)
Sets the GraphObjectContainer to be a multigraph or a
regular GraphObjectContainer,
Multigraphs can have edge (A,B) more than once.
|
| Method Detail |
public void enableGraphEvents(int eventmask)
eventmask - specifies which events to enable.public void disableGraphEvents(int eventmask)
eventmask - specifies which events to disable.public int getEventmask()
GraphObjectContainer.
GraphObjectContainer.public void enableGraphEventsInternal(int eventmaskInternal)
This method is API-Internal. It should never be invoked by clients.
eventmaskInternal - specifies which events to enable.public void disableGraphEventsInternal(int eventmaskInternal)
This method is API-Internal. It should never be invoked by clients.
eventmaskInternal - specifies which events to disable.public int getEventmaskInternal()
GraphObjectContainer.
This method is API-Internal. It should never be invoked by clients.
GraphObjectContainer.public GraphObjectContainer getRootContainer()
GraphObjectContainer instances can be nested
inside of each other by means of the
Subgraph class. This method returns the root
component of the nesting hierarchy, or the this pointer
if this instance is the root of the hierarchy. In case there is
no parent assigned then null is returned.
this.public GraphObjectContainer getParentContainer()
GraphObjectContainer instances can be nested
inside of each other by means of the
Subgraph class. This method returns the parent
component of this GraphObjectContainer
, or null
if this instance is the root of the hierarchy.
null.public Node getNodeByID(long localId)
Node with the given id.
localId - the local id of the Node.
Node.public Edge getEdgeByID(long localId)
Edge with the given id.
localId - the local id of the Edge.
Edge.public GraphObject getObjectByID(long localId)
GraphObject
localId - the local id of the GraphObject
GraphObjectpublic int getNodeCount()
GraphObjectContainer.
GraphObjectContainer.public int getEdgeCount()
GraphObjectContainer.
GraphObjectContainer.public java.util.Iterator getNodes()
Iterator for all nodes.
GraphObjectContainer.public java.util.Iterator getEdges()
Iterator for all edges in the
GraphObjectContainer.
GraphObjectContainer.
public void addNodes(Node[] nodes)
throws IllegalNodeException
GraphObjectContainer in one go.
This call will invoke the single addNode() method several times in
a row. As soon as a single call to addNode() fails, the adding
of any potentially remaining nodes in the array is skipped.
If null is specified as argument to this method then
an IllegalNodeException is thrown right away, no events
are generated.
nodes - the nodes to add to the GraphObjectContainer.
IllegalNodeException - thrown if one of the nodes has
an illegal state, or if one of the nodes is in the
GraphObjectContainer already. The exception is not
thrown if a user veto prevented the adding of the node.
public void addEdges(Edge[] edges)
throws IllegalEdgeException,
IllegalNodeException
GraphObjectContainer in one go.
This method will invoke the single addEdge() method for each edge
that is passed to it.
edges - the edges to add.
IllegalEdgeException - thrown if one of the edges is in an
illegal state.
IllegalNodeException - thrown if one of the the edges' source
or target references point to an illegal node which is not in
the GraphObjectContainer or in an invalid state.
public void addNode(Node node)
throws IllegalNodeException
GraphObjectContainer. If the node
can be successfully added a pre-node add event is generated, if that
event is not rejected in a vetoable listener then the node-add event is
generated. If a node cannot be added at all
(e.g. it is already added) then no events are generated at all.
node - the node to add to the GraphObjectContainer.
IllegalNodeException - thrown if the node has an illegal
state, or if the node is in the GraphObjectContainer already.
public void removeNode(Node node)
throws IllegalNodeException
GraphObjectContainer. The
node must in the GraphObjectContainer for this operation to
succeed.
node - the node to remove from the GraphObjectContainer.
IllegalNodeException - thrown if the node has an illegal
state, or if the node is not in the GraphObjectContainer.
public void addEdge(Edge edge)
throws IllegalEdgeException,
IllegalNodeException
GraphObjectContainer.
The edge must not be in the GraphObjectContainer already
and its source and target pointers must point to nodes in the
GraphObjectContainer.
edge - the edge to add.
IllegalEdgeException - thrown if the edge is in an illegal
state.
IllegalNodeException - thrown if the edge's source and
target references point to illegal nodes which are not in the
GraphObjectContainer
or in invalid state.
public void removeEdge(Edge edge)
throws IllegalEdgeException
GraphObjectContainer.
The edge must be in the GraphObjectContainer for this
operation to succeed.
edge - the edge to remove.
IllegalEdgeException - thrown if the edge has in illegal
state or if it is not in GraphObjectContainer.public boolean isMultiEdge(Edge edge)
Edge to the GraphObjectContainer,
it might be necessary to find out
whether the Edge would be a multiedge.
edge - the Edge to check.
GraphObjectContainer
already (it is a multiedge).
If not then false is returned.public Edge findMultiEdge(Edge edge)
GraphObjectContainer at this point in time).
null is returned
if adding the given edge would not result in a
multi-edge GraphObjectContainer.
The result of this method is not influenced by the Graph's
"Multi-Edge" property (as returned by the method
isMultiGraph().
edge - the edge to check for being a multi-edge.
GraphObjectContainer.
public void setMultiGraph(boolean multigraph)
throws IllegalGraphException
GraphObjectContainer to be a multigraph or a
regular GraphObjectContainer,
Multigraphs can have edge (A,B) more than once.
The GraphObjectContainer must be empty to set this property.
multigraph - boolean flag that determines the multigraph
property.
IllegalGraphException - thrown if the property cannot be set.public boolean isMultiGraph()
GraphObjectContainer is a
multigraph or not.
GraphObjectContainer is a
multigraph otherwise false.public boolean isDirected()
GraphObjectContainer is directed.
GraphObjectContainer is a directed
GraphObjectContainer.public void setDirected(boolean directed)
GraphObjectContainer
whether it is an undirected
or a directed GraphObjectContainer (digraph).
directed - if true the GraphObjectContainer is set
to be a directed GraphObjectContainer,
otherwise the GraphObjectContainer is made undirected.
public int[] buildAdjacencyMatrix()
throws InappropriateGraphException
GraphObjectContainer.
This operation maybe very expensive. In case it seems too expensive it is
up to the implementation to throw an exception.
InappropriateGraphException - thrown if the underlying
implementation wants to signal that building the adjency matrix is not
possible or to expensivepublic Node[] getNodeArray()
public Edge[] getEdgeArray()
public void fireNodePreRemove(Node node)
throws GraphEventVetoException
node - for internal use only.
GraphEventVetoException - thrown if a veto occurred.
public void fireNodeRemoved(Node node,
long previd)
node - for internal use only.previd - for internal use only.
public void firePreEdgeSplitInternal(Node node,
long oldEdgeID,
Edge oldEdge,
GraphObjectContainer oldEdgeGOC,
Edge newEdge1,
GraphObjectContainer newEdge1GOC,
Edge newEdge2,
GraphObjectContainer newEdge2GOC)
throws GraphEventVetoException
node - for internal use only.oldEdgeID - for internal use only.oldEdge - for internal use only.oldEdgeGOC - for internal use only.newEdge1 - for internal use only.newEdge1GOC - for internal use only.newEdge2 - for internal use only.newEdge2GOC - for internal use only.
GraphEventVetoException - potentially thrown by a
vetoable listener.
public GraphEvent fireEdgeSplitInternal(Node node,
long oldEdgeID,
Edge oldEdge,
GraphObjectContainer oldEdgeGOC,
Edge newEdge1,
GraphObjectContainer newEdge1GOC,
Edge newEdge2,
GraphObjectContainer newEdge2GOC)
node - for internal use only.oldEdgeID - for internal use only.oldEdge - for internal use only.oldEdgeGOC - for internal use only.newEdge1 - for internal use only.newEdge1GOC - for internal use only.newEdge2 - for internal use only.newEdge2GOC - for internal use only.
public void firePreCascadeNodeDeleteInternal(Node node,
Edge newEdge,
GraphObjectContainer newEdgeGOC,
Edge oldEdge1,
GraphObjectContainer oldEdge1GOC,
Edge oldEdge2,
GraphObjectContainer oldEdge2GOC)
throws GraphEventVetoException
node - for internal use only.newEdge - for internal use only.newEdgeGOC - for internal use only.oldEdge1 - for internal use only.oldEdge1GOC - for internal use only.oldEdge2 - for internal use only.oldEdge2GOC - for internal use only.
GraphEventVetoException - potentially thrown by a
vetoable listener.
public GraphEvent fireCascadeNodeDeleteInternal(Node node,
Edge newEdge,
GraphObjectContainer newEdgeGOC,
Edge oldEdge1,
GraphObjectContainer oldEdge1GOC,
Edge oldEdge2,
GraphObjectContainer oldEdge2GOC)
node - for internal use only.newEdge - for internal use only.newEdgeGOC - for internal use only.oldEdge1 - for internal use only.oldEdge1GOC - for internal use only.oldEdge2 - for internal use only.oldEdge2GOC - for internal use only.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||