net.sf.jec
Class Operator

java.lang.Object
  extended bynet.sf.jec.Operator
Direct Known Subclasses:
ArithmeticOperator, AssignOperator, BooleanOperator, ConstantOperator, GroupOperator, InvertibleOperator, MethodOperator, SelectOperator, TableOperator

public abstract class Operator
extends java.lang.Object

Abstract class parent of every operator. An operator might nest another operator, resulting in a function composition: OP1(x), OP2(OP1(x))

Thus, applying OP2 to an object 'x', implies appliying OP1 to 'x' and then OP2 to the result.

Author:
mballesteros

Field Summary
protected  Operator[] argOps
           
protected  Operator nestedOp
          Nested operator
static boolean showFunctionString
           
 
Constructor Summary
Operator()
          Creates a new operator that nest another operator
Operator(Operator nestedOp)
          Creates a new operator that nest another operator
 
Method Summary
 java.lang.Object apply(java.lang.Object rootCtx, java.lang.Object ctx)
           
protected abstract  java.lang.Object directMap(java.lang.Object rootCtx, java.lang.Object ctx)
          Returns the associated value to the given context and root context
 void setArgumentOperators(Operator[] argOps)
           
 void setNestedOperator(Operator nestedOp)
          Sets the operator's nested operator
abstract  java.lang.String toExpressionString()
          Returns an expression String representation for this operator
abstract  java.lang.String toFunctionString()
          Returns a function representation String for this operator
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

showFunctionString

public static boolean showFunctionString

nestedOp

protected Operator nestedOp
Nested operator


argOps

protected Operator[] argOps
Constructor Detail

Operator

public Operator()
Creates a new operator that nest another operator


Operator

public Operator(Operator nestedOp)
Creates a new operator that nest another operator

Method Detail

setNestedOperator

public void setNestedOperator(Operator nestedOp)
Sets the operator's nested operator


setArgumentOperators

public void setArgumentOperators(Operator[] argOps)

toString

public java.lang.String toString()

toFunctionString

public abstract java.lang.String toFunctionString()
Returns a function representation String for this operator


toExpressionString

public abstract java.lang.String toExpressionString()
Returns an expression String representation for this operator


apply

public final java.lang.Object apply(java.lang.Object rootCtx,
                                    java.lang.Object ctx)
                             throws EvaluationException
Throws:
EvaluationException

directMap

protected abstract java.lang.Object directMap(java.lang.Object rootCtx,
                                              java.lang.Object ctx)
                                       throws EvaluationException
Returns the associated value to the given context and root context

Parameters:
rootCtx - The root context, needed for operators that require expression evaluation from root point. Example: Indexer operators
ctx - The current context where the operator will work over
Throws:
EvaluationException


Copyright © 2003 SourceForge. All Rights Reserved.