KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jalisto > se > query > result > QueryResultWrapper


1 /*
2  * Jalisto - JAva LIght STOrage
3  * Copyright (C) 2000-2005 Xcalia http://www.xcalia.com
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18  *
19  * Xcalia
20  * 71, rue Desnouettes
21  * 75014 Paris - France
22  * http://www.xcalia.com
23  */

24 package org.objectweb.jalisto.se.query.result;
25
26 import org.objectweb.jalisto.se.impl.LogicalOid;
27 import org.objectweb.jalisto.se.api.Session;
28 import org.objectweb.jalisto.se.impl.util.JalistoUtils;
29
30 public class QueryResultWrapper implements Comparable JavaDoc {
31
32     public QueryResultWrapper(LogicalOid loid, Object JavaDoc[] value) {
33         this.logicalOid = loid;
34         this.value = value;
35     }
36
37     public QueryResultWrapper() {
38     }
39
40     public LogicalOid getLogicalOid() {
41         return logicalOid;
42     }
43
44     public void setLogicalOid(LogicalOid logicalOid) {
45         this.logicalOid = logicalOid;
46     }
47
48     public Object JavaDoc[] getValue() {
49         return value;
50     }
51
52     public void setValue(Object JavaDoc[] value) {
53         this.value = value;
54     }
55
56     public boolean isReaded() {
57         return (value != null);
58     }
59
60     public int hashCode() {
61         return logicalOid.hashCode();
62     }
63
64     public boolean equals(Object JavaDoc o) {
65         try {
66             return this.logicalOid.equals(((QueryResultWrapper) o).logicalOid);
67         } catch (Exception JavaDoc e) {
68         }
69         return false;
70     }
71
72     public String JavaDoc toString() {
73         return "(" + String.valueOf(logicalOid) + "," + JalistoUtils.arrayToString(value);
74     }
75
76     public String JavaDoc toStringFull(Session session) {
77         return "(" + String.valueOf(logicalOid) + "," + JalistoUtils.arrayToString(value, session);
78     }
79
80     public int compareTo(Object JavaDoc object) {
81         QueryResultWrapper candidate = (QueryResultWrapper) object;
82         return this.logicalOid.compareTo(candidate.logicalOid);
83     }
84
85     private LogicalOid logicalOid;
86     private Object JavaDoc[] value;
87 }
88
Popular Tags