01: /*
02: * GreaterThanComparator.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.storage.filter;
13:
14: /**
15: * @author support@sql-workbench.net
16: */
17: public class GreaterThanComparator implements ColumnComparator {
18: public GreaterThanComparator() {
19: }
20:
21: public boolean supportsIgnoreCase() {
22: return false;
23: }
24:
25: public String getValueExpression(Object value) {
26: return (value == null ? "" : value.toString());
27: }
28:
29: public String getOperator() {
30: return ">";
31: }
32:
33: public boolean needsValue() {
34: return true;
35: }
36:
37: public boolean comparesEquality() {
38: return false;
39: }
40:
41: public boolean evaluate(Object reference, Object value,
42: boolean ignoreCase) {
43: if (reference == null || value == null)
44: return false;
45: try {
46: return ((Comparable) reference)
47: .compareTo((Comparable) value) < 0;
48: } catch (Exception e) {
49: return false;
50: }
51: }
52:
53: public boolean supportsType(Class valueClass) {
54: return Comparable.class.isAssignableFrom(valueClass);
55: }
56:
57: public boolean equals(Object other) {
58: return (other instanceof GreaterThanComparator);
59: }
60:
61: public boolean validateInput(Object value) {
62: return (value instanceof Comparable);
63: }
64: }
|