public class RepeatGroup extends StructRule implements StructGroup
As long as one rule or group is found but not finished all lines will be passed to that rule, otherwhise an attempt is made to match incoming lines to any of the rules in this group. The first rule that matches will be used
BOL, EMPTY_LINE, EOB, EOL, m_attribute, m_out, m_terminate, SPACEMAP, XML| Constructor and Description |
|---|
RepeatGroup(java.lang.Object objectId,
int outputType)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(StructRule rule)
add a rule to this Group.
|
void |
addTransformat(Transformat format)
add a
Transformat to this rule |
void |
clearBuffer()
general method to clear a buffer which an implementation
of a StructRule can implement to keep all data between
StructRule.isFound() and StructRule.isFinished(). |
java.lang.Object |
getObject()
get the Object created as a result of the input matching
this group.
|
int |
getOutputType()
the type of output
StructGroup.getObject() will deliver if the
rules are matched to the output |
void |
insertTransformat(int pos,
Transformat format) |
void |
readline(java.lang.String line)
read a line from the parser for processing, without
tracking the line number
|
void |
readline(java.lang.String line,
int lineno)
read a line from the parser for processing, with
tracking the line number
|
void |
setParent(StructGroup parent)
set the parent for this rule
|
getParent, getTransformats, isFinished, isFound, isTerminate, removeWhitespace, reset, set, setFinished, setFoundclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetTransformats, isFinished, isFound, resetpublic RepeatGroup(java.lang.Object objectId,
int outputType)
objectId - String, id for the object to createoutputType - int, either (XML|MAP)public void readline(java.lang.String line)
The StructParser supplies the input line for line. This
does not limit the rules to one line. This is only dependant
on StructRule.isFound() and StructRule.isFinished()
This method calls StructRule.readline(String, int) with lineno=-1
and will ignore lineno for information purposes
readline in interface StructGroupreadline in class StructRuleline - String, the line to be readStructRule.readline(String, int),
StructParserpublic void readline(java.lang.String line,
int lineno)
The StructParser supplies the input line for line. This
does not limit the rules to one line. This is only dependant
on StructRule.isFound() and StructRule.isFinished()
readline in interface StructGroupreadline in class StructRuleline - String, the line to be readlineno - int, the linenumber of this lineStructParserpublic void add(StructRule rule)
StructGroup.isFound() is true and until StructGroup.isFinished()
is true.add in interface StructGrouprule - StructRule, the rule to add to this grouppublic void addTransformat(Transformat format)
StructRuleTransformat to this rule
A transformater is a class which will be called to
format the values from an input to a value for the output.
With an implementation one can do simple transformations
SimpleTransformat like trimming whitespaces or
setting the value to uppercase or do complex transformations
ComplexTransformat changing multiple values
in a resulting Object
addTransformat in class StructRuleformat - Transformatpublic void insertTransformat(int pos,
Transformat format)
insertTransformat in class StructRulepublic java.lang.Object getObject()
getObject in interface StructGroupStructGroup.isFound() is never true
for this group and might not be correctly set if StructGroup.isFinished() never is truepublic int getOutputType()
StructGroup.getObject() will deliver if the
rules are matched to the outputgetOutputType in interface StructGrouppublic void clearBuffer()
StructRule.isFound() and StructRule.isFinished().
This method is called from reset to clear the buffer between two independant uses of this rule
clearBuffer in class StructRuleStructRule.reset()public void setParent(StructGroup parent)
setParent in interface StructGroupsetParent in class StructRuleparent - StructGroup the parent to use