List of usage examples for org.joda.time Interval Interval
public Interval(Object interval, Chronology chronology)
From source file:com.stagecents.common.EffectiveDateInterval.java
License:Open Source License
public boolean isEffective(DateTime effectiveDate) { Interval interval = new Interval(startDate, endDate); return interval.contains(effectiveDate); }
From source file:com.stagecents.common.EffectiveDateInterval.java
License:Open Source License
public boolean isEffective(LocalDate effectiveDate) { Interval period = new Interval(startDate, endDate); return period.contains(effectiveDate.toInterval()); }
From source file:com.stagecents.common.EffectiveDateInterval.java
License:Open Source License
/** * Returns the overlap between the effective date range represented by this * EffectivedateInterval object and the given interval. * //from w w w.j av a2s . c om * @param arg The interval to test for overlap. * @return The overlapping interval. */ public Interval getOverlap(Interval arg) { Interval period = new Interval(startDate, endDate); return period.overlap(arg); }
From source file:com.stagecents.hxt.domain.DetailHours.java
License:Open Source License
public DetailHours(SummaryHours summaryHours, Timecard timecard, Position position, float hours, DateTime start, DateTime end, ElementType elementType, Activity activity) { this.summaryHours = summaryHours; this.timecard = timecard; this.position = position; this.hours = hours; this.timeWorked = new Interval(start, end); this.elementType = elementType; this.activity = activity; }
From source file:com.stagecents.hxt.domain.DetailHours.java
License:Open Source License
public void setTimeWorked(DateTime start, DateTime end) { this.timeWorked = new Interval(start, end); }
From source file:com.stagecents.pa.api.ActivityService.java
License:Open Source License
private void updateTimecardHours(Timecard timecard, Position position, LocalDate startDate, LocalDate endDate) { while (timecard.isEffective(startDate)) { Interval duration = new Interval(startDate.toDateTime(activity.getScheduledStart()), startDate.toDateTime(activity.getScheduledEnd())); // Update the time card hours for each element type Iterator<ElementType> iter = position.getElements().iterator(); while (iter.hasNext()) { ElementType e = iter.next(); e.processHours(duration, activity, timecard, position); }/* www . ja va 2 s .c o m*/ // Increment the day startDate = startDate.plusDays(1); if (startDate.isAfter(endDate)) { return; } } }
From source file:com.stagecents.pa.domain.GenericActivity.java
License:Open Source License
@Override public Interval duration() { return new Interval(scheduledStart, scheduledEnd); }
From source file:com.stagecents.pay.domain.Overtime.java
License:Open Source License
@Override public void processHours(Interval interval, Activity activity, Timecard timecard, Position position) { DateTime start = interval.getStart(); DateTime end = interval.getEnd();//from www . j a v a2 s . c o m // 1. Test start time against normal start time. DateTime regStart = start; if (position.getNormalStart() != null) { DateTime normalStart = start.toLocalDate().toDateTime(position.getNormalStart()); regStart = regStart.isBefore(normalStart) ? normalStart : regStart; } // Update the time card with any premium time prior to the position's // normal start if (start.isBefore(regStart)) { updateTimecard(timecard, activity, new Interval(start, regStart)); } // 2. Test end time against minimum call. MinimumCallValue mc = getMinimumCall(new Interval(start, end)); if (mc != null) { long minCall = (long) mc.getDefaultValue() * 1000 * 60 * 60; DateTime minCallEnd = end.plus(minCall); end = end.isBefore(minCallEnd) ? minCallEnd : end; } // Test end time against normal end time. DateTime regEnd = end; if (position.getNormalEnd() != null) { DateTime normalEnd = end.toLocalDate().toDateTime(position.getNormalEnd()); regEnd = normalEnd.isBefore(regEnd) ? normalEnd : regEnd; } // Test end time against maximum time for position. if (position.getMaximumHours() > 0) { float priorHrs = getPriorHours(timecard, regStart.toLocalDate()); long availMillis = (long) (position.getMaximumHours() - priorHrs) * 1000 * 60 * 60; DateTime availEnd = regStart.plus(availMillis); regEnd = availEnd.isBefore(regEnd) ? availEnd : regEnd; } // Update the timecard with any premium time after the position's normal // end if (regEnd.isBefore(end)) { updateTimecard(timecard, activity, new Interval(regEnd, end)); } }
From source file:com.stagecents.pay.domain.RegularWages.java
License:Open Source License
protected void doProcessHours(Interval interval, Activity activity, Timecard timecard, Position position) { DateTime start = interval.getStart(); DateTime end = interval.getEnd();/*w ww .j ava 2s . c o m*/ // Test start time against normal start time. if (position.getNormalStart() != null) { DateTime normalStart = start.toLocalDate().toDateTime(position.getNormalStart()); start = start.isBefore(normalStart) ? normalStart : start; } // Test end time against minimum call. MinimumCallValue mc = getMinimumCall(activity.duration()); if (mc != null) { long minCall = (long) mc.getDefaultValue() * 1000 * 60 * 60; DateTime minCallEnd = end.plus(minCall); end = end.isBefore(minCallEnd) ? minCallEnd : end; } // Test end time against normal end time. if (position.getNormalEnd() != null) { DateTime normalEnd = end.toLocalDate().toDateTime(position.getNormalEnd()); end = end.isAfter(normalEnd) ? normalEnd : end; } // Test end time against maximum time for position. if (position.getMaximumHours() > 0) { float priorHours = getPriorHours(timecard, start.toLocalDate()); long availMillis = (long) (position.getMaximumHours() - priorHours) * 1000 * 60 * 60; DateTime availEnd = start.plus(availMillis); end = availEnd.isBefore(end) ? availEnd : end; } updateTimecard(timecard, activity, new Interval(start, end)); }
From source file:com.tkmtwo.timex.Intervals.java
License:Apache License
public static Interval noMillis(Interval i) { return new Interval(DateTimes.noMillis(i.getStart()), DateTimes.noMillis(i.getEnd())); }