Example usage for org.joda.time DateTime withHourOfDay

List of usage examples for org.joda.time DateTime withHourOfDay

Introduction

In this page you can find the example usage for org.joda.time DateTime withHourOfDay.

Prototype

public DateTime withHourOfDay(int hour) 

Source Link

Document

Returns a copy of this datetime with the hour of day field updated.

Usage

From source file:TVShowTimelineMaker.timeConstraints.Relation.java

@Override
public boolean complexApplyConstraint() {
    boolean changed = this.applyConstraint();
    if ((!this.firstEpisode.isMarkedForComplexEval()) && this.secondEpisode.isMarkedForComplexEval()) {
        if ((this.kind == RelationKind.FIXED_TIME_BEFORE) || (this.kind == RelationKind.SAME_DAY_OF_YEAR)
                || (this.kind == RelationKind.LESS_THEN_BEFORE) || (this.kind == RelationKind.SAME_TIME_AS)
                || (this.kind == RelationKind.BEFORE_SAME_DAY)) {
            this.firstEpisode.setUpForComplexEval();
        }/*  ww  w.ja v a 2s.  co  m*/
    }
    if (this.firstEpisode.isMarkedForComplexEval() && (!this.secondEpisode.isMarkedForComplexEval())) {
        if ((this.kind == RelationKind.FIXED_TIME_BEFORE) || (this.kind == RelationKind.SAME_DAY_OF_YEAR)
                || (this.kind == RelationKind.LESS_THEN_BEFORE) || (this.kind == RelationKind.SAME_TIME_AS)
                || (this.kind == RelationKind.BEFORE_SAME_DAY)) {
            this.secondEpisode.setUpForComplexEval();
        }
    }
    if (this.firstEpisode.isMarkedForComplexEval() && this.secondEpisode.isMarkedForComplexEval()) {
        NavigableSet<DateTime> firstEpisodeStartDates;
        NavigableSet<DateTime> firstEpisodeEndDates;
        NavigableSet<DateTime> secondEpisodeStartDates;
        NavigableSet<DateTime> secondEpisodeEndDates;
        if (this.firstEpisode instanceof OnceDayEvent) {
            OnceDayEvent firstEpisodeDayEvent = (OnceDayEvent) this.firstEpisode;
            firstEpisodeStartDates = firstEpisodeDayEvent.getPossibleDays();
            firstEpisodeEndDates = firstEpisodeDayEvent.getPossibleDays();
        } else if (this.firstEpisode instanceof OncePeriodEvent) {
            OncePeriodEvent firstEpisodePeriodEvent = (OncePeriodEvent) this.firstEpisode;
            firstEpisodeStartDates = firstEpisodePeriodEvent.getStartPossibleDays();
            firstEpisodeEndDates = firstEpisodePeriodEvent.getEndPossibleDays();
        } else {
            throw new UnsupportedOperationException(
                    this.firstEpisode.getClass().getCanonicalName() + "Not supported yet");
        }
        if (this.secondEpisode instanceof OnceDayEvent) {
            OnceDayEvent secondEpisodeDayEvent = (OnceDayEvent) this.secondEpisode;
            secondEpisodeStartDates = secondEpisodeDayEvent.getPossibleDays();
            secondEpisodeEndDates = secondEpisodeDayEvent.getPossibleDays();
        } else if (this.secondEpisode instanceof OncePeriodEvent) {
            OncePeriodEvent secondEpisodePeriodEvent = (OncePeriodEvent) this.secondEpisode;
            secondEpisodeStartDates = secondEpisodePeriodEvent.getStartPossibleDays();
            secondEpisodeEndDates = secondEpisodePeriodEvent.getEndPossibleDays();
        } else {
            throw new UnsupportedOperationException(
                    this.firstEpisode.getClass().getCanonicalName() + "Not supported yet");
        }
        Iterator<DateTime> firstEpisodeStartDatesIterator = firstEpisodeStartDates.iterator();
        Iterator<DateTime> secondEpisodeStartDatesIterator = secondEpisodeStartDates.iterator();
        DateTime curFirstEpisodeStartDate = firstEpisodeStartDatesIterator.next();
        DateTime curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
        Iterator<DateTime> firstEpisodeEndDatesIterator = firstEpisodeEndDates.iterator();
        Iterator<DateTime> secondEpisodeEndDatesIterator = secondEpisodeEndDates.iterator();
        DateTime curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next();
        DateTime curSecondEpisodeEndDate = secondEpisodeEndDatesIterator.next();
        boolean cont = true;
        if (this.kind == RelationKind.IMMEDIATELY_BEFORE) {
            DateTime startOfLastDay = secondEpisodeStartDates.last().withHourOfDay(1);
            /*while (indexInToFirstEpisodeDatesDates < firstEpisodeDates.size()) {
             if (firstEpisodeDates.get(indexInToFirstEpisodeDatesDates).isAfter(startOfLastDay)) {
             firstEpisodeDates.remove(indexInToFirstEpisodeDatesDates);
             changed = true;
             } else {
             indexInToFirstEpisodeDatesDates++;
             }
             }*/
            while (!firstEpisodeEndDates.isEmpty()) {
                if (firstEpisodeEndDates.last().isAfter(startOfLastDay)) {
                    firstEpisodeEndDates.pollLast();
                    changed = true;
                } else {
                    break;
                }
            }
            DateTime endOfFirstPossibleDay = firstEpisodeEndDates.first().withHourOfDay(23);
            while (cont) {
                if (endOfFirstPossibleDay.isAfter(curSecondEpisodeStartDate)) {
                    secondEpisodeStartDatesIterator.remove();
                    if (secondEpisodeStartDatesIterator.hasNext()) {
                        curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
                    } else {
                        cont = false;
                    }
                    changed = true;
                } else {
                    //indexInToSecondEpisodeDatesDates++;
                    break;
                }
            }
        } else if (this.kind == RelationKind.BEFORE) {
            DateTime startOfLastDay = secondEpisodeStartDates.last().withHourOfDay(1);
            /*while (indexInToFirstEpisodeDatesDates < firstEpisodeDates.size()) {
             if (firstEpisodeDates.get(indexInToFirstEpisodeDatesDates).isAfter(startOfLastDay)) {
             firstEpisodeDates.remove(indexInToFirstEpisodeDatesDates);
             changed = true;
             } else {
             indexInToFirstEpisodeDatesDates++;
             }
             }*/
            while (!firstEpisodeEndDates.isEmpty()) {
                if (firstEpisodeEndDates.last().isAfter(startOfLastDay)) {
                    firstEpisodeEndDates.pollLast();
                    changed = true;
                } else {
                    break;
                }
            }
            DateTime endOfFirstPossibleDay = firstEpisodeEndDates.first().withHourOfDay(23);
            while (cont) {
                if (endOfFirstPossibleDay.isAfter(curSecondEpisodeStartDate)) {
                    secondEpisodeStartDatesIterator.remove();
                    if (secondEpisodeStartDatesIterator.hasNext()) {
                        curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
                    } else {
                        cont = false;
                    }
                    changed = true;
                } else {
                    //indexInToSecondEpisodeDatesDates++;
                    break;
                }
            }
        } else if (this.kind == RelationKind.FIXED_TIME_BEFORE) {
            //while (indexInToFirstEpisodeDatesDates < firstEpisodeEndDates.size()) {
            while (cont) {
                //DateTime later = firstEpisodeEndDates.get(indexInToFirstEpisodeDatesDates).plus(time);
                DateTime later = curFirstEpisodeEndDate.plus(this.time);
                if (secondEpisodeStartDates.contains(later)) {
                    if (firstEpisodeEndDatesIterator.hasNext()) {
                        curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next();
                    } else {
                        break;
                    }
                } else {
                    firstEpisodeEndDatesIterator.remove();
                    if (firstEpisodeEndDatesIterator.hasNext()) {
                        curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next();
                    } else {
                        cont = false;
                    }
                    changed = true;
                }
            }
            while (cont) {
                DateTime earlier = curSecondEpisodeStartDate.minus(this.time);
                if (firstEpisodeEndDates.contains(earlier)) {
                    if (secondEpisodeStartDatesIterator.hasNext()) {
                        curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
                    } else {
                        break;
                    }
                } else {
                    secondEpisodeStartDatesIterator.remove();
                    if (secondEpisodeStartDatesIterator.hasNext()) {
                        curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
                    } else {
                        cont = false;
                    }
                    changed = true;
                }
            }
        } else if (this.kind == RelationKind.LESS_THEN_BEFORE) {
            DateTime startOfDay = curSecondEpisodeStartDate.withHourOfDay(1);
            DateTime tempEarliestPossibleDate = curSecondEpisodeStartDate.minus(this.time).withHourOfDay(1);
            while (cont) {
                if (curFirstEpisodeEndDate.isBefore(tempEarliestPossibleDate)) {
                    firstEpisodeEndDatesIterator.remove();
                    if (firstEpisodeEndDatesIterator.hasNext()) {
                        curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next();
                    } else {
                        cont = false;
                    }
                    changed = true;
                } else if (curFirstEpisodeEndDate.isAfter(startOfDay)) {
                    //if (indexInToSecondEpisodeDatesDates < secondEpisodeStartDates.size()) {
                    if (secondEpisodeStartDatesIterator.hasNext()) {
                        curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
                        startOfDay = curSecondEpisodeStartDate.withHourOfDay(1);
                        tempEarliestPossibleDate = curSecondEpisodeStartDate.minus(this.time).withHourOfDay(1);
                    } else {
                        firstEpisodeEndDatesIterator.remove();
                        if (firstEpisodeEndDatesIterator.hasNext()) {
                            curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next();
                        } else {
                            cont = false;
                        }
                        changed = true;
                    }
                } else {
                    if (firstEpisodeEndDatesIterator.hasNext()) {
                        curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next();
                    } else {
                        cont = false;
                    }
                }
            }
            firstEpisodeStartDatesIterator = firstEpisodeStartDates.iterator();
            secondEpisodeStartDatesIterator = secondEpisodeStartDates.iterator();
            curFirstEpisodeStartDate = firstEpisodeStartDatesIterator.next();
            curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
            firstEpisodeEndDatesIterator = firstEpisodeEndDates.iterator();
            secondEpisodeEndDatesIterator = secondEpisodeEndDates.iterator();
            curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next();
            curSecondEpisodeEndDate = secondEpisodeEndDatesIterator.next();
            cont = true;
            DateTime endOfDay = curFirstEpisodeEndDate.withHourOfDay(23);
            DateTime tempLatestPossibleDate = curFirstEpisodeEndDate.plus(this.time).withHourOfDay(23);
            while (cont) {
                if (curSecondEpisodeStartDate.isBefore(endOfDay)) {
                    secondEpisodeStartDatesIterator.remove();
                    if (secondEpisodeStartDatesIterator.hasNext()) {
                        curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
                    } else {
                        cont = false;
                    }
                    changed = true;
                } else if (curSecondEpisodeStartDate.isAfter(tempLatestPossibleDate)) {
                    //indexInToFirstEpisodeDatesDates++;
                    //if (indexInToFirstEpisodeDatesDates < firstEpisodeEndDates.size()) {
                    if (firstEpisodeEndDatesIterator.hasNext()) {
                        curFirstEpisodeEndDate = firstEpisodeEndDatesIterator.next();
                        endOfDay = curFirstEpisodeEndDate.withHourOfDay(23);
                        tempLatestPossibleDate = curFirstEpisodeEndDate.plus(this.time).withHourOfDay(23);
                    } else {
                        secondEpisodeStartDatesIterator.remove();
                        if (secondEpisodeStartDatesIterator.hasNext()) {
                            curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
                        } else {
                            cont = false;
                        }
                        changed = true;
                    }
                } else {
                    if (secondEpisodeStartDatesIterator.hasNext()) {
                        curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
                    } else {
                        cont = false;
                    }
                }
            }
        } else if (this.kind == RelationKind.SAME_DAY_OF_YEAR) {
            changed |= this.mSameTimeOfYearConstraint.complexApplyConstraint();
        } else if ((this.kind == RelationKind.SAME_TIME_AS) || (this.kind == RelationKind.BEFORE_SAME_DAY)) {
            Iterator<DateTime> iterator = firstEpisodeStartDates.iterator();
            while (iterator.hasNext()) {
                DateTime next = iterator.next();
                if (!secondEpisodeStartDates.contains(next)) {
                    iterator.remove();
                    changed = true;
                }
            }
            iterator = secondEpisodeStartDates.iterator();
            while (iterator.hasNext()) {
                DateTime next = iterator.next();
                if (!firstEpisodeStartDates.contains(next)) {
                    iterator.remove();
                    changed = true;
                }
            }
            iterator = firstEpisodeEndDates.iterator();
            while (iterator.hasNext()) {
                DateTime next = iterator.next();
                if (!secondEpisodeEndDates.contains(next)) {
                    iterator.remove();
                    changed = true;
                }
            }
            iterator = secondEpisodeEndDates.iterator();
            while (iterator.hasNext()) {
                DateTime next = iterator.next();
                if (!firstEpisodeEndDates.contains(next)) {
                    iterator.remove();
                    changed = true;
                }
            }
        } else if (this.kind == RelationKind.MORE_THEN_BEFORE) {
            DateTime tempEarliestPossibleDateForSecondEpisode = firstEpisodeEndDates.first().plus(this.time)
                    .withHourOfDay(1);
            DateTime tempLatestPossibleDateForFirstEpisode = secondEpisodeStartDates.last().minus(this.time)
                    .withHourOfDay(23);
            /*while (indexInToFirstEpisodeDatesDates < firstEpisodeDates.size()) {
             if (firstEpisodeDates.get(indexInToFirstEpisodeDatesDates).isAfter(tempLatestPossibleDateForFirstEpisode)) {
             firstEpisodeDates.remove(indexInToFirstEpisodeDatesDates);
             changed = true;
             } else {
             indexInToFirstEpisodeDatesDates++;
             }
             }*/
            while (!firstEpisodeEndDates.isEmpty()) {
                if (firstEpisodeEndDates.last().isAfter(tempLatestPossibleDateForFirstEpisode)) {
                    firstEpisodeEndDates.pollLast();
                    changed = true;
                } else {
                    break;
                }
            }
            while (cont) {
                if (tempEarliestPossibleDateForSecondEpisode.isAfter(curSecondEpisodeStartDate)) {
                    secondEpisodeStartDatesIterator.remove();
                    if (secondEpisodeStartDatesIterator.hasNext()) {
                        curSecondEpisodeStartDate = secondEpisodeStartDatesIterator.next();
                    } else {
                        cont = true;
                    }
                    changed = true;
                } else {
                    //indexInToSecondEpisodeDatesDates++;
                    break;
                }
            }
        }
    }
    return changed;
}

From source file:TVShowTimelineMaker.timeConstraints.Relation.java

public boolean consistentWithConstraint(DateTime inFirstDay, DateTime inSecondDay) {
    if ((this.kind == RelationKind.IMMEDIATELY_BEFORE) || (this.kind == RelationKind.BEFORE)) {
        return inFirstDay.isBefore(inSecondDay.withHourOfDay(1));
    } else if (this.kind == RelationKind.FIXED_TIME_BEFORE) {
        return inFirstDay.plus(this.time).equals(inSecondDay);
    } else if (this.kind == RelationKind.LESS_THEN_BEFORE) {
        DateTime tempEarliestPossibleDate = inSecondDay.minus(this.time).withHourOfDay(1);
        return inFirstDay.isAfter(tempEarliestPossibleDate)
                && inFirstDay.isBefore(inSecondDay.withHourOfDay(1));
    } else if (this.kind == RelationKind.SAME_DAY_OF_YEAR) {
        return (inFirstDay.getMonthOfYear() == inSecondDay.getMonthOfYear())
                && (inFirstDay.getDayOfMonth() == inSecondDay.getDayOfMonth());
    } else if ((this.kind == RelationKind.SAME_TIME_AS) || (this.kind == RelationKind.BEFORE_SAME_DAY)) {
        return this.mSameTimeOfYearConstraint.consistentWithConstraint(inFirstDay, inSecondDay);
    } else if (this.kind == RelationKind.MORE_THEN_BEFORE) {
        DateTime earyer = inSecondDay.minus(this.time).withHourOfDay(1);
        return inFirstDay.isBefore(earyer);
    } else {// ww  w  .  ja va2  s. com
        return true;
    }
}

From source file:TVShowTimelineMaker.timeConstraints.Relation.java

@Override
public boolean consistentWithConstraint(T inFirstPlacement, S inSecondPlacement) {
    DateTime inFirstStartTime;/* w  ww.  ja  v a2 s. c  o m*/
    DateTime inFirstEndTime;
    DateTime inSecondStartTime;
    DateTime inSecondEndTime;
    if (this.firstEpisode instanceof OnceDayEvent) {
        OnceDayEvent.OnceDayEventPlacement curOnceDayEventPlacement = (OnceDayEvent.OnceDayEventPlacement) inFirstPlacement;
        inFirstStartTime = curOnceDayEventPlacement.day;
        inFirstEndTime = curOnceDayEventPlacement.day;
    } else {
        OncePeriodEvent.OncePeriodEventPlacement curOncePeriodEventPlacement = (OncePeriodEvent.OncePeriodEventPlacement) inFirstPlacement;
        inFirstStartTime = curOncePeriodEventPlacement.startDay;
        inFirstEndTime = curOncePeriodEventPlacement.endDay;
    }
    if (this.secondEpisode instanceof OnceDayEvent) {
        OnceDayEvent.OnceDayEventPlacement curOnceDayEventPlacement = (OnceDayEvent.OnceDayEventPlacement) inSecondPlacement;
        inSecondStartTime = curOnceDayEventPlacement.day;
        inSecondEndTime = curOnceDayEventPlacement.day;
    } else {
        OncePeriodEvent.OncePeriodEventPlacement curOncePeriodEventPlacement = (OncePeriodEvent.OncePeriodEventPlacement) inSecondPlacement;
        inSecondStartTime = curOncePeriodEventPlacement.startDay;
        inSecondEndTime = curOncePeriodEventPlacement.endDay;
    }
    if ((this.kind == RelationKind.IMMEDIATELY_BEFORE) || (this.kind == RelationKind.BEFORE)) {
        return inFirstEndTime.isBefore(inSecondStartTime.withHourOfDay(1));
    } else if (this.kind == RelationKind.FIXED_TIME_BEFORE) {
        return inFirstEndTime.plus(this.time).equals(inSecondStartTime);
    } else if (this.kind == RelationKind.LESS_THEN_BEFORE) {
        DateTime tempEarliestPossibleDate = inSecondStartTime.minus(this.time).withHourOfDay(1);
        return inFirstEndTime.isAfter(tempEarliestPossibleDate)
                && inFirstEndTime.isBefore(inSecondStartTime.withHourOfDay(1));
    } else if (this.kind == RelationKind.SAME_DAY_OF_YEAR) {
        return this.mSameTimeOfYearConstraint.consistentWithConstraint(inFirstPlacement, inSecondPlacement);
    } else if ((this.kind == RelationKind.SAME_TIME_AS) || (this.kind == RelationKind.BEFORE_SAME_DAY)) {
        return inFirstStartTime.equals(inSecondStartTime) && inFirstEndTime.equals(inSecondEndTime);
    } else if (this.kind == RelationKind.MORE_THEN_BEFORE) {
        DateTime earyer = inSecondStartTime.minus(this.time).withHourOfDay(1);
        return inFirstEndTime.isBefore(earyer);
    } else {
        return true;
    }
}

From source file:TVShowTimelineMaker.timeConstraints.Relation.java

@Override
public Event[] increaseWhat(Placement<?> inValues[]) {
    DateTime inFirstStartTime;/*  w w w  . j a  v  a2 s.  c om*/
    DateTime inFirstEndTime;
    DateTime inSecondStartTime;
    DateTime inSecondEndTime;
    if (this.firstEpisode instanceof OnceDayEvent) {
        OnceDayEvent.OnceDayEventPlacement curOnceDayEventPlacement = (OnceDayEvent.OnceDayEventPlacement) inValues[0];
        inFirstStartTime = curOnceDayEventPlacement.day;
        inFirstEndTime = curOnceDayEventPlacement.day;
    } else {
        return new Event[] { this.firstEpisode, this.secondEpisode };
    }
    if (this.secondEpisode instanceof OnceDayEvent) {
        OnceDayEvent.OnceDayEventPlacement curOnceDayEventPlacement = (OnceDayEvent.OnceDayEventPlacement) inValues[1];
        inSecondStartTime = curOnceDayEventPlacement.day;
        inSecondEndTime = curOnceDayEventPlacement.day;
    } else {
        return new Event[] { this.firstEpisode, this.secondEpisode };
    }
    if ((this.kind == RelationKind.IMMEDIATELY_BEFORE) || (this.kind == RelationKind.BEFORE)) {
        if (!inFirstEndTime.isBefore(inSecondStartTime.withHourOfDay(1))) {
            return new Event[] { this.secondEpisode };
        }
    } else if (this.kind == RelationKind.FIXED_TIME_BEFORE) {
        //inFirstEndTime.plus(this.time).equals(inSecondStartTime);
        DateTime later = inFirstEndTime.plus(this.time);
        if (later.isBefore(inSecondStartTime)) {
            return new Event[] { this.firstEpisode };
        } else if (later.isAfter(inSecondStartTime)) {
            return new Event[] { this.secondEpisode };
        }
    } else if (this.kind == RelationKind.LESS_THEN_BEFORE) {
        DateTime tempEarliestPossibleDate = inSecondStartTime.minus(this.time).withHourOfDay(1);
        if (!inFirstEndTime.isAfter(tempEarliestPossibleDate)) {
            return new Event[] { this.firstEpisode };
        }
        if (!inFirstEndTime.isBefore(inSecondStartTime.withHourOfDay(1))) {
            return new Event[] { this.secondEpisode };
        }
    } else if (this.kind == RelationKind.SAME_DAY_OF_YEAR) {
        return this.mSameTimeOfYearConstraint.increaseWhat(inValues);
    } else if ((this.kind == RelationKind.SAME_TIME_AS) || (this.kind == RelationKind.BEFORE_SAME_DAY)) {
        //inFirstStartTime.equals(inSecondStartTime) && inFirstEndTime.equals(inSecondEndTime);
        if (inFirstStartTime.isBefore(inSecondStartTime) || inFirstEndTime.isBefore(inSecondEndTime)) {
            return new Event[] { this.firstEpisode };
        } else if (inFirstStartTime.isAfter(inSecondStartTime) || inFirstEndTime.isAfter(inSecondEndTime)) {
            return new Event[] { this.secondEpisode };
        }
    } else if (this.kind == RelationKind.MORE_THEN_BEFORE) {
        DateTime earyer = inSecondStartTime.minus(this.time).withHourOfDay(1);
        if (!inFirstEndTime.isBefore(earyer)) {
            return new Event[] { this.secondEpisode };
        }
    }
    return new Event[] {};
}

From source file:TVShowTimelineMaker.timeline.OnceDayEvent.java

@Override
public boolean addSuggestedDay(DateTime inDate) {
    final DateTime transformedDate = inDate.withHourOfDay(12).withMinuteOfHour(0).withSecondOfMinute(0)
            .withMillisOfSecond(0);//www . j a  v  a2  s .  c o m
    return this.SuggestedDays.add(transformedDate);
}

From source file:TVShowTimelineMaker.timeline.OnceDayEvent.java

/**
 * @param earliestPossibleDate the earliestPossibleDate to set
 *///from ww  w .ja  v  a 2  s.c o  m
public void setEarliestPossibleDate(DateTime earliestPossibleDate) {
    this.earliestPossibleDate = earliestPossibleDate.withHourOfDay(10);
    this.lastmodifyed = System.currentTimeMillis();
}

From source file:TVShowTimelineMaker.timeline.OnceDayEvent.java

/**
 * @param latestPossibleDate the latestPossibleDate to set
 *///from  www .j a v  a 2s  . c om
public void setLatestPossibleDate(DateTime latestPossibleDate) {
    this.latestPossibleDate = latestPossibleDate.withHourOfDay(14);
    this.lastmodifyed = System.currentTimeMillis();
}

From source file:TVShowTimelineMaker.timeline.OnceDayEvent.java

@Override
public boolean setAfter(DateTime inTime) {
    boolean changed = false;
    DateTime transformedTime = inTime.withHourOfDay(1);
    if (!this.earliestPossibleDate.isAfter(transformedTime)) {
        this.setEarliestPossibleDate(transformedTime);
        changed = true;// ww w .  j  a v  a  2s  . com
    }
    return changed;
}

From source file:TVShowTimelineMaker.timeline.OnceDayEvent.java

@Override
public boolean setBefore(DateTime inTime) {
    boolean changed = false;
    DateTime transformedTime = inTime.withHourOfDay(23);
    if (!this.latestPossibleDate.isBefore(transformedTime)) {
        this.setLatestPossibleDate(transformedTime);
        changed = true;/*from   ww  w.jav a 2s  .  c  o  m*/
    }
    return changed;
}

From source file:TVShowTimelineMaker.timeline.OncePeriodEvent.java

public void setEarliestPossibleDateForStart(DateTime earliestPossibleDate) {
    this.earliestPossibleDateForStart = earliestPossibleDate.withHourOfDay(10);
    this.lastmodifyed = System.currentTimeMillis();
}