net.sourceforge.chaperon.process
Class PatternProcessor

java.lang.Object
  extended bynet.sourceforge.chaperon.process.PatternProcessor

public class PatternProcessor
extends java.lang.Object

Processor for pattern, which try for matching against a pattern.

Version:
CVS $Id: PatternProcessor.java,v 1.9 2003/12/09 19:55:53 benedikta Exp $
Author:
Stephan Michels

Constructor Summary
PatternProcessor()
          Create a new pattern processor.
PatternProcessor(PatternAutomaton automaton)
          Create a new pattern processor.
 
Method Summary
 java.lang.String getGroup()
          Return the text, which in last match was found.
 java.lang.String getGroup(int group)
          Return the text of the specifed group, which in last match was found.
 int getGroupCount()
          Return count of groups.
 int getGroupEnd()
          Return the end position of the last match.
 int getGroupEnd(int group)
          Return the end position of a group from the last match.
 int getGroupStart()
          Return the start position of the last match.
 int getGroupStart(int group)
          Return the start position of a group from the last match.
 boolean match(char[] text)
          Matches for pattern.
 boolean match(char[] text, int start)
          Matches for pattern at specified position within the text.
 boolean search(char[] text)
          Search a postion, where the processor is successful.
 boolean search(char[] text, int start)
          Search a postion, where the processor is successful.
 void setPatternAutomaton(PatternAutomaton automaton)
          Set the pattern automaton.
 void setVerbose(boolean verbose)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternProcessor

public PatternProcessor()
Create a new pattern processor.


PatternProcessor

public PatternProcessor(PatternAutomaton automaton)
Create a new pattern processor.

Parameters:
automaton - Automaton, which the processor should use.
Method Detail

setPatternAutomaton

public void setPatternAutomaton(PatternAutomaton automaton)
Set the pattern automaton.

Parameters:
automaton - Automaton, which the processor should use.

search

public boolean search(char[] text)
Search a postion, where the processor is successful.

Parameters:
text - Text.
Returns:
Next first position where the parser is successfull otherwise -1.

search

public boolean search(char[] text,
                      int start)
Search a postion, where the processor is successful.

Parameters:
text - Text.
start - Start position within the text.
Returns:
Next first position where the parser is successfull otherwise -1.

setVerbose

public void setVerbose(boolean verbose)

match

public boolean match(char[] text)
Matches for pattern.

Parameters:
text - Text.
Returns:
True, if the processor matches successfully.

match

public boolean match(char[] text,
                     int start)
Matches for pattern at specified position within the text.

Parameters:
text - Text
start - Position within the text.
Returns:
True, if the processor matches successfully.

getGroup

public java.lang.String getGroup()
Return the text, which in last match was found.

Returns:
Text.

getGroup

public java.lang.String getGroup(int group)
Return the text of the specifed group, which in last match was found.

Parameters:
group - Index of group;
Returns:
Text

getGroupCount

public int getGroupCount()
Return count of groups.

Returns:
Count of groups.

getGroupStart

public int getGroupStart()
Return the start position of the last match.

Returns:
Start position.

getGroupStart

public int getGroupStart(int group)
Return the start position of a group from the last match.

Parameters:
group - Index of group.
Returns:
Start position.

getGroupEnd

public int getGroupEnd()
Return the end position of the last match.

Returns:
End position.

getGroupEnd

public int getGroupEnd(int group)
Return the end position of a group from the last match.

Parameters:
group - Index of group.
Returns:
End position.


Copyright ? 2003 Chaperon project. All Rights Reserved.