|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.simonstl.fragment.FragmentRule
Each FragmentRule describes a regular expression and the results of the fragmentation it produces, described as a series of child elements.
Currently, the series is a simple list. Eventually it may provide for collections (appropriate for the HTML style element and some SVG) and for attribute results.
Rules currently don't keep track of which elements they apply to. That information is stored
in the FragmentRules
element.
This may change in future versions.
Version 0.08 adds better print() and toString() support.
Version 0.07 now returns DocComponent
objects more effectively, uses the cleanDuplicate()
method to ensure that object reuse doesn't mar results.
Version 0.06 moved regular expression processing to the RegexProc
class, a first step toward permitting the use of pluggable regular expressions processors.
Version 0.05 adds support for DocComponents rather than Elements, genericizing processing a bit.
Version 0.04 moved regular expression processing from the FragmentFilter
into the processRule() method.
Version 0.03 adds support for the split attribute.
Version 0.02 adds information about repetition and skipping the first result. By default,
rules don't repeat and are assumed to skip the first result. If the repeat
attribute
of the fragmentRule
element is set to "true
", the rule will cycle through
the elements in the produces
element rather than just proceeding once. Similarly, setting
the skipFirst
attribute to "false
will preserve the first match on the
regular expression.
Field Summary | |
boolean |
isSplit
|
java.lang.String |
matchRegEx
|
boolean |
repeats
|
java.util.ArrayList |
results
|
boolean |
skipFirst
|
Constructor Summary | |
FragmentRule(java.lang.String regEx)
|
|
FragmentRule(java.lang.String regEx,
java.util.ArrayList endResults)
|
|
FragmentRule(java.lang.String regEx,
java.util.ArrayList endResults,
boolean doesRepeat)
|
Method Summary | |
void |
addResult(DocComponent resultComponent)
|
boolean |
getIsSplit()
|
boolean |
getRepeat()
|
DocComponent |
getResults(int which)
|
int |
getSize()
|
boolean |
getSkipFirst()
|
void |
print()
|
java.util.ArrayList |
processResult(java.lang.String elementContent)
|
void |
setIsSplit(boolean split)
|
void |
setRepeat(boolean doesRepeat)
|
void |
setSkipFirst(boolean skip)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public java.lang.String matchRegEx
public java.util.ArrayList results
public boolean repeats
public boolean skipFirst
public boolean isSplit
Constructor Detail |
public FragmentRule(java.lang.String regEx)
public FragmentRule(java.lang.String regEx, java.util.ArrayList endResults)
public FragmentRule(java.lang.String regEx, java.util.ArrayList endResults, boolean doesRepeat)
Method Detail |
public void setRepeat(boolean doesRepeat)
public boolean getRepeat()
public void setSkipFirst(boolean skip)
public boolean getSkipFirst()
public void setIsSplit(boolean split)
public boolean getIsSplit()
public int getSize()
public DocComponent getResults(int which)
public java.util.ArrayList processResult(java.lang.String elementContent)
public void print()
public java.lang.String toString()
toString
in class java.lang.Object
public void addResult(DocComponent resultComponent)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |