edu.indiana.iucbrf.feature
Class AbstractFeature
java.lang.Object
edu.indiana.iucbrf.feature.AbstractFeature
- All Implemented Interfaces:
- Feature, SwingRepresentable, java.io.Serializable, java.lang.Comparable
- Direct Known Subclasses:
- AbstractFSMFeature, CharacterFeature, DoubleFeature, ExceptionFeature, InetAddressFeature, IntegerFeature, ObjectFeature, StringFeature, TableFeature, TermVectorFeature
public abstract class AbstractFeature
- extends java.lang.Object
- implements java.io.Serializable, Feature
This class makes assumptions about Features that are general enough to be applicable
to most implementations.
- See Also:
- Serialized Form
Field Summary |
protected static java.lang.Object |
DEFAULT_CONSTRUCTED
|
static java.lang.reflect.Constructor |
NO_STANDARD_CONSTRUCTOR
|
protected java.lang.Object |
value
This should refer to whatever the value of the feature is, whether it's a Double, String, some custom type, etc. |
Method Summary |
void |
adjust(double adjustAmount)
|
static double |
checkAndGetDoubleValue(java.lang.Object feature)
Get the double value according to getValueAsDouble(), and throwing an exception
if the feature is not DoubleRepresentable. |
abstract java.lang.Object |
clone()
|
int |
compareTo(java.lang.Object otherFeature)
Compare this feature with another, based on their double values. |
boolean |
equals(java.lang.Object other)
|
java.lang.Object |
getValue()
|
abstract Feature |
midpoint(Feature other_feature)
|
java.lang.String |
toString()
|
java.lang.String |
toString(FeatureValueFormat formatter)
|
javax.swing.JComponent |
toSwing(FeatureValueFormat formatter)
|
javax.swing.JComponent |
toSwing(int detailLevel)
Detail level may be ignored by implementations. |
javax.swing.JComponent |
toSwing(java.lang.String asString)
|
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
NO_STANDARD_CONSTRUCTOR
public static final transient java.lang.reflect.Constructor NO_STANDARD_CONSTRUCTOR
DEFAULT_CONSTRUCTED
protected static final java.lang.Object DEFAULT_CONSTRUCTED
value
protected java.lang.Object value
- This should refer to whatever the value of the feature is, whether it's a Double, String, some custom type, etc.
AbstractFeature
public AbstractFeature()
AbstractFeature
public AbstractFeature(java.lang.Object new_value)
AbstractFeature
public AbstractFeature(Feature other_feature)
AbstractFeature
public AbstractFeature(Distribution distribution)
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in class java.lang.Object
compareTo
public int compareTo(java.lang.Object otherFeature)
- Compare this feature with another, based on their double values.
Note that since this assumes the features are DoubleRepresentable, an IllegalArgumentException will be thrown if the features being compared are not actually DoubleRepresentable.
Whether this version or an overriding subclass' version is used:
Return value is < 0 (here, -1) if "this" is less than otherFeature.
Return value is > 0 (here, 1) if "this" is greater than otherFeature.
Return value is = 0 (here, 0) if "this" equals otherFeature.
- Specified by:
compareTo
in interface java.lang.Comparable
checkAndGetDoubleValue
public static double checkAndGetDoubleValue(java.lang.Object feature)
- Get the double value according to getValueAsDouble(), and throwing an exception
if the feature is not DoubleRepresentable.
midpoint
public abstract Feature midpoint(Feature other_feature)
- Specified by:
midpoint
in interface Feature
adjust
public void adjust(double adjustAmount)
throws CouldNotAdjustException,
java.lang.UnsupportedOperationException
- Specified by:
adjust
in interface Feature
- Throws:
CouldNotAdjustException
java.lang.UnsupportedOperationException
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
toSwing
public javax.swing.JComponent toSwing(int detailLevel)
- Description copied from interface:
SwingRepresentable
- Detail level may be ignored by implementations.
If used, the standard is for detailLevel 0 to be least detail, with higher values growing more detailed.
0 is least detail, higher numbers are more
- Specified by:
toSwing
in interface SwingRepresentable
toSwing
public javax.swing.JComponent toSwing(FeatureValueFormat formatter)
- Specified by:
toSwing
in interface Feature
toSwing
public javax.swing.JComponent toSwing(java.lang.String asString)
toString
public java.lang.String toString(FeatureValueFormat formatter)
- Specified by:
toString
in interface Feature
getValue
public java.lang.Object getValue()
- Specified by:
getValue
in interface Feature
clone
public abstract java.lang.Object clone()
- Specified by:
clone
in interface Feature
- Overrides:
clone
in class java.lang.Object