@Override public DurationFieldType getRangeDurationType() { return DurationFieldType.years(); }
/** * Gets the duration field type, which is <code>years</code>. * * @return the period type */ public DurationFieldType getFieldType() { return DurationFieldType.years(); }
/** * Gets the duration field type, which is <code>years</code>. * * @return the period type */ public DurationFieldType getFieldType() { return DurationFieldType.years(); }
public DurationFieldType getRangeDurationType() { return DurationFieldType.years(); }
public DurationFieldType getRangeDurationType() { return DurationFieldType.years(); }
public DurationFieldType getDurationType() { return DurationFieldType.years(); }
/** * Sets the number of years of the period. * * @param years the number of years * @throws IllegalArgumentException if field is not supported and the value is non-zero */ public void setYears(int years) { super.setField(DurationFieldType.years(), years); }
/** * Get the years duration field for this chronology. * * @return DurationField or UnsupportedDurationField if unsupported */ public DurationField years() { return UnsupportedDurationField.getInstance(DurationFieldType.years()); }
/** * Adds the specified years to the number of years in the period. * * @param years the number of years * @throws IllegalArgumentException if field is not supported and the value is non-zero * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void addYears(int years) { super.addField(DurationFieldType.years(), years); }
/** * Sets the number of years of the period. * * @param years the number of years * @throws IllegalArgumentException if field is not supported and the value is non-zero */ public void setYears(int years) { super.setField(DurationFieldType.years(), years); }
/** * Adds the specified years to the number of years in the period. * * @param years the number of years * @throws IllegalArgumentException if field is not supported and the value is non-zero * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void addYears(int years) { super.addField(DurationFieldType.years(), years); }
/** * Get the years duration field for this chronology. * * @return DurationField or UnsupportedDurationField if unsupported */ public DurationField years() { return UnsupportedDurationField.getInstance(DurationFieldType.years()); }
/** * Gets a type that defines just the years field. * * @return the period type */ public static PeriodType years() { PeriodType type = cYears; if (type == null) { type = new PeriodType( "Years", new DurationFieldType[] { DurationFieldType.years() }, new int[] { 0, -1, -1, -1, -1, -1, -1, -1, } ); cYears = type; } return type; }
/** * Returns a copy of this year-month plus the specified number of years. * <p> * This year-month instance is immutable and unaffected by this method call. * <p> * The following three lines are identical in effect: * <pre> * YearMonth added = ym.plusYears(6); * YearMonth added = ym.plus(Period.years(6)); * YearMonth added = ym.withFieldAdded(DurationFieldType.years(), 6); * </pre> * * @param years the amount of years to add, may be negative * @return the new year-month plus the increased years, never null */ public YearMonth plusYears(int years) { return withFieldAdded(DurationFieldType.years(), years); }
/** * Creates a <code>Years</code> representing the number of whole years * between the two specified datetimes. This method correctly handles * any daylight savings time changes that may occur during the interval. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in years * @throws IllegalArgumentException if the instants are null or invalid */ public static Years yearsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.years()); return Years.years(amount); }
/** * Creates a <code>Years</code> representing the number of whole years * between the two specified datetimes. This method correctly handles * any daylight savings time changes that may occur during the interval. * * @param start the start instant, must not be null * @param end the end instant, must not be null * @return the period in years * @throws IllegalArgumentException if the instants are null or invalid */ public static Years yearsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.years()); return Years.years(amount); }
@Override long fromMillis(long millisSinceEpoch) { return DurationFieldType.years().getField(ISOChronology.getInstanceUTC()).getDifference(millisSinceEpoch, 0L); } };
@Override public long fromMillis(long millisSinceEpoch) { return DurationFieldType.years().getField(ISOChronology.getInstanceUTC()).getDifference(millisSinceEpoch, 0L); } };
/** * Creates a <code>Years</code> representing the number of whole years * in the specified interval. This method correctly handles any daylight * savings time changes that may occur during the interval. * * @param interval the interval to extract years from, null returns zero * @return the period in years * @throws IllegalArgumentException if the partials are null or invalid */ public static Years yearsIn(ReadableInterval interval) { if (interval == null) { return Years.ZERO; } int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.years()); return Years.years(amount); }
/** * Private method called from constructor. */ private int[] setPeriodInternal(int years, int months, int weeks, int days, int hours, int minutes, int seconds, int millis) { int[] newValues = new int[size()]; checkAndUpdate(DurationFieldType.years(), newValues, years); checkAndUpdate(DurationFieldType.months(), newValues, months); checkAndUpdate(DurationFieldType.weeks(), newValues, weeks); checkAndUpdate(DurationFieldType.days(), newValues, days); checkAndUpdate(DurationFieldType.hours(), newValues, hours); checkAndUpdate(DurationFieldType.minutes(), newValues, minutes); checkAndUpdate(DurationFieldType.seconds(), newValues, seconds); checkAndUpdate(DurationFieldType.millis(), newValues, millis); return newValues; }