Java Code Examples for org.joda.time.ReadableInstant#get()

The following examples show how to use org.joda.time.ReadableInstant#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractPartialFieldProperty.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compare this field to the same field on another instant.
 * <p>
 * The comparison is based on the value of the same field type, irrespective
 * of any difference in chronology. Thus, if this property represents the
 * hourOfDay field, then the hourOfDay field of the other instant will be queried
 * whether in the same chronology or not.
 * 
 * @param instant  the instant to compare to
 * @return negative value if this is less, 0 if equal, or positive value if greater
 * @throws IllegalArgumentException if the instant is null or the instant
 *  doesn't support the field of this property
 */
public int compareTo(ReadableInstant instant) {
    if (instant == null) {
        throw new IllegalArgumentException("The instant must not be null");
    }
    int thisValue = get();
    int otherValue = instant.get(getFieldType());
    if (thisValue < otherValue) {
        return -1;
    } else if (thisValue > otherValue) {
        return 1;
    } else {
        return 0;
    }
}
 
Example 2
Source File: AbstractReadableInstantFieldProperty.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compare this field to the same field on another instant.
 * <p>
 * The comparison is based on the value of the same field type, irrespective
 * of any difference in chronology. Thus, if this property represents the
 * hourOfDay field, then the hourOfDay field of the other instant will be queried
 * whether in the same chronology or not.
 * 
 * @param instant  the instant to compare to
 * @return negative value if this is less, 0 if equal, or positive value if greater
 * @throws IllegalArgumentException if the instant is null
 */
public int compareTo(ReadableInstant instant) {
    if (instant == null) {
        throw new IllegalArgumentException("The instant must not be null");
    }
    int thisValue = get();
    int otherValue = instant.get(getFieldType());
    if (thisValue < otherValue) {
        return -1;
    } else if (thisValue > otherValue) {
        return 1;
    } else {
        return 0;
    }
}
 
Example 3
Source File: AbstractPartialFieldProperty.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compare this field to the same field on another instant.
 * <p>
 * The comparison is based on the value of the same field type, irrespective
 * of any difference in chronology. Thus, if this property represents the
 * hourOfDay field, then the hourOfDay field of the other instant will be queried
 * whether in the same chronology or not.
 * 
 * @param instant  the instant to compare to
 * @return negative value if this is less, 0 if equal, or positive value if greater
 * @throws IllegalArgumentException if the instant is null or the instant
 *  doesn't support the field of this property
 */
public int compareTo(ReadableInstant instant) {
    if (instant == null) {
        throw new IllegalArgumentException("The instant must not be null");
    }
    int thisValue = get();
    int otherValue = instant.get(getFieldType());
    if (thisValue < otherValue) {
        return -1;
    } else if (thisValue > otherValue) {
        return 1;
    } else {
        return 0;
    }
}
 
Example 4
Source File: AbstractReadableInstantFieldProperty.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Compare this field to the same field on another instant.
 * <p>
 * The comparison is based on the value of the same field type, irrespective
 * of any difference in chronology. Thus, if this property represents the
 * hourOfDay field, then the hourOfDay field of the other instant will be queried
 * whether in the same chronology or not.
 * 
 * @param instant  the instant to compare to
 * @return negative value if this is less, 0 if equal, or positive value if greater
 * @throws IllegalArgumentException if the instant is null
 */
public int compareTo(ReadableInstant instant) {
    if (instant == null) {
        throw new IllegalArgumentException("The instant must not be null");
    }
    int thisValue = get();
    int otherValue = instant.get(getFieldType());
    if (thisValue < otherValue) {
        return -1;
    } else if (thisValue > otherValue) {
        return 1;
    } else {
        return 0;
    }
}