Package org.graffiti.attributes
Class LinkedHashMapAttribute
java.lang.Object
org.graffiti.attributes.AbstractAttribute
org.graffiti.attributes.AbstractCollectionAttribute
org.graffiti.attributes.LinkedHashMapAttribute
- All Implemented Interfaces:
Attribute
,CollectionAttribute
,SortedCollectionAttribute
,DeepCopy
,Displayable
- Direct Known Subclasses:
ShapeDescriptionAttribute
public class LinkedHashMapAttribute extends AbstractCollectionAttribute implements SortedCollectionAttribute
DOCUMENT ME!
- Version:
- $Revision: 1.8 $
-
Field Summary
-
Constructor Summary
Constructors Constructor Description LinkedHashMapAttribute(String id)
Construct a new instance of aLinkedHashMapAttribute
. -
Method Summary
Modifier and Type Method Description Object
copy()
Copies thisCollectionAttribute
and returns the copy.Map<String,Attribute>
getCollection()
Returns a cloned map (shallow copy of map: i.e.LinkedHashMap<String,Attribute>
getCollectionNoClone()
void
setCollection(Map<String,Attribute> attrs)
Sets the collection of attributes contained within this CollectionAttribute For each entry in the map, pre- and post- AttributeAdded events are generated since methodadd(Attribute a)
is called for each attribute in the map.void
setDefaultValue()
Already done in constructor for this attribute type.int
size()
String
toXMLString()
Returns a well-formed XML string representing the Displayable.Methods inherited from class org.graffiti.attributes.AbstractCollectionAttribute
add, add, getAttributable, getAttribute, getValue, isEmpty, remove, remove, setAttributable, toString
Methods inherited from class org.graffiti.attributes.AbstractAttribute
addEdgeAttributeType, addNodeAttributeType, getDescription, getIcon, getId, getName, getParent, getPath, getTypedAttribute, isDeleted, isTypedAttributeFromID, setDeleted, setDescription, setId, setParent, setValue, toString
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.graffiti.attributes.Attribute
getAttributable, getId, getParent, getPath, getValue, isDeleted, setDeleted, setId, setParent, setValue, toString
Methods inherited from interface org.graffiti.attributes.CollectionAttribute
add, add, getAttribute, isEmpty, remove, remove, setAttributable
Methods inherited from interface org.graffiti.plugin.Displayable
getDescription, getIcon, getName, setDescription
-
Constructor Details
-
LinkedHashMapAttribute
Construct a new instance of aLinkedHashMapAttribute
. The internal LinkedHashMap is initialized empty.- Parameters:
id
- the id of the attribute.
-
-
Method Details
-
setCollection
Sets the collection of attributes contained within this CollectionAttribute For each entry in the map, pre- and post- AttributeAdded events are generated since methodadd(Attribute a)
is called for each attribute in the map.- Specified by:
setCollection
in interfaceCollectionAttribute
- Parameters:
attrs
- the Map that contains all attributes.
-
getCollection
Returns a cloned map (shallow copy of map: i.e.this.map.equals(getCollection())
but notthis.map == getCollection()
) between attributes' ids and attributes contained in thisCollectionAttribute
.- Specified by:
getCollection
in interfaceCollectionAttribute
- Returns:
- a clone of the list of attributes in this
CollectionAttribute
.
-
getCollectionNoClone
-
setDefaultValue
public void setDefaultValue()Already done in constructor for this attribute type.- Specified by:
setDefaultValue
in interfaceAttribute
- See Also:
Attribute.setDefaultValue()
-
copy
Copies thisCollectionAttribute
and returns the copy. All sub-attributes will be copied, too, i.e. a deep-copy is returned. -
toXMLString
Description copied from interface:Displayable
Returns a well-formed XML string representing the Displayable. The Displayable should be reconstructable via this representation. Therefore it must at least include the type of Displayable (classname) and a representation of its value. PROBABLE FUTURE DESIGN: The Displayables themselves will provide a method to reconstruct their value from the XML representation they provided.- Specified by:
toXMLString
in interfaceDisplayable
- Overrides:
toXMLString
in classAbstractCollectionAttribute
- Returns:
- string holding an XML representation of this Displayable
- See Also:
Displayable.toXMLString()
-
size
public int size()- Specified by:
size
in interfaceCollectionAttribute
-