Enterprise Information Portal APIs

com.ibm.mm.sdk.common
Class DKSequentialCollection

java.lang.Object
  |
  +--com.ibm.mm.sdk.common.DKSequentialCollection
All Implemented Interfaces:
dkCollection, DKMessageId, java.io.Serializable
Direct Known Subclasses:
DKChildCollection, DKFederatedCollection, DKFolder, DKLinkCollection, DKParts, dkQueryableCollection, DKViewDataOD

public class DKSequentialCollection
extends java.lang.Object
implements dkCollection, DKMessageId, java.io.Serializable

DKSequentialCollection is a subclass of dkCollection which supports sorting and sequential access in a bi-directional manner, i.e. forward and backward. A sequential collection is not queryable. DKSequentialCollection can create and support DKSequentialIterator, which is also bi-directional.

See Also:
Serialized Form

Fields inherited from interface com.ibm.mm.sdk.common.DKMessageId
    For details, see the class or interface
 
Constructor Summary
DKSequentialCollection()
          Constructs a DKSequentialCollection
DKSequentialCollection(dkSort sortFunction)
          Constructs a DKSequentialCollection with the given sort function.
 
Method Summary
 void addElement(java.lang.Object element)
          Adds an element to the end of the collection, and invalidates all of the current iterators.
 int cardinality()
          Gets the number of elements in the collection.
 dkIterator createIterator()
          Creates a new iterator for this collection.
 java.lang.String getAssociatedAttrName()
          Gets the associated attribute name
 java.lang.String getName()
          Gets the name of the collection.
 dkDataObjectBase getOwner()
          Gets the owner data object for this collection.
 dkSort getSortFunction()
          Gets the sort function.
 void insertElementAt(java.lang.Object element, dkIterator iter)
          Adds a new element, after the element the iterator is currently pointing at.
 void removeAllElements()
          Removes all elements in the collection and invalidates all other iterators.
 void removeElementAt(dkIterator iter)
          Removes the element the iterator is currently pointing at.
 void replaceElementAt(java.lang.Object element, dkIterator iter)
          Replaces the element the iterator is currently pointing at.
 java.lang.Object retrieveElementAt(dkIterator iter)
          Gets the element that the iterator is pointing at.
 void setName(java.lang.String name)
          Sets the name of the collection.
 void setSortFunction(dkSort sortFunction)
          Sets the sort function for sorting this collection.
 void sort()
          Sorts the elements in this collection using the sort function.
 void sort(boolean order)
          Sorts the elements in this collection in the given order using the sort function.
 void sort(dkSort sortFunction, boolean sortOrder)
          Sorts the elements in this collection using the given sort function and sort order.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.mm.sdk.common.dkCollection
addAllElements
 

Constructor Detail

DKSequentialCollection

public DKSequentialCollection()
Constructs a DKSequentialCollection

DKSequentialCollection

public DKSequentialCollection(dkSort sortFunction)
Constructs a DKSequentialCollection with the given sort function.
Parameters:
sortFounction - sort function.
Method Detail

cardinality

public int cardinality()
Gets the number of elements in the collection.
Specified by:
cardinality in interface dkCollection
Returns:
the number of elements.

createIterator

public dkIterator createIterator()
Creates a new iterator for this collection. The default is DKSequentialIterator object.
Specified by:
createIterator in interface dkCollection
Returns:
an iterator

retrieveElementAt

public java.lang.Object retrieveElementAt(dkIterator iter)
                                   throws DKUsageError
Gets the element that the iterator is pointing at.
Specified by:
retrieveElementAt in interface dkCollection
Parameters:
iter - location in collection to retrieve an object.
Returns:
an element

addElement

public void addElement(java.lang.Object element)
                throws DKUsageError
Adds an element to the end of the collection, and invalidates all of the current iterators.
Specified by:
addElement in interface dkCollection
Parameters:
element - element to be added.

insertElementAt

public void insertElementAt(java.lang.Object element,
                            dkIterator iter)
                     throws DKUsageError
Adds a new element, after the element the iterator is currently pointing at. The iterator is advanced to the new element, invalidating all other iterators.
Specified by:
insertElementAt in interface dkCollection
Parameters:
element - element to be added.
iter - location in collection.

replaceElementAt

public void replaceElementAt(java.lang.Object element,
                             dkIterator iter)
                      throws DKUsageError
Replaces the element the iterator is currently pointing at.
Specified by:
replaceElementAt in interface dkCollection
Parameters:
element - element to be added.
iter - location in collection.

removeElementAt

public void removeElementAt(dkIterator iter)
                     throws DKUsageError
Removes the element the iterator is currently pointing at. The iterator is advanced to the next element after this operation, invalidating all other iterators.
Specified by:
removeElementAt in interface dkCollection
Parameters:
iter - location in collection .

removeAllElements

public void removeAllElements()
                       throws DKUsageError
Removes all elements in the collection and invalidates all other iterators.
Specified by:
removeAllElements in interface dkCollection

setName

public void setName(java.lang.String name)
Sets the name of the collection.
Specified by:
setName in interface dkCollection
Parameters:
name - collection name.

getName

public java.lang.String getName()
Gets the name of the collection.
Specified by:
getName in interface dkCollection
Returns:
collection name

getOwner

public dkDataObjectBase getOwner()
Gets the owner data object for this collection.
Specified by:
getOwner in interface dkCollection
Returns:
owner data object.

getAssociatedAttrName

public java.lang.String getAssociatedAttrName()
Gets the associated attribute name
Specified by:
getAssociatedAttrName in interface dkCollection
Returns:
associated attribute name.

setSortFunction

public void setSortFunction(dkSort sortFunction)
Sets the sort function for sorting this collection.
Parameters:
sortFunction - the sort function.

getSortFunction

public dkSort getSortFunction()
Gets the sort function.
Returns:
a sort function object.

sort

public void sort()
          throws DKUsageError
Sorts the elements in this collection using the sort function. The default order is ascending. The sort function must be set before.
See Also:
sort(dkSort sortFunction, boolean sortOrder)

sort

public void sort(boolean order)
          throws DKUsageError
Sorts the elements in this collection in the given order using the sort function. The sort function must be set before.
Parameters:
order - a boolean value indicating the sort order. If true sort in ascending order, otherwise sort in descending order.
See Also:
sort(dkSort sortFunction, boolean sortOrder)

sort

public void sort(dkSort sortFunction,
                 boolean sortOrder)
          throws DKUsageError
Sorts the elements in this collection using the given sort function and sort order. sortFunction is a function object which defines the method to get the object key and perform comparison on them.
Parameters:
sortFunction - the sort function.
sortOrder - a boolean value indicating the sort order. If true sort in ascending order, otherwise sort in descending order.

EIP Java APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.