1 package com.calipso.reportgenerator.reportcalculator; 2 3 import com.calipso.reportgenerator.reportcalculator.expression.Expression; 4 import com.calipso.reportgenerator.reportcalculator.expression.Context; 5 import com.calipso.reportgenerator.reportcalculator.expression.RowContext; 6 import com.calipso.reportgenerator.reportcalculator.CubeFilter; 7 8 import java.util.Map ; 9 10 14 public class ExpressionCubeFilter extends CubeFilter { 15 Expression expresion; 16 private Map paramValues; 17 18 public Map getParamValues() { 19 return paramValues; 20 } 21 22 26 public ExpressionCubeFilter(Expression expresion, Map paramValues) { 27 this.paramValues = paramValues; 28 this.expresion = expresion; 29 } 30 31 36 private Context getContext(Object [] row) { 37 return new RowContext(row); 38 } 39 40 44 public String getOqlText() { 45 return expresion.toString(); 46 } 47 48 53 public boolean matches(Object [] row) { 54 if(expresion!=null){ 55 return expresion.valueIn(getContext(row)); 56 }else{ 57 return true; 58 } 59 } 60 61 65 public String toString() { 66 if(expresion!=null){ 67 return expresion.toString(); 68 }else{ 69 return ""; 70 } 71 } 72 73 public boolean equals(Object obj){ 74 if (super.equals(obj))return true; 75 if (obj instanceof ExpressionCubeFilter && ((ExpressionCubeFilter)obj).expresion!=null){ 76 return expresion.equals(((ExpressionCubeFilter)obj).expresion); 77 } 78 return false; 79 } 80 81 82 } 83 | Popular Tags |