org.enhydra.shark.xpdl
Class XMLBaseForCollectionAndComplex

java.lang.Object
  extended by org.enhydra.shark.xpdl.XMLElement
      extended by org.enhydra.shark.xpdl.XMLBaseForCollectionAndComplex
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
XMLCollection, XMLComplexElement

public abstract class XMLBaseForCollectionAndComplex
extends XMLElement

Base class for implementing XMLComplexElement and XMLCollection classes.

Author:
Sasa Bojanic
See Also:
Serialized Form

Field Summary
protected  boolean cachesInitialized
           
protected  org.enhydra.shark.utilities.SequencedHashMap elementMap
           
protected  java.util.ArrayList elements
           
 
Fields inherited from class org.enhydra.shark.xpdl.XMLElement
isReadOnly, listeners, notifyListeners, notifyMainListeners, originalElementHashCode, parent, value
 
Constructor Summary
XMLBaseForCollectionAndComplex(XMLElement parent, boolean isRequired)
           
XMLBaseForCollectionAndComplex(XMLElement parent, java.lang.String name, boolean isRequired)
           
 
Method Summary
protected abstract  boolean add(int no, XMLElement el)
          Adds new element to a certain position
protected abstract  void add(XMLElement el)
          Adds new element.
 void clearCaches()
           
 boolean contains(XMLElement el)
          Returns true if there is such element in collection.
 boolean equals(java.lang.Object e)
           
 XMLElement get(int no)
          Gets the element from specified location.
 void initCaches()
          Initializes caches in read-only mode.
 void setNotifyListeners(boolean notify)
           
 void setNotifyMainListeners(boolean notify)
           
 void setReadOnly(boolean ro)
          Sets this element, and all contained elements to be read only or not.
 void setValue(java.lang.String v)
          Sets the element value.
 int size()
          Returns the number of elements.
 org.enhydra.shark.utilities.SequencedHashMap toElementMap()
          Returns the copy of the map of all elements within collection.
 java.util.ArrayList toElements()
          Returns the copy of the list all elements within collection.
 
Methods inherited from class org.enhydra.shark.xpdl.XMLElement
addListener, clone, createInfo, getListeners, getMainElement, getOriginalElementHashCode, getParent, isEmpty, isMainElement, isReadOnly, isRequired, makeAs, notifyListeners, notifyMainListeners, removeListener, setParent, toName, toValue
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elementMap

protected org.enhydra.shark.utilities.SequencedHashMap elementMap

elements

protected java.util.ArrayList elements

cachesInitialized

protected transient boolean cachesInitialized
Constructor Detail

XMLBaseForCollectionAndComplex

public XMLBaseForCollectionAndComplex(XMLElement parent,
                                      boolean isRequired)

XMLBaseForCollectionAndComplex

public XMLBaseForCollectionAndComplex(XMLElement parent,
                                      java.lang.String name,
                                      boolean isRequired)
Method Detail

setValue

public void setValue(java.lang.String v)
Description copied from class: XMLElement
Sets the element value. If it is simple element or an non-choice attribute, this sets the actual value of the element. If it is choice attribute, it sets the choosen value. Only some complex elements (Condition, SchemaType, and ExtendedAttribute) allows you to use this method, while others will throw RuntimeException.

Overrides:
setValue in class XMLElement

setReadOnly

public void setReadOnly(boolean ro)
Sets this element, and all contained elements to be read only or not.

Overrides:
setReadOnly in class XMLElement

setNotifyMainListeners

public void setNotifyMainListeners(boolean notify)
Overrides:
setNotifyMainListeners in class XMLElement

setNotifyListeners

public void setNotifyListeners(boolean notify)
Overrides:
setNotifyListeners in class XMLElement

initCaches

public void initCaches()
Initializes caches in read-only mode. If mode is not read-only, throws RuntimeException.


clearCaches

public void clearCaches()

add

protected abstract void add(XMLElement el)
Adds new element.


add

protected abstract boolean add(int no,
                               XMLElement el)
Adds new element to a certain position


contains

public boolean contains(XMLElement el)
Returns true if there is such element in collection.


get

public XMLElement get(int no)
Gets the element from specified location.


size

public int size()
Returns the number of elements.


toElements

public java.util.ArrayList toElements()
Returns the copy of the list all elements within collection.


toElementMap

public org.enhydra.shark.utilities.SequencedHashMap toElementMap()
Returns the copy of the map of all elements within collection.


equals

public boolean equals(java.lang.Object e)
Overrides:
equals in class XMLElement