Class pmr.euclid.StringSet
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class pmr.euclid.StringSet

java.lang.Object
   |
   +----pmr.euclid.StringSet

public class StringSet
extends Object
Stores a unique set of Strings. By default this is case-sensitive, but the user can set this to insensitive. The actual value stored is case-sensitive. Also keeps a score of the indexNumber of each element, and can thus be used for keying Vectors.
Author:
(C) P. Murray-Rust, 1996

Variable Index

 o IGNORE_CASE

Constructor Index

 o StringSet()
default contsructor is case-sensitive
 o StringSet(int)
set case insensitivity if 'ignore' arg is 'StringSet.IGNORE_CASE'
 o StringSet(String[])
create a StringSet from the Strings (duplicates are ignored); case-sensitive

Method Index

 o addElement(String)
adds an element.
 o addSet(StringSet)
catenates one set onto another.
 o contains(String)
does Set contain String? (according to case-sensitivity
 o debug()
 o elementAt(int)
return (case-sensitive) element
 o getElements()
return all members (case sensitive by default)
 o getIgnoreCase()
state of case-sensitivity
 o indexOf(String)
index of a given String (default is case-sensitive); -1 if not found
 o indexSortAscending()
 o indexSortDescending()
sort elem into descending order via indexes; elem NOT MODIFIED
 o main(String[])
 o reverse()
MODIFIES StringSet to be in reverse order
 o size()
 o sortAscending()
MODIFIES StringSet to be in ascending order
 o sortDescending()
MODIFIES StringSet to be in descending order
 o toString()
outputs the components as a list separated by "\n" - bad luck if they already contain this!

Variables

 o IGNORE_CASE
  public final static int IGNORE_CASE

Constructors

 o StringSet
  public StringSet()
default contsructor is case-sensitive
 o StringSet
  public StringSet(int ignore)
set case insensitivity if 'ignore' arg is 'StringSet.IGNORE_CASE'
 o StringSet
  public StringSet(String strings[])
create a StringSet from the Strings (duplicates are ignored); case-sensitive

Methods

 o getElements
  public String[] getElements()
return all members (case sensitive by default)
 o size
  public int size()
 o getIgnoreCase
  public boolean getIgnoreCase()
state of case-sensitivity
 o addElement
  public void addElement(String value)
adds an element. If String is already present, does nothing
 o contains
  public boolean contains(String value)
does Set contain String? (according to case-sensitivity
 o indexOf
  public int indexOf(String value)
index of a given String (default is case-sensitive); -1 if not found
 o elementAt
  public String elementAt(int i)
return (case-sensitive) element
 o addSet
  public void addSet(StringSet is) throws StringSetException
catenates one set onto another. Fails if Sets differ in case-sensitivity.
Throws: StringSetException
mixed case is not allowed
 o debug
  public void debug()
 o toString
  public String toString()
outputs the components as a list separated by "\n" - bad luck if they already contain this!
Overrides:
toString in class Object
 o sortAscending
  public void sortAscending()
MODIFIES StringSet to be in ascending order
 o sortDescending
  public void sortDescending()
MODIFIES StringSet to be in descending order
 o reverse
  public void reverse()
MODIFIES StringSet to be in reverse order
 o indexSortAscending
  public IntSet indexSortAscending()
 o indexSortDescending
  public IntSet indexSortDescending()
sort elem into descending order via indexes; elem NOT MODIFIED
 o main
  public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index