javazoom.jlgui.player.amp.util.ini

Class SortedStrings

Implemented Interfaces:
Cloneable

public class SortedStrings
extends Alphabetizer
implements 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(DataInput in)
Contructor creates a new SortedStrings object using a DataInput object.
SortedStrings(String[] array)
Contructor creates a new SortedStrings object, initializing it with the String[] passed.
SortedStrings(int initial_size)
Constructor creates a new SortedStrings object of size passed.

Method Summary

void
add(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.
Object
clone()
Clones the SortedStrings object.
boolean
contains(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(DataOutput out)
Writes a the SortedStrings object to the DataOutput object.
int
indexOf(String num)
Returns String index of the int passed.
SortedStrings
merge(SortedStrings that)
Merge two sorted lists of integers.
void
remove(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(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 String[]
sort(String[] input)
Returns a sorted String[] from the String[] passed.
String
stringAt(int index)
Returns the String value at the index passed.
int
stringCount()
Returns the number of Strings in the array.
String[]
toStringArray()
Returns an String[] that contains the value in the SortedStrings object.

Methods inherited from class javazoom.jlgui.player.amp.util.ini.Alphabetizer

compare, compare, equalTo, greaterThan, lessThan

Field Details

DEFAULT_SIZE

public static final int DEFAULT_SIZE
Field Value:
32

Constructor Details

SortedStrings

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

SortedStrings

public SortedStrings(DataInput in)
            throws 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(String[] array)
Contructor creates a new SortedStrings object, initializing it with the String[] passed.

SortedStrings

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

Method Details

add

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

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.

clone

public Object clone()
Clones the SortedStrings object.

contains

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

diff

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

emit

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

indexOf

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

merge

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

remove

public void remove(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.

search

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

sort

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

stringAt

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

stringCount

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

toStringArray

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

JavaZOOM 1999-2006