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