protected void assemble(Fields fields) { if (getBase() == null) { super.assemble(fields); fields.era = ERA_FIELD; fields.monthOfYear = new BasicMonthOfYearDateTimeField(this, 12); fields.months = fields.monthOfYear.getDurationField(); } }
public int[] add(ReadablePartial partial, int fieldIndex, int[] values, int valueToAdd) { // overridden as superclass algorithm can't handle // 2004-02-29 + 48 months -> 2008-02-29 type dates if (valueToAdd == 0) { return values; } if (partial.size() > 0 && partial.getFieldType(0).equals(DateTimeFieldType.monthOfYear()) && fieldIndex == 0) { // month is largest field and being added to, such as month-day int curMonth0 = values[0] - 1; int newMonth = ((curMonth0 + (valueToAdd % 12) + 12) % 12) + 1; return set(partial, 0, values, newMonth); } if (DateTimeUtils.isContiguous(partial)) { long instant = 0L; for (int i = 0, isize = partial.size(); i < isize; i++) { instant = partial.getFieldType(i).getField(iChronology).set(instant, values[i]); } instant = add(instant, valueToAdd); return iChronology.get(partial, instant); } else { return super.add(partial, fieldIndex, values, valueToAdd); } }
/** * Add to the Month component of the specified time instant * wrapping around within that component if necessary. * * @see org.joda.time.DateTimeField#addWrapField * @param instant the time instant in millis to update. * @param months the months to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int months) { return set(instant, FieldUtils.getWrappedValue(get(instant), months, MIN, iMax)); }
public long add(long instant, long months) { int i_months = (int)months; if (i_months == months) { return add(instant, i_months);
public long remainder(long instant) { return instant - roundFloor(instant); }
public int getLeapAmount(long instant) { return isLeap(instant) ? 1 : 0; }
public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) { if (minuendInstant < subtrahendInstant) { return -getDifference(subtrahendInstant, minuendInstant);
public long add(long instant, long months) { int i_months = (int)months; if (i_months == months) { return add(instant, i_months);
public long remainder(long instant) { return instant - roundFloor(instant); }
public int getLeapAmount(long instant) { return isLeap(instant) ? 1 : 0; }
public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) { if (minuendInstant < subtrahendInstant) { return -getDifference(subtrahendInstant, minuendInstant);
/** * Add to the Month component of the specified time instant * wrapping around within that component if necessary. * * @see org.joda.time.DateTimeField#addWrapField * @param instant the time instant in millis to update. * @param months the months to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int months) { return set(instant, FieldUtils.getWrappedValue(get(instant), months, MIN, iMax)); }
protected void assemble(Fields fields) { if (getBase() == null) { super.assemble(fields); fields.era = ERA_FIELD; fields.monthOfYear = new BasicMonthOfYearDateTimeField(this, 12); fields.months = fields.monthOfYear.getDurationField(); } }
public int[] add(ReadablePartial partial, int fieldIndex, int[] values, int valueToAdd) { // overridden as superclass algorithm can't handle // 2004-02-29 + 48 months -> 2008-02-29 type dates if (valueToAdd == 0) { return values; } if (partial.size() > 0 && partial.getFieldType(0).equals(DateTimeFieldType.monthOfYear()) && fieldIndex == 0) { // month is largest field and being added to, such as month-day int curMonth0 = values[0] - 1; int newMonth = ((curMonth0 + (valueToAdd % 12) + 12) % 12) + 1; return set(partial, 0, values, newMonth); } if (DateTimeUtils.isContiguous(partial)) { long instant = 0L; for (int i = 0, isize = partial.size(); i < isize; i++) { instant = partial.getFieldType(i).getField(iChronology).set(instant, values[i]); } instant = add(instant, valueToAdd); return iChronology.get(partial, instant); } else { return super.add(partial, fieldIndex, values, valueToAdd); } }
public long add(long instant, long months) { int i_months = (int)months; if (i_months == months) { return add(instant, i_months);
public long remainder(long instant) { return instant - roundFloor(instant); }
public int getLeapAmount(long instant) { return isLeap(instant) ? 1 : 0; }
public long getDifferenceAsLong(long minuendInstant, long subtrahendInstant) { if (minuendInstant < subtrahendInstant) { return -getDifference(subtrahendInstant, minuendInstant);
/** * Add to the Month component of the specified time instant * wrapping around within that component if necessary. * * @see org.joda.time.DateTimeField#addWrapField * @param instant the time instant in millis to update. * @param months the months to add (can be negative). * @return the updated time instant. */ public long addWrapField(long instant, int months) { return set(instant, FieldUtils.getWrappedValue(get(instant), months, MIN, iMax)); }
protected void assemble(Fields fields) { if (getBase() == null) { super.assemble(fields); // Ethiopic, like Julian, has no year zero. fields.year = new SkipDateTimeField(this, fields.year); fields.weekyear = new SkipDateTimeField(this, fields.weekyear); fields.era = ERA_FIELD; fields.monthOfYear = new BasicMonthOfYearDateTimeField(this, 13); fields.months = fields.monthOfYear.getDurationField(); } }