/** * Gets the weeks field part of the period. * * @return the number of weeks in the period, zero if unsupported */ public int getWeeks() { return getPeriodType().getIndexedField(this, PeriodType.WEEK_INDEX); }
/** * Gets the days field part of the period. * * @return the number of days in the period, zero if unsupported */ public int getDays() { return getPeriodType().getIndexedField(this, PeriodType.DAY_INDEX); }
/** * Gets the minutes field part of the period. * * @return the number of minutes in the period, zero if unsupported */ public int getMinutes() { return getPeriodType().getIndexedField(this, PeriodType.MINUTE_INDEX); }
/** * Gets the months field part of the period. * * @return the number of months in the period, zero if unsupported */ public int getMonths() { return getPeriodType().getIndexedField(this, PeriodType.MONTH_INDEX); }
/** * Gets the hours field part of the period. * * @return the number of hours in the period, zero if unsupported */ public int getHours() { return getPeriodType().getIndexedField(this, PeriodType.HOUR_INDEX); }
/** * Gets the millis field part of the period. * * @return the number of millis in the period, zero if unsupported */ public int getMillis() { return getPeriodType().getIndexedField(this, PeriodType.MILLI_INDEX); }
/** * Gets the years field part of the period. * * @return the number of years in the period, zero if unsupported */ public int getYears() { return getPeriodType().getIndexedField(this, PeriodType.YEAR_INDEX); }
/** * Gets the seconds field part of the period. * * @return the number of seconds in the period, zero if unsupported */ public int getSeconds() { return getPeriodType().getIndexedField(this, PeriodType.SECOND_INDEX); }
/** * Gets the minutes field part of the period. * * @return the number of minutes in the period, zero if unsupported */ public int getMinutes() { return getPeriodType().getIndexedField(this, PeriodType.MINUTE_INDEX); }
/** * Gets the seconds field part of the period. * * @return the number of seconds in the period, zero if unsupported */ public int getSeconds() { return getPeriodType().getIndexedField(this, PeriodType.SECOND_INDEX); }
/** * Gets the months field part of the period. * * @return the number of months in the period, zero if unsupported */ public int getMonths() { return getPeriodType().getIndexedField(this, PeriodType.MONTH_INDEX); }
/** * Gets the weeks field part of the period. * * @return the number of weeks in the period, zero if unsupported */ public int getWeeks() { return getPeriodType().getIndexedField(this, PeriodType.WEEK_INDEX); }
/** * Gets the millis field part of the period. * * @return the number of millis in the period, zero if unsupported */ public int getMillis() { return getPeriodType().getIndexedField(this, PeriodType.MILLI_INDEX); }
/** * Gets the years field part of the period. * * @return the number of years in the period, zero if unsupported */ public int getYears() { return getPeriodType().getIndexedField(this, PeriodType.YEAR_INDEX); }
/** * Gets the days field part of the period. * * @return the number of days in the period, zero if unsupported */ public int getDays() { return getPeriodType().getIndexedField(this, PeriodType.DAY_INDEX); }
/** * Gets the hours field part of the period. * * @return the number of hours in the period, zero if unsupported */ public int getHours() { return getPeriodType().getIndexedField(this, PeriodType.HOUR_INDEX); }
/** * Adds a duration to this one by dividing the duration into * fields and calling {@link #add(ReadablePeriod)}. * * @param duration the duration to add, null means add nothing * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(ReadableDuration duration) { if (duration != null) { add(new Period(duration.getMillis(), getPeriodType())); } }
/** * Adds a duration to this one by dividing the duration into * fields and calling {@link #add(ReadablePeriod)}. * * @param duration the duration to add, null means add nothing * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(ReadableDuration duration) { if (duration != null) { add(new Period(duration.getMillis(), getPeriodType())); } }
/** * Adds an interval to this one by dividing the interval into * fields and calling {@link #add(ReadablePeriod)}. * * @param interval the interval to add, null means add nothing * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(ReadableInterval interval) { if (interval != null) { add(interval.toPeriod(getPeriodType())); } }
/** * Adds an interval to this one by dividing the interval into * fields and calling {@link #add(ReadablePeriod)}. * * @param interval the interval to add, null means add nothing * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(ReadableInterval interval) { if (interval != null) { add(interval.toPeriod(getPeriodType())); } }