org.apache.turbine.util
Class StringStackBuffer

java.lang.Object
  |
  +--org.apache.turbine.util.StringStackBuffer

public class StringStackBuffer
extends java.lang.Object

This class implements a Stack for String objects.

Version:
$Id$
Author:
John D. McNally

Field Summary
private  java.util.Stack stk
          The stack.
 
Constructor Summary
StringStackBuffer()
          Constructor.
 
Method Summary
 StringStackBuffer add(java.lang.String s)
          Adds the String to the collection if it does not already contain it.
 StringStackBuffer addAll(StringStackBuffer s)
          Adds all Strings in the given StringStackBuffer to the collection (skipping those it already contains)
 void clear()
          Clears the Stack.
 boolean contains(java.lang.String s)
          Does the Stack contain this String?
 boolean empty()
          Is the Stack empty?
 boolean equals(java.lang.Object ssbuf)
          Compares two StringStackBuffers.
 java.lang.String get(int i)
          Get a String off the Stack at a certain position.
 int size()
          What is the size of the Stack?
 java.lang.String toString()
          Converts the stack to a single String with no separator.
 java.lang.String toString(java.lang.String separator)
          Converts the stack to a single String.
 java.lang.String[] toStringArray()
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

stk

private java.util.Stack stk
The stack.
Constructor Detail

StringStackBuffer

public StringStackBuffer()
Constructor.
Method Detail

add

public StringStackBuffer add(java.lang.String s)
Adds the String to the collection if it does not already contain it.
Parameters:
s - A String.
Returns:
A StringStackBuffer.

addAll

public StringStackBuffer addAll(StringStackBuffer s)
Adds all Strings in the given StringStackBuffer to the collection (skipping those it already contains)
Parameters:
s - A StringStackBuffer.
Returns:
A StringStackBuffer.

clear

public void clear()
Clears the Stack.

contains

public boolean contains(java.lang.String s)
Does the Stack contain this String?
Parameters:
s - A String.
Returns:
True if the Stack contains this String.

empty

public boolean empty()
Is the Stack empty?
Returns:
True if the Stack is empty.

get

public java.lang.String get(int i)
Get a String off the Stack at a certain position.
Parameters:
i - An int with the position.
Returns:
A String.

size

public int size()
What is the size of the Stack?
Returns:
An int, the size of the Stack.

toString

public java.lang.String toString()
Converts the stack to a single String with no separator.
Overrides:
toString in class java.lang.Object
Returns:
The stack elements as a single block of text.

toString

public java.lang.String toString(java.lang.String separator)
Converts the stack to a single String.
Parameters:
separator - The text to use as glue between elements in the stack.
Returns:
The stack elements--glued together by separator--as a single block of text.

equals

public boolean equals(java.lang.Object ssbuf)
Compares two StringStackBuffers. Considered equal if the toString() methods are equal.
Overrides:
equals in class java.lang.Object

toStringArray

public java.lang.String[] toStringArray()


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.