Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.portal.format.util
Class Stack

    java.lang.Object
      org.jboss.portal.format.util.Stack

    public abstract class Stack

extends java.lang.Object

The goal of this class is to ensure that any event with open/close well formdness semantics are respected.

This class maintain a stack of keys.

To be operational this class must be subclassed to provide semantics that the user wants to give to the key identities.

Version:
  $Revision: 8784 $
Author:
  Julien Viet

Nested Class Summary
`static interface` | `Stack.Key` A key for the stack.
`class` | `Stack.KeyIterator` Iterates over the poped keys.

Field Summary
`protected int` | `ptr` The stack pointer which always points the first available element.
`protected Stack.Key[]` | `stack` The stack holder.

Constructor Summary
`Stack(int initalCapacity)` Create a new stack with a specified depth.

Method Summary
`protected abstract Stack.Key` | `createKey()` The implementation must provide a reusable key.
`protected void` | `enlarge()` Enlarge the key stack.
`protected abstract boolean` | `equals(Stack.Key key1, Stack.Key key2)` The implementation must test keys equality.
`Stack.Key` | `peek(int level)` Peek a key on the stack.
`java.util.Iterator` | `pop(Stack.Key candidate)` Pop keys until it finds the good one.
`Stack.Key` | `push()` Push a key on the stack.
`void` | `reset()` Reset the stack state.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### ptr

    protected int ptr

  The stack pointer which always points the first available element.

### stack

    protected Stack.Key[] stack

  The stack holder.

Constructor Detail

### Stack

    public Stack(int initalCapacity)

  Create a new stack with a specified depth.

Method Detail

### reset

    public final void reset()

  Reset the stack state.

### push

    public final Stack.Key push()

  Push a key on the stack.

### peek

    public Stack.Key peek(int level)

  Peek a key on the stack.

### pop

    public final java.util.Iterator pop(Stack.Key candidate)

  Pop keys until it finds the good one.

### createKey

    protected abstract Stack.Key createKey()

  The implementation must provide a reusable key.

### equals

    protected abstract boolean equals(Stack.Key key1,
                                      Stack.Key key2)

  The implementation must test keys equality.

### enlarge

    protected void enlarge()

  Enlarge the key stack. For now it simply add 3 keys to the actual length

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD