Esempio n. 1
0
  /** Takes a subscription, gets the changed list and updates the changedList. */
  public static void updateAllocationResult(IncrementalSubscription sub) {

    Enumeration changedPEs = sub.getChangedList();
    while (changedPEs.hasMoreElements()) {
      PlanElement pe = (PlanElement) changedPEs.nextElement();
      if (pe.getReportedResult() != null) {
        // compare entire pv arrays
        AllocationResult repar = pe.getReportedResult();
        AllocationResult estar = pe.getEstimatedResult();
        if ((estar == null) || (!repar.isEqual(estar))) {
          pe.setEstimatedResult(repar);
          sub.getSubscriber().publishChange(pe);
        }
      }
    }
  }
 public Object getValueAt(int row, int column) {
   synchronized (allocations) {
     Allocation[] ary = getAllocationArray();
     if (row >= ary.length) return null;
     Allocation a = ary[row];
     AllocationResult ar = a.getEstimatedResult();
     switch (column) {
       case 0: // The task id
         return a.getTask().getUID();
       case 1: // The failed status
         return ar.isSuccess() ? "Succeeded" : "Failed";
       case 2: // The confidence rating
         return confidenceFormat.format(ar.getConfidenceRating());
     }
     return "???";
   }
 }
 private void checkAllocations(Enumeration en) {
   while (en.hasMoreElements()) {
     Allocation alloc = (Allocation) en.nextElement();
     AllocationResult ar = alloc.getEstimatedResult();
     if (ar != null) {
       if (!allocations.contains(alloc)) {
         allocations.add(alloc);
         tableModel.fireTableDataChanged();
       } else {
         tableModel.fireTableDataChanged();
       }
       if (ar.isSuccess()) {
         removeAlert(alloc);
       } else {
         createAlert(alloc);
       }
     } else {
       removeAllocation(alloc);
     }
   }
 }