com.sas.collection
Interface SortedCollectionInterface

All Superinterfaces:
java.lang.Cloneable, CollectionInterface, com.sas.collection.ContentsChangedSource, com.sas.util.Countable, com.sas.util.Enumerable, IndexedGetInterface, com.sas.beans.PropertyChangeSource, com.sas.PublicClonable, StaticCollectionInterface, StaticOrderedCollectionInterface
All Known Implementing Classes:
SortedCollection

public interface SortedCollectionInterface
extends CollectionInterface, StaticOrderedCollectionInterface

SortedCollectionInterface defines an interface for an ordered collection which preserves a sort order when inserting items. The sorted collection is constructed with a Comparator which is used to determine where the items are inserted.

The SortedCollectionInterface extends CollectionInterface with which you can add items, test if an item exists, gett the item count, obtain an enumeration of the elements. It also extends StaticOrderedCollectionInterface by which you can access items by their integer index [0..count()-1]. This interface adds the sort() and removeAt(int) methods. Note that the OrderedCollectionInterface methods such as set(int, Object) are not in this interface, since arbitrarily setting items in a sorted collection may render the collection unsorted.

The behavior of a SortedCollection is undefined if the Comparator is null or if the comparator cannot compare two items (i.e. if the comparator ever returns @{link com.sas.util.Comparator#INCOMPARABLE Comparator.INCOMPARABLE})

See Also:
SortedCollection

Method Summary
abstract  void removeAt(int index)
          Remove the item at the specificed position.
abstract  void sort()
          Re-sort this collection.
 
Methods inherited from interface com.sas.collection.CollectionInterface
add, addItems, clone, remove, removeAll, removeAll
 
Methods inherited from interface com.sas.collection.StaticOrderedCollectionInterface
clone, 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
 

Method Detail

sort

void sort()
Re-sort this collection. This may be necessary if one or more of the items in this collection have changed in such a way that the collection is out of order. The collection will emit a ContentsChangedEvent.


removeAt

void removeAt(int index)
Remove the item at the specificed position. This sorted collection will emit a ContentsChangedEvent.

Parameters:
index - the index of the item to remove from the sorted collection.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.