1 28 29 package org.objectweb.util.explorer.core.common.lib; 30 31 import org.objectweb.util.explorer.ExplorerUtils; 32 import org.objectweb.util.explorer.core.role.api.Role; 33 34 43 public class DefaultKey 44 { 45 46 52 53 protected String typeSystemId_; 54 55 56 protected String typeName_; 57 58 59 protected Role role_; 60 61 67 73 public DefaultKey(String typeSystemId, String typeName, Role role) { 74 this.typeSystemId_ = typeSystemId; 75 this.typeName_ = typeName; 76 this.role_ = role; 77 } 78 79 85 86 87 91 protected boolean equals(DefaultKey key){ 92 if (key != null) { 93 return ExplorerUtils.compareObjects(key.typeSystemId_,typeSystemId_) 94 && ExplorerUtils.compareObjects(key.typeName_,typeName_) 95 && ExplorerUtils.compareObjects(key.role_,role_); 96 } 97 return false; 98 } 99 100 101 107 111 public boolean equals(Object o){ 112 if(o!=null && o instanceof DefaultKey) 113 return equals((DefaultKey)o); 114 return false; 115 } 116 117 120 public String toString(){ 121 return "DefaultKey[typeSystem=" + typeSystemId_ + ", typeName=" + typeName_ + ", role=" + (role_!=null?role_.toString():"null") + "]"; 122 } 123 124 128 public int hashCode(){ 129 return ExplorerUtils.getHashCode(typeSystemId_) 130 + ExplorerUtils.getHashCode(typeName_) 131 + ExplorerUtils.getHashCode(role_); 132 } 133 } 134 135 | Popular Tags |