本文整理匯總了Java中org.joda.time.DateTimeUtils.getIntervalChronology方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTimeUtils.getIntervalChronology方法的具體用法?Java DateTimeUtils.getIntervalChronology怎麽用?Java DateTimeUtils.getIntervalChronology使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.joda.time.DateTimeUtils
的用法示例。
在下文中一共展示了DateTimeUtils.getIntervalChronology方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: BasePeriod
import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
* Creates a period from the given interval endpoints.
*
* @param startInstant interval start, null means now
* @param endInstant interval end, null means now
* @param type which set of fields this period supports, null means standard
* @throws IllegalArgumentException if period type is invalid
*/
protected BasePeriod(ReadableInstant startInstant, ReadableInstant endInstant, PeriodType type) {
super();
type = checkPeriodType(type);
if (startInstant == null && endInstant == null) {
iType = type;
iValues = new int[size()];
} else {
long startMillis = DateTimeUtils.getInstantMillis(startInstant);
long endMillis = DateTimeUtils.getInstantMillis(endInstant);
Chronology chrono = DateTimeUtils.getIntervalChronology(startInstant, endInstant);
iType = type;
iValues = chrono.get(this, startMillis, endMillis);
}
}
示例2: setInto
import org.joda.time.DateTimeUtils; //導入方法依賴的package包/類
/**
* Sets the values of the mutable duration from the specified interval.
*
* @param writablePeriod the period to modify
* @param object the interval to set from
* @param chrono the chronology to use
*/
public void setInto(ReadWritablePeriod writablePeriod, Object object, Chronology chrono) {
ReadableInterval interval = (ReadableInterval) object;
chrono = (chrono != null ? chrono : DateTimeUtils.getIntervalChronology(interval));
long start = interval.getStartMillis();
long end = interval.getEndMillis();
int[] values = chrono.get(writablePeriod, start, end);
for (int i = 0; i < values.length; i++) {
writablePeriod.setValue(i, values[i]);
}
}