Exemplo n.º 1
0
 @Override
 public void run() {
   if (finished) throw new IllegalArgumentException("Goal is already finished: " + goal);
   long start = System.currentTimeMillis();
   try {
     super.run(); // calls goalFinished when absofuckinglutely done
     if (pauseReason instanceof TaskDoneReason) {
       Object exitobj = ((TaskDoneReason) pauseReason).exitObj;
       if (exitobj instanceof Error) throw (Error) exitobj;
       if (exitobj instanceof RuntimeException) throw (RuntimeException) exitobj;
     }
   } finally {
     long d = System.currentTimeMillis() - start;
     ++evalCount;
     stats.finishedRun(goal, d);
   }
 }
Exemplo n.º 2
0
 @pausable
 public <R extends Result> List<R> evaluate(final Collection<? extends Goal<R>> goals) {
   final List<Slot<R>> slots = new ArrayList<Slot<R>>(goals.size());
   willAddSubgoals();
   try {
     for (Goal<R> goal : goals) slots.add(subgoal(goal));
   } finally {
     didAddSubgoals();
   }
   Task.pause(
       new PauseReason() {
         public boolean isValid() {
           return subgoalCount > 0;
         }
       });
   List<R> results = new ArrayList<R>(slots.size());
   for (Slot<R> slot : slots) results.add(slot.result());
   return results;
 }
Exemplo n.º 3
0
 @pausable
 public static AnalysisTask currentTask() {
   return (AnalysisTask) Task.getCurrentTask();
 }