GXPARSE hosted by SourceForge.net Logo

ca.gorman.util.scan.spi
Class AbstractScanState

java.lang.Object
  extended by ca.gorman.util.scan.spi.AbstractScanState
All Implemented Interfaces:
ScanState

public abstract class AbstractScanState
extends Object
implements ScanState

A ScanState factory.


Constructor Summary
protected AbstractScanState(InputScanBuffer inputScanBuffer, Appendable appendable, RuleList ruleList)
           
 
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.
 InputScanBuffer getInputScanBuffer()
           
 Map<String,CharSequence> getMap()
           Get the map that supports saving and retrieving character sequences as temporary values.
 RuleList getRuleList()
           
 boolean isTerminationRequested()
           Indicate whether the Scanner has been requested to stop.
 AbstractScanState newInstance(InputScanBuffer inputScanBuffer, Appendable appendable, RuleList ruleList)
           
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractScanState

protected AbstractScanState(InputScanBuffer inputScanBuffer,
                            Appendable appendable,
                            RuleList ruleList)
Method Detail

newInstance

public AbstractScanState newInstance(InputScanBuffer inputScanBuffer,
                                     Appendable appendable,
                                     RuleList ruleList)

pushRuleList

public void pushRuleList(RuleList ruleList)
Description copied from interface: ScanState

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

Specified by:
pushRuleList in interface ScanState

popRuleList

public RuleList popRuleList()
Description copied from interface: ScanState

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

Specified by:
popRuleList in interface ScanState

ruleListStackSize

public int ruleListStackSize()
Description copied from interface: ScanState

Return the number of RuleList items pushed on stack.

Specified by:
ruleListStackSize in interface ScanState
Returns:
number of items pushed, or zero if not implemented

pushOutput

public void pushOutput(Appendable appendable)
Description copied from interface: ScanState

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.

Specified by:
pushOutput in interface ScanState

popOutput

public Appendable popOutput()
Description copied from interface: ScanState

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.

Specified by:
popOutput in interface ScanState

outputStackSize

public int outputStackSize()
Description copied from interface: ScanState

Return the number of Appendable items pushed on stack.

Specified by:
outputStackSize in interface ScanState
Returns:
number of items pushed, or zero if not implemented

out

public Writer out()
Description copied from interface: ScanState

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.

Specified by:
out in interface ScanState

get

public CharSequence get(String key)
Description copied from interface: ScanState

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

Specified by:
get in interface ScanState

put

public CharSequence put(String key,
                        CharSequence value)
Description copied from interface: ScanState

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.

Specified by:
put in interface ScanState

containsKey

public boolean containsKey(String key)
Description copied from interface: ScanState

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

Specified by:
containsKey in interface ScanState
Returns:
the previous value, or null if the key has not been used since the last time the keys were cleared.

getMap

public Map<String,CharSequence> getMap()
Description copied from interface: ScanState

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

Specified by:
getMap in interface ScanState

getRuleList

public RuleList getRuleList()

requestTermination

public void requestTermination()
Description copied from interface: ScanState

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

Specified by:
requestTermination in interface ScanState

isTerminationRequested

public boolean isTerminationRequested()
Description copied from interface: ScanState

Indicate whether the Scanner has been requested to stop.

This method is normally used only by implementors.

Specified by:
isTerminationRequested in interface ScanState

getInputScanBuffer

public InputScanBuffer getInputScanBuffer()

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