01: package org.objectweb.celtix.bus.ws.rm;
02:
03: import org.objectweb.celtix.ws.rm.Identifier;
04:
05: public abstract class AbstractSequenceImpl {
06:
07: protected final Identifier id;
08:
09: protected AbstractSequenceImpl(Identifier i) {
10: id = i;
11: }
12:
13: /**
14: * @return the sequence identifier
15: */
16: public Identifier getIdentifier() {
17: return id;
18: }
19:
20: public String toString() {
21: return id.getValue();
22: }
23:
24: public boolean equals(Object other) {
25: if (other == this ) {
26: return true;
27: }
28: if (other instanceof AbstractSequenceImpl) {
29: AbstractSequenceImpl otherSeq = (AbstractSequenceImpl) other;
30: return otherSeq.getIdentifier().getValue().equals(
31: getIdentifier().getValue());
32: }
33: return false;
34: }
35:
36: public int hashCode() {
37: return getIdentifier().getValue().hashCode();
38: }
39:
40: static boolean identifierEquals(Identifier id1, Identifier id2) {
41: if (null == id1) {
42: return null == id2;
43: } else {
44: return null != id2 && id1.getValue().equals(id2.getValue());
45: }
46: }
47:
48: }
|