|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
A graph Edge (link, arc, connection, association) in the abstract.
Edges are defined by the nodes to which they are connected (source and
target). In an undirected graph, edges do not distinguish these nodes.
Constructing an Edge (and its related objects) is done
by means of a GraphModelFactory,
which will hide the particular implementation classes from client code.
An Edge can be queried for its incoming and outgoing nodes. This
information is stored in the Edge itself as well as in the nodes
it is connected to. This redundant data storage results in better performance
when retrieving connection information. On the other hand, redundant data can
become inconsistent if not synchronized properly. This is the reason why
updates to all connection information is only allowed through the
GraphObjectContainer interface and not
by manipulating nodes and edges themselves.
Edge objects that are dereferenced will be garbage collected.
Two types of event listeners are available for notification. Instances of
EdgeListener listen to events coming
from one Edge object, while
GraphEventMediator instances listen to
events coming from an entire Graph tree. Any number of event
listeners may be added to an Edge.
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.
Functionality that is common to both the Edge and Node
interfaces is defined in the base interface GraphObject.
Graph,
Subgraph,
Node,
GraphObject,
GraphObjectContainer,
EdgeListener| Field Summary |
| Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet |
TREE_SUBSET_POSTFIX |
| Method Summary | |
void |
addEdgeListener(EdgeListener listener)
Adds a EdgeListener to this
Edge. |
Edge |
createIsolatedCopy(Node source,
Node target)
Copies the attributes of the edge and constructs a new object. |
Edge |
deepCopy(Node source,
Node target)
Returns a deep copy of the Edge. |
EdgeInfo |
getEdgeInfo()
Returns the EdgeInfo associated with this
Edge. |
Node |
getOpposite(Node node)
Returns the node of the Edge that is not the given Node.
|
Node |
getSource()
Gets the Node at the source end of this Edge. |
Node |
getTarget()
Gets the Node at the target end of this Edge. |
int |
getWeight()
Returns the weight of the Edge. |
void |
invert()
Swaps source and target pointers, effectively inverting the direction of this edge |
void |
removeEdgeListener(EdgeListener listener)
Removes a EdgeListener from this
Edge. |
void |
setEdgeInfo(EdgeInfo edgeInfo)
Sets the EdgeInfo associated with this
Edge. |
void |
setID(long id)
NOTE: This method is for API internal use only. |
void |
setSourceInternal(Node source)
NOTE: This method is for internal use only and should never be invoked by the client. |
void |
setTargetInternal(Node target)
NOTE: This method is for internal use only and should never be invoked by the client. |
void |
setWeight(int weight)
Sets the weight of the Edge. |
| Methods inherited from interface com.tensegrity.graph.model.GraphObject |
addCustomAttribute, assertCustomAttribute, assertCustomAttribute, fillInDump, getCustomAttributes, getDescription, getID, getLabel, getParentContainer, getUniqueID, registerEventMediator, registerEventMediatorInternal, registerVetoableEventMediator, removeCustomAttribute, setCustomAttributes, setDescription, setLabel |
| 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 |
| Method Detail |
public void addEdgeListener(EdgeListener listener)
EdgeListener to this
Edge.
listener - the EdgeListener
to add to this Edge.public void removeEdgeListener(EdgeListener listener)
EdgeListener from this
Edge.
listener - the EdgeListener
to remove from this Edge.
public Edge createIsolatedCopy(Node source,
Node target)
source - source Node to associate the copy with.target - target Node to associate the copy with.
Edge instance.public int getWeight()
Edge.
Edge.public void setWeight(int weight)
Edge.
weight - the new weight of the Edge.public void setID(long id)
id - the id to set (internal use only).public Node getSource()
Node at the source end of this Edge.
Node at the start of this Edge.public void setSourceInternal(Node source)
source - the new source to set for this Edge.public void setTargetInternal(Node target)
target - the new target to set for this Edge.public Node getTarget()
Node at the target end of this Edge.
Node at the end of this Edge.public EdgeInfo getEdgeInfo()
EdgeInfo associated with this
Edge.
EdgeInfo associated with this
Edge. The returned value may be null if no
info is associated with this Edge.public void setEdgeInfo(EdgeInfo edgeInfo)
EdgeInfo associated with this
Edge.
edgeInfo - the EdgeInfo to associate with this
Edge.public void invert()
public Edge deepCopy(Node source,
Node target)
Edge.
source - the source Node to associate the copy with.target - the target Node to associate the copy with.
Edge.public Node getOpposite(Node node)
Edge that is not the given Node.
This method is only meaningful in the context of undirected
graphs.
node - the Node that is the opposite Node
of the returned Node.
Node.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||