org.apache.xml.utils

Class StringVector

public class StringVector extends Object implements Serializable

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

UNKNOWN: internal

Constructor Summary
StringVector()
Default constructor.
StringVector(int blocksize)
Construct a StringVector, using the given block size.
Method Summary
voidaddElement(String value)
Append a string onto the vector.
booleancontains(String s)
Tell if the table contains the given string.
booleancontainsIgnoreCase(String s)
Tell if the table contains the given string.
StringelementAt(int i)
Get the nth element.
intgetLength()
Get the length of the list.
Stringpeek()
Get the string at the tail of this vector without popping.
Stringpop()
Pop the tail of this vector.
voidpush(String s)
Tell if the table contains the given string.
intsize()
Get the length of the list.

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

addElement

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

Parameters: value Sting to add to the vector

contains

public final boolean contains(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(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

elementAt

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

Parameters: i Index of string to find

Returns: String at given index

getLength

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

Returns: Number of strings in the list

peek

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

Returns: The string at the tail of this vector.

pop

public final 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.

push

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

Parameters: s String to push into the vector

size

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

Returns: Number of strings in the list

Copyright B) 2006 Apache XML Project. All Rights Reserved.