com.saelist.stx.operators
Class YankOperator
java.lang.Object
com.saelist.stx.operators.AbstractOperator
com.saelist.stx.operators.YankOperator
- All Implemented Interfaces:
- Operator
- public class YankOperator
- extends AbstractOperator
See Operator for general description of the Operator
concept in stx. YankOperator replaces the text of the pair with the
concatenated text of its descendants. The text is indented with two
spaces for each generation.
text
'
this is
a message composed of
multiple lines.
into
text
this is\na message composed of\n multiple lines.
|
Method Summary |
void |
init()
Caches the pattern and replacement settings in variables. |
void |
operate(Pair pair)
Replaces the text of pairs that match pattern with the concatenated text
of its descendands and removes the descendants. |
java.lang.String |
subText(Pair pair,
java.lang.String indent)
Recursively accumulates the text of the descendants of pair
while removing them from their parents. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
YankOperator
public YankOperator()
init
public void init()
- Caches the pattern and replacement settings in variables.
- Overrides:
init in class AbstractOperator
operate
public void operate(Pair pair)
- Replaces the text of pairs that match pattern with the concatenated text
of its descendands and removes the descendants.
- Specified by:
operate in interface Operator- Specified by:
operate in class AbstractOperator
subText
public java.lang.String subText(Pair pair,
java.lang.String indent)
- Recursively accumulates the text of the descendants of
pair
while removing them from their parents.