GXPARSE hosted by SourceForge.net Logo

ca.gorman.util.scan
Class ScanRuleDelegator

java.lang.Object
  extended by ca.gorman.util.scan.ScanRuleDelegator
All Implemented Interfaces:
ScanAction, ScanMatch, ScanRule

public class ScanRuleDelegator
extends Object
implements ScanRule

Realization of ScanRule that delegates to a ScanMatch and a scanAction.


Constructor Summary
protected ScanRuleDelegator(ScanMatch scanMatch)
           Delegate to a ScanMatch, but do nothing when match succeeds.
protected ScanRuleDelegator(ScanMatch scanMatch, ScanAction scanAction)
           Delegate to a ScanMatch and a scanAction.
 
Method Summary
 void action(ScanState scanState, MatchedText matchedText)
           Do something with text that has been matched by a scanRule.
 MatchedText match(ScanBuffer scanBuffer)
           Test characters at the beginning of a ScanBuffer, removing any matching CharSequence and returning it as MatchedText.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScanRuleDelegator

protected ScanRuleDelegator(ScanMatch scanMatch)

Delegate to a ScanMatch, but do nothing when match succeeds.

Throws:
NullPointerException - if any scanMatch is null

ScanRuleDelegator

protected ScanRuleDelegator(ScanMatch scanMatch,
                            ScanAction scanAction)

Delegate to a ScanMatch and a scanAction.

Throws:
NullPointerException - if any parameter is null
Method Detail

match

public MatchedText match(ScanBuffer scanBuffer)
                  throws IOException
Description copied from interface: ScanMatch

Test characters at the beginning of a ScanBuffer, removing any matching CharSequence and returning it as MatchedText.

This method is reentrant and thread-safe.

Specified by:
match in interface ScanMatch
Returns:
the matched text, or null if there is no match.
Throws:
IOException

action

public void action(ScanState scanState,
                   MatchedText matchedText)
            throws IOException
Description copied from interface: ScanAction

Do something with text that has been matched by a scanRule.

Specified by:
action in interface ScanAction
Throws:
IOException

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