本文整理汇总了Java中org.joda.time.DateTimeField.getDurationField方法的典型用法代码示例。如果您正苦于以下问题:Java DateTimeField.getDurationField方法的具体用法?Java DateTimeField.getDurationField怎么用?Java DateTimeField.getDurationField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.DateTimeField
的用法示例。
在下文中一共展示了DateTimeField.getDurationField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: RemainderDateTimeField
import org.joda.time.DateTimeField; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param field the field to wrap, like "year()".
* @param type the field type this field actually uses
* @param divisor divisor, such as 100 years in a century
* @throws IllegalArgumentException if divisor is less than two
*/
public RemainderDateTimeField(DateTimeField field,
DateTimeFieldType type, int divisor) {
super(field, type);
if (divisor < 2) {
throw new IllegalArgumentException("The divisor must be at least 2");
}
DurationField rangeField = field.getDurationField();
if (rangeField == null) {
iRangeField = null;
} else {
iRangeField = new ScaledDurationField(
rangeField, type.getRangeDurationType(), divisor);
}
iDivisor = divisor;
}
示例2: CutoverField
import org.joda.time.DateTimeField; //导入方法依赖的package包/类
/**
* @param julianField field from the chronology used before the cutover instant
* @param gregorianField field from the chronology used at and after the cutover
* @param cutoverMillis the millis of the cutover
* @param convertByWeekyear
*/
CutoverField(DateTimeField julianField, DateTimeField gregorianField,
long cutoverMillis, boolean convertByWeekyear) {
super(gregorianField.getType());
iJulianField = julianField;
iGregorianField = gregorianField;
iCutover = cutoverMillis;
iConvertByWeekyear = convertByWeekyear;
// Although average length of Julian and Gregorian years differ,
// use the Gregorian duration field because it is more accurate.
iDurationField = gregorianField.getDurationField();
DurationField rangeField = gregorianField.getRangeDurationField();
if (rangeField == null) {
rangeField = julianField.getRangeDurationField();
}
iRangeDurationField = rangeField;
}
示例3: DividedDateTimeField
import org.joda.time.DateTimeField; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param field the field to wrap, like "year()".
* @param type the field type this field will actually use
* @param divisor divisor, such as 100 years in a century
* @throws IllegalArgumentException if divisor is less than two
*/
public DividedDateTimeField(DateTimeField field,
DateTimeFieldType type, int divisor) {
super(field, type);
if (divisor < 2) {
throw new IllegalArgumentException("The divisor must be at least 2");
}
DurationField unitField = field.getDurationField();
if (unitField == null) {
iDurationField = null;
} else {
iDurationField = new ScaledDurationField(
unitField, type.getDurationType(), divisor);
}
iDivisor = divisor;
int i = field.getMinimumValue();
int min = (i >= 0) ? i / divisor : ((i + 1) / divisor - 1);
int j = field.getMaximumValue();
int max = (j >= 0) ? j / divisor : ((j + 1) / divisor - 1);
iMin = min;
iMax = max;
}