Mercurial > hg > blitz_condensed
comparison src/org/dancres/blitz/SpaceEntryUID.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dc0c5604566 |
---|---|
1 package org.dancres.blitz; | |
2 | |
3 import org.dancres.blitz.oid.OID; | |
4 | |
5 import org.dancres.blitz.lease.SpaceUID; | |
6 | |
7 /** | |
8 Opaque space-level unique identifier for an Entry. <P> | |
9 | |
10 This will be the cookie we place inside a lease. We should make this | |
11 cookie responsible for doing a renew. i.e. put the renew code in here. | |
12 */ | |
13 final class SpaceEntryUID implements SpaceUID, Comparable { | |
14 private OID theOID; | |
15 private String theType; | |
16 | |
17 SpaceEntryUID(String aType, OID aOID) { | |
18 theType = aType; | |
19 theOID = aOID; | |
20 } | |
21 | |
22 public boolean equals(Object anObject) { | |
23 if (anObject instanceof SpaceEntryUID) { | |
24 SpaceEntryUID myUID = (SpaceEntryUID) anObject; | |
25 | |
26 if (theType.equals(myUID.theType)) { | |
27 return (theOID.equals(myUID.theOID)); | |
28 } | |
29 } | |
30 | |
31 return false; | |
32 } | |
33 | |
34 public int hashCode() { | |
35 return theOID.hashCode(); | |
36 } | |
37 | |
38 public int compareTo(Object anObject) { | |
39 SpaceEntryUID myOther = (SpaceEntryUID) anObject; | |
40 | |
41 if (myOther.theType.equals(theType)) { | |
42 return theOID.compareTo(myOther.theOID); | |
43 } else | |
44 return theType.compareTo(myOther.theType); | |
45 } | |
46 | |
47 String getType() { | |
48 return theType; | |
49 } | |
50 | |
51 OID getOID() { | |
52 return theOID; | |
53 } | |
54 | |
55 public String toString() { | |
56 return "EGUID:" + theType + ":" + theOID; | |
57 } | |
58 } |