01: package com.jat.util;
02:
03: /**
04: * <p>Title: JAT</p>
05: * <p>Description: </p>
06: * <p>Copyright: Copyright (c) 2004 -2005 Stefano Fratini (stefano.fratini@gmail.com)</p>
07: * <p>Distributed under the terms of the GNU Lesser General Public License, v2.1 or later</p>
08: * @author stf
09: * @version 1.2
10: * @since 1.0
11: */
12:
13: public class StringOrderable implements Orderable {
14:
15: public StringOrderable(String string) {
16: this .string = string;
17: }
18:
19: public boolean greatThan(Orderable _obj) {
20: return !lessThan(_obj);
21: }
22:
23: public boolean lessThan(Orderable _obj) {
24: String val = (String) _obj.getValue();
25: return StringUtil.less(this .getValue().toString(), val);
26: }
27:
28: public Object getValue() {
29: return this .string;
30: }
31:
32: public void orderBy(Object order) {
33: /**@todo Implement this com.jat.util.Orderable method*/
34: throw new java.lang.UnsupportedOperationException(
35: "Method orderBy() not yet implemented.");
36: }
37:
38: public Object getOrderBy() {
39: /**@todo Implement this com.jat.util.Orderable method*/
40: throw new java.lang.UnsupportedOperationException(
41: "Method getOrderBy() not yet implemented.");
42: }
43:
44: public boolean equals(Object other) {
45: if (other == this )
46: return true;
47: if (other == null)
48: return false;
49: if (getClass() != other.getClass())
50: return false;
51: StringOrderable ord = (StringOrderable) other;
52: return this .string != null
53: && this .getValue().equals(ord.getValue());
54: }
55:
56: public String toString() {
57: return this .string;
58: }
59:
60: private String string;
61:
62: }
|