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 Objectcopy()Copies thisCollectionAttributeand returns the copy.Map<String,Attribute>getCollection()Returns a cloned map (shallow copy of map: i.e.LinkedHashMap<String,Attribute>getCollectionNoClone()voidsetCollection(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.voidsetDefaultValue()Already done in constructor for this attribute type.intsize()StringtoXMLString()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, toStringMethods inherited from class org.graffiti.attributes.AbstractAttribute
addEdgeAttributeType, addNodeAttributeType, getDescription, getIcon, getId, getName, getParent, getPath, getTypedAttribute, isDeleted, isTypedAttributeFromID, setDeleted, setDescription, setId, setParent, setValue, toStringMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.graffiti.attributes.Attribute
getAttributable, getId, getParent, getPath, getValue, isDeleted, setDeleted, setId, setParent, setValue, toStringMethods inherited from interface org.graffiti.attributes.CollectionAttribute
add, add, getAttribute, isEmpty, remove, remove, setAttributableMethods 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:
setCollectionin 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:
getCollectionin 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:
setDefaultValuein interfaceAttribute- See Also:
Attribute.setDefaultValue()
-
copy
Copies thisCollectionAttributeand returns the copy. All sub-attributes will be copied, too, i.e. a deep-copy is returned. -
toXMLString
Description copied from interface:DisplayableReturns 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:
toXMLStringin interfaceDisplayable- Overrides:
toXMLStringin classAbstractCollectionAttribute- Returns:
- string holding an XML representation of this Displayable
- See Also:
Displayable.toXMLString()
-
size
public int size()- Specified by:
sizein interfaceCollectionAttribute
-