|
|||||||||
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 (now RegexProcFactory
)
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 | |
protected ComponentList |
appliesTo
|
protected int |
isSplit
|
protected int |
matchLevel
|
protected java.lang.String |
pattern
|
protected RegExInt |
regExProc
|
protected boolean |
repeats
|
protected ComponentList |
results
|
protected boolean |
skipFirst
|
Constructor Summary | |
FragmentRule(java.lang.String regEx)
|
Method Summary | |
void |
addAppliesTo(DocComponent ruleComponent)
|
void |
addResult(DocComponent resultComponent)
|
void |
complete()
|
int |
getIsSplit()
|
boolean |
getRepeat()
|
DocComponent |
getResults(int which)
|
int |
getSize()
|
boolean |
getSkipFirst()
|
void |
print()
|
java.util.ArrayList |
processResult(java.lang.String elementContent)
|
void |
setIsSplit(int split)
|
void |
setMatchLevel(int level)
|
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 |
protected java.lang.String pattern
protected ComponentList appliesTo
protected ComponentList results
protected boolean repeats
protected boolean skipFirst
protected int isSplit
protected int matchLevel
protected RegExInt regExProc
Constructor Detail |
public FragmentRule(java.lang.String regEx)
Method Detail |
public void complete()
public void setRepeat(boolean doesRepeat)
public boolean getRepeat()
public void setSkipFirst(boolean skip)
public boolean getSkipFirst()
public void setIsSplit(int split)
public int getIsSplit()
public int getSize()
public void setMatchLevel(int level)
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)
public void addAppliesTo(DocComponent ruleComponent)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |