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 voidaddAttribute(Attribute attr, String path)Addsattrto the attributes at position indicated by path.voidaddBoolean(String path, String id, boolean value)Adds aBooleanAttributewith the given value and id to aCollectionAttributeatpath.voidaddByte(String path, String id, byte value)Adds an ByteAttribute with the given value and id to aCollectionAttributeatpath.voidaddDouble(String path, String id, double value)Adds aDoubleAttributewith the given value andidto aCollectionAttributeatpath.voidaddFloat(String path, String id, float value)Adds aFloatAttributewith the given value andidto aCollectionAttributeatpath.voidaddInteger(String path, String id, int value)Adds an IntegerAttribute with the given value andidto aCollectionAttributeatpath.voidaddLong(String path, String id, long value)Adds an LongAttribute with the given value and id to aCollectionAttributeatpath.voidaddShort(String path, String id, short value)Adds an ShortAttribute with the given value and id to aCollectionAttributeatpath.voidaddString(String path, String id, String value)Adds an StringAttribute with the given value and id to aCollectionAttributeatpath.voidchangeBoolean(String path, boolean value)Changes theAttributeat the given path to the given value.voidchangeByte(String path, byte value)Changes theAttributeat the given path to the given value.voidchangeDouble(String path, double value)Changes theAttributeat the given path to the given value.voidchangeFloat(String path, float value)Changes theAttributeat the given path to the given value.voidchangeInteger(String path, int value)Changes theAttributeat the given path to the given value.voidchangeLong(String path, long value)Changes theAttributeat the given path to the given value.voidchangeShort(String path, short value)Changes theAttributeat the given path to the given value.voidchangeString(String path, String value)Changes theAttributeat the given path to the given value.AttributegetAttribute(String path)Returns theAttributelocated at the given path.CollectionAttributegetAttributes()Returns the attributes of the current object in the base hierarchie in aCollectionAttribute.booleangetBoolean(String path)Returns the value of theAttributeat the given path.bytegetByte(String path)Returns the value of theAttributeat the given path.doublegetDouble(String path)Returns the value of theAttributeat the given path.floatgetFloat(String path)Returns the value of theAttributeat the given path.intgetInteger(String path)Returns the value of theAttributeat the given path.ListenerManagergetListenerManager()Returns theListenerManagerasscociated to thisAttributable.longgetLong(String path)Returns the value of theAttributeat the given path.shortgetShort(String path)Returns the value of theAttributeat the given path.StringgetString(String path)Returns the value of theAttributeat the given path.AttributeremoveAttribute(String path)Deletes theAttributelocated at the given path from the attributes.voidsetBoolean(String path, boolean value)Sets theAttributeat the given path to the given value.voidsetByte(String path, byte value)Sets theAttributeat the given path to the given value.voidsetDouble(String path, double value)Sets theAttributeat the given path to the given value.voidsetFloat(String path, float value)Sets theAttributeat the given path to the given value.voidsetInteger(String path, int value)Sets theAttributeat the given path to the given value.voidsetLong(String path, long value)Sets theAttributeat the given path to the given value.voidsetShort(String path, short value)Sets theAttributeat the given path to the given value.voidsetString(String path, String value)Sets theAttributeat the given path to the given value.
-
Method Details
-
getAttribute
Returns theAttributelocated at the given path.- Parameters:
path- the path to theAttribute.- Returns:
- DOCUMENT ME!
- Throws:
AttributeNotFoundException- if there is noAttributeat 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 theAttributeat the given path to the given value. TheAttributeis 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 theAttributeto.
-
getBoolean
Returns the value of theAttributeat the given path.- Parameters:
path- the path to search for theAttribute.- Returns:
- the value of the
Attributeat the given path. - Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
setByte
Sets theAttributeat the given path to the given value. TheAttributeis 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 theAttributeto.
-
getByte
Returns the value of theAttributeat the given path.- Parameters:
path- the path to search for theAttribute.- Returns:
- the value of the
Attributeat the given path. - Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
setDouble
Sets theAttributeat 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 theAttributeto.
-
getDouble
Returns the value of theAttributeat the given path.- Parameters:
path- the path to search for theAttribute.- Returns:
- the value of the
Attributeat the given path. - Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
setFloat
Sets theAttributeat 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 theAttributeto.
-
getFloat
Returns the value of theAttributeat the given path.- Parameters:
path- the path to search for theAttribute.- Returns:
- the value of the
Attributeat the given path. - Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
setInteger
Sets theAttributeat the given path to the given value. TheAttributeis 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 theAttributeto.
-
getInteger
Returns the value of theAttributeat the given path.- Parameters:
path- the path to search for theAttribute.- Returns:
- the value of the
Attributeat the given path. - Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
getListenerManager
ListenerManager getListenerManager()Returns theListenerManagerasscociated to thisAttributable.- Returns:
- the
ListenerManagerasscociated to thisAttributable.
-
setLong
Sets theAttributeat the given path to the given value. TheAttributeis 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 theAttributeto.
-
getLong
Returns the value of theAttributeat the given path.- Parameters:
path- the path to search for theAttribute.- Returns:
- the value of the
Attributeat the given path. - Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
setShort
Sets theAttributeat the given path to the given value. TheAttributeis 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 theAttributeto.
-
getShort
Returns the value of theAttributeat the given path.- Parameters:
path- the path to search for theAttribute.- Returns:
- the value of the
Attributeat the given path. - Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
setString
Sets theAttributeat the given path to the given value. TheAttributeis 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 theAttributeto.
-
getString
Returns the value of theAttributeat the given path.- Parameters:
path- the path to search for theAttribute.- Returns:
- the value of the
Attributeat the given path. - Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
addAttribute
void addAttribute(Attribute attr, String path) throws AttributeExistsException, NoCollectionAttributeException, FieldAlreadySetExceptionAddsattrto the attributes at position indicated by path. Informs the ListenerManager about the change: callspreAttributeAddedandpostAttributeAddedin the ListenManager. Also sets theparentand theattributableofattr.Implementation Notes:
pathspecifies the location of the CollectionAttribute or (in casepathis the empty string) the Attributableattrshould 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
Attributewith the sameidand cannot be overwritten, then anAttributeExistsExceptionwill be thrown.- Parameters:
attr- theAttributeto be added.- Throws:
AttributeExistsException- if there is already anAttributewith the sameidasattrat locationpath.NoCollectionAttributeException- if theAttributeat locationpathis not aCollectionAttribute.FieldAlreadySetException
-
addBoolean
void addBoolean(String path, String id, boolean value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds aBooleanAttributewith the given value and id to aCollectionAttributeatpath.- Parameters:
path- the path to theCollectionAttributethe new IntegerAttribute should be added to.id- the id of the newly createdAttribute.value- the value of the newly createdAttribute.- Throws:
NoCollectionAttributeException- if theAttributeat the location specified bypathis noCollectionAttribute.AttributeExistsException- if there is already anAttributewith the givenidat 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 aCollectionAttributeatpath.- Parameters:
path- the path to theCollectionAttributethe new ByteAttribute should be added to.id- the id of the new ByteAttribute.value- the value of the new ByteAttribute.- Throws:
NoCollectionAttributeException- if theAttributeat the location specified bypathis noCollectionAttribute.AttributeExistsException- if there is already anAttributewith the givenidat the givenpath.FieldAlreadySetException
-
addDouble
void addDouble(String path, String id, double value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds aDoubleAttributewith the given value andidto aCollectionAttributeatpath.- Parameters:
path- the path to theCollectionAttributethe newIntegerAttributeshould be added to.id- the id of the newly createdAttribute.value- the value of the newly createdAttribute.- Throws:
NoCollectionAttributeException- if theAttributeat the location specified bypathis noCollectionAttribute.AttributeExistsException- if there is already anAttributewith the givenidat the givenpath.FieldAlreadySetException
-
addFloat
void addFloat(String path, String id, float value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds aFloatAttributewith the given value andidto aCollectionAttributeatpath.- Parameters:
path- the path to theCollectionAttributethe new IntegerAttribute should be added to.id- the id of the newly createdAttribute.value- the value of the newly createdAttribute.- Throws:
NoCollectionAttributeException- if theAttributeat the location specified bypathis noCollectionAttribute.AttributeExistsException- if there is already anAttributewith the givenidat the givenpath.FieldAlreadySetException
-
addInteger
void addInteger(String path, String id, int value) throws NoCollectionAttributeException, AttributeExistsException, FieldAlreadySetExceptionAdds an IntegerAttribute with the given value andidto aCollectionAttributeatpath.- Parameters:
path- the path to theCollectionAttributethe new IntegerAttribute should be added to.id- the id of the Integer.valueOfAttribute.value- the value of the Integer.valueOfAttribute.- Throws:
NoCollectionAttributeException- if theAttributeat the location specified bypathis noCollectionAttribute.AttributeExistsException- if there is already anAttributewith the givenidat 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 aCollectionAttributeatpath.- Parameters:
path- the path to theCollectionAttributethe new LongAttribute should be added to.id- the id of the new LongAttribute.value- the value of the new LongAttribute.- Throws:
NoCollectionAttributeException- if theAttributeat the location specified bypathis noCollectionAttribute.AttributeExistsException- if there is already anAttributewith the givenidat 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 aCollectionAttributeatpath.- Parameters:
path- the path to theCollectionAttributethe new ShortAttribute should be added to.id- the id of the new ShortAttribute.value- the value of the new ShortAttribute.- Throws:
NoCollectionAttributeException- if theAttributeat the location specified bypathis noCollectionAttribute.AttributeExistsException- if there is already anAttributewith the givenidat 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 aCollectionAttributeatpath.- Parameters:
path- the path to theCollectionAttributethe new IntegerAttribute should be added to.id- the id of the newly createdAttribute.value- the value of the newly createdAttribute.- Throws:
NoCollectionAttributeException- if theAttributeat the location specified bypathis noCollectionAttribute.AttributeExistsException- if there is already anAttributewith the givenidat the givenpath.FieldAlreadySetException
-
changeBoolean
Changes theAttributeat the given path to the given value.- Parameters:
path- the path to search for theAttribute.value- the value to set to theAttributeto.- Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
changeByte
Changes theAttributeat the given path to the given value.- Parameters:
path- the path to search for theAttribute.value- the value to set to theAttributeto.- Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
changeDouble
Changes theAttributeat the given path to the given value.- Parameters:
path- the path to search for theAttribute.value- the value to set to theAttributeto.- Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
changeFloat
Changes theAttributeat the given path to the given value.- Parameters:
path- the path to search for theAttribute.value- the value to set to theAttributeto.- Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
changeInteger
Changes theAttributeat the given path to the given value.- Parameters:
path- the path to search for theAttribute.value- the value to set to theAttributeto.- Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
changeLong
Changes theAttributeat the given path to the given value.- Parameters:
path- the path to search for theAttribute.value- the value to set to theAttributeto.- Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
changeShort
Changes theAttributeat the given path to the given value.- Parameters:
path- the path to search for theAttribute.value- the value to set to theAttributeto.- Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
changeString
Changes theAttributeat the given path to the given value.- Parameters:
path- the path to search for theAttribute.value- the value to set to theAttributeto.- Throws:
AttributeNotFoundException- if there is noAttributeat the specified location.
-
removeAttribute
Deletes theAttributelocated at the given path from the attributes. Informs the ListenerManager about the change: callspre-/postAttributeRemovedin the ListenerManager.- Parameters:
path- the path of theAttributeto be removed.- Returns:
- the removed attribute
- Throws:
AttributeNotFoundException- if there is noAttributeat the location specified bypath.
-