com.sas.collection
Interface StringListInterface

All Superinterfaces:
java.lang.Cloneable, com.sas.collection.ContentsChangedSource, com.sas.util.Countable, com.sas.util.Enumerable, com.sas.PublicClonable, StaticStringListInterface
All Known Subinterfaces:
StringCollectionInterface
All Known Implementing Classes:
StringCollection

public interface StringListInterface
extends StaticStringListInterface

An interface for an ordered, modifiable collection of strings. StringCollection is an implementation of the StringListInterface.


Method Summary
abstract  void add(java.lang.String string)
          Add a string to the list.
abstract  void add(java.lang.String string, int index)
          Add a string to the list at a specific location.
abstract  void addItems(StaticStringListInterface strings)
          Add multiple strings to a list.
abstract  java.lang.Object clone()
          Clone the object.
abstract  void removeAll()
          Remove all strings from the string list.
abstract  void removeAt(int start, int n)
          Delete multiple strings starting at a specified index.
abstract  java.lang.String removeStringAt(int index)
          Delete a string at a specified index.
abstract  void setSize(int newSize)
          Set the number of strings that are being held in this collection.
abstract  void setString(int index, java.lang.String string)
          Replace the string at the specified index with a new string.
abstract  void sort(boolean ascending)
          Sorts the current collection in place in ascending/descending order using the built-in String comparison functions.
abstract  void sort(boolean ascending, int start, int end)
          Sorts the current collection in place in ascending/descending order using the built-in String comparison functions.
abstract  void sort(com.sas.util.Comparator comparator)
          Sorts the current collection in place in ascending/descending order using the built-in String comparison functions.
abstract  void sort(com.sas.util.Comparator comparator, int start, int end)
          Sorts the current collection in place in ascending/descending order using the built-in String comparison functions.
 
Methods inherited from interface com.sas.collection.StaticStringListInterface
equals, getIndex, getLastIndex, getString, getStringItems, getStringItems
 
Methods inherited from interface com.sas.util.Countable
count
 
Methods inherited from interface com.sas.util.Enumerable
getItems
 
Methods inherited from interface com.sas.collection.ContentsChangedSource
addContentsChangedListener, removeContentsChangedListener
 

Method Detail

add

void add(java.lang.String string)
Add a string to the list.

Parameters:
string - a string to add to the end of this list.

addItems

void addItems(StaticStringListInterface strings)
Add multiple strings to a list.

Parameters:
strings - a list of strings to add to the end of this list.

add

void add(java.lang.String string,
         int index)
Add a string to the list at a specific location. Items will be shifted forward to make room for the new string.

Parameters:
string - The string to insert into the list.
index - The index where the string will be inserted. A call of getString(index) will return the string after the call is completed.
Throws:
java.lang.IndexOutOfBoundsException - if index is not in the range [0..count()]

removeAll

void removeAll()
Remove all strings from the string list.


removeAt

void removeAt(int start,
              int n)
Delete multiple strings starting at a specified index. This can often be more efficient that calling deleteAt(index) n times.

Parameters:
start - delete the string at this zero-based position.
n - delete n strings from the list.
Throws:
java.lang.IndexOutOfBoundsException - if start or (start+count()-1) is not in the range [0..count()-1]

removeStringAt

java.lang.String removeStringAt(int index)
Delete a string at a specified index.

Parameters:
index - delete the string at this zero-based position
Returns:
string at specified index
Throws:
java.lang.IndexOutOfBoundsException - if the index is not in the range [0..count()-1]
See Also:
removeAt(int, int)

setString

void setString(int index,
               java.lang.String string)
Replace the string at the specified index with a new string.

Parameters:
index - replace the string at this zero-based position
string - The new string to put in the specified location
Throws:
java.lang.IndexOutOfBoundsException - if the index is not in the range [0..count()-1]

setSize

void setSize(int newSize)
Set the number of strings that are being held in this collection. If size is smaller than the current collection size, then this collection is truncated to the size specified. If size is greater than the current collection size, then this collection's 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 index is less than zero.

sort

void sort(com.sas.util.Comparator comparator,
          int start,
          int end)
Sorts the current collection in place in ascending/descending order using the built-in String comparison functions.

Parameters:
comparator - An instance of a subclass of Comparator which provides a compare(Object,Object) function.
start - the index of the first string in the range to sort
end - the index of the last string in the range to sort
See Also:
Comparator

sort

void sort(com.sas.util.Comparator comparator)
Sorts the current collection in place in ascending/descending order using the built-in String comparison functions.

Parameters:
comparator - An instance of a subclass of Comparator which provides a compare(Object,Object) function.
See Also:
Comparator

sort

void sort(boolean ascending,
          int start,
          int end)
Sorts the current collection in place in ascending/descending order using the built-in String comparison functions.

Parameters:
ascending - if true, sort in ascending order, else in descending order.
start - the index of the first string in the range to sort
end - the index of the last string in the range to sort

sort

void sort(boolean ascending)
Sorts the current collection in place in ascending/descending order using the built-in String comparison functions.

Parameters:
ascending - if true, sort in ascending order, else in descending order.

clone

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

Specified by:
clone in interface com.sas.PublicClonable
Specified by:
clone in interface StaticStringListInterface
Returns:
a clone of this collection.
Throws:
java.lang.CloneNotSupportedException - if the object could not be cloned.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.