GXPARSE hosted by SourceForge.net Logo

ca.gorman.xml.parse.toolkit
Class CoroutineElementStack<T extends Parser>

java.lang.Object
  extended by ca.gorman.xml.parse.toolkit.Coroutine_NoCallback<T>
      extended by ca.gorman.xml.parse.toolkit.Coroutine_Callback<T>
          extended by ca.gorman.xml.parse.toolkit.CoroutineElementStack<T>
All Implemented Interfaces:
ElementStack<T>

public final class CoroutineElementStack<T extends Parser>
extends Coroutine_Callback<T>
implements ElementStack<T>

Element stack implemented for coroutine parser.


Constructor Summary
  CoroutineElementStack()
           Construct instance that cannot be used until initialized by setCoroutine, setListener and setParser.
protected CoroutineElementStack(Coroutine coroutine)
           Construct instance that cannot be used until initialized by setListener and setParser.
protected CoroutineElementStack(Coroutine coroutine, ElementListener<T> elementListener)
           Construct instance that cannot be used until initialized by setParser.
 
Method Summary
 Element getCurrentElement()
           Get the CurrentElement at the top of the stack without removing it from the stack.
 Element[] getElementStack()
           Get a list of elements currently on the stack.
 ElementListener<T> getListener()
           G the listener.
 boolean isEmpty()
           Indicate whether element stack is empty.
 boolean isParsing(QName qName)
           Indicate whether the named element is currently being parsed.
 Element pop()
           Remove the current element from the top of the stack.
 void push(CoroutineElement<T> coroutineElement)
           Push a CoroutineElement on the element stack, where it will become the current element.
 void setListener(ElementListener<T> elementListener)
           Set or reset the listener.
 
Methods inherited from class ca.gorman.xml.parse.toolkit.Coroutine_Callback
getCoroutine, setCoroutine
 
Methods inherited from class ca.gorman.xml.parse.toolkit.Coroutine_NoCallback
getParser, setParser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoroutineElementStack

public CoroutineElementStack()

Construct instance that cannot be used until initialized by setCoroutine, setListener and setParser.


CoroutineElementStack

protected CoroutineElementStack(Coroutine coroutine)

Construct instance that cannot be used until initialized by setListener and setParser.

Throws:
NullPointerException - if coroutine is null

CoroutineElementStack

protected CoroutineElementStack(Coroutine coroutine,
                                ElementListener<T> elementListener)

Construct instance that cannot be used until initialized by setParser.

Throws:
NullPointerException - if coroutine or elementListener is null
Method Detail

setListener

public void setListener(ElementListener<T> elementListener)

Set or reset the listener.

Throws:
NullPointerException - if elementListener is null

getListener

public ElementListener<T> getListener()

G the listener.


push

public void push(CoroutineElement<T> coroutineElement)
Description copied from interface: ElementStack

Push a CoroutineElement on the element stack, where it will become the current element.

Specified by:
push in interface ElementStack<T extends Parser>
Parameters:
coroutineElement - the CoroutineElement to be pushed..

pop

public Element pop()
Description copied from interface: ElementStack

Remove the current element from the top of the stack. The element is no longer valid as an instance of CurrentElement. The element is normally popped when it goes out of scope in the document, in which case it will not be valid even as an instance of the superclass Element.

Specified by:
pop in interface ElementStack<T extends Parser>
Returns:
the element removed from the element stack

getCurrentElement

public Element getCurrentElement()
Description copied from interface: ElementStack

Get the CurrentElement at the top of the stack without removing it from the stack.

Specified by:
getCurrentElement in interface ElementStack<T extends Parser>
Returns:
the element that is at the top of the element stack, or null if the stack is empty (no element is currently being parsed)

getElementStack

public Element[] getElementStack()
Description copied from interface: ElementStack

Get a list of elements currently on the stack.

Specified by:
getElementStack in interface ElementStack<T extends Parser>
Returns:
Array of Element instances that are on the element stack, the first element is the document element, the last element is the current element. The array will be of zero length if no elements are currently being parsed.

isParsing

public boolean isParsing(QName qName)
Description copied from interface: ElementStack

Indicate whether the named element is currently being parsed.

Specified by:
isParsing in interface ElementStack<T extends Parser>
Parameters:
qName - name of the desired element.
Returns:
true if the element is on the element stack (currently being parsed), false otherwise

isEmpty

public boolean isEmpty()
Description copied from interface: ElementStack

Indicate whether element stack is empty.

Specified by:
isEmpty in interface ElementStack<T extends Parser>
Returns:
true if there are no elements on the element stack

GXPARSE download

GXPARSE Generic XML Stream Parser API and supporting tools.   Release $Name: gxparse-sf-alpha-2_0 $
Copyright 2003-2004 Ian E. Gorman
Released under GNU Lesser General Public License