001package org.maltparser.core.feature.value;
002
003import org.maltparser.core.feature.function.Function;
004/**
005 *  
006 *
007 * @author Johan Hall
008**/
009public class AddressValue extends FunctionValue {
010        private Object address;
011        
012        public AddressValue(Function function) {
013                super(function);
014                setAddress(null);
015        }
016        
017        public void reset() {
018                setAddress(null);
019        }
020        
021        public Class<?> getAddressClass() {
022                if (address != null) {
023                        return address.getClass();
024                }
025                return null;
026        }
027        
028        public Object getAddress() {
029                return address;
030        }
031
032        public void setAddress(Object address) {
033                this.address = address;
034        }
035        
036        public boolean equals(Object obj) {
037                if (this == obj)
038                        return true;
039                if (obj == null)
040                        return false;
041                if (getClass() != obj.getClass())
042                        return false;
043                AddressValue other = (AddressValue) obj;
044                if (address == null) {
045                        if (other.address != null)
046                                return false;
047                } else if (!address.equals(other.address))
048                        return false;
049                return super.equals(obj);
050        }
051        
052        public int hashCode() {
053                return 31 + ((address == null) ? 0 : address.hashCode());
054        }
055
056        public String toString() {
057                final StringBuilder sb = new StringBuilder();
058                sb.append(super.toString());
059                sb.append(address.toString());
060                return sb.toString();
061        }
062}