Mercurial > hg > Members > shoshi > TreeCMSv2
comparison src/treecms/tree/id/AbstractNodeID.java @ 6:12604eb6b615
added javadoc
author | shoshi |
---|---|
date | Mon, 14 Mar 2011 23:24:38 +0900 |
parents | src/treecms/tree/id/RandomNodeID.java@bdde898e8ef9 |
children | f3150b37f9be |
comparison
equal
deleted
inserted
replaced
5:87bba22e4fa2 | 6:12604eb6b615 |
---|---|
1 package treecms.tree.id; | |
2 | |
3 import treecms.api.NodeID; | |
4 | |
5 public abstract class AbstractNodeID implements NodeID | |
6 { | |
7 public abstract NodeID create(); | |
8 public abstract NodeID update(); | |
9 public abstract String getUUID(); | |
10 public abstract String getVersion(); | |
11 | |
12 public abstract boolean isFamily(NodeID _id); | |
13 | |
14 @Override | |
15 public String toString() | |
16 { | |
17 return (new StringBuffer(getUUID())).append('@').append(getVersion()).toString(); | |
18 } | |
19 | |
20 @Override | |
21 public int hashCode() | |
22 { | |
23 int hash = 17; | |
24 hash = 37*hash + getUUID().hashCode(); | |
25 hash = 37*hash + getVersion().hashCode(); | |
26 | |
27 return hash; | |
28 } | |
29 | |
30 @Override | |
31 public boolean equals(Object _id) | |
32 { | |
33 if(_id instanceof NodeID){ | |
34 NodeID target = (NodeID)_id; | |
35 if(isFamily(target) && getVersion().equals(target.getVersion())){ | |
36 return true; | |
37 } | |
38 } | |
39 return false; | |
40 } | |
41 } |