* If data was not supported.
*/
public int compareValues(LiteralRestriction restriction)
throws DataFormatException {
if (restriction.getValueType() != valueType) {
throw new DataFormatException(
"Value types did not match. Value type "
+ restriction.getValueType() + " was compared to "
+ valueType);
}
if (valueType == Field.FieldType.DATE) {
return dateValue.compareTo(restriction.getDateValue());
} else if (valueType == Field.FieldType.DOUBLE) {
if (doubleValue > restriction.getDoubleValue()) {
return 1;
} else if (doubleValue < restriction.getDoubleValue()) {
return -1;
} else {
return 0;
}
} else if (valueType == Field.FieldType.INT) {
if (intValue > restriction.getIntValue()) {
return 1;
} else if (intValue < restriction.getIntValue()) {
return -1;
} else {
return 0;
}
} else if (valueType == Field.FieldType.STRING) {
return stringValue.compareTo(restriction.getValueAsString());
}
throw new DataFormatException("Value types did not match. Value type "
+ restriction.getValueType() + " was compared to " + valueType);
}