} } else { AspectValue[] npresult = (AspectValue[]) withdrawAR.getAspectValueResults(); mergedPhasedResults.add(merge(merged, npresult));
        public AllocationResult calculate(Workflow wf, TaskScoreTable tst, AllocationResult currentar) {            AspectValue[] merged = new AspectValue[AlpineAspectType.LAST_ALPINE_ASPECT + 1];            long startTime = Long.MAX_VALUE;            long endTime = Long.MIN_VALUE;            boolean success = true;            float rating = 0.0f;            int tstSize = tst.size();            AllocationResult withdrawAR = null; // Remember this when we see it            Task parentTask = wf.getParentTask();            AllocationResultHelper helper = new AllocationResultHelper(parentTask, null);            AllocationResult bestAR = helper.getAllocationResult();            AspectValue[] curr = bestAR.getAspectValueResults();            for (int i = 0; i < curr.length; i++) {                AspectValue av = curr[i];                int type = av.getAspectType();                merged[type] = av;                switch (type) {                case START_TIME:                    startTime = (long) av.getValue();                    break;                case END_TIME:                    endTime = (long) av.getValue();                    break;                }            }            for (int i = 0; i < tstSize; i++) {                AllocationResult ar = tst.getAllocationResult(i);                if (ar == null) return null; // bail if undefined                Task t = tst.getTask(i);                Verb verb = t.getVerb();                boolean isWithdraw =                    verb.equals(Constants.Verb.Withdraw)                    || verb.equals(Constants.Verb.ProjectWithdraw);                if (isWithdraw) {                    if (ar == null) return null;                    withdrawAR = ar;                }                AspectValue[] avs = ar.getAspectValueResults();                success = success && ar.isSuccess();                rating += ar.getConfidenceRating();                for (int j = 0; j < avs.length; j++) {                    int type = avs[j].getAspectType();                    switch (type) {                    case AspectType.START_TIME:                        break;                    case AspectType.END_TIME:                        break;                    case AspectType.QUANTITY:                        if (isWithdraw) merged[AspectType.QUANTITY] = avs[j];                        break;                    default:                        if (!isWithdraw) merged[type] = avs[j];                    }                }            }            List mergedPhasedResults = new ArrayList();            List withdrawPhasedResults = withdrawAR.getPhasedAspectValueResults();            for (int i = 0, n = withdrawPhasedResults.size(); i < n; i++) {                AspectValue[] oneResult = (AspectValue[]) withdrawPhasedResults.get(i);                mergedPhasedResults.add(merge(merged, oneResult));            }            return new AllocationResult(rating / tstSize, success,                                        merge(merged, null), mergedPhasedResults);        }