1 7 22 23 package com.sun.corba.se.impl.naming.pcosnaming; 24 25 import java.io.Serializable ; 26 import org.omg.CosNaming.NameComponent ; 27 28 29 36 public class InternalBindingKey 37 implements Serializable 38 { 39 40 private static final long serialVersionUID = -5410796631793704055L; 42 43 public String id; 44 public String kind; 45 46 public InternalBindingKey() {} 48 49 public InternalBindingKey(NameComponent n) 51 { 52 setup(n); 53 } 54 55 protected void setup(NameComponent n) { 57 this.id = n.id; 58 this.kind = n.kind; 59 } 60 61 public boolean equals(java.lang.Object o) { 63 if (o == null) 64 return false; 65 if (o instanceof InternalBindingKey) { 66 InternalBindingKey that = (InternalBindingKey)o; 67 if( this.id != null && that.id != null ) 68 { 69 if (this.id.length() != that.id.length() ) 70 { 71 return false; 72 } 73 if (this.id.length() > 0 && this.id.equals(that.id) == false) 75 { 76 return false; 77 } 78 } 79 else 80 { 81 if( ( this.id == null && that.id != null ) 84 || ( this.id !=null && that.id == null ) ) 85 { 86 return false; 87 } 88 } 89 if( this.kind != null && that.kind != null ) 90 { 91 if (this.kind.length() != that.kind.length() ) 92 { 93 return false; 94 } 95 if (this.kind.length() > 0 && this.kind.equals(that.kind) == false) 97 { 98 return false; 99 } 100 } 101 else 102 { 103 if( ( this.kind == null && that.kind != null ) 106 || ( this.kind !=null && that.kind == null ) ) 107 { 108 return false; 109 } 110 } 111 return true; 113 } else { 114 return false; 115 } 116 } 117 118 119 public int hashCode() { 121 int hashVal = 0; 122 if (this.id.length() > 0) 123 { 124 hashVal += this.id.hashCode(); 125 } 126 if (this.kind.length() > 0) 127 { 128 hashVal += this.kind.hashCode(); 129 } 130 return hashVal; 131 } 132 } 133 134 | Popular Tags |