001 package org.maltparser.core.feature.value;
002
003 import org.maltparser.core.feature.function.Function;
004
005 /**
006 *
007 *
008 * @author Johan Hall
009 * @since 1.0
010 **/
011 public abstract class FeatureValue extends FunctionValue {
012 protected boolean nullValue;
013 // protected int cardinality;
014
015 public FeatureValue(Function function) {
016 super(function);
017 setNullValue(true);
018 // setCardinality(0);
019 }
020
021 public void reset() {
022 setNullValue(true);
023 }
024
025 public boolean isNullValue() {
026 return nullValue;
027 }
028
029 public void setNullValue(boolean nullValue) {
030 this.nullValue = nullValue;
031 }
032
033 // /**
034 // * Returns the cardinality (the number of distinct values) of the feature
035 // *
036 // * @return the cardinality (the number of distinct values) of the feature
037 // */
038 // public int getCardinality() {
039 // return cardinality;
040 // }
041 //
042 // /**
043 // * Sets the cardinality (the number of distinct values) of the feature
044 // *
045 // * @param cardinality the cardinality (the number of distinct values)
046 // */
047 // public void setCardinality(int cardinality) {
048 // this.cardinality = cardinality;
049 // }
050
051 public boolean equals(Object obj) {
052 if (this == obj)
053 return true;
054 if (obj == null)
055 return false;
056 if (getClass() != obj.getClass())
057 return false;
058 return super.equals(obj);
059 }
060
061 public String toString() {
062 StringBuilder sb = new StringBuilder();
063 sb.append(super.toString());
064 sb.append("[null=");
065 sb.append(nullValue);
066 sb.append("]");
067 return sb.toString();
068 }
069 }