Class 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 $
  • Constructor Details

    • LinkedHashMapAttribute

      public LinkedHashMapAttribute​(String id)
      Construct a new instance of a LinkedHashMapAttribute. The internal LinkedHashMap is initialized empty.
      Parameters:
      id - the id of the attribute.
  • Method Details

    • setCollection

      public 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 method add(Attribute a) is called for each attribute in the map.
      Specified by:
      setCollection in interface CollectionAttribute
      Parameters:
      attrs - the Map that contains all attributes.
    • getCollection

      public Map<String,​Attribute> 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 this CollectionAttribute.
      Specified by:
      getCollection in interface CollectionAttribute
      Returns:
      a clone of the list of attributes in this CollectionAttribute.
    • getCollectionNoClone

      public LinkedHashMap<String,​Attribute> getCollectionNoClone()
    • setDefaultValue

      public void setDefaultValue()
      Already done in constructor for this attribute type.
      Specified by:
      setDefaultValue in interface Attribute
      See Also:
      Attribute.setDefaultValue()
    • copy

      public Object copy()
      Copies this CollectionAttribute and returns the copy. All sub-attributes will be copied, too, i.e. a deep-copy is returned.
      Specified by:
      copy in interface DeepCopy
      Returns:
      a copy of the CollectionAttribute.
    • toXMLString

      public String 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 interface Displayable
      Overrides:
      toXMLString in class AbstractCollectionAttribute
      Returns:
      string holding an XML representation of this Displayable
      See Also:
      Displayable.toXMLString()
    • size

      public int size()
      Specified by:
      size in interface CollectionAttribute