Пример #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);
  }
Пример #3
0
  // from Operator
  @Override
  public List<String> process(List<String> tuple) {
    _numTuplesProcessed++;
    if (_distinct != null) {
      tuple = _distinct.process(tuple);
      if (tuple == null) {
        return null;
      }
    }
    String tupleHash;
    if (_groupByType == GB_PROJECTION) {
      tupleHash =
          MyUtilities.createHashString(
              tuple, _groupByColumns, _groupByProjection.getExpressions(), _map);
    } else {
      tupleHash = MyUtilities.createHashString(tuple, _groupByColumns, _map);
    }
    T value = _storage.update(tuple, tupleHash);
    String strValue = _wrapper.toString(value);

    // propagate further the affected tupleHash-tupleValue pair
    List<String> affectedTuple = new ArrayList<String>();
    affectedTuple.add(tupleHash);
    affectedTuple.add(strValue);

    return affectedTuple;
  }
Пример #4
0
 @Override
 public String evalString(List<String> tuple) {
   T result = eval(tuple);
   return _wrapper.toString(result);
 }