Esempio n. 1
0
 @Override
 public void finished() {
   contextsPending--;
   if (contextsPending == 0) {
     if (expression.union.hitExpression != null) {
       for (EvaluationInfo evalInfo : new ArrayList<EvaluationInfo>(evaluations.values()))
         evalInfo.doFinish();
       if (positionTracker != null) positionTracker.expired();
     }
   }
   tryToFinish();
 }
Esempio n. 2
0
 @SuppressWarnings({"unchecked", "UnnecessaryBoxing"})
 private Object computeResultItem(LongTreeMap result) {
   switch (expression.resultType) {
     case NODESET:
     case STRINGS:
     case NUMBERS:
       return new ArrayList(result.values());
     case NUMBER:
       if (expression.relativeExpression instanceof Count) return new Double(result.size());
       else {
         double d = 0;
         for (LongTreeMap.Entry entry = result.firstEntry(); entry != null; entry = entry.next())
           d += (Double) entry.value;
         return d;
       }
     case BOOLEAN:
       return !result.isEmpty();
     default:
       if (result.isEmpty()) return expression.resultType.defaultValue;
       else return result.firstEntry().value;
   }
 }