Package org.libreplan.business.calendars.entities.AvailabilityTimeLine

Examples of org.libreplan.business.calendars.entities.AvailabilityTimeLine.Interval


            public boolean matches(Object object) {
                if (object instanceof List) {
                    List<Interval> intervals = (List<Interval>) object;
                    List<DatePoint[]> pairsOfPoints = pointsAsPairs();
                    for (int i = 0; i < intervals.size(); i++) {
                        Interval interval = intervals.get(i);
                        DatePoint[] pair = pairsOfPoints.get(i);
                        if (!(pair[0].equals(interval.getStart()) && pair[1]
                                .equals(interval.getEnd()))) {
                            return false;
                        }
                    }
                    return true;
                }
View Full Code Here


        List<Interval> validPeriods = realAvailability.getValidPeriods();
        if (validPeriods.isEmpty()) {
            return new ThereAreNoValidPeriods(calendar, availability);
        }

        Interval last = getLast(validPeriods);
        Interval first = validPeriods.get(0);
        final boolean isOpenEnded = last.getEnd().equals(EndOfTime.create())
                || first.getStart().equals(StartOfTime.create());
        if (isOpenEnded) {
            return new CapacityAvailable();
        }
        return thereIsCapacityOn(calendar, effortToAllocate, resourcesPerDay,
                validPeriods);
View Full Code Here

                });
    }

    private List<Interval> getIntervalsRelatedWith(Criterion criterion,
            LocalDate startInclusive, LocalDate endExclusive) {
        Interval queryInterval = AvailabilityTimeLine.Interval.create(
                startInclusive, endExclusive);

        List<Interval> result = new ArrayList<Interval>();
        for (Interval each : getIntervalsThisAllocationInterferesWith(criterion)) {
            if (queryInterval.overlaps(each)) {
                result.add(queryInterval.intersect(each));
            }
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.calendars.entities.AvailabilityTimeLine.Interval

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.