com.sas.collection
Interface OrderedCollectionInterface

All Superinterfaces:
java.lang.Cloneable, CollectionInterface, com.sas.collection.ContentsChangedSource, com.sas.util.Countable, com.sas.util.Enumerable, IndexedGetInterface, IndexedSetInterface, com.sas.beans.PropertyChangeSource, com.sas.PublicClonable, Sortable, StaticCollectionInterface, StaticOrderedCollectionInterface
All Known Subinterfaces:
AssociationListInterface, SelectionGroupInterface, StringCollectionInterface
All Known Implementing Classes:
AssociationList, ColorList, ColorNameList, DefaultColorList, DefaultFontFamilyList, DefaultFontList, FontList, KeyCollection, OrderedCollection, OrderedListCollection, RGBList, SelectionGroup, StringCollection

public interface OrderedCollectionInterface
extends CollectionInterface, StaticOrderedCollectionInterface, IndexedSetInterface, Sortable

An ordered collection is a collection which accesses items via consecutive integer indices. These indices range from from 0 to n, where n=collection.count()-1.

An ordered colection supports insertion or deletion from anywhere in the collection.


Method Summary
abstract  void add(java.lang.Object item, int index)
          Insert an item into a specific location in this collection.
abstract  void addItems(java.util.Enumeration items, int index)
          Add all elements of an enumeration to this collection.
abstract  java.lang.Object clone()
          Clone the object.
abstract  java.lang.Object removeAt(int index)
          Remove from this collection the item at the specified index.
abstract  void set(int index, java.lang.Object item)
          Replace the item at the specified index with a new item.
abstract  void setSize(int newSize)
          Set the number of items that are being held in this collection.
 
Methods inherited from interface com.sas.collection.CollectionInterface
add, addItems, remove, removeAll, removeAll
 
Methods inherited from interface com.sas.collection.StaticOrderedCollectionInterface
equals, getIndex, getItems, getLastIndex
 
Methods inherited from interface com.sas.collection.StaticCollectionInterface
apply, contains
 
Methods inherited from interface com.sas.collection.ContentsChangedSource
addContentsChangedListener, removeContentsChangedListener
 
Methods inherited from interface com.sas.beans.PropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface com.sas.util.Enumerable
getItems
 
Methods inherited from interface com.sas.util.IndexedGetInterface
get
 
Methods inherited from interface com.sas.util.Countable
count
 
Methods inherited from interface com.sas.collection.Sortable
sort, sort
 

Method Detail

add

void add(java.lang.Object item,
         int index)
Insert an item into a specific location in this collection.

Parameters:
item - the item to add to this collection. The item may exist multiple times in this collection.
index - Insert the object before the indexed item. The newly inserted item can be accessed by get(index) afterwards.
Throws:
java.lang.IndexOutOfBoundsException - if index is not in the range [0, count()].
java.lang.ClassCastException - In some implementations, the objects that are stored may be restricted to a particular type (such as String).

addItems

void addItems(java.util.Enumeration items,
              int index)
Add all elements of an enumeration to this collection. Note: to add the contents of another collection, use targetCollection.addItems(otherCollection.getItems())

Parameters:
items - an Enumeration of items to add to this collection
index - Insert the objects starting before the item at index. The first of the newly inserted item can be accessed by get(index) afterwards.
Throws:
java.lang.ClassCastException - In some implementations, the objects that are stored may be restricted to a particular type (such as String).

removeAt

java.lang.Object removeAt(int index)
Remove from this collection the item at the specified index. The items after the deleted item are shifted backward to fill in the hole.

Parameters:
index - the position of the item, zero-based indexing.
Returns:
the item that was removed from this collection
Throws:
java.lang.IndexOutOfBoundsException - if index is not in the range [0, count()-1].

set

void set(int index,
         java.lang.Object item)
Replace the item at the specified index with a new item.

Specified by:
set in interface IndexedSetInterface
Parameters:
index - The position where the new item will be placed.
item - The object to be added to this ordered collection
Throws:
java.lang.IndexOutOfBoundsException - if index is not in the range [0, count()-1].
java.lang.ClassCastException - In some implementations, the objects that are stored may be restricted to a particular type (such as String).

setSize

void setSize(int newSize)
Set the number of items that are being held in this collection. If size is smaller than the current collection count, then this collection is truncated to the size specified. If size is greater than the current collection size, then this collection size is extended, and the new collection slots are set to contain null.

Parameters:
size - The new size of this collection
Throws:
java.lang.IndexOutOfBoundsException - if size is less than zero.

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone the object.

Specified by:
clone in interface CollectionInterface
Specified by:
clone in interface com.sas.PublicClonable
Specified by:
clone in interface StaticCollectionInterface
Specified by:
clone in interface StaticOrderedCollectionInterface
Returns:
a clone of this ordered collection.
Throws:
java.lang.CloneNotSupportedException - if this collection cannot be cloned.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.