Package pspdash.EVSchedule

Examples of pspdash.EVSchedule.Period


    protected synchronized void preparePeriods(List histPeriods) {
        cleanUp();

        Date effDate = getEffectiveDate();
        Period p;

        // grow the schedule until the final schedule period falls
        // after the effective date.
        if (defaultPlanDirectTime != 0)
            while (true) {
                p = get(periods.size()-1);
                if (p.getBeginDate().compareTo(effDate) >= 0)
                    break;

                double newCumTime =
                    p.cumPlanDirectTime + defaultPlanDirectTime;
                super.getPlannedCompletionDate(newCumTime, newCumTime);
            }

        p = getLast();
        lastPeriodEnd = p.endDate.getTime();
        long lastPeriodStart = p.getBeginDate().getTime();
        defaultPeriodLen = lastPeriodEnd - lastPeriodStart;

        splitAt(effDate);
        rewriteHistory(effDate, histPeriods);
        recalcCumPlanTimes();
View Full Code Here


    /** split the schedule at a given date.
     */
    protected void splitAt(Date effDate) {
        // find the period that contains the given date.
        Period r = get(effDate);
        int pos = periods.indexOf(r);

        // if the date already begins or ends with the given date, we
        // don't need to do anything.
        if (r.endDate.equals(effDate) || r.getBeginDate().equals(effDate))
            return;

        // calculate what percentage of the period lies on each side
        // of the given date.
        long eff = effDate.getTime();
        long start = r.getBeginDate().getTime();
        long end = r.endDate.getTime();
        double duration = end - start;
        double left = (eff - start) / duration;
        double right = (end - eff) / duration;

        // create a new period that ends on the given date; insert it
        // before the existing period; adjust "previous" pointers
        Period l = new Period(effDate, 0.0);
        l.previous = r.previous;
        r.previous = l;
        periods.add(pos, l);

        // proportionally distribute plan total time
View Full Code Here

        l.cumEarnedValue = r.cumEarnedValue;
    }

    private void rewriteHistory(Date effDate, List histPeriods) {
        for (int i = 1;  i < periods.size() && i < histPeriods.size();  i++) {
            Period p = get(i);
            Period h = (Period) histPeriods.get(i);
            if (p.endDate.compareTo(effDate) <= 0) {
                p.planTotalTime = h.actualDirectTime + h.actualIndirectTime;
                p.planDirectTime = h.actualDirectTime;
                p.cumPlanDirectTime = h.cumActualDirectTime;
                p.cumPlanValue = h.cumEarnedValue;
View Full Code Here

        }
    }


    private void simplifyPeriods(Date effectiveDate) {
        Period p = getLast();
        while (p != null) {
            maybeSimplifyPeriod(p, effectiveDate);
            p = p.previous;
        }
    }
View Full Code Here


    private void maybeSimplifyPeriod(Period b, Date effectiveDate) {
        int bPos = periods.indexOf(b);
        if (bPos < 2) return;
        Period a = b.previous;
        int aPos = bPos - 1;

        boolean aIsPast = a.getBeginDate().before(effectiveDate);
        boolean bIsPast = b.getBeginDate().before(effectiveDate);
        if (aIsPast != bIsPast) return;

        if (!aIsPast) {
            double aSpeed = calcPeriodSpeed(a);
View Full Code Here

        double cumPlanDirectTime = 0;

        Iterator i = periods.iterator();
        Date endDate = null;
        while (i.hasNext()) {
            Period p = (Period) i.next();
            if (p.endDate.compareTo(effDate) > 0) {
                p.planDirectTime = p.planDirectTime * timeErrRatio;
                p.cumPlanDirectTime = cumPlanDirectTime + p.planDirectTime;
            }
            cumPlanDirectTime = p.cumPlanDirectTime;
View Full Code Here

        Date result = getHypotheticalDate(cumPlanTime, false);
        if (NEVER.equals(result) || (result.getTime() <= lastPeriodEnd))
            return result;

        else {
            Period p = new Period(result, cumPlanTime - lastPeriodCumPlanTime);
            p.previous = getLast();
            periods.add(p);
            p.cumPlanDirectTime = lastPeriodCumPlanTime = cumPlanTime;
            lastPeriodEnd = result.getTime();
            return result;
View Full Code Here

TOP

Related Classes of pspdash.EVSchedule.Period

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.