|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This interface defines an abstract Graph without any
notion of a visualization. This class can be used on its own for
applying graph algorithms and for deriving specialized graph classes.
Both directed and undirected graphs are supported.
A Graph consists of Node and Edge
objects. These are the parts of the graph model that can
be accessed through the Graph interface and whose abstraction
is commonly defined in the base interface
GraphObject.
This component interface defines the functionality common to both
nodes and edges, as illustrated in the following class diagram.
Constructing a Graph and its related objects is
done by means of a GraphModelFactory,
which will hide the particular implementation classes from client code.
Upon adding, the ID of any GraphObject
is automatically assigned. Before adding, however, the ID should be set to
-1.
Each GraphObject may only be added
to at most one Graph instance. Adding it to a Graph
instance while still managed by another will produce an exception.
Removing a GraphObject will reset
its ID to -1.
Graph objects that are dereferenced will be garbage collected.
Two types of event listeners are available for notification. Instances of
GraphListener listen to events coming
from one Graph object, while
GraphEventMediator instances listen to
events coming from an entire Graph tree. Any number of event
listeners may be added to a Graph.
Additionally, there are corresponding vetoable listeners and mediators
defined in the event package of the API. These listeners and mediators
contain methods that are invoked prior to a specific event. By throwing
an exception, code can indicate that it would like to prevent a
specific event from happening, thereby sending a veto for the event.
These special listeners are
VetoableGraphListener
and
VetoableGraphEventMediatorListener.
A Graph contains and manages objects of type
Node and
Edge. Instances of these classes may be
added to and removed from a Graph. Both types are derived
from the superclass GraphObject.
Many methods in this interface specification may be found in the
the parent interface
GraphObjectContainer, which allows
generic handling of both Graph and
Subgraph instances.
Node,
Edge,
Subgraph,
Port,
GraphObject| Field Summary | |
static int |
EVENT_MASK_CASCADE_NODE_DELETE
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_EDGE_ADDED
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_EDGE_ATTACH_REJECTED
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_EDGE_PRE_ADD
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_EDGE_PRE_REMOVE
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_EDGE_PRE_SPLIT
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_EDGE_REMOVED
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_EDGE_SPLIT
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_NODE_ADDED
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_NODE_PRE_ADD
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_NODE_PRE_REMOVE
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_NODE_REMOVED
Enumeration for setting event masks for the different type of events. |
static int |
EVENT_MASK_PRE_CASCADE_NODE_DELETE
Enumeration for setting event masks for the different type of events. |
| Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet |
TREE_SUBSET_POSTFIX |
| Method Summary | |
void |
addCustomAttribute(Attribute attribute)
Adds the Attribute given by attribute to the
custom attributes of the Graph. |
void |
addEventMediatorListener(GraphEventMediatorListener listener)
Adds the GraphEventMediatorListener given by
listener to the list of
|
void |
addEventMediatorListenerInternal(GraphEventMediatorListener listenerInternal)
Adds the GraphEventMediatorListener given by
listener to the list of
|
void |
addGraphListener(GraphListener listener)
Adds a graph listener to the graphs internal structure. |
void |
addVetoableEventMediatorListener(VetoableGraphEventMediatorListener listener)
Adds the VetoableGraphEventMediatorListener given by
listener to the list of
|
void |
addVetoableGraphListener(VetoableGraphListener listener)
Adds a graph listener to the graph's internal structure. |
Graph |
deepCopy()
Returns a deep independent copy of the Graph.
|
Graph |
deepCopyWithoutEdges()
Copies this Graph and its type to a new empty Graph and omitting
the edges. |
Graph |
deepCopyWithoutNodesAndEdges()
Copies this Graph and its type to a new empty Graph and omitting
the nodes and edges. |
void |
disableVerify()
Disables internal invariant verifications. |
void |
enableVerify()
Enables internal invariant verifications. |
void |
enableVetosFromStack()
This method is API internal and should not be invoked by clients. |
void |
enableVetosWithStack(boolean enable)
This method is API internal and should not be invoked by clients. |
AttributeSet |
getCustomAttributes()
Returns an AttributeSet that contains all custom attributes
currently assigned to the Graph or null
if no custom attribute is assigned to the Graph.
|
Subgraph |
getSubgraph()
Returns a reference to the Subgraph this Graph
is a part of. |
int |
getVersionID()
Gets the version-id of the Graph. |
void |
removeCustomAttribute(java.lang.String attributename)
Removes the custom Attribute with the name given by
attributename from the Graphs
custom attributes. |
void |
removeEventMediatorListener(GraphEventMediatorListener listener)
Removes the GraphEventMediatorListener given by
listener from the list of
GraphEventMediatorListeners so that he will no longer be
informed about events related to graph objects. |
void |
removeEventMediatorListenerInternal(GraphEventMediatorListener listenerInternal)
Removes the GraphEventMediatorListener given by
listener from the list of
GraphEventMediatorListeners so that he will no longer be
informed about events related to graph objects.
|
void |
removeGraphListener(GraphListener listener)
Removes a graph listener. |
void |
removeVetoableEventMediatorListener(VetoableGraphEventMediatorListener listener)
Removes the VetoableGraphEventMediatorListener given by
listener from the list of
VetoableGraphEventMediatorListeners so that he will no
longer be informed about events related to graph objects. |
void |
removeVetoableGraphListener(VetoableGraphListener listener)
Removes a graph listener. |
void |
setCustomAttributes(AttributeSet customAttributes)
Sets the Attributes within the AttributeSet
given by customAttributes to the custom attributes currently
added to the Graph. |
void |
visitSubgraphs(GraphVisitor visitor)
Traverse the sub graphs of this graph by means of the given GraphVisitor. |
| Methods inherited from interface com.tensegrity.generic.attribute.AttributableOnSet |
addAttributableOnSetListener, areAttributableEventsEnabled, disableAttributableEvents, enableAttributableEvents, getAttributes, getAttributesTree, removeAttributableOnSetListener, setAttributes, setAttributesTree |
| Methods inherited from interface com.tensegrity.generic.attribute.Attributable |
getAttribute, getAttributeType, getAttributeValue, setAttribute, setAttributeValue |
| Field Detail |
public static final int EVENT_MASK_NODE_ADDED
public static final int EVENT_MASK_NODE_REMOVED
public static final int EVENT_MASK_EDGE_ADDED
public static final int EVENT_MASK_EDGE_REMOVED
public static final int EVENT_MASK_EDGE_ATTACH_REJECTED
public static final int EVENT_MASK_EDGE_SPLIT
public static final int EVENT_MASK_NODE_PRE_ADD
public static final int EVENT_MASK_NODE_PRE_REMOVE
public static final int EVENT_MASK_EDGE_PRE_ADD
public static final int EVENT_MASK_EDGE_PRE_REMOVE
public static final int EVENT_MASK_EDGE_PRE_SPLIT
public static final int EVENT_MASK_PRE_CASCADE_NODE_DELETE
public static final int EVENT_MASK_CASCADE_NODE_DELETE
| Method Detail |
public void addCustomAttribute(Attribute attribute)
Attribute given by attribute to the
custom attributes of the Graph.
attribute - the custom Attribute to addpublic void removeCustomAttribute(java.lang.String attributename)
Attribute with the name given by
attributename from the Graphs
custom attributes.
attributename - the name of the custom Attribute to
removepublic AttributeSet getCustomAttributes()
AttributeSet that contains all custom attributes
currently assigned to the Graph or null
if no custom attribute is assigned to the Graph.
Attributes within the returned
AttributeSet are copies of the custom attributes currently
added to the Graph and no references. So that if you
want to change them you have to call
setCustomAttributes(AttributeSet) afterwards.
Graphpublic void setCustomAttributes(AttributeSet customAttributes)
Attributes within the AttributeSet
given by customAttributes to the custom attributes currently
added to the Graph. This is done by a merge of the
given Attributes and the custom attributes currently added.
The merge is done by the following rules:
Attributes that are part of the custom
attributes currently added to the Graph and part of
the given AttributeSet will be assigned to the custom
attribute.
Attributes within the given AttributeSet that
are not part of the custom attributes currently added to the
Graph will be added.
Attributes that are part of the custom attributes currently
added to the Graph but not part of the given
AttributeSet will NOT be removed.
customAttributes - The AttributeSet with the
Attributes to setpublic void enableVerify()
public void disableVerify()
public void enableVetosWithStack(boolean enable)
Depending on the given boolean this method enables or
disables all vetoable events for this Graph object and
nested Subgraph objects as well.
Additionally the old state is put onto a stack so that it can be
easily restored afterwards.
Notice:When setting the state through this method one must
call the method enableVetosFromStack() afterwards. Otherwise
the internal stack gets demaged.
enable - flag indicating whether to raise vetoable eventsenableVetosFromStack()public void enableVetosFromStack()
Restores the old state for raising of vetoable events from the internal
stack. In order to do so the method enableVetosWithStack(boolean)
must have been called beforehand.
The state is restored for this Graph and nested
Subgraph objects as well.
enableVetosWithStack(boolean)public void visitSubgraphs(GraphVisitor visitor)
GraphVisitor.
visitor - object to use during traversal.public void addGraphListener(GraphListener listener)
listener - the graph listener instance to add to the internal list
of graph listeners that is notified when an event occurs.public void removeGraphListener(GraphListener listener)
listener - the graph listener instance to remove.public void addVetoableGraphListener(VetoableGraphListener listener)
listener - the graph listener instance to add to the internal list
of graph listeners that is notified when an event occurs.public void removeVetoableGraphListener(VetoableGraphListener listener)
listener - the graph listener instance to remove.public void addEventMediatorListener(GraphEventMediatorListener listener)
GraphEventMediatorListener given by
listener to the list of
listener - the GraphEventMediatorListener to addpublic void removeEventMediatorListener(GraphEventMediatorListener listener)
GraphEventMediatorListener given by
listener from the list of
GraphEventMediatorListeners so that he will no longer be
informed about events related to graph objects.
listener - the GraphEventMediatorListener to removepublic void addEventMediatorListenerInternal(GraphEventMediatorListener listenerInternal)
GraphEventMediatorListener given by
listener to the list of
This method is API internal and should not be invoked by clients
listenerInternal - the GraphEventMediatorListener to addpublic void removeEventMediatorListenerInternal(GraphEventMediatorListener listenerInternal)
GraphEventMediatorListener given by
listener from the list of
GraphEventMediatorListeners so that he will no longer be
informed about events related to graph objects.
This method is API internal and should not be invoked by clients
listenerInternal - the GraphEventMediatorListener to removepublic void addVetoableEventMediatorListener(VetoableGraphEventMediatorListener listener)
VetoableGraphEventMediatorListener given by
listener to the list of
listener - the VetoableGraphEventMediatorListener to
addpublic void removeVetoableEventMediatorListener(VetoableGraphEventMediatorListener listener)
VetoableGraphEventMediatorListener given by
listener from the list of
VetoableGraphEventMediatorListeners so that he will no
longer be informed about events related to graph objects.
listener - the VetoableGraphEventMediatorListener to
removepublic Subgraph getSubgraph()
Subgraph this Graph
is a part of. If this Graph is not part of a
Subgraph then null is returned.
Subgraph or null.public int getVersionID()
Graph. The versionid is
incremented each time a modification of the Graph takes
place.
Graph.public Graph deepCopy()
Graph.
All edges, nodes are deep-copied. This includes
node- and edgeinfos.
Graph. all edges, nodes are deep-copied.
public Graph deepCopyWithoutNodesAndEdges()
throws GraphException
Graph and its type to a new empty Graph and omitting
the nodes and edges. This produces a new empty Graph.
Graph without nodes and edges.
These copies are independent objects, but have cloned attributes of
their originals.
GraphException - is thrown if the cloning fails.
public Graph deepCopyWithoutEdges()
throws GraphException
Graph and its type to a new empty Graph and omitting
the edges. This produces a new Graph with just isolated nodes.
Graph without edges containing copies of the original nodes.
These copies are independent objects, but have cloned attributes of
their originals.
GraphException - is thrown if the cloning fails.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||