View Javadoc
1 /*** 2 * AssignOperator.java 3 * 4 * $Author: mballesteros $ 5 * $Date: 2003/11/28 19:18:04 $ 6 * $Revision: 1.1 $ 7 */ 8 package net.sf.jec; 9 10 /*** AssignOperator does an assignation to an invertible operator. The value is 11 * calculated from another operator. 12 * 13 * @author mballesteros 14 */ 15 public class AssignOperator extends Operator { 16 17 private InvertibleOperator op1; 18 private Operator op2; 19 private boolean throwExceptions; 20 21 /*** Creates a new instance of AssignOperator */ 22 public AssignOperator(InvertibleOperator op1, Operator op2, 23 boolean throwExceptions) { 24 this.op1 = op1; 25 this.op2 = op2; 26 this.throwExceptions = throwExceptions; 27 } 28 29 /*** Returns the associated value to the given context and root context 30 * @param rootCtx The root context, needed for operators that require 31 * expression evaluation from root point. Example: Indexer operators 32 * @param ctx The current context where the operator will work over 33 */ 34 protected Object directMap(Object rootCtx, Object ctx) throws EvaluationException { 35 op1.applyInverse(rootCtx, ctx, op2.apply(rootCtx, ctx)); 36 return Boolean.TRUE; 37 } 38 39 /*** Returns a function representation String for this operator 40 */ 41 public String toFunctionString() { 42 return "Assign(" + op1 + ", " + op2 + ")"; 43 } 44 45 /*** Returns an expression String representation for this operator 46 */ 47 public String toExpressionString() { 48 return op1 + " = " + op2; 49 } 50 }

This page was automatically generated by Maven