GXPARSE hosted by SourceForge.net Logo

ca.gorman.xml.parse.toolkit
Class CoroutineEntityStack<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.CoroutineEntityStack<T>
All Implemented Interfaces:
EntityStack<T>

public final class CoroutineEntityStack<T extends Parser>
extends Coroutine_Callback<T>
implements EntityStack<T>

Entity stack implemented for coroutine parser.


Constructor Summary
  CoroutineEntityStack()
           Construct instance that cannot be used until initialized by setCoroutine, setListener and setParser.
protected CoroutineEntityStack(Coroutine coroutine)
           Construct instance that cannot be used until initialized by setListener and setParser.
protected CoroutineEntityStack(Coroutine coroutine, EntityListener<T> entityListener)
           Construct instance that cannot be used until initialized by setParser.
 
Method Summary
 Entity getCurrentEntity()
           Get the CurrentEntity at the top of the stack without removing it from the stack.
 EntityListener<T> getListener()
           Get the listener.
 boolean isEmpty()
           Indicate whether entity stack is empty.
 Entity pop()
           Remove the current entity from the top of the stack.
 void push(CoroutineEntity<T> coroutineEntity)
           Push a CoroutineEntity on the entity stack from the parser thread, and invoke an entity handler on the entity as current entity in the application thread.
 void setListener(EntityListener<T> entityListener)
           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

CoroutineEntityStack

public CoroutineEntityStack()

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


CoroutineEntityStack

protected CoroutineEntityStack(Coroutine coroutine)

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

Throws:
NullPointerException - if coroutine is null

CoroutineEntityStack

protected CoroutineEntityStack(Coroutine coroutine,
                               EntityListener<T> entityListener)

Construct instance that cannot be used until initialized by setParser.

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

setListener

public void setListener(EntityListener<T> entityListener)

Set or reset the listener.

Throws:
NullPointerException - if entityListener is null

getListener

public EntityListener<T> getListener()

Get the listener.


push

public void push(CoroutineEntity<T> coroutineEntity)

Push a CoroutineEntity on the entity stack from the parser thread, and invoke an entity handler on the entity as current entity in the application thread.

Specified by:
push in interface EntityStack<T extends Parser>

pop

public Entity pop()
Description copied from interface: EntityStack

Remove the current entity from the top of the stack. The entity is no longer valid as an instance of CurrentEntity. The entity 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 Entity.

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

isEmpty

public boolean isEmpty()
Description copied from interface: EntityStack

Indicate whether entity stack is empty.

Specified by:
isEmpty in interface EntityStack<T extends Parser>
Returns:
true if there are no entities on the entity stack

getCurrentEntity

public Entity getCurrentEntity()
Description copied from interface: EntityStack

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

Specified by:
getCurrentEntity in interface EntityStack<T extends Parser>

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