|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.quick.StringSet
StringSet encapsulates a structure that maintains a set
of Strings both in the original order of entry and in
sorted order.
| Field Summary | |
private QuickVector |
stringList
The vector of strings in order. |
private QuickTreeSet |
stringSet
The string sorted set. |
| Constructor Summary | |
StringSet()
The default constructor. |
|
StringSet(String[] strings)
The constructor with an array of strings. |
|
| Method Summary | |
void |
addString(String string)
Adds the given String to the StringSet. |
void |
addStrings(String[] strings)
Adds an array of strings to the set. |
void |
clear()
Clear the set of all strings. |
boolean |
contains(String string)
Returns true if this set contains the String. |
String[] |
getSortedStrings()
Returns as an array the Strings in this set
in sorted order. |
String |
getString(int index)
Returns the String string at the given index
in order of entry into the set; or null if the
index is out of bounds. |
String[] |
getStrings()
Returns as an array the Strings in this set
in order of entry into the set. |
String |
remove(int index)
Removes and returns the string corresponding to the given index in order of entry in the set provided that the index is in bounds; otherwise returns null. |
String |
remove(String string)
Removes and returns the given String string
provided that the string is in the set; otherwise returns
null. |
void |
setStrings(String[] strings)
Clears the set and adds an array of strings to the set. |
int |
size()
Returns the number of strings in this set. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private QuickTreeSet stringSet
private QuickVector stringList
| Constructor Detail |
public StringSet()
public StringSet(String[] strings)
The constructor with an array of strings.
strings - the array of strings| Method Detail |
public void addString(String string)
Adds the given String to the StringSet.
The string must be non-null and must not already be in
the set; otherwise does nothing.
string - the string to enter into the setpublic void addStrings(String[] strings)
Adds an array of strings to the set.
strings - the array of stringspublic void setStrings(String[] strings)
Clears the set and adds an array of strings to the set.
If strings is null, then only clears.
strings - the array of stringspublic String remove(int index)
Removes and returns the string corresponding to the given
index in order of entry in the set provided that the index
is in bounds; otherwise returns null.
index - the index of the string
public String remove(String string)
Removes and returns the given String string
provided that the string is in the set; otherwise returns
null.
string - to remove
public void clear()
Clear the set of all strings.
public int size()
public String getString(int index)
Returns the String string at the given index
in order of entry into the set; or null if the
index is out of bounds.
index - the index of the string
public String[] getStrings()
Returns as an array the Strings in this set
in order of entry into the set.
public String[] getSortedStrings()
Returns as an array the Strings in this set
in sorted order.
public boolean contains(String string)
true if this set contains the String.
string - the string to test
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||