org.apache.xml.utils
Class StringVector

java.lang.Object
  extended by org.apache.xml.utils.StringVector
All Implemented Interfaces:
java.io.Serializable

public class StringVector
extends java.lang.Object
implements java.io.Serializable

A very simple table that stores a list of strings, optimized for small lists.

See Also:
Serialized Form

Field Summary
protected  int m_blocksize
           
protected  int m_firstFree
           
protected  java.lang.String[] m_map
           
protected  int m_mapSize
           
(package private) static long serialVersionUID
           
 
Constructor Summary
StringVector()
          Default constructor.
StringVector(int blocksize)
          Construct a StringVector, using the given block size.
 
Method Summary
 void addElement(java.lang.String value)
          Append a string onto the vector.
 boolean contains(java.lang.String s)
          Tell if the table contains the given string.
 boolean containsIgnoreCase(java.lang.String s)
          Tell if the table contains the given string.
 java.lang.String elementAt(int i)
          Get the nth element.
 int getLength()
          Get the length of the list.
 java.lang.String peek()
          Get the string at the tail of this vector without popping.
 java.lang.String pop()
          Pop the tail of this vector.
 void push(java.lang.String s)
          Tell if the table contains the given string.
 int size()
          Get the length of the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

m_blocksize

protected int m_blocksize

m_map

protected java.lang.String[] m_map

m_firstFree

protected int m_firstFree

m_mapSize

protected int m_mapSize
Constructor Detail

StringVector

public StringVector()
Default constructor. Note that the default block size is very small, for small lists.


StringVector

public StringVector(int blocksize)
Construct a StringVector, using the given block size.

Parameters:
blocksize - Size of the blocks to allocate
Method Detail

getLength

public int getLength()
Get the length of the list.

Returns:
Number of strings in the list

size

public final int size()
Get the length of the list.

Returns:
Number of strings in the list

addElement

public final void addElement(java.lang.String value)
Append a string onto the vector.

Parameters:
value - Sting to add to the vector

elementAt

public final java.lang.String elementAt(int i)
Get the nth element.

Parameters:
i - Index of string to find
Returns:
String at given index

contains

public final boolean contains(java.lang.String s)
Tell if the table contains the given string.

Parameters:
s - String to look for
Returns:
True if the string is in this table

containsIgnoreCase

public final boolean containsIgnoreCase(java.lang.String s)
Tell if the table contains the given string. Ignore case.

Parameters:
s - String to find
Returns:
True if the String is in this vector

push

public final void push(java.lang.String s)
Tell if the table contains the given string.

Parameters:
s - String to push into the vector

pop

public final java.lang.String pop()
Pop the tail of this vector.

Returns:
The String last added to this vector or null not found. The string is removed from the vector.

peek

public final java.lang.String peek()
Get the string at the tail of this vector without popping.

Returns:
The string at the tail of this vector.