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 SingleFeatureValue extends FeatureValue {
011 protected int code;
012 protected String symbol;
013 protected boolean known;
014
015 public SingleFeatureValue(Function function) {
016 super(function);
017 setCode(0);
018 setSymbol(null);
019 setKnown(true);
020 }
021
022 public void reset() {
023 super.reset();
024 setCode(0);
025 setSymbol(null);
026 setKnown(true);
027 }
028
029 public int getCode() {
030 return code;
031 }
032
033 public void setCode(int code) {
034 this.code = code;
035 }
036
037 public String getSymbol() {
038 return symbol;
039 }
040
041 public void setSymbol(String symbol) {
042 this.symbol = symbol;
043 }
044
045 public boolean isKnown() {
046 return known;
047 }
048
049 public void setKnown(boolean known) {
050 this.known = known;
051 }
052
053 public boolean equals(Object obj) {
054 if (this == obj)
055 return true;
056 if (obj == null)
057 return false;
058 if (getClass() != obj.getClass())
059 return false;
060 if (!symbol.equals(((SingleFeatureValue)obj).symbol))
061 return false;
062 if (code != ((SingleFeatureValue)obj).code)
063 return false;
064 return super.equals(obj);
065 }
066
067 public String toString() {
068 return super.toString()+ "{" + symbol + " -> " + code + ", known=" + known +"} ";
069 }
070 }