001package org.maltparser.core.feature.value; 002 003import org.maltparser.core.feature.function.Function; 004 005/** 006 * 007 * 008 * @author Johan Hall 009**/ 010public abstract class FeatureValue extends FunctionValue { 011 protected boolean nullValue; 012 013 public FeatureValue(Function function) { 014 super(function); 015 setNullValue(true); 016 } 017 018 public void reset() { 019 setNullValue(true); 020 } 021 022 public boolean isNullValue() { 023 return nullValue; 024 } 025 026 public void setNullValue(boolean nullValue) { 027 this.nullValue = nullValue; 028 } 029 030 public abstract boolean isMultiple(); 031 032 public abstract int nFeatureValues(); 033 034 public boolean equals(Object obj) { 035 if (this == obj) 036 return true; 037 if (obj == null) 038 return false; 039 if (getClass() != obj.getClass()) 040 return false; 041 return super.equals(obj); 042 } 043 044 public String toString() { 045 StringBuilder sb = new StringBuilder(); 046 sb.append(super.toString()); 047 sb.append("[null="); 048 sb.append(nullValue); 049 sb.append("]"); 050 return sb.toString(); 051 } 052}