Package org.graffiti.attributes
Interface Attributable
- All Known Subinterfaces:
CoarsenedGraph
,Edge
,Graph
,GraphElement
,Node
- All Known Implementing Classes:
AbstractAttributable
,AbstractEdge
,AbstractGraph
,AbstractGraphElement
,AbstractNode
,AdjListEdge
,AdjListGraph
,AdjListNode
,MergedNode
,NodeHelper
,OptAdjListGraph
public interface Attributable
Interfaces an object that contains a hierarchy of attributes. This interface
defines methods for accessing and modifying this hierarchy.
- Version:
- $Revision: 1.5 $
- See Also:
AttributeTypesManager
-
Method Summary
Modifier and Type Method Description void
addAttribute(Attribute attr, String path)
Addsattr
to the attributes at position indicated by path.void
addBoolean(String path, String id, boolean value)
Adds aBooleanAttribute
with the given value and id to aCollectionAttribute
atpath
.void
addByte(String path, String id, byte value)
Adds an ByteAttribute with the given value and id to aCollectionAttribute
atpath
.void
addDouble(String path, String id, double value)
Adds aDoubleAttribute
with the given value andid
to aCollectionAttribute
atpath
.void
addFloat(String path, String id, float value)
Adds aFloatAttribute
with the given value andid
to aCollectionAttribute
atpath
.void
addInteger(String path, String id, int value)
Adds an IntegerAttribute with the given value andid
to aCollectionAttribute
atpath
.void
addLong(String path, String id, long value)
Adds an LongAttribute with the given value and id to aCollectionAttribute
atpath
.void
addShort(String path, String id, short value)
Adds an ShortAttribute with the given value and id to aCollectionAttribute
atpath
.void
addString(String path, String id, String value)
Adds an StringAttribute with the given value and id to aCollectionAttribute
atpath
.void
changeBoolean(String path, boolean value)
Changes theAttribute
at the given path to the given value.void
changeByte(String path, byte value)
Changes theAttribute
at the given path to the given value.void
changeDouble(String path, double value)
Changes theAttribute
at the given path to the given value.void
changeFloat(String path, float value)
Changes theAttribute
at the given path to the given value.void
changeInteger(String path, int value)
Changes theAttribute
at the given path to the given value.void
changeLong(String path, long value)
Changes theAttribute
at the given path to the given value.void
changeShort(String path, short value)
Changes theAttribute
at the given path to the given value.void
changeString(String path, String value)
Changes theAttribute
at the given path to the given value.Attribute
getAttribute(String path)
Returns theAttribute
located at the given path.CollectionAttribute
getAttributes()
Returns the attributes of the current object in the base hierarchie in aCollectionAttribute
.boolean
getBoolean(String path)
Returns the value of theAttribute
at the given path.byte
getByte(String path)
Returns the value of theAttribute
at the given path.double
getDouble(String path)
Returns the value of theAttribute
at the given path.float
getFloat(String path)
Returns the value of theAttribute
at the given path.int
getInteger(String path)
Returns the value of theAttribute
at the given path.ListenerManager
getListenerManager()
Returns theListenerManager
asscociated to thisAttributable
.long
getLong(String path)
Returns the value of theAttribute
at the given path.short
getShort(String path)
Returns the value of theAttribute
at the given path.String
getString(String path)
Returns the value of theAttribute
at the given path.Attribute
removeAttribute(String path)
Deletes theAttribute
located at the given path from the attributes.void
setBoolean(String path, boolean value)
Sets theAttribute
at the given path to the given value.void
setByte(String path, byte value)
Sets theAttribute
at the given path to the given value.void
setDouble(String path, double value)
Sets theAttribute
at the given path to the given value.void
setFloat(String path, float value)
Sets theAttribute
at the given path to the given value.void
setInteger(String path, int value)
Sets theAttribute
at the given path to the given value.void
setLong(String path, long value)
Sets theAttribute
at the given path to the given value.void
setShort(String path, short value)
Sets theAttribute
at the given path to the given value.void
setString(String path, String value)
Sets theAttribute
at the given path to the given value.
-
Method Details
-
getAttribute
Returns theAttribute
located at the given path.- Parameters:
path
- the path to theAttribute
.- Returns:
- DOCUMENT ME!
- Throws:
AttributeNotFoundException
- if there is noAttribute
at the location specified bypath
.
-
getAttributes
CollectionAttribute getAttributes()Returns the attributes of the current object in the base hierarchie in aCollectionAttribute
.- Returns:
- the attributes of the current object.
-
setBoolean
Sets theAttribute
at the given path to the given value. TheAttribute
is created at the given location, if it does not yet exist.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.
-
getBoolean
Returns the value of theAttribute
at the given path.- Parameters:
path
- the path to search for theAttribute
.- Returns:
- the value of the
Attribute
at the given path. - Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
setByte
Sets theAttribute
at the given path to the given value. TheAttribute
is created at the given location, if it does not yet exist.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.
-
getByte
Returns the value of theAttribute
at the given path.- Parameters:
path
- the path to search for theAttribute
.- Returns:
- the value of the
Attribute
at the given path. - Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
setDouble
Sets theAttribute
at the given path to the given value. The attribute is created at the given location, if it does not yet exist.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.
-
getDouble
Returns the value of theAttribute
at the given path.- Parameters:
path
- the path to search for theAttribute
.- Returns:
- the value of the
Attribute
at the given path. - Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
setFloat
Sets theAttribute
at the given path to the given value. The attribute is created at the given location, if it does not yet exist.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.
-
getFloat
Returns the value of theAttribute
at the given path.- Parameters:
path
- the path to search for theAttribute
.- Returns:
- the value of the
Attribute
at the given path. - Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
setInteger
Sets theAttribute
at the given path to the given value. TheAttribute
is created at the given location, if it does not yet exist.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.
-
getInteger
Returns the value of theAttribute
at the given path.- Parameters:
path
- the path to search for theAttribute
.- Returns:
- the value of the
Attribute
at the given path. - Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
getListenerManager
ListenerManager getListenerManager()Returns theListenerManager
asscociated to thisAttributable
.- Returns:
- the
ListenerManager
asscociated to thisAttributable
.
-
setLong
Sets theAttribute
at the given path to the given value. TheAttribute
is created at the given location, if it does not yet exist.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.
-
getLong
Returns the value of theAttribute
at the given path.- Parameters:
path
- the path to search for theAttribute
.- Returns:
- the value of the
Attribute
at the given path. - Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
setShort
Sets theAttribute
at the given path to the given value. TheAttribute
is created at the given location, if it does not yet exist.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.
-
getShort
Returns the value of theAttribute
at the given path.- Parameters:
path
- the path to search for theAttribute
.- Returns:
- the value of the
Attribute
at the given path. - Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
setString
Sets theAttribute
at the given path to the given value. TheAttribute
is created at the given location, if it does not yet exist.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.
-
getString
Returns the value of theAttribute
at the given path.- Parameters:
path
- the path to search for theAttribute
.- Returns:
- the value of the
Attribute
at the given path. - Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
addAttribute
void addAttribute(Attribute attr, String path) throws AttributeExistsException, NoCollectionAttributeException, FieldAlreadySetExceptionAddsattr
to the attributes at position indicated by path. Informs the ListenerManager about the change: callspreAttributeAdded
andpostAttributeAdded
in the ListenManager. Also sets theparent
and theattributable
ofattr
.Implementation Notes:
path
specifies the location of the CollectionAttribute or (in casepath
is the empty string) the Attributableattr
should be added to. Usage should look as follows:Graph g = new Graph(..); CollectionAttribute ca = new CollectionAttribute("root"); //add ca to the attributable g as root attribute g.addAttribute(ca, ""); IntegerAttribute ia = Integer.valueOfAttribute("int", 10); //add ia as child of root g.addAttribute(ia, "root");
Given there already exists an
Attribute
with the sameid
and cannot be overwritten, then anAttributeExistsException
will be thrown.- Parameters:
attr
- theAttribute
to be added.- Throws:
AttributeExistsException
- if there is already anAttribute
with the sameid
asattr
at locationpath
.NoCollectionAttributeException
- if theAttribute
at locationpath
is not aCollectionAttribute
.FieldAlreadySetException
-
addBoolean
void addBoolean(String path, String id, boolean value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds aBooleanAttribute
with the given value and id to aCollectionAttribute
atpath
.- Parameters:
path
- the path to theCollectionAttribute
the new IntegerAttribute should be added to.id
- the id of the newly createdAttribute
.value
- the value of the newly createdAttribute
.- Throws:
NoCollectionAttributeException
- if theAttribute
at the location specified bypath
is noCollectionAttribute
.AttributeExistsException
- if there is already anAttribute
with the givenid
at the givenpath
.FieldAlreadySetException
-
addByte
void addByte(String path, String id, byte value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds an ByteAttribute with the given value and id to aCollectionAttribute
atpath
.- Parameters:
path
- the path to theCollectionAttribute
the new ByteAttribute should be added to.id
- the id of the new ByteAttribute.value
- the value of the new ByteAttribute.- Throws:
NoCollectionAttributeException
- if theAttribute
at the location specified bypath
is noCollectionAttribute
.AttributeExistsException
- if there is already anAttribute
with the givenid
at the givenpath
.FieldAlreadySetException
-
addDouble
void addDouble(String path, String id, double value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds aDoubleAttribute
with the given value andid
to aCollectionAttribute
atpath
.- Parameters:
path
- the path to theCollectionAttribute
the newIntegerAttribute
should be added to.id
- the id of the newly createdAttribute
.value
- the value of the newly createdAttribute
.- Throws:
NoCollectionAttributeException
- if theAttribute
at the location specified bypath
is noCollectionAttribute
.AttributeExistsException
- if there is already anAttribute
with the givenid
at the givenpath
.FieldAlreadySetException
-
addFloat
void addFloat(String path, String id, float value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds aFloatAttribute
with the given value andid
to aCollectionAttribute
atpath
.- Parameters:
path
- the path to theCollectionAttribute
the new IntegerAttribute should be added to.id
- the id of the newly createdAttribute
.value
- the value of the newly createdAttribute
.- Throws:
NoCollectionAttributeException
- if theAttribute
at the location specified bypath
is noCollectionAttribute
.AttributeExistsException
- if there is already anAttribute
with the givenid
at the givenpath
.FieldAlreadySetException
-
addInteger
void addInteger(String path, String id, int value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds an IntegerAttribute with the given value andid
to aCollectionAttribute
atpath
.- Parameters:
path
- the path to theCollectionAttribute
the new IntegerAttribute should be added to.id
- the id of the Integer.valueOfAttribute.value
- the value of the Integer.valueOfAttribute.- Throws:
NoCollectionAttributeException
- if theAttribute
at the location specified bypath
is noCollectionAttribute
.AttributeExistsException
- if there is already anAttribute
with the givenid
at the givenpath
.FieldAlreadySetException
-
addLong
void addLong(String path, String id, long value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds an LongAttribute with the given value and id to aCollectionAttribute
atpath
.- Parameters:
path
- the path to theCollectionAttribute
the new LongAttribute should be added to.id
- the id of the new LongAttribute.value
- the value of the new LongAttribute.- Throws:
NoCollectionAttributeException
- if theAttribute
at the location specified bypath
is noCollectionAttribute
.AttributeExistsException
- if there is already anAttribute
with the givenid
at the givenpath
.FieldAlreadySetException
-
addShort
void addShort(String path, String id, short value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds an ShortAttribute with the given value and id to aCollectionAttribute
atpath
.- Parameters:
path
- the path to theCollectionAttribute
the new ShortAttribute should be added to.id
- the id of the new ShortAttribute.value
- the value of the new ShortAttribute.- Throws:
NoCollectionAttributeException
- if theAttribute
at the location specified bypath
is noCollectionAttribute
.AttributeExistsException
- if there is already anAttribute
with the givenid
at the givenpath
.FieldAlreadySetException
-
addString
void addString(String path, String id, String value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds an StringAttribute with the given value and id to aCollectionAttribute
atpath
.- Parameters:
path
- the path to theCollectionAttribute
the new IntegerAttribute should be added to.id
- the id of the newly createdAttribute
.value
- the value of the newly createdAttribute
.- Throws:
NoCollectionAttributeException
- if theAttribute
at the location specified bypath
is noCollectionAttribute
.AttributeExistsException
- if there is already anAttribute
with the givenid
at the givenpath
.FieldAlreadySetException
-
changeBoolean
Changes theAttribute
at the given path to the given value.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.- Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
changeByte
Changes theAttribute
at the given path to the given value.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.- Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
changeDouble
Changes theAttribute
at the given path to the given value.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.- Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
changeFloat
Changes theAttribute
at the given path to the given value.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.- Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
changeInteger
Changes theAttribute
at the given path to the given value.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.- Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
changeLong
Changes theAttribute
at the given path to the given value.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.- Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
changeShort
Changes theAttribute
at the given path to the given value.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.- Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
changeString
Changes theAttribute
at the given path to the given value.- Parameters:
path
- the path to search for theAttribute
.value
- the value to set to theAttribute
to.- Throws:
AttributeNotFoundException
- if there is noAttribute
at the specified location.
-
removeAttribute
Deletes theAttribute
located at the given path from the attributes. Informs the ListenerManager about the change: callspre-/postAttributeRemoved
in the ListenerManager.- Parameters:
path
- the path of theAttribute
to be removed.- Returns:
- the removed attribute
- Throws:
AttributeNotFoundException
- if there is noAttribute
at the location specified bypath
.
-