01: /*
02: * GreaterOrEqualComparator.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: import workbench.util.StringUtil;
15:
16: /**
17: * @author support@sql-workbench.net
18: */
19: public class GreaterOrEqualComparator implements ColumnComparator {
20: public GreaterOrEqualComparator() {
21: }
22:
23: public boolean supportsIgnoreCase() {
24: return false;
25: }
26:
27: public String getValueExpression(Object value) {
28: return (value == null ? "" : value.toString());
29: }
30:
31: public String getOperator() {
32: return "\u2265";
33: }
34:
35: public boolean needsValue() {
36: return true;
37: }
38:
39: public boolean comparesEquality() {
40: return false;
41: }
42:
43: public boolean evaluate(Object reference, Object value,
44: boolean ignoreCase) {
45: if (reference == null || value == null)
46: return false;
47: try {
48: int result = ((Comparable) reference)
49: .compareTo((Comparable) value);
50: return result <= 0;
51: } catch (Exception e) {
52: return false;
53: }
54: }
55:
56: public boolean supportsType(Class valueClass) {
57: return Comparable.class.isAssignableFrom(valueClass);
58: }
59:
60: public boolean equals(Object other) {
61: return (other instanceof GreaterOrEqualComparator);
62: }
63:
64: public boolean validateInput(Object value) {
65: return (value instanceof Comparable);
66: }
67:
68: }
|