com.mckoi.util
Class StringListBucket

java.lang.Object
  extended by com.mckoi.util.StringListBucket

public class StringListBucket
extends java.lang.Object

A utility container class for holding a list of strings. This method provides a convenient way of exporting and importing the list as a string itself. This is useful if we need to represent a variable array of strings.

Author:
Tobias Downer

Constructor Summary
StringListBucket()
          Constructs the bucket.
StringListBucket(java.lang.String list)
           
 
Method Summary
 void add(java.lang.String element)
          Adds a string to the end of the list.
 void add(java.lang.String element, int index)
          Adds a string to the given index of the list.
 void clear()
          Clears the list of all string elements.
 boolean contains(java.lang.String element)
          Returns true if the list contains the given element string.
 void fromString(java.lang.String list)
          Imports from a String into this bucket.
 java.lang.String get(int index)
          Returns the string at the given index of the list.
 int indexOfVar(java.lang.String element)
          Returns the index of the given string in the bucket, or -1 if not found.
 void remove(int index)
          Removes the string at the given index of the list.
 int size()
          Returns the number of string elements in the list.
 java.lang.String toString()
           
 java.lang.StringBuffer toStringBuffer()
          Returns the bucket as a StringBuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringListBucket

public StringListBucket()
Constructs the bucket.


StringListBucket

public StringListBucket(java.lang.String list)
Method Detail

size

public int size()
Returns the number of string elements in the list.


clear

public void clear()
Clears the list of all string elements.


add

public void add(java.lang.String element)
Adds a string to the end of the list.


add

public void add(java.lang.String element,
                int index)
Adds a string to the given index of the list.


get

public java.lang.String get(int index)
Returns the string at the given index of the list.


remove

public void remove(int index)
Removes the string at the given index of the list.


contains

public boolean contains(java.lang.String element)
Returns true if the list contains the given element string.


indexOfVar

public int indexOfVar(java.lang.String element)
Returns the index of the given string in the bucket, or -1 if not found.


toStringBuffer

public java.lang.StringBuffer toStringBuffer()
Returns the bucket as a StringBuffer. This can be exported to a file or to a database, etc.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

fromString

public void fromString(java.lang.String list)
Imports from a String into this bucket. This is used to transform a previously exported bucket via 'toStringBuffer()'.