| 185 | } |
| 186 | |
| 187 | public boolean equals(Object o) { |
| 188 | |
| 189 | if (o == null) { |
| 190 | return false; |
| 191 | } |
| 192 | |
| 193 | if (!Metadata.class.isAssignableFrom(o.getClass())) { |
| 194 | return false; |
| 195 | } |
| 196 | |
| 197 | Metadata other = (Metadata) o; |
| 198 | |
| 199 | if (other.size() != size()) { |
| 200 | return false; |
| 201 | } |
| 202 | |
| 203 | String[] names = names(); |
| 204 | for (int i = 0; i < names.length; i++) { |
| 205 | String[] otherValues = other._getValues(names[i]); |
| 206 | String[] thisValues = _getValues(names[i]); |
| 207 | if (otherValues.length != thisValues.length) { |
| 208 | return false; |
| 209 | } |
| 210 | for (int j = 0; j < otherValues.length; j++) { |
| 211 | if (!otherValues[j].equals(thisValues[j])) { |
| 212 | return false; |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | return true; |
| 217 | } |
| 218 | |
| 219 | public String toString() { |
| 220 | StringBuffer buf = new StringBuffer(); |