for (int i = 0; i < copy.length; i++) { AspectValue value = copy[i]; if (value.getAspectType () == AspectType.START_TIME) { Date preferredStart = prefHelper.getReadyAt (task); copy[i] = new TimeAspectValue (AspectType.START_TIME, preferredStart); break; } }
  public void reportChangedExpansion(Expansion cpe) {     if (isDebugEnabled ())      debug (getName () + " : Received changed pe " + 	    cpe.getUID () + " for task " + 	    cpe.getTask ().getUID());    AllocationResult reportedresult = cpe.getReportedResult();    if (reportedresult != null) {      // compare entire allocationresults.      AllocationResult estimatedresult = cpe.getEstimatedResult();      double confidence = reportedresult.getConfidenceRating ();      boolean nullEstimated  = (estimatedresult == null);      // if we are not ignoring low confidence reported values      boolean highConfidence = (!skipLowConfidence || confidence > HIGH_CONFIDENCE);      if ( nullEstimated  || 	   (highConfidence &&	    (! isEqual(estimatedresult, reportedresult)))) { 	if (isDebugEnabled ())          debug (getName () + " : Swapping Alloc Results for task " +                               cpe.getTask ().getUID ());        if (isWarnEnabled() && !reportedresult.isSuccess ())          warn (getName () + " : " + 		cpe.getTask ().getUID () + " failed to allocate.");        cpe.setEstimatedResult(reportedresult);        double prefValue =           cpe.getTask().getPreference(AlpineAspectType.DEMANDRATE).getScoringFunction().getBest().getAspectValue().getValue();        AspectValue[] aspectValues = cpe.getEstimatedResult().getAspectValueResults();	AspectValue [] copy = new AspectValue [aspectValues.length+1];	System.arraycopy (aspectValues, 0, copy, 0, aspectValues.length);	copy[aspectValues.length] = new AspectValue (AlpineAspectType.DEMANDRATE, prefValue);	AllocationResult correctedAR = 	  new AllocationResult(reportedresult.getConfidenceRating(),			       reportedresult.isSuccess(),			       copy);	cpe.setEstimatedResult(correctedAR);                  if (isInfoEnabled())           info (getName () + " : publish changing task " + cpe.getTask ().getUID ());	blackboard.publishChange(cpe);      }    }    else if (!cpe.getTask().getSource ().equals (((PluginBindingSite)getBindingSite()).getAgentIdentifier())) {      error ("ERROR! " + getName () + 	     " : "     + cpe.getTask ().getUID () + 	     " has a null reported allocation.");    }  }