/** * Is this instant strictly after the millisecond instant passed in * comparing solely by millisecond. * * @param instant a millisecond instant to check against * @return true if this instant is strictly after the instant passed in */ public boolean isAfter(long instant) { return (getMillis() > instant); }
/** * Checks whether the duration field specified is supported by this period. * * @param type the type to check, may be null which returns false * @return true if the field is supported */ public boolean isSupported(DurationFieldType type) { return (type == getFieldType()); }
/** * Sets the value of one of the fields by index. * * @param index the field index * @param value the new value for the field * @throws IndexOutOfBoundsException if the index is invalid */ public void setValue(int index, int value) { super.setValue(index, value); }
/** * Merges the fields from another period. * * @param period the period to add from, not null * @throws IllegalArgumentException if an unsupported field's value is non-zero */ protected void mergePeriod(ReadablePeriod period) { if (period != null) { setValues(mergePeriodInto(getValues(), period)); } }
/** * Adds the fields from another period. * * @param period the period to add from, not null * @throws IllegalArgumentException if an unsupported field's value is non-zero */ protected void addPeriod(ReadablePeriod period) { if (period != null) { setValues(addPeriodInto(getValues(), period)); } }
/** * Gets the field at the specified index. * * @param index the index * @return the field * @throws IndexOutOfBoundsException if the index is invalid */ public DateTimeField getField(int index) { return getField(index, getChronology()); }
/** * Adds a period to this one by adding each field in turn. * * @param period the period to add, null means add nothing * @throws IllegalArgumentException if the period being added contains a field * not supported by this period * @throws ArithmeticException if the addition exceeds the capacity of the period */ public void add(ReadablePeriod period) { super.addPeriod(period); }
/** * Sets the chronology of the datetime. * <p> * All changes to the chronology field occurs via this method. * Override and block this method to make a subclass immutable. * * @param chronology the chronology to set */ protected void setChronology(Chronology chronology) { iChronology = checkChronology(chronology); }
/** * Adds the value of a field in this period. * * @param field the field to set * @param value the value to set * @throws IllegalArgumentException if field is is null or not supported. */ protected void addField(DurationFieldType field, int value) { addFieldInto(iValues, field, value); }
/** * Sets the value of one of the fields. * <p> * The field type specified must be one of those that is supported by the period. * * @param field a DurationFieldType instance that is supported by this period, not null * @param value the new value for the field * @throws IllegalArgumentException if the field is null or not supported */ public void set(DurationFieldType field, int value) { super.setField(field, value); }
/** * Sets the milliseconds of the datetime. * <p> * All changes to the millisecond field occurs via this method. * Override and block this method to make a subclass immutable. * * @param instant the milliseconds since 1970-01-01T00:00:00Z to set the datetime to */ protected void setMillis(long instant) { iMillis = checkInstant(instant, iChronology); }
/** * Is this time interval after the specified millisecond instant. * <p> * Intervals are inclusive of the start instant and exclusive of the end. * * @param millisInstant the instant to compare to, * millisecond instant from 1970-01-01T00:00:00Z * @return true if this time interval is after the instant */ public boolean isAfter(long millisInstant) { return (getStartMillis() > millisInstant); }
/** * Sets all the fields in one go from another ReadablePeriod. * * @param period the period to set, null means zero length period * @throws IllegalArgumentException if an unsupported field's value is non-zero */ public void setPeriod(ReadablePeriod period) { super.setPeriod(period); }
/** * Adds to the value of one of the fields. * <p> * The field type specified must be one of those that is supported by the period. * * @param field a DurationFieldType instance that is supported by this period, not null * @param value the value to add to the field * @throws IllegalArgumentException if the field is null or not supported */ public void add(DurationFieldType field, int value) { super.addField(field, value); }
/** * Merges all the fields from the specified period into this one. * <p> * Fields that are not present in the specified period are left unaltered. * * @param period the period to set, null ignored * @throws IllegalArgumentException if an unsupported field's value is non-zero */ public void mergePeriod(ReadablePeriod period) { super.mergePeriod(period); }
/** * Set the chronology of the datetime. * <p> * All changes to the chronology occur via this method. * * @param chronology the chronology to use, null means ISOChronology in default zone */ public void setChronology(Chronology chronology) { super.setChronology(chronology); }
/** * Gets a hash code for the duration that is compatible with the * equals method. * * @return a hash code */ public int hashCode() { long len = getMillis(); return (int) (len ^ (len >>> 32)); }
/** * Is this time interval before the specified millisecond instant. * <p> * Intervals are inclusive of the start instant and exclusive of the end. * * @param millisInstant the instant to compare to, * millisecond instant from 1970-01-01T00:00:00Z * @return true if this time interval is before the instant */ public boolean isBefore(long millisInstant) { return (getEndMillis() <= millisInstant); }
/** * Is this instant strictly before the millisecond instant passed in * comparing solely by millisecond. * * @param instant a millisecond instant to check against * @return true if this instant is strictly before the instant passed in */ public boolean isBefore(long instant) { return (getMillis() < instant); }
/** * Is this instant equal to the millisecond instant passed in * comparing solely by millisecond. * * @param instant a millisecond instant to check against * @return true if this instant is equal to the instant passed in */ public boolean isEqual(long instant) { return (getMillis() == instant); }