01: /**
02: * com.mckoi.database.TDateType 31 Jul 2002
03: *
04: * Mckoi SQL Database ( http://www.mckoi.com/database )
05: * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * Version 2 as published by the Free Software Foundation.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License Version 2 for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * Version 2 along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19: *
20: * Change Log:
21: *
22: *
23: */package com.mckoi.database;
24:
25: import java.util.Date;
26:
27: /**
28: * An implementation of TType for date objects.
29: *
30: * @author Tobias Downer
31: */
32:
33: public class TDateType extends TType {
34:
35: static final long serialVersionUID = 1494137367081481985L;
36:
37: /**
38: * Constructs the type.
39: */
40: public TDateType(int sql_type) {
41: super (sql_type);
42: }
43:
44: public boolean comparableTypes(TType type) {
45: return (type instanceof TDateType);
46: }
47:
48: public int compareObs(Object ob1, Object ob2) {
49: return ((Date) ob1).compareTo((Date) ob2);
50: }
51:
52: public int calculateApproximateMemoryUse(Object ob) {
53: return 4 + 8;
54: }
55:
56: public Class javaClass() {
57: return Date.class;
58: }
59:
60: }
|