Class LookUpUpdate

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, InputConsumer, OutputProducer, Serializable, Comparable

    public class LookUpUpdate
    extends AbstractSpreadSheetTransformer
    Updates the lookup table (in form of a spreadsheet) that passes through using the specified rules.
    The rules can contain variables.

    The rules use the following grammar:

    expr_list ::= expr_list expr_part | expr_part

    expr_part ::= conditional | assignment

    conditional ::= if expr then assignments end
    | if expr then assignments else assignments end

    assignments ::= assignments assignment | assignment
    assignment ::=
    VARIABLE := expr;
    | all ( "regexp" ) := expr;

    expr ::= ( expr )
    | NUMBER
    | STRING
    | BOOLEAN
    | VARIABLE

    | true
    | false

    | -expr

    | expr < expr
    | expr <= expr
    | expr > expr
    | expr >= expr
    | expr = expr
    | expr != expr

    | not expr
    | expr and expr
    | expr or expr

    | expr + expr
    | expr - expr
    | expr * expr
    | expr / expr
    | expr % expr
    | expr ^ expr

    | abs ( expr )
    | sqrt ( expr )
    | cbrt ( expr )
    | log ( expr )
    | log10 ( expr )
    | exp ( expr )
    | sin ( expr )
    | sinh ( expr )
    | cos ( expr )
    | cosh ( expr )
    | tan ( expr )
    | tanh ( expr )
    | atan ( expr )
    | atan2 ( exprY , exprX )
    | hypot ( exprX , exprY )
    | signum ( expr )
    | rint ( expr )
    | floor ( expr )
    | pow[er] ( expr , expr )
    | ceil ( expr )
    | min ( expr1 , expr2 )
    | max ( expr1 , expr2 )

    Notes:
    - Variables are either all alphanumeric and -/_ (e.g., "ABc_1-2") or any character
    apart from "'" enclosed by "'" and "'" (e.g., "'Hello World'").
    - The 'all' method applies the value to all the values in the lookup table
    that match the regular expression.
    - Variables starting with '_' are considered local and don't get transferred back out.


    Input/output:
    - accepts:
       adams.data.spreadsheet.SpreadSheet
    - generates:
       adams.data.spreadsheet.SpreadSheet


    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: LookUpUpdate
     
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
        default: 
     
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
        default: false
     
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this 
        actor encounters an error; the error gets propagated; useful for critical 
        actors.
        default: false
     
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing 
        actor handler must have this enabled as well.
        default: false
     
    -key-column <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: keyColumn)
        The index of the column in the spreadsheet to use as key; An index is a 
        number starting with 1; column names (case-sensitive) as well as the following 
        placeholders can be used: first, second, third, last_2, last_1, last; numeric 
        indices can be enforced by preceding them with '#' (eg '#12'); column names 
        can be surrounded by double quotes.
        default: 1
        example: An index is a number starting with 1; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
     
    -value-column <adams.data.spreadsheet.SpreadSheetColumnIndex> (property: valueColumn)
        The index of the column in the spreadsheet to use as value; An index is 
        a number starting with 1; column names (case-sensitive) as well as the following 
        placeholders can be used: first, second, third, last_2, last_1, last; numeric 
        indices can be enforced by preceding them with '#' (eg '#12'); column names 
        can be surrounded by double quotes.
        default: 2
        example: An index is a number starting with 1; column names (case-sensitive) as well as the following placeholders can be used: first, second, third, last_2, last_1, last; numeric indices can be enforced by preceding them with '#' (eg '#12'); column names can be surrounded by double quotes.
     
    -rules <adams.parser.LookUpUpdateText> (property: rules)
        The rules for updating the lookup table.
        default: 
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • LookUpUpdate

        public LookUpUpdate()
    • Method Detail

      • setKeyColumn

        public void setKeyColumn​(SpreadSheetColumnIndex value)
        Sets the index of the column to act as key in the lookup table.
        Parameters:
        value - the index
      • getKeyColumn

        public SpreadSheetColumnIndex getKeyColumn()
        Returns the index of the column to act as key in the lookup table.
        Returns:
        the index
      • keyColumnTipText

        public String keyColumnTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setValueColumn

        public void setValueColumn​(SpreadSheetColumnIndex value)
        Sets the index of the column to act as value in the lookup table.
        Parameters:
        value - the index
      • getValueColumn

        public SpreadSheetColumnIndex getValueColumn()
        Returns the index of the column to act as value in the lookup table.
        Returns:
        the index
      • valueColumnTipText

        public String valueColumnTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setRules

        public void setRules​(LookUpUpdateText value)
        Sets the rules to use for updating.
        Parameters:
        value - the rules
      • getRules

        public LookUpUpdateText getRules()
        Returns the rules for updating.
        Returns:
        the rules
      • rulesTipText

        public String rulesTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message