Java Code Examples for org.joda.time.DateTimeField#getDurationField()
The following examples show how to use
org.joda.time.DateTimeField#getDurationField() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Time_18_GJChronology_t.java From coming with MIT License | 6 votes |
/** * @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; }
Example 2
Source File: Time_18_GJChronology_s.java From coming with MIT License | 6 votes |
/** * @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; }
Example 3
Source File: Time_6_GJChronology_s.java From coming with MIT License | 6 votes |
/** * @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; }
Example 4
Source File: Time_6_GJChronology_t.java From coming with MIT License | 6 votes |
/** * @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; }
Example 5
Source File: RemainderDateTimeField.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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); } iDurationField = field.getDurationField(); iDivisor = divisor; }
Example 6
Source File: DividedDateTimeField.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Constructor. * * @param field the field to wrap, like "year()". * @param rangeField the range field, null to derive * @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, DurationField rangeField, 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); } iRangeDurationField = rangeField; 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; }
Example 7
Source File: GJChronology.java From astor with GNU General Public License v2.0 | 6 votes |
/** * @param julianField field from the chronology used before the cutover instant * @param gregorianField field from the chronology used at and after the cutover * @param rangeField the range field * @param cutoverMillis the millis of the cutover * @param convertByWeekyear */ CutoverField(DateTimeField julianField, DateTimeField gregorianField, DurationField rangeField, 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(); if (rangeField == null) { rangeField = gregorianField.getRangeDurationField(); if (rangeField == null) { rangeField = julianField.getRangeDurationField(); } } iRangeDurationField = rangeField; }
Example 8
Source File: RemainderDateTimeField.java From astor with GNU General Public License v2.0 | 6 votes |
/** * 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; }
Example 9
Source File: GJChronology.java From astor with GNU General Public License v2.0 | 6 votes |
/** * @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; }
Example 10
Source File: RemainderDateTimeField.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Constructor. * * @param field the field to wrap, like "year()". * @param rangeField the range field * @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, DurationField rangeField, DateTimeFieldType type, int divisor) { super(field, type); if (divisor < 2) { throw new IllegalArgumentException("The divisor must be at least 2"); } iRangeField = rangeField; iDurationField = field.getDurationField(); iDivisor = divisor; }
Example 11
Source File: DividedDateTimeField.java From astor with GNU General Public License v2.0 | 5 votes |
/** * 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; }