public class FeatureSetImpl extends Object implements FeatureSet
Modifier and Type | Field and Description |
---|---|
private Map |
featureMap |
(package private) static DecimalFormat |
formatter |
Constructor and Description |
---|
FeatureSetImpl()
Creates a new empty feature set
|
Modifier and Type | Method and Description |
---|---|
void |
dump(PrintWriter output,
int pad,
String title)
Dumps the FeatureSet in textual form.
|
void |
dump(PrintWriter output,
int pad,
String title,
boolean showName)
Dumps the FeatureSet in textual form.
|
float |
getFloat(String name)
Convenience method that returns the named feature as a float.
|
int |
getInt(String name)
Convenience method that returns the named feature as a int.
|
Object |
getObject(String name)
Returns the named feature as an object.
|
String |
getString(String name)
Convenience method that returns the named feature as a string.
|
boolean |
isPresent(String name)
Determines if the given feature is present.
|
void |
remove(String name)
Removes the named feature from this set of features.
|
void |
setFloat(String name,
float value)
Convenience method that sets the named feature as a float.
|
void |
setInt(String name,
int value)
Convenience method that sets the named feature as a int.
|
void |
setObject(String name,
Object value)
Sets the named feature.
|
void |
setString(String name,
String value)
Convenience method that sets the named feature as a String.
|
private final Map featureMap
static DecimalFormat formatter
public FeatureSetImpl()
public boolean isPresent(String name)
isPresent
in interface FeatureSet
name
- the name of the feature of interestpublic void remove(String name)
remove
in interface FeatureSet
name
- the name of the feature of interestpublic String getString(String name)
getString
in interface FeatureSet
name
- the name of the featureClassCastException
- if the associated value is not a
Stringpublic int getInt(String name)
getInt
in interface FeatureSet
name
- the name of the featureClassCastException
- if the associated value is not an int.public float getFloat(String name)
getFloat
in interface FeatureSet
name
- the name of the featureClassCastException
- if the associated value is not a
floatpublic Object getObject(String name)
getObject
in interface FeatureSet
name
- the name of the featurepublic void setInt(String name, int value)
setInt
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic void setFloat(String name, float value)
setFloat
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic void setString(String name, String value)
setString
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic void setObject(String name, Object value)
setObject
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic void dump(PrintWriter output, int pad, String title)
dump
in interface Dumpable
dump
in interface FeatureSet
output
- where to send the formatted outputpad
- the paddingtitle
- the titlepublic void dump(PrintWriter output, int pad, String title, boolean showName)
output
- where to send the formatted outputpad
- the paddingtitle
- the titleshowName
- if true
, include the feature nameWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses