List of usage examples for org.joda.time Duration Duration
public Duration(ReadableInstant start, ReadableInstant end)
From source file:kr.debop4j.timeperiod.DateTimeSet.java
License:Apache License
/** * ? ? {@link Duration}? .//from w w w .j ava 2 s .com * * @param startIndex ?? (0 ) * @param count count () */ @Override public List<Duration> getDurations(int startIndex, int count) { Guard.shouldBePositiveOrZeroNumber(startIndex, "startIndex"); Guard.shouldBePositiveNumber(count, "count"); Guard.shouldBe(startIndex < count, "startIndex Count . startIndex=[%d], count=[%d]", startIndex, count); log.trace("duration? ... startIndex=[{}], count=[{}]", startIndex, count); int endIndex = Math.min(startIndex + count, size() - 1); List<Duration> durations = Lists.newArrayList(); Iterator<DateTime> iter = iterator(); DateTime prevItem = null; while (iter.hasNext()) { DateTime currItem = iter.next(); if (prevItem == null) { prevItem = currItem; } else { durations.add(new Duration(prevItem, currItem)); } } return durations; }
From source file:kr.debop4j.timeperiod.TimeInterval.java
License:Apache License
@Override public Duration getDuration() { return new Duration(start, end); }
From source file:kr.debop4j.timeperiod.TimePeriodBase.java
License:Apache License
/** ? TimeSpan , ? <see cref="TimeSpec.MaxPeriodTime"/> ? . */ @Override//from w ww. ja va2 s . c om public Duration getDuration() { return new Duration(getStart(), getEnd()); }
From source file:kr.debop4j.timeperiod.TimePeriodChain.java
License:Apache License
/** period chain? ?? . */ @Override/* w w w. j a va 2s . c o m*/ public void setStart(DateTime value) { if (getFirst() != null) move(new Duration(getStart(), value)); }
From source file:kr.debop4j.timeperiod.TimePeriodChain.java
License:Apache License
@Override public void setEnd(DateTime value) { if (getLast() != null) move(new Duration(getEnd(), value)); }
From source file:kr.debop4j.timeperiod.TimePeriodChain.java
License:Apache License
/** moment ?? duration ?? ? ? ( ? ? ) */ protected void assertSpaceBefore(DateTime moment, Duration duration) { boolean hasSpace = moment != TimeSpec.MinPeriodTime; if (hasSpace) { Duration remaining = new Duration(TimeSpec.MinPeriodTime, moment); hasSpace = duration.compareTo(remaining) <= 0; }//from w w w . j a v a2s . com shouldBe(hasSpace, "duration [%s] is out of range.", duration); }
From source file:kr.debop4j.timeperiod.TimePeriodChain.java
License:Apache License
/** moment ?? duration ?? ? ? ( ? ? ) */ protected void assertSpaceAfter(DateTime moment, Duration duration) { boolean hasSpace = moment != TimeSpec.MaxPeriodTime; if (hasSpace) { Duration remaining = new Duration(moment, TimeSpec.MaxPeriodTime); hasSpace = duration.compareTo(remaining) <= 0; }/*from w w w. ja va 2 s .c om*/ shouldBe(hasSpace, "duration [%s] is out of range.", duration); }
From source file:kr.debop4j.timeperiod.TimePeriodContainer.java
License:Apache License
@Override public void setStart(DateTime value) { if (size() > 0) move(new Duration(getStart(), value)); }
From source file:kr.debop4j.timeperiod.TimePeriodContainer.java
License:Apache License
@Override public void setEnd(DateTime value) { if (size() > 0) move(new Duration(getEnd(), value)); }
From source file:kr.debop4j.timeperiod.TimePeriodContainer.java
License:Apache License
@Override public Duration getDuration() { return hasPeriod() ? new Duration(getStart(), getEnd()) : TimeSpec.MaxDuration; }