com.miami.romeo.config
Class SortedStrings

java.lang.Object
  extended bycom.miami.romeo.config.Alphabetizer
      extended bycom.miami.romeo.config.SortedStrings
All Implemented Interfaces:
java.lang.Cloneable

public class SortedStrings
extends Alphabetizer
implements java.lang.Cloneable

An object that represents an array of alpabetized Strings. Implemented with an String array that grows as appropriate.


Field Summary
static int DEFAULT_SIZE
           
 
Constructor Summary
SortedStrings()
          Constructor creates a new SortedStrings object of default size.
SortedStrings(java.io.DataInput in)
          Contructor creates a new SortedStrings object using a DataInput object.
SortedStrings(int initial_size)
          Constructor creates a new SortedStrings object of size passed.
SortedStrings(java.lang.String[] array)
          Contructor creates a new SortedStrings object, initializing it with the String[] passed.
 
Method Summary
 void add(java.lang.String num)
          Adds the String passed to the array in its proper place -- sorted.
 void clear()
          Clears the Strings from the object and creates a new one of the default size.
 void clear(int initial_size)
          Clears the Strings from the object and creates a new one of the size passed.
 java.lang.Object clone()
          Clones the SortedStrings object.
 boolean contains(java.lang.String num)
          Returns true flag if the String passed is in the array.
 SortedStrings diff(SortedStrings that)
          Returns a SortedStrings object that has the Strings from this object that are not in the one passed.
 void emit(java.io.DataOutput out)
          Writes a the SortedStrings object to the DataOutput object.
 int indexOf(java.lang.String num)
          Returns String index of the int passed.
 SortedStrings merge(SortedStrings that)
          Merge two sorted lists of integers.
 void remove(java.lang.String num)
          Removes the String passed from the array.
 void removeIndex(int index)
          Removes the String from the beginning of the array to the index passed.
protected  int search(java.lang.String num)
          Returns the index where the String value passed is located or where it should be sorted to if it is not present.
static java.lang.String[] sort(java.lang.String[] input)
          Returns a sorted String[] from the String[] passed.
 java.lang.String stringAt(int index)
          Returns the String value at the index passed.
 int stringCount()
          Returns the number of Strings in the array.
 java.lang.String[] toStringArray()
          Returns an String[] that contains the value in the SortedStrings object.
 
Methods inherited from class com.miami.romeo.config.Alphabetizer
compare, compare, equalTo, greaterThan, lessThan
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SIZE

public static final int DEFAULT_SIZE
See Also:
Constant Field Values
Constructor Detail

SortedStrings

public SortedStrings()
Constructor creates a new SortedStrings object of default size.


SortedStrings

public SortedStrings(int initial_size)
Constructor creates a new SortedStrings object of size passed.


SortedStrings

public SortedStrings(java.io.DataInput in)
              throws java.io.IOException
Contructor creates a new SortedStrings object using a DataInput object. The first int in the DataInput object is assumed to be the size wanted for the SortedStrings object.


SortedStrings

public SortedStrings(java.lang.String[] array)
Contructor creates a new SortedStrings object, initializing it with the String[] passed.

Method Detail

clone

public java.lang.Object clone()
Clones the SortedStrings object.


emit

public void emit(java.io.DataOutput out)
          throws java.io.IOException
Writes a the SortedStrings object to the DataOutput object.

Throws:
java.io.IOException

merge

public SortedStrings merge(SortedStrings that)
Merge two sorted lists of integers. The time complexity of the merge is O(n).


diff

public SortedStrings diff(SortedStrings that)
Returns a SortedStrings object that has the Strings from this object that are not in the one passed.


clear

public void clear()
Clears the Strings from the object and creates a new one of the default size.


clear

public void clear(int initial_size)
Clears the Strings from the object and creates a new one of the size passed.


add

public void add(java.lang.String num)
Adds the String passed to the array in its proper place -- sorted.


remove

public void remove(java.lang.String num)
Removes the String passed from the array.


removeIndex

public void removeIndex(int index)
Removes the String from the beginning of the array to the index passed.


contains

public boolean contains(java.lang.String num)
Returns true flag if the String passed is in the array.


stringCount

public int stringCount()
Returns the number of Strings in the array.


indexOf

public int indexOf(java.lang.String num)
Returns String index of the int passed.


stringAt

public java.lang.String stringAt(int index)
Returns the String value at the index passed.


search

protected int search(java.lang.String num)
Returns the index where the String value passed is located or where it should be sorted to if it is not present.


toStringArray

public java.lang.String[] toStringArray()
Returns an String[] that contains the value in the SortedStrings object.


sort

public static java.lang.String[] sort(java.lang.String[] input)
Returns a sorted String[] from the String[] passed.