예제 #1
0
 @Override
 public T eval(List<String> tuple) {
   double result = 0;
   for (ValueExpression factor : _veList) {
     Object currentVal = factor.eval(tuple);
     NumericConversion currentType = (NumericConversion) (factor.getType());
     result += currentType.toDouble(currentVal);
   }
   return _wrapper.fromDouble(result);
 }
예제 #2
0
  @Override
  public T eval(List<String> tuple) {
    final ValueExpression firstVE = _veList.get(0);
    final Object firstObj = firstVE.eval(tuple);
    final NumericConversion firstType = (NumericConversion) firstVE.getType();
    double result = firstType.toDouble(firstObj);

    for (int i = 1; i < _veList.size(); i++) {
      final ValueExpression currentVE = _veList.get(i);
      final Object currentObj = currentVE.eval(tuple);
      final NumericConversion currentType = (NumericConversion) currentVE.getType();
      result -= currentType.toDouble(currentObj);
    }
    return _wrapper.fromDouble(result);
  }