/**
* Copyright 2011 multibit.org
*
* Licensed under the MIT license (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://opensource.org/licenses/mit-license.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.multibit.model.bitcoin;
/**
* class used to store the data in the table in a quick to access form
*/
@SuppressWarnings("rawtypes")
public class WalletAddressBookData implements Comparable {
String label;
String address;
public WalletAddressBookData(String label, String address) {
this.label = label;
this.address = address;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((label == null) ? 0 : label.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
WalletAddressBookData other = (WalletAddressBookData) obj;
if (address == null) {
if (other.address != null) {
return false;
}
} else if (!address.equals(other.address)) {
return false;
}
if (label == null) {
if (other.label != null) {
return false;
}
} else if (!label.equals(other.label)) {
return false;
}
return true;
}
@Override
public String toString() {
return "AddressBookData [label=" + label + ", address=" + address + "]";
}
@Override
public int compareTo(Object other) {
if (other instanceof WalletAddressBookData) {
return (label + "").compareTo(((WalletAddressBookData)other).label);
} else {
return 0;
}
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAddress() {
return address;
}
}