|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFreeCBR.Feature
public class Feature
This class represents a feature defined by a feature type and a value.
Field Summary | |
---|---|
static short |
FEATURE_TYPE_BOOL
The feature is of type Bool |
static short |
FEATURE_TYPE_FLOAT
The feature is of type Float |
static short |
FEATURE_TYPE_INT
The feature is of type Int |
static short |
FEATURE_TYPE_MULTISTRING
The feature is of type MultiString |
static short |
FEATURE_TYPE_STRING
The feature is of type String |
static java.lang.String |
FEATURE_VALUE_UNDEFINED
The feature is undefined or not applicable |
protected java.lang.Object |
value
Contains the feature value |
Constructor Summary | |
---|---|
Feature(boolean value)
Creates a feature of type Bool and initiates it |
|
Feature(double value)
Creates a feature of type Float and initiates it |
|
Feature(long value)
Creates a feature of type Int and initiates it |
|
Feature(java.lang.String value)
Creates a feature of type String and initiates it |
|
Feature(java.lang.String[] value)
Creates a feature of type MultiString and initiates it |
|
Feature(java.lang.String value,
short type)
Creates a feature of specified type from a String |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Tests if two Features are equal. |
boolean |
getBoolValue()
Returns the feature value if the type is Bool. |
short |
getFeatureType()
Returns the type of this feature |
double |
getFloatValue()
Returns the feature value if the type is Float. |
long |
getIntValue()
Returns the feature value if the type is Int. |
java.lang.String[] |
getMultiStringValue()
Returns the feature value if the type is MultiString. |
java.lang.String |
getStringValue()
Returns the feature value if the type is String. |
java.lang.Object |
getValue()
Returns the feature value casted to Object whatever the actual type is |
boolean |
isUndefined()
Is this feature undefined? |
protected static java.lang.String |
multiStringJoin(java.lang.String[] strings)
Creates a "MultiString" from an array of strings |
protected static java.lang.String[] |
multiStringSplit(java.lang.String mstring)
Splits a "MultiString" to an array of String:s |
static short |
stringToType(java.lang.String typeString)
Converts a string representing a type to the type |
java.lang.String |
toString()
Returns a string representing the instance |
static java.lang.String |
typeToString(short type)
Converts a type to a string representing the type |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object value
public static final java.lang.String FEATURE_VALUE_UNDEFINED
public static final short FEATURE_TYPE_STRING
public static final short FEATURE_TYPE_MULTISTRING
public static final short FEATURE_TYPE_INT
public static final short FEATURE_TYPE_FLOAT
public static final short FEATURE_TYPE_BOOL
Constructor Detail |
---|
public Feature(java.lang.String value)
value
- the String to initiate the feature withpublic Feature(java.lang.String[] value)
value
- the String array to initiate the feature withpublic Feature(long value)
value
- the integer to initiate the feature withpublic Feature(double value)
value
- the floating point to initiate the feature withpublic Feature(boolean value)
value
- the boolean to initiate the feature withpublic Feature(java.lang.String value, short type)
value
- the value of the feature. If empty string then feature
will be of type FEATURE_VALUE_UNDEFINEDtype
- the datatype of the featureMethod Detail |
---|
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to compare
public boolean isUndefined()
public short getFeatureType()
public java.lang.String getStringValue()
IllegalTypeException
- if the feature is not a Stringpublic java.lang.String[] getMultiStringValue()
IllegalTypeException
- if the feature is not a MultiStringpublic long getIntValue()
IllegalTypeException
- if the feature is not an Int
NoDataException
- if the value is undefinedpublic double getFloatValue()
IllegalTypeException
- if the feature is not a Float
NoDataException
- if the value is undefinedpublic boolean getBoolValue()
IllegalTypeException
- if the feature is not a Bool
NoDataException
- if the value is undefinedpublic java.lang.Object getValue()
public java.lang.String toString()
toString
in class java.lang.Object
public static short stringToType(java.lang.String typeString)
typeString
- the string that will be translated to a type,
for example "String"
IllegalTypeException
- if no valid type is foundpublic static java.lang.String typeToString(short type)
type
- the type that shall be converted, for example
Feature.STRING_FEATURE
IllegalTypeException
- if no valid type is foundprotected static java.lang.String[] multiStringSplit(java.lang.String mstring)
mstring
- the MultiString
protected static java.lang.String multiStringJoin(java.lang.String[] strings)
strings
- array of strings to convert
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |