Java Code Examples for org.joda.time.DurationField#isSupported()

The following examples show how to use org.joda.time.DurationField#isSupported() . 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: Nopol2017_0091_s.java    From coming with MIT License 5 votes vote down vote up
static int compareReverse(DurationField a, DurationField b) {
    if (a == null || !a.isSupported()) {
        if (b == null || !b.isSupported()) {
            return 0;
        }
        return -1;
    }
    if (b == null || !b.isSupported()) {
        return 1;
    }
    return -a.compareTo(b);
}
 
Example 2
Source File: DateTimeParserBucket.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
static int compareReverse(DurationField a, DurationField b) {
    if (a == null || !a.isSupported()) {
        if (b == null || !b.isSupported()) {
            return 0;
        }
        return -1;
    }
    if (b == null || !b.isSupported()) {
        return 1;
    }
    return -a.compareTo(b);
}
 
Example 3
Source File: LimitChronology.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private DurationField convertField(DurationField field, HashMap<Object, Object> converted) {
    if (field == null || !field.isSupported()) {
        return field;
    }
    if (converted.containsKey(field)) {
        return (DurationField)converted.get(field);
    }
    LimitDurationField limitField = new LimitDurationField(field);
    converted.put(field, limitField);
    return limitField;
}
 
Example 4
Source File: ZonedChronology.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
ZonedDurationField(DurationField field, DateTimeZone zone) {
    super(field.getType());
    if (!field.isSupported()) {
        throw new IllegalArgumentException();
    }
    iField = field;
    iTimeField = useTimeArithmetic(field);
    iZone = zone;
}
 
Example 5
Source File: ZonedChronology.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private DurationField convertField(DurationField field, HashMap<Object, Object> converted) {
    if (field == null || !field.isSupported()) {
        return field;
    }
    if (converted.containsKey(field)) {
        return (DurationField)converted.get(field);
    }
    ZonedDurationField zonedField = new ZonedDurationField(field, getZone());
    converted.put(field, zonedField);
    return zonedField;
}
 
Example 6
Source File: LimitChronology.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private DurationField convertField(DurationField field, HashMap<Object, Object> converted) {
    if (field == null || !field.isSupported()) {
        return field;
    }
    if (converted.containsKey(field)) {
        return (DurationField)converted.get(field);
    }
    LimitDurationField limitField = new LimitDurationField(field);
    converted.put(field, limitField);
    return limitField;
}
 
Example 7
Source File: DateTimeParserBucket.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
static int compareReverse(DurationField a, DurationField b) {
    if (a == null || !a.isSupported()) {
        if (b == null || !b.isSupported()) {
            return 0;
        }
        return -1;
    }
    if (b == null || !b.isSupported()) {
        return 1;
    }
    return -a.compareTo(b);
}
 
Example 8
Source File: DecoratedDurationField.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor.
 * 
 * @param field  the base field
 * @param type  the type to actually use
 */
public DecoratedDurationField(DurationField field, DurationFieldType type) {
    super(type);
    if (field == null) {
        throw new IllegalArgumentException("The field must not be null");
    }
    if (!field.isSupported()) {
        throw new IllegalArgumentException("The field must be supported");
    }
    iField = field;
}
 
Example 9
Source File: ZonedChronology.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
ZonedDurationField(DurationField field, DateTimeZone zone) {
    super(field.getType());
    if (!field.isSupported()) {
        throw new IllegalArgumentException();
    }
    iField = field;
    iTimeField = useTimeArithmetic(field);
    iZone = zone;
}
 
Example 10
Source File: Time_26_ZonedChronology_t.java    From coming with MIT License 5 votes vote down vote up
ZonedDurationField(DurationField field, DateTimeZone zone) {
    super(field.getType());
    if (!field.isSupported()) {
        throw new IllegalArgumentException();
    }
    iField = field;
    iTimeField = useTimeArithmetic(field);
    iZone = zone;
}
 
Example 11
Source File: Time_26_ZonedChronology_t.java    From coming with MIT License 5 votes vote down vote up
private DurationField convertField(DurationField field, HashMap<Object, Object> converted) {
    if (field == null || !field.isSupported()) {
        return field;
    }
    if (converted.containsKey(field)) {
        return (DurationField)converted.get(field);
    }
    ZonedDurationField zonedField = new ZonedDurationField(field, getZone());
    converted.put(field, zonedField);
    return zonedField;
}
 
Example 12
Source File: Time_2_UnsupportedDurationField_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Always returns zero, indicating that sort order is not relevent.
 *
 * @return zero always
 */
public int compareTo(DurationField durationField) {
    if (durationField.isSupported()) {
        return 1;
    }
    return 0;
}
 
Example 13
Source File: Time_24_DateTimeParserBucket_t.java    From coming with MIT License 5 votes vote down vote up
static int compareReverse(DurationField a, DurationField b) {
    if (a == null || !a.isSupported()) {
        if (b == null || !b.isSupported()) {
            return 0;
        }
        return -1;
    }
    if (b == null || !b.isSupported()) {
        return 1;
    }
    return -a.compareTo(b);
}
 
Example 14
Source File: Time_24_DateTimeParserBucket_s.java    From coming with MIT License 5 votes vote down vote up
static int compareReverse(DurationField a, DurationField b) {
    if (a == null || !a.isSupported()) {
        if (b == null || !b.isSupported()) {
            return 0;
        }
        return -1;
    }
    if (b == null || !b.isSupported()) {
        return 1;
    }
    return -a.compareTo(b);
}
 
Example 15
Source File: Time_1_UnsupportedDurationField_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Always returns zero, indicating that sort order is not relevent.
 *
 * @return zero always
 */
public int compareTo(DurationField durationField) {
    if (durationField.isSupported()) {
        return 1;
    }
    return 0;
}
 
Example 16
Source File: Nopol2017_0087_s.java    From coming with MIT License 5 votes vote down vote up
static int compareReverse(DurationField a, DurationField b) {
    if (a == null || !a.isSupported()) {
        if (b == null || !b.isSupported()) {
            return 0;
        }
        return -1;
    }
    if (b == null || !b.isSupported()) {
        return 1;
    }
    return -a.compareTo(b);
}
 
Example 17
Source File: ZonedChronology.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private DurationField convertField(DurationField field, HashMap<Object, Object> converted) {
    if (field == null || !field.isSupported()) {
        return field;
    }
    if (converted.containsKey(field)) {
        return (DurationField)converted.get(field);
    }
    ZonedDurationField zonedField = new ZonedDurationField(field, getZone());
    converted.put(field, zonedField);
    return zonedField;
}
 
Example 18
Source File: Nopol2017_0091_t.java    From coming with MIT License 5 votes vote down vote up
static int compareReverse(DurationField a, DurationField b) {
    if (a == null || !a.isSupported()) {
        if (b == null || !b.isSupported()) {
            return 0;
        }
        return -1;
    }
    if (b == null || !b.isSupported()) {
        return 1;
    }
    return -a.compareTo(b);
}
 
Example 19
Source File: AssembledChronology.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
private static boolean isSupported(DurationField field) {
    return field == null ? false : field.isSupported();
}
 
Example 20
Source File: AssembledChronology.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
private static boolean isSupported(DurationField field) {
    return field == null ? false : field.isSupported();
}