Structured Text Toolkit

com.saelist.stx.operators
Class SelectOperator

java.lang.Object
  extended bycom.saelist.stx.operators.AbstractOperator
      extended bycom.saelist.stx.operators.SelectOperator
All Implemented Interfaces:
Operator

public class SelectOperator
extends AbstractOperator

See Operator for general description of the Operator concept in stx. SelectOperator removes all siblings of each visited pair from the parent aswell as the pair it self and promotes the children for the pair up one level. A typecal use case is to select a language version. For example select on "//de" will transform the structure


   subject
     en=English subject.
     de=Deutsches Subjekt.
     dk=Danskt subjekt.
   message
     en
       This is the english
       message.
     de
       Das ist die deutsche
       Nachricht.
     dk
       Det er det danske
       beskjed.


into

   subject=Deutsches Subjekt.
   message
     Das ist die deutsche
     Nachricht.


Field Summary
 
Fields inherited from class com.saelist.stx.operators.AbstractOperator
config, logger
 
Constructor Summary
SelectOperator()
           
 
Method Summary
 void init()
          Descendants should overide this if they vant to cache elements of config in member variables or do some other inital setup.
 void operate(Pair pair)
          Performs the select operation on the given pair.
 
Methods inherited from class com.saelist.stx.operators.AbstractOperator
init, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectOperator

public SelectOperator()
Method Detail

init

public void init()
Description copied from class: AbstractOperator
Descendants should overide this if they vant to cache elements of config in member variables or do some other inital setup.

Overrides:
init in class AbstractOperator

operate

public void operate(Pair pair)
Performs the select operation on the given pair.

Specified by:
operate in interface Operator
Specified by:
operate in class AbstractOperator
Throws:
java.lang.IllegalStateException - if this hasn't been initialized.

Structured Text Toolkit