KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > aspects > persistence > LongOID


1 /*
2   Copyright (C) 2001-2003 Laurent Martelli <laurent@aopsys.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */

17
18 package org.objectweb.jac.aspects.persistence;
19
20 /**
21  * An implementation of OID with a long
22  *
23  */

24
25 public class LongOID extends OID {
26     private long oid = 0;
27     public LongOID(Storage storage, long oid) {
28         super(storage);
29         this.oid = oid;
30     }
31     public long getOID() {
32         return oid;
33     }
34     public String JavaDoc localId() {
35         return ""+oid;
36     }
37
38     public boolean equals(Object JavaDoc obj) {
39         return (obj instanceof LongOID)
40             && (oid == ((LongOID)obj).getOID())
41             && (storage == ((OID)obj).storage);
42     }
43     public String JavaDoc toString() {
44         return Long.toString(oid)+"@"+storage.getId();
45     }
46     public int hashCode() {
47         return (int)(oid ^ (oid >>> 32));
48     }
49 }
50
Popular Tags