public class PositionGroup extends StructRule implements StructGroup
This would be the same as MarkGroup with BOL and EOL as beginning
and end, but this one is a bit faster, while it does not need to check.
Keep in mind that StructRule.isFinished() and StructRule.isFound() are always
the same and that the rules of this Group need to match the content of the line
for this group to be found and finished.
Mostly used with PositionRule
BOL, EMPTY_LINE, EOB, EOL, m_attribute, m_out, m_terminate, SPACEMAP, XML| Constructor and Description |
|---|
PositionGroup()
Constructor
|
PositionGroup(int outputType)
Constructor
|
PositionGroup(java.lang.String 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 |
protected 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 |
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, insertTransformat, isFinished, isFound, isTerminate, removeWhitespace, reset, set, setFinished, setFoundclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetTransformats, isFinished, isFound, resetpublic PositionGroup()
outputType is set to XML by default
public PositionGroup(int outputType)
outputType - int set type to (XML|MAP)public PositionGroup(java.lang.String objectId,
int outputType)
objectId - Object, the id of the Object to createoutputType - int, set type to (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 lineStructParserprotected 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 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 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 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 setParent(StructGroup parent)
setParent in interface StructGroupsetParent in class StructRuleparent - StructGroup the parent to use