1 24 package org.objectweb.jalisto.se.impl.server; 25 26 import java.io.Serializable ; 27 import java.util.StringTokenizer ; 28 29 public class PhysicalOid implements Serializable { 30 31 public PhysicalOid() { 32 } 33 34 public PhysicalOid(Object clid, Object pid, Object iid) { 35 this.clid = ((Number ) clid).shortValue(); 36 this.pid = ((Number ) pid).intValue(); 37 this.iid = ((Number ) iid).shortValue(); 38 } 39 40 public PhysicalOid(String fpoidAsString) { 41 StringTokenizer st = new StringTokenizer (fpoidAsString, ":"); 42 this.clid = Short.parseShort(st.nextToken()); 43 this.pid = Integer.parseInt(st.nextToken()); 44 this.iid = Short.parseShort(st.nextToken()); 45 } 46 47 public Object getClid() { 48 return new Short (clid); 49 } 50 51 public Object getIid() { 52 return new Short (iid); 53 } 54 55 public Integer getIidAsInteger() { 56 return new Integer (iid); 57 } 58 59 public Object getPid() { 60 return new Integer (pid); 61 } 62 63 public boolean equals(Object obj) { 64 try { 65 PhysicalOid candidate = (PhysicalOid) obj; 66 67 return ((candidate.clid == this.clid) && 68 (candidate.pid == this.pid) && (candidate.iid == this.iid)); 69 } catch (Exception e) { 70 } 71 72 return false; 73 } 74 75 public boolean hasClidEqualsWith(Object candidateClid) { 76 try { 77 return ((Short ) candidateClid).shortValue() == this.clid; 78 } catch (Exception e) { 79 } 80 81 return false; 82 } 83 84 public int hashCode() { 85 int result = Integer.parseInt(String.valueOf(clid) + 86 String.valueOf(pid) + 87 String.valueOf(iid)); 88 89 return result; 90 } 91 92 public PhysicalOid getClone() { 93 PhysicalOid clone = new PhysicalOid(); 94 clone.clid = clid; 95 clone.iid = iid; 96 clone.pid = pid; 97 return clone; 98 } 99 100 public String toString() { 101 return String.valueOf(clid) + ":" + String.valueOf(pid) + ":" + 102 String.valueOf(iid); 103 } 104 105 106 private short clid; private short iid; private int pid; 110 111 static final long serialVersionUID = -7589366669041161459L; 112 } | Popular Tags |