1 29 30 31 package snmp; 32 33 34 35 38 39 40 public abstract class SNMPObject 41 { 42 43 47 48 public abstract Object getValue(); 49 50 51 52 56 57 public abstract void setValue(Object o) 58 throws SNMPBadValueException; 59 60 61 62 65 66 public abstract String toString(); 67 68 69 70 73 74 protected abstract byte[] getBEREncoding(); 75 76 77 80 81 public boolean equals(Object other) 82 { 83 if (other == null) 85 { 86 return false; 87 } 88 89 if (!this.getClass().equals(other.getClass())) 91 { 92 return false; 93 } 94 95 SNMPObject otherSNMPObject = (SNMPObject)other; 96 97 if (this.getValue().equals(otherSNMPObject.getValue())) 99 { 100 return true; 101 } 102 else 103 { 104 return false; 105 } 106 } 107 108 109 112 113 public int hashCode() 114 { 115 if (this.getValue() != null) 117 { 118 return this.getValue().hashCode(); 119 } 120 else 121 { 122 return 0; 123 } 124 } 125 126 127 } | Popular Tags |