com.infoengine.object
Class IeObject

java.lang.Object
  extended bycom.infoengine.object.IeObject
All Implemented Interfaces:
Cloneable, Externalizable, Serializable
Direct Known Subclasses:
IeAtt, IeCollection, IeGroup, IeNode, IeRequest

public class IeObject
extends Object
implements Externalizable, Cloneable

This is the base class for the Info*Engine classes that are used in defining groups and their components.

See Also:
Serialized Form

Field Summary
protected  List _attributes
           
protected  List _children
           
protected  boolean _hasChanged
           
protected  Map _meta
           
protected  String _name
           
private static String _serialVersion
           
protected  String _type
           
private static Enumeration EMPTY_ENUMERATION
           
protected static int INITIAL_LIST_SIZE
           
protected static int INITIAL_MAP_SIZE
           
(package private) static boolean USE_COLLECTIONS
           
 
Constructor Summary
IeObject()
          Constructs a new instance without a name.
IeObject(String name)
          Constructs a new instance with a name.
 
Method Summary
protected  void _addChild(Object o)
           
protected  void _addMeta(String key, Object value)
           
protected  IeMeta _getMeta(String key)
           
protected  void _removeChild(Object o)
           
protected  void _setMeta(String key, Object value)
           
 void addAtt(IeAtt att)
          Adds an attribute to the object.
protected  void addChild(Object o)
           
 void addMeta(String key, byte[] value)
          Adds meta-information of type byte array to the object.
 void addMeta(String key, Date value)
          Adds meta-information of type Date to the object.
 void addMeta(String key, Number value)
          Adds meta-information of type Number to the object.
 void addMeta(String key, String value)
          Adds meta-information of type String to the object.
 void addMetaDatum(String key, IeDatum value)
          Adds meta-information of type IeDatum to the object.
 void addMetaValue(String key, Object o)
          Add/append an object to a possibly multi-valued meta-information item, or create a vector and add it to the meta-information item.
 void addMetaValues(String key, Vector v)
          Add elements of a vector to a possibly multi-valued meta-information item.
 void appendMetaDatum(String key, IeDatum value)
          Appends a value to the pre-existing value defined for a specified meta-information item.
private  void c10e(Object o, StringBuffer sb)
          examine object and append canonical representation to a StringBuffer
 String canonicalize()
           
 void canonicalize(StringBuffer sb)
          append canonical string representation to a StringBuffer
protected  void clearChildren()
           
 Object clone()
          Returns a shallow copy of the object.
protected  boolean containsChild(Object o)
           
 boolean containsMetaValue(String key, Object value)
          Determines whether an object is contained within a meta-information item.
 Object deepClone()
          Returns a deep copy of the object.
 Object deepCopy(IeObject newObject)
          Returns a deep copy of the object.
protected  Object findChild(String key)
           
 IeAtt firstAtt()
          Returns the first attribute associated with the object.
 Object firstChild()
          Returns the object that is the first child of this object.
 Object firstMetaValue(String key)
          Returns the first value contained in a meta-information item.
 IeAtt getAtt(String name)
          Returns an attribute specified by name.
 IeAtt getAttAt(int index)
          Returns the attribute located at a particular index.
 IeAtt getAttByMeta(String name, Object value)
          Returns the attribute containing a specific metadata name and value.
 int getAttCount()
          Returns the number of attributes associated with the object.
 String getAttribute(String name)
          Returns the value of a named attribute.
 Enumeration getAtts()
          Returns all of the attributes associated with the object.
protected  Object getChildAt(int index)
           
 int getChildCount()
          Returns the number of objects that are immediate children of this object.
 Enumeration getChildren()
          Returns all of the objects that are immediate children of this object.
 boolean getHasChanged()
          Indicates whether this object has changed.
 IeMeta getMeta(String key)
          Returns the value of a meta-information item.
 Enumeration getMetaNames()
          Return the names of all meta-information items associated with the object instance.
 Object getMetaValue(String key)
          Returns the value of a meta-information item.
 Object getMetaValueAt(String key, int index)
          Returns the value of a multi-valued meta-information item located at a specified index.
 int getMetaValueCount(String key)
          Returns the number of values contained within a meta-information item.
 Enumeration getMetaValues(String key)
          Returns all of the values contained within a meta-information item.
 String getName()
          Returns the name of the object.
 String getNodeName()
          Returns the name of this node.
 String getTagName()
          Returns the name of the element.
 String getType()
          Returns the type of the object.
 boolean hasChildren()
          Indicates whether this object has any children.
protected  int indexOfChild(Object o)
           
 int indexOfMetaValue(String key, Object value)
          Returns the index of a particular value of a meta-information item.
 IeAtt lastAtt()
          Returns the last attribute of the object.
 Object lastChild()
          Returns the object that is the last child of this object.
 Object lastMetaValue(String key)
          Returns the last value contained in a meta-information item.
(package private) static List newList()
           
(package private) static List newList(Collection c)
           
(package private) static Map newMap()
           
(package private) static Map newMap(Map m)
           
 void readExternal(ObjectInput in)
           
 void removeAllAtts()
          Removes all attributes of the object.
protected  void removeAllChildren()
           
 void removeAllMeta()
          Removes all meta-information items from the object instance.
 void removeAllMetaValues(String key)
          Removes all values of a meta-information item.
 void removeAtt(IeAtt att)
          Removes a particular attribute from the object.
 void removeAtt(String name)
          Removes a particular attribute specified by name.
 void removeAttAt(int index)
          Removes the attribute located at a particular index.
 void removeAttribute(String name)
          Removes an attribute from this DOM object.
 void removeChild(Object o)
          Removes a particular child of this object.
protected  void removeChildAt(int index)
           
 void removeMeta(String key)
          Removes a meta-information item from the object instance.
 void removeMetaValue(String key, Object o)
          Removes a particular value from a meta-information item.
 void removeMetaValueAt(String key, int index)
          Removes the value located at a particular index of a meta-information item.
 void removeName()
          Removes the object's name by setting it to null.
 void removeType()
          Removes the object's type by setting it to an empty string.
 IeObject replaceChild(IeObject newChild, IeObject oldChild)
          Replaces the specified child object with a new one.
 void setAttAt(IeAtt att, int index)
          Sets the attribute located at a particular index.
 void setAttribute(String name, String value)
          Sets a named attribute to a specified value.
protected  void setChildAt(Object o, int index)
           
 void setHasChanged(boolean hasChanged)
          Sets the modification flag.
 void setMeta(String key, byte[] value)
          Set meta-information of type byte array on the object.
 void setMeta(String key, Date value)
          Set meta-information of type Date on the object.
 void setMeta(String key, Number value)
          Set meta-information of type Number on the object.
 void setMeta(String key, String value)
          Set meta-information of type String on the object.
 void setMetaValue(String s, Object value)
          Set the value of a meta-information item.
 void setMetaValueAt(String key, String o, int index)
          Set the value located at a particular index of a multi-valued meta-information item.
 void setName(String name)
          Sets the name of the object.
 void setType(String type)
          Sets the type of the object.
 Object shallowCopy(IeObject newObject)
          Returns a shallow copy of the object (without children).
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_LIST_SIZE

protected static final int INITIAL_LIST_SIZE
See Also:
Constant Field Values

INITIAL_MAP_SIZE

protected static final int INITIAL_MAP_SIZE
See Also:
Constant Field Values

_attributes

protected List _attributes

_children

protected List _children

_meta

protected Map _meta

_name

protected String _name

_type

protected String _type

_hasChanged

protected boolean _hasChanged

_serialVersion

private static final String _serialVersion
See Also:
Constant Field Values

EMPTY_ENUMERATION

private static Enumeration EMPTY_ENUMERATION

USE_COLLECTIONS

static boolean USE_COLLECTIONS
Constructor Detail

IeObject

public IeObject()
Constructs a new instance without a name.


IeObject

public IeObject(String name)
Constructs a new instance with a name.

Parameters:
name - the name to be assigned to the object
Method Detail

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

addMeta

public void addMeta(String key,
                    String value)
Adds meta-information of type String to the object.

Parameters:
key - the name of the meta-information item
value - the value of the meta-information item

addMeta

public void addMeta(String key,
                    Date value)
Adds meta-information of type Date to the object.

Parameters:
key - the name of the meta-information item
value - the value of the meta-information item

addMeta

public void addMeta(String key,
                    Number value)
Adds meta-information of type Number to the object.

Parameters:
key - the name of the meta-information item
value - the value of the meta-information item

addMeta

public void addMeta(String key,
                    byte[] value)
Adds meta-information of type byte array to the object.

Parameters:
key - the name of the meta-information item
value - the value of the meta-information item

addMetaDatum

public void addMetaDatum(String key,
                         IeDatum value)
Adds meta-information of type IeDatum to the object.

Parameters:
key - the name of the meta-information item
value - the value of the meta-information item

appendMetaDatum

public void appendMetaDatum(String key,
                            IeDatum value)
Appends a value to the pre-existing value defined for a specified meta-information item.

Parameters:
key - the name of the meta-information item
value - the value to be appended

getMeta

public IeMeta getMeta(String key)
Returns the value of a meta-information item.

Parameters:
key - the name of the meta-information item to return
Returns:
The value of the specified meta-information item

getMetaNames

public Enumeration getMetaNames()
Return the names of all meta-information items associated with the object instance.

Returns:
The names of all meta-information items

getNodeName

public String getNodeName()
Returns the name of this node. Subclasses should override this method.

Returns:
The name of this node.

removeAllMeta

public void removeAllMeta()
Removes all meta-information items from the object instance.


removeMeta

public void removeMeta(String key)
Removes a meta-information item from the object instance.

Parameters:
key - the name of the meta-information item to remove

replaceChild

public IeObject replaceChild(IeObject newChild,
                             IeObject oldChild)
Replaces the specified child object with a new one.

Parameters:
newChild - the new child object
oldChild - the child to be replaced
Returns:
The replaced object, or null if the old child is not found

setMeta

public void setMeta(String key,
                    Date value)
Set meta-information of type Date on the object. If a meta-information item of the same name already exists on the object, it is replaced.

Parameters:
key - the name of the meta-information item
value - the value of the meta-information item

setMeta

public void setMeta(String key,
                    String value)
Set meta-information of type String on the object. If a meta-information item of the same name already exists on the object, it is replaced.

Parameters:
key - the name of the meta-information item
value - the value of the meta-information item

setMeta

public void setMeta(String key,
                    byte[] value)
Set meta-information of type byte array on the object. If a meta-information item of the same name already exists on the object, it is replaced.

Parameters:
key - the name of the meta-information item
value - the value of the meta-information item

setMeta

public void setMeta(String key,
                    Number value)
Set meta-information of type Number on the object. If a meta-information item of the same name already exists on the object, it is replaced.

Parameters:
key - the name of the meta-information item
value - the value of the meta-information item

addMetaValue

public void addMetaValue(String key,
                         Object o)
Add/append an object to a possibly multi-valued meta-information item, or create a vector and add it to the meta-information item.

Parameters:
key - the name of the meta-information item
o - the object to be added/appended

addMetaValues

public void addMetaValues(String key,
                          Vector v)
Add elements of a vector to a possibly multi-valued meta-information item.

Parameters:
key - the name of the meta-information item
v - the vector containing objects to be added

containsMetaValue

public boolean containsMetaValue(String key,
                                 Object value)
Determines whether an object is contained within a meta-information item.

Parameters:
key - the name of the meta-information item
value - the value to test for containment
Returns:
true if the value is contained within the meta-information item

firstMetaValue

public Object firstMetaValue(String key)
Returns the first value contained in a meta-information item.

Parameters:
key - the name of the meta-information item
Returns:
The first value contained in the item

getMetaValue

public Object getMetaValue(String key)
Returns the value of a meta-information item. Use this method when you know that the meta-information item is single-valued.

Parameters:
key - the name of the meta-information item
Returns:
The value of the meta-information item

getMetaValueAt

public Object getMetaValueAt(String key,
                             int index)
Returns the value of a multi-valued meta-information item located at a specified index.

Parameters:
key - the name of the meta-information item
index - the index of the value to return
Returns:
The value located at the specified index

getMetaValueCount

public int getMetaValueCount(String key)
Returns the number of values contained within a meta-information item.

Parameters:
key - the name of the meta-information item
Returns:
The number of values contained within the item

getMetaValues

public Enumeration getMetaValues(String key)
Returns all of the values contained within a meta-information item.

Parameters:
key - the name of the meta-information item
Returns:
All of the values contained within the item

indexOfMetaValue

public int indexOfMetaValue(String key,
                            Object value)
Returns the index of a particular value of a meta-information item.

Parameters:
key - the name of the meta-information item
value - the value for which to find the index
Returns:
The index of the value within the item

lastMetaValue

public Object lastMetaValue(String key)
Returns the last value contained in a meta-information item.

Parameters:
key - the name of the meta-information item
Returns:
The last value contained in the item

removeMetaValue

public void removeMetaValue(String key,
                            Object o)
Removes a particular value from a meta-information item.

Parameters:
key - the name of the meta-information item
o - the value to be removed

removeMetaValueAt

public void removeMetaValueAt(String key,
                              int index)
Removes the value located at a particular index of a meta-information item.

Parameters:
key - the name of the meta-information item
index - the index of the value to be removed

removeAllMetaValues

public void removeAllMetaValues(String key)
Removes all values of a meta-information item.

Parameters:
key - the name of the meta-information item

setMetaValue

public void setMetaValue(String s,
                         Object value)
Set the value of a meta-information item. If a meta-information item of the same name already exists on the object, its value is replaced.

Parameters:
value - the value to be set

setMetaValueAt

public void setMetaValueAt(String key,
                           String o,
                           int index)
Set the value located at a particular index of a multi-valued meta-information item.

Parameters:
key - the name of the meta-information item
o - the value to be set
index - the index of the value to be set

_getMeta

protected final IeMeta _getMeta(String key)

_setMeta

protected final void _setMeta(String key,
                              Object value)

_addMeta

protected final void _addMeta(String key,
                              Object value)

_removeChild

protected final void _removeChild(Object o)

_addChild

protected final void _addChild(Object o)

getChildren

public final Enumeration getChildren()
Returns all of the objects that are immediate children of this object.

Returns:
The immediate children of this object

addChild

protected final void addChild(Object o)

removeChild

public final void removeChild(Object o)
Removes a particular child of this object.

Parameters:
o - the child to be removed

removeAllChildren

protected final void removeAllChildren()

clearChildren

protected final void clearChildren()

findChild

protected final Object findChild(String key)

containsChild

protected final boolean containsChild(Object o)

removeChildAt

protected final void removeChildAt(int index)

indexOfChild

protected final int indexOfChild(Object o)

getChildAt

protected final Object getChildAt(int index)

setChildAt

protected final void setChildAt(Object o,
                                int index)

addAtt

public void addAtt(IeAtt att)
Adds an attribute to the object.

Parameters:
att - the attribute to be added

firstAtt

public IeAtt firstAtt()
Returns the first attribute associated with the object.

Returns:
The first attribute of the object

getAtt

public IeAtt getAtt(String name)
Returns an attribute specified by name.

Parameters:
name - the name of the attribute to return
Returns:
The named attribute

getAtts

public Enumeration getAtts()
Returns all of the attributes associated with the object.

Returns:
All attributes of the object

getAttAt

public IeAtt getAttAt(int index)
Returns the attribute located at a particular index.

Parameters:
index - the index of the attribute to be returned
Returns:
The attribute referenced by the index

getAttByMeta

public IeAtt getAttByMeta(String name,
                          Object value)
Returns the attribute containing a specific metadata name and value.

Parameters:
name - The name of the metadata.
value - The value of the metadata.
Returns:
The attribute containing the metadata name/value pair, or null if no attribute contains the specified name/value pair.

getAttCount

public int getAttCount()
Returns the number of attributes associated with the object.

Returns:
The number of attributes of the object

lastAtt

public IeAtt lastAtt()
Returns the last attribute of the object.

Returns:
The last attribute of the object

removeAllAtts

public void removeAllAtts()
Removes all attributes of the object.


removeAtt

public void removeAtt(String name)
Removes a particular attribute specified by name.

Parameters:
name - the name of the attribute to be removed

removeAtt

public void removeAtt(IeAtt att)
Removes a particular attribute from the object.

Parameters:
att - the attribute to be removed

removeAttAt

public void removeAttAt(int index)
Removes the attribute located at a particular index.

Parameters:
index - the index of the attribute to be removed

setAttAt

public void setAttAt(IeAtt att,
                     int index)
Sets the attribute located at a particular index.

Parameters:
att - the new attribute to be set
index - the index of the attribute to be set

deepClone

public Object deepClone()
Returns a deep copy of the object.

Returns:
The deep copy

shallowCopy

public final Object shallowCopy(IeObject newObject)
Returns a shallow copy of the object (without children).

Parameters:
newObject - base object in which to generate the shallow copy
Returns:
The shallow copy

deepCopy

public final Object deepCopy(IeObject newObject)
Returns a deep copy of the object.

Parameters:
newObject - base object in which to generate the deep copy
Returns:
The deep copy

clone

public final Object clone()
Returns a shallow copy of the object.

Returns:
The shallow copy

getName

public String getName()
Returns the name of the object.

Returns:
The name of the object, or null if the object has no name

setName

public void setName(String name)
Sets the name of the object.

Parameters:
name - the name to set

removeName

public void removeName()
Removes the object's name by setting it to null.


getType

public String getType()
Returns the type of the object.

Returns:
The object's type

setType

public void setType(String type)
Sets the type of the object.

Parameters:
type - the type to set

removeType

public void removeType()
Removes the object's type by setting it to an empty string.


firstChild

public Object firstChild()
Returns the object that is the first child of this object.

Returns:
The first child of this object

lastChild

public Object lastChild()
Returns the object that is the last child of this object.

Returns:
The last child of this object

getChildCount

public int getChildCount()
Returns the number of objects that are immediate children of this object.

Returns:
The number of children associated with this object

hasChildren

public boolean hasChildren()
Indicates whether this object has any children.

Returns:
true if this object has any children

getHasChanged

public boolean getHasChanged()
Indicates whether this object has changed.

Returns:
true if this object has changed

setHasChanged

public void setHasChanged(boolean hasChanged)
Sets the modification flag.

Parameters:
hasChanged - true to indicate that the object has changed

getTagName

public String getTagName()
Returns the name of the element.

Returns:
the name of the element

getAttribute

public String getAttribute(String name)
Returns the value of a named attribute.

Parameters:
name - the name of the attribute to retrieve
Returns:
The attribute value, or null if the attribute is not found

setAttribute

public void setAttribute(String name,
                         String value)
Sets a named attribute to a specified value.

Parameters:
name - the name of the attribute to be set
value - the value to set
Throws:
DOMException - if attribute value can not be set

removeAttribute

public void removeAttribute(String name)
Removes an attribute from this DOM object.

Parameters:
name - the name of the attribute to be removed

canonicalize

public String canonicalize()
Returns:
canonical string representation

canonicalize

public void canonicalize(StringBuffer sb)
append canonical string representation to a StringBuffer

Parameters:
sb - - the StringBuffer

c10e

private void c10e(Object o,
                  StringBuffer sb)
examine object and append canonical representation to a StringBuffer

Parameters:
o - - the object to canonicalize
sb - - the StringBuffer to append the canonical representation to

newList

static List newList(Collection c)

newList

static List newList()

newMap

static Map newMap(Map m)

newMap

static Map newMap()