KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > bus > ws > rm > AbstractSequenceImpl


1 package org.objectweb.celtix.bus.ws.rm;
2
3 import org.objectweb.celtix.ws.rm.Identifier;
4
5 public abstract class AbstractSequenceImpl {
6     
7     protected final Identifier id;
8     
9     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 JavaDoc toString() {
21         return id.getValue();
22     }
23     
24     public boolean equals(Object JavaDoc 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(getIdentifier().getValue());
31         }
32         return false;
33     }
34     
35     public int hashCode() {
36         return getIdentifier().getValue().hashCode();
37     }
38     
39     static boolean identifierEquals(Identifier id1, Identifier id2) {
40         if (null == id1) {
41             return null == id2;
42         } else {
43             return null != id2 && id1.getValue().equals(id2.getValue());
44         }
45     }
46    
47 }
48
Popular Tags