/**
   * UpdatePV looks for differences between the reported and estimated allocation results. If they
   * are different then the estimated value is set to the reported value in both the cases.
   */
  public static void updatePV(PlanElement pe, CollectionSubscription sub) {

    if (pe.getReportedResult() != null) {
      // compare the result objects.
      // If they are NOT ==, re-set the estimated result.
      // For now ignore whether their compositions are equal.
      AllocationResult repar = pe.getReportedResult();
      AllocationResult estar = pe.getEstimatedResult();
      if ((estar == null) || (!(repar == estar))) {
        pe.setEstimatedResult(repar);
        sub.getSubscriber().publishChange(pe);
      }
    }
  }
  /** 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);
        }
      }
    }
  }