|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This interface represents the aspects common to all Graph
elements, including a Node, Edge and
Subgraph.
GraphObject instances are created using factory objects that
return specialized, concrete GraphObject types.
GraphObjects have an identifiable nature.
Every GraphObject has both an identifier unique to its context
as well as a global identifier that is unique within a hierarchy of
Graph objects.
GraphObject implementation is constructed with an
initial identifier of -1. When a GraphObject is
added to a GraphObjectContainer, the
identifier is changed internally by the container to a value that becomes
unique within that container context. The container may nest other containers
recursively, which might have the same identifier assigned to one of their
managed objects. Identifiers, therefore, are unique within the scope of a
single GraphObjectContainer only.
GraphObject is removed from a
GraphObjectContainer, the identifier is
reset to -1.
long getID()long getUniqueID()
It is possible to associate a name and a description with a
GraphObject. These can be used for example to easily assign a
type and a descriptive text to the GraphObject.
String getLabel()void setLabel(String)String getDescription()void setDescription(String)
The standard attributes of a GraphObject may be extended with
custom attributes.
The custom attributes added to the GraphObject
are grouped into the category custom and returned by a call to
AttributableOnSet.getAttributes().
The methods provided by a GraphObject to handle custom
attributes are listed below:
void addCustomAttribute(Attribute)void removeCustomAttribute(String)AttributeSet getCustomAttributes()void setCustomAttributes(AttributeSet)
GraphObject instances that are removed from their containers and
dereferenced will be garbage collected.
GraphObject extends the AttributableOnSet
interface, which allows clients to associate attributes with them.
Edge,
Node,
Subgraph,
GraphObjectContainer,
Graph| Field Summary |
| 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 GraphObject.
|
boolean |
assertCustomAttribute(Attribute attribute)
Sets a custom attribute and adds it, if it doesn't exist yet. |
boolean |
assertCustomAttribute(java.lang.String path,
java.lang.Object value)
Sets the value of a custom attributes and creates it first, if it doesn't exist. |
void |
fillInDump(java.util.List list,
int level)
Fills in a dump into the given list. |
AttributeSet |
getCustomAttributes()
Returns an AttributeSet that contains all custom attributes
currently assigned to the GraphObject or null
if no custom attribute is assigned to the GraphObject.
|
java.lang.String |
getDescription()
Returns the description string of this GraphObject |
long |
getID()
Returns the local identifier (unique within a single GraphObjectContainer. |
java.lang.String |
getLabel()
Returns the label associated with this object. |
GraphObjectContainer |
getParentContainer()
This method returns the GraphObjectContainer this
GraphObject instance currently resides in. |
long |
getUniqueID()
Returns the global identifier (unique within the complete GraphObjectContainer hierarchy) |
void |
registerEventMediator(GraphEventMediator mediator)
Registers the GraphEventMediator object given by
mediator to the GraphObject. |
void |
registerEventMediatorInternal(GraphEventMediator mediatorInternal)
Registers the GraphEventMediator object given by
mediator to the GraphObject. |
void |
registerVetoableEventMediator(VetoableGraphEventMediator vmediator)
Registers the VetoableGraphEventMediator object given by
vmediator to the GraphObject. |
void |
removeCustomAttribute(java.lang.String attributename)
Removes the custom Attribute with the name given by
attributename from the GraphObjects
custom attributes. |
void |
setCustomAttributes(AttributeSet customAttributes)
Sets the Attributes within the AttributeSet
given by customAttributes to the custom attributes currently
added to the GraphObject. |
void |
setDescription(java.lang.String description)
Sets the description of this GraphObject to
the given string |
void |
setLabel(java.lang.String label)
Sets the label to be associated with this object. |
| 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 long getID()
GraphObjectContainer.
public long getUniqueID()
GraphObjectContainer hierarchy)
public java.lang.String getLabel()
public void setLabel(java.lang.String label)
label - the labelpublic java.lang.String getDescription()
GraphObject
GraphObjectpublic void setDescription(java.lang.String description)
GraphObject to
the given string
description - The description to setpublic void addCustomAttribute(Attribute attribute)
Attribute given by attribute to the
custom attributes of the GraphObject.
GraphObject then the adding of the new
custom attribute fails and the instance remains unchanged.
attribute - the custom Attribute to addpublic void removeCustomAttribute(java.lang.String attributename)
Attribute with the name given by
attributename from the GraphObjects
custom attributes.
attributename - the name of the custom Attribute to
removepublic AttributeSet getCustomAttributes()
AttributeSet that contains all custom attributes
currently assigned to the GraphObject or null
if no custom attribute is assigned to the GraphObject.
Attributes within the returned
AttributeSet are copies of the custom attributes currently
added to the GraphObject and no references. So that if you
want to change them you have to call setCustomAttributes(com.tensegrity.generic.attribute.AttributeSet)
afterwards.
GraphObjectpublic void setCustomAttributes(AttributeSet customAttributes)
Attributes within the AttributeSet
given by customAttributes to the custom attributes currently
added to the GraphObject. 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 GraphObject 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
GraphObject will be added.
Attributes that are part of the custom attributes currently
added to the GraphObject but not part of the given
AttributeSet will NOT be removed.
customAttributes - The AttributeSet with the
Attributes to set
public boolean assertCustomAttribute(java.lang.String path,
java.lang.Object value)
throws IllegalValueException,
ConstraintViolationException,
IllegalNameException
path - The path of the custom attributevalue - The value of the custom attribute
IllegalValueException - is thrown when the given value
is illegal (for instance when it is null).
ConstraintViolationException - is thrown when the given
value violates the constraint of the Attribute to set.
IllegalNameException - is thrown if the given name for the
attribute is invalid.
public boolean assertCustomAttribute(Attribute attribute)
throws IllegalValueException,
ConstraintViolationException,
IllegalNameException
attribute - The custom attribute to set
IllegalValueException - is thrown when the value of the given
Attribute is illegal (for instance when it is null).
ConstraintViolationException - is thrown when the value of the
given Attribute violates the constraint of the
Attribute to set.
IllegalNameException - is thrown if the given attribute has an
invalid name.public GraphObjectContainer getParentContainer()
GraphObjectContainer this
GraphObject instance currently resides in. In case this
GraphObject instance is not added to a
GraphObjectContainer this method returns null.
GraphObject instance or null.public void registerEventMediator(GraphEventMediator mediator)
GraphEventMediator object given by
mediator to the GraphObject. Subsequently the
mediator will be informed about all events that occurs at
the GraphObject.
mediator - the GraphEventMediator to registerpublic void registerEventMediatorInternal(GraphEventMediator mediatorInternal)
GraphEventMediator object given by
mediator to the GraphObject. Subsequently the
mediator will be informed about all events that occurs at
the GraphObject.
mediatorInternal - the GraphEventMediator to register.public void registerVetoableEventMediator(VetoableGraphEventMediator vmediator)
VetoableGraphEventMediator object given by
vmediator to the GraphObject. Subsequently the
vmediator will be informed about all vetoable events that
occurs at the GraphObject.
vmediator - the GraphEventMediator to register
public void fillInDump(java.util.List list,
int level)
list - the list to fill the dump into.level - the current depth of the dump.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||