예제 #1
0
 @Override
 @SuppressWarnings({"unchecked"})
 public void finished(Evaluation evaluation) {
   LongTreeMap.Entry<EvaluationInfo> entry = evaluations.getEntry(evaluation.order);
   assert entry.value.eval == evaluation;
   if (evaluation instanceof PredicateEvaluation) {
     PredicateEvaluation predicateEvaluation = (PredicateEvaluation) evaluation;
     if (predicateEvaluation.result != null) {
       if (predicateEvaluation.result instanceof Evaluation) {
         entry.value.eval = (Evaluation) predicateEvaluation.result;
         entry.value.eval.addListener(this);
         return;
       } else {
         entry.value.setResult(predicateEvaluation.result);
         entry.value.eval = null;
         pendingCount--;
       }
     } else {
       entry.value.doDiscards();
       evaluations.deleteEntry(entry);
       if (entry.value.eval != null) pendingCount--;
     }
   } else {
     entry.value.setResult(evaluation.getResult());
     entry.value.eval = null;
     pendingCount--;
   }
   tryToFinish();
 }
예제 #2
0
 @Override
 public void discard(long order) {
   LongTreeMap.Entry<EvaluationInfo> entry = evaluations.getEntry(order);
   if (entry != null) {
     if (entry.value.discard() == 0) {
       evaluations.deleteEntry(entry);
       if (entry.value.eval != null) {
         pendingCount--;
         entry.value.eval.removeListener(this);
       }
     }
   }
 }