View Javadoc
1 /*** 2 * InvertibleOperator.java 3 * 4 * $Author: mballesteros $ 5 * $Date: 2003/11/28 19:18:03 $ 6 * $Revision: 1.1 $ 7 */ 8 package net.sf.jec; 9 10 /*** Abstract class parent of every invertible operator. An invertible operator 11 * is an operator able to perform the inverse function. Thus, being y=OP.apply(x) 12 * is true that x=OP.applyInverse(y) 13 * 14 * @author mballesteros 15 */ 16 public abstract class InvertibleOperator extends Operator { 17 18 /*** Creates a new operator that nest another operator 19 */ 20 public InvertibleOperator() { 21 super(); 22 } 23 24 /*** Creates a new operator that nest another operator 25 */ 26 public InvertibleOperator(Operator nestedOp) { 27 super(nestedOp); 28 } 29 30 /*** 31 */ 32 public final void applyInverse(Object rootCtx, Object ctx, Object value) 33 throws EvaluationException { 34 if (nestedOp != null && ctx != null) ctx = nestedOp.apply(rootCtx, ctx); 35 inverseMap(rootCtx, ctx, value); 36 } 37 38 /*** Sets the given value if this operator is at the end of the operator chain 39 * or just resolves the context object and passes it to the next operator in 40 * the chain. 41 * @param rootCtx The root context, needed for operators that require 42 * expression evaluation from root point. Example: Indexer operators 43 * @param ctx The current context where the operator will work over 44 * @param value The value to set. 45 */ 46 protected abstract void inverseMap(Object rootCtx, Object ctx, Object value) 47 throws EvaluationException; 48 }

This page was automatically generated by Maven