com.simonstl.fragment
Class FragmentRule

java.lang.Object
  |
  +--com.simonstl.fragment.FragmentRule

public class FragmentRule
extends java.lang.Object

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.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.

Version:
0.03 24 June 2001
Author:
Simon St.Laurent

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)
           
 boolean getSkipFirst()
           
 void print()
           
 java.util.ArrayList processResult(java.lang.String elementContent)
           
 void setIsSplit(boolean split)
           
 void setRepeat(boolean doesRepeat)
           
 void setSkipFirst(boolean skip)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matchRegEx

public java.lang.String matchRegEx

results

public java.util.ArrayList results

repeats

public boolean repeats

skipFirst

public boolean skipFirst

isSplit

public boolean isSplit
Constructor Detail

FragmentRule

public FragmentRule(java.lang.String regEx)

FragmentRule

public FragmentRule(java.lang.String regEx,
                    java.util.ArrayList endResults)

FragmentRule

public FragmentRule(java.lang.String regEx,
                    java.util.ArrayList endResults,
                    boolean doesRepeat)
Method Detail

setRepeat

public void setRepeat(boolean doesRepeat)

getRepeat

public boolean getRepeat()

setSkipFirst

public void setSkipFirst(boolean skip)

getSkipFirst

public boolean getSkipFirst()

setIsSplit

public void setIsSplit(boolean split)

getIsSplit

public boolean getIsSplit()

getResults

public DocComponent getResults(int which)

processResult

public java.util.ArrayList processResult(java.lang.String elementContent)

print

public void print()

addResult

public void addResult(DocComponent resultComponent)