GXPARSE hosted by SourceForge.net Logo

ca.gorman.util.scan
Interface ScanState

All Known Implementing Classes:
AbstractScanState

public interface ScanState

Control interface between an active Scanner and an action invoked by the Scanner.

Warning: a ScanState instance is undefined outside the scope of the action method that received the instance as a parameter.


Method Summary
 boolean containsKey(String key)
           Find out whether a particular key has been used to save a value.
 CharSequence get(String key)
           Get a CharSequence that has been saved as the value for a specific key.
 Map<String,CharSequence> getMap()
           Get the map that supports saving and retrieving character sequences as temporary values.
 boolean isTerminationRequested()
           Indicate whether the Scanner has been requested to stop.
 Writer out()
           Get the default output destination of the Scanner.
 int outputStackSize()
           Return the number of Appendable items pushed on stack.
 Appendable popOutput()
           Restore the previous default output (optional operation).
 RuleList popRuleList()
           Restore the previous scanning rules (optional operation).
 void pushOutput(Appendable appendable)
           Temporarily change the default output (optional operation).
 void pushRuleList(RuleList ruleList)
           Temporarily change the scanning rules (optional operation).
 CharSequence put(String key, CharSequence value)
           Save a CharSequence as the value associated with a key.
 void requestTermination()
           Request the Scanner to discontinue scanning at the end of the action from which this method has been invoked.
 int ruleListStackSize()
           Return the number of RuleList items pushed on stack.
 

Method Detail

pushRuleList

void pushRuleList(RuleList ruleList)

Temporarily change the scanning rules (optional operation). The change becomes effective when control returns from the currently active ScanRule action.

Throws:
UnsupportedOperationException - if not implemented
NullPointerException - if ruleList is null

popRuleList

RuleList popRuleList()

Restore the previous scanning rules (optional operation). The change becomes effective when control returns from the currently active ScanRule action.

Throws:
UnsupportedOperationException - if not implemented
EmptyStackException - if no rules are pushed.

ruleListStackSize

int ruleListStackSize()

Return the number of RuleList items pushed on stack.

Returns:
number of items pushed, or zero if not implemented

pushOutput

void pushOutput(Appendable appendable)

Temporarily change the default output (optional operation). The change becomes effective immediately.

If the currently active default output is a Flushable, it will be flushed before the new default ouput is put on the output stack.

Throws:
UnsupportedOperationException - if not implemented
NullPointerException - if appendable is null

popOutput

Appendable popOutput()

Restore the previous default output (optional operation). The change becomes effective immediately.

If the currently active default output is a Flushable, it will be flushed, before being popped from the output stack.

Throws:
UnsupportedOperationException - if not implemented
EmptyStackException - if no default output has been pushed.

outputStackSize

int outputStackSize()

Return the number of Appendable items pushed on stack.

Returns:
number of items pushed, or zero if not implemented

out

Writer out()

Get the default output destination of the Scanner.

The close method throws UnsupportedOperationException because the default output destination must remain available while the Scanner is running..

Scanner default output methods should not be invoked from outside the action method of a ScanRule. Doing so may cause an IllegalStateException.


get

CharSequence get(String key)

Get a CharSequence that has been saved as the value for a specific key. All keys are cleared when a ScanRule completes an action.

Throws:
NullPointerException - if key is null
IllegalArgumentException - if no value has been set for the key since the last time that all keys have been cleared.
IllegalStateException - if invoked outside the scope of a ScanRule action

put

CharSequence put(String key,
                 CharSequence value)

Save a CharSequence as the value associated with a key. Replaces any previous value saved against the same key. All keys are cleared when a ScanRule completes an action.

Throws:
NullPointerException - if any parameter is null
IllegalStateException - if invoked outside the scope of a ScanRule action

containsKey

boolean containsKey(String key)

Find out whether a particular key has been used to save a value. All keys are cleared when a ScanRule completes an action.

Returns:
the previous value, or null if the key has not been used since the last time the keys were cleared.
Throws:
NullPointerException - if key is null
IllegalStateException - if invoked outside the scope of a ScanRule action

getMap

Map<String,CharSequence> getMap()

Get the map that supports saving and retrieving character sequences as temporary values.


requestTermination

void requestTermination()

Request the Scanner to discontinue scanning at the end of the action from which this method has been invoked.


isTerminationRequested

boolean isTerminationRequested()

Indicate whether the Scanner has been requested to stop.

This method is normally used only by implementors.


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