com.ibm.commons.iloader.node.collections
Class SingleCollection

java.lang.Object
  extended by com.ibm.commons.iloader.node.collections.SingleCollection
All Implemented Interfaces:
IObjectCollection

public class SingleCollection
extends java.lang.Object
implements IObjectCollection

A 'collection' that only contains a single object. All of the methods in the class operate on the single object item.


Constructor Summary
SingleCollection(java.lang.Object object)
          Creates a new instance of this class.
 
Method Summary
 boolean add(int index, java.lang.Object object, DataChangeNotifier dataChangeNotifier)
          Adds a new child to the current collection.
 java.lang.Object get(int index)
          Returns the item at the given index in the collection.
 java.lang.Object getParentObject()
          Returns the parent of the collection.
 boolean remove(int index, DataChangeNotifier dataChangeNotifier)
          Removes the child at the given index.
 boolean removeAll(DataChangeNotifier dataChangeNotifier)
          Remove all children.
 boolean set(int index, java.lang.Object object, DataChangeNotifier dataChangeNotifier)
          Sets the child at the given index.
 int size()
          Returns the size of the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleCollection

public SingleCollection(java.lang.Object object)
Creates a new instance of this class.

Parameters:
object - the object to operate on
Method Detail

size

public int size()
Description copied from interface: IObjectCollection
Returns the size of the collection.

Specified by:
size in interface IObjectCollection
Returns:

get

public java.lang.Object get(int index)
Description copied from interface: IObjectCollection
Returns the item at the given index in the collection.

Specified by:
get in interface IObjectCollection
Returns:

add

public boolean add(int index,
                   java.lang.Object object,
                   DataChangeNotifier dataChangeNotifier)
Description copied from interface: IObjectCollection
Adds a new child to the current collection.

Specified by:
add in interface IObjectCollection
Parameters:
index - index at which the item should be inserted
object - the new child to insert
dataChangeNotifier - a listener that is to be notified of the change
Returns:
returns true if the operation succeeded.

set

public boolean set(int index,
                   java.lang.Object object,
                   DataChangeNotifier dataChangeNotifier)
Description copied from interface: IObjectCollection
Sets the child at the given index. The child which previously resided at the index is OVERWRITTEN!

Specified by:
set in interface IObjectCollection
Parameters:
index - index at which the item should be inserted
object - the new child to insert
dataChangeNotifier - a listener that is to be notified of the change
Returns:
returns true if the operation succeeded.

remove

public boolean remove(int index,
                      DataChangeNotifier dataChangeNotifier)
Description copied from interface: IObjectCollection
Removes the child at the given index.

Specified by:
remove in interface IObjectCollection
Parameters:
index - the index of the child to remove
dataChangeNotifier - a listener that is to be notified of the change
Returns:
returns true if the operation succeeded.

removeAll

public boolean removeAll(DataChangeNotifier dataChangeNotifier)
Description copied from interface: IObjectCollection
Remove all children.

Specified by:
removeAll in interface IObjectCollection
Parameters:
dataChangeNotifier - a listener that is to be notified of the change
Returns:
returns true if the operation succeeded.

getParentObject

public java.lang.Object getParentObject()
Description copied from interface: IObjectCollection
Returns the parent of the collection.

Specified by:
getParentObject in interface IObjectCollection
Returns:
the physical object that contains this collection