public DateTimeField getField(Chronology chronology) { return new OffsetDateTimeField(new RemainderDateTimeField(new OffsetDateTimeField(chronology.monthOfYear(), -1), MonthOfHalfYear, 6), 1); } };
/** * Add the specified amount to the specified time instant, wrapping around * within the remainder range if necessary. The amount added may be * negative. * * @param instant the time instant in millis to update. * @param amount the amount to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, 0, iDivisor - 1)); }
/** * Set the specified amount of remainder units to the specified time instant. * * @param instant the time instant in millis to update. * @param value value of remainder units to set. * @return the updated time instant. * @throws IllegalArgumentException if value is too large or too small. */ public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, 0, iDivisor - 1); int divided = getDivided(getWrappedField().get(instant)); return getWrappedField().set(instant, divided * iDivisor + value); }
public long roundFloor(long instant) { return getWrappedField().roundFloor(instant); }
public long roundHalfFloor(long instant) { return getWrappedField().roundHalfFloor(instant); }
public DateTimeField getField(Chronology chronology) { return new OffsetDateTimeField(new RemainderDateTimeField(new OffsetDateTimeField(chronology.monthOfYear(), -1), MonthOfQuarter, 3), 1); } };
/** * Add the specified amount to the specified time instant, wrapping around * within the remainder range if necessary. The amount added may be * negative. * * @param instant the time instant in millis to update. * @param amount the amount to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, 0, iDivisor - 1)); }
/** * Set the specified amount of remainder units to the specified time instant. * * @param instant the time instant in millis to update. * @param value value of remainder units to set. * @return the updated time instant. * @throws IllegalArgumentException if value is too large or too small. */ public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, 0, iDivisor - 1); int divided = getDivided(getWrappedField().get(instant)); return getWrappedField().set(instant, divided * iDivisor + value); }
/** * Get the remainder from the specified time instant. * * @param instant the time instant in millis to query. * @return the remainder extracted from the input. */ public int get(long instant) { int value = getWrappedField().get(instant); if (value >= 0) { return value % iDivisor; } else { return (iDivisor - 1) + ((value + 1) % iDivisor); } }
public DateTimeField getField(Chronology chronology) { return new OffsetDateTimeField(new RemainderDateTimeField(new OffsetDateTimeField(chronology.weekOfWeekyear(), -1), WeekOfMonth, 4), 1); } };
/** * Add the specified amount to the specified time instant, wrapping around * within the remainder range if necessary. The amount added may be * negative. * * @param instant the time instant in millis to update. * @param amount the amount to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, 0, iDivisor - 1)); }
/** * Set the specified amount of remainder units to the specified time instant. * * @param instant the time instant in millis to update. * @param value value of remainder units to set. * @return the updated time instant. * @throws IllegalArgumentException if value is too large or too small. */ public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, 0, iDivisor - 1); int divided = getDivided(getWrappedField().get(instant)); return getWrappedField().set(instant, divided * iDivisor + value); }
public long roundCeiling(long instant) { return getWrappedField().roundCeiling(instant); }
protected void assemble(Fields fields) { if (getBase().getZone() == DateTimeZone.UTC) { // Use zero based century and year of century. fields.centuryOfEra = new DividedDateTimeField( ISOYearOfEraDateTimeField.INSTANCE, DateTimeFieldType.centuryOfEra(), 100); fields.centuries = fields.centuryOfEra.getDurationField(); fields.yearOfCentury = new RemainderDateTimeField( (DividedDateTimeField) fields.centuryOfEra, DateTimeFieldType.yearOfCentury()); fields.weekyearOfCentury = new RemainderDateTimeField( (DividedDateTimeField) fields.centuryOfEra, fields.weekyears, DateTimeFieldType.weekyearOfCentury()); } }
/** * Add the specified amount to the specified time instant, wrapping around * within the remainder range if necessary. The amount added may be * negative. * * @param instant the time instant in millis to update. * @param amount the amount to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, 0, iDivisor - 1)); }
/** * Set the specified amount of remainder units to the specified time instant. * * @param instant the time instant in millis to update. * @param value value of remainder units to set. * @return the updated time instant. * @throws IllegalArgumentException if value is too large or too small. */ public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, 0, iDivisor - 1); int divided = getDivided(getWrappedField().get(instant)); return getWrappedField().set(instant, divided * iDivisor + value); }
public long roundHalfEven(long instant) { return getWrappedField().roundHalfEven(instant); }
protected void assemble(Fields fields) { if (getBase().getZone() == DateTimeZone.UTC) { // Use zero based century and year of century. fields.centuryOfEra = new DividedDateTimeField( ISOYearOfEraDateTimeField.INSTANCE, DateTimeFieldType.centuryOfEra(), 100); fields.centuries = fields.centuryOfEra.getDurationField(); fields.yearOfCentury = new RemainderDateTimeField( (DividedDateTimeField) fields.centuryOfEra, DateTimeFieldType.yearOfCentury()); fields.weekyearOfCentury = new RemainderDateTimeField( (DividedDateTimeField) fields.centuryOfEra, fields.weekyears, DateTimeFieldType.weekyearOfCentury()); } }
/** * Add the specified amount to the specified time instant, wrapping around * within the remainder range if necessary. The amount added may be * negative. * * @param instant the time instant in millis to update. * @param amount the amount to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int amount) { return set(instant, FieldUtils.getWrappedValue(get(instant), amount, 0, iDivisor - 1)); }
/** * Set the specified amount of remainder units to the specified time instant. * * @param instant the time instant in millis to update. * @param value value of remainder units to set. * @return the updated time instant. * @throws IllegalArgumentException if value is too large or too small. */ public long set(long instant, int value) { FieldUtils.verifyValueBounds(this, value, 0, iDivisor - 1); int divided = getDivided(getWrappedField().get(instant)); return getWrappedField().set(instant, divided * iDivisor + value); }