|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.knime.base.node.io.filereader.DataCellFactory
public class DataCellFactory
Helper class for the file reader node. Creates data cells of a certain type
from a provided string.
Constructor Summary | |
---|---|
DataCellFactory()
Creates a new factory that can be used to create DataCell s from
a string representation of data. |
Method Summary | |
---|---|
void |
clearThousandsSeparator()
After a call to this method no grouping of thousands in floating point numbers is supported. |
DataCell |
createDataCellOfType(DataType type,
String data)
Creates a DataCell of the specified type from the data passed. |
char |
getDecimalSeparator()
Returns the current decimal separator of floating point numbers. |
String |
getErrorMessage()
Get the error message when createDataCellOfType(DataType, String) returned
null . |
String |
getMissingValuePattern()
Returns the currently set missing value pattern. |
char |
getThousandsSeparator()
Returns the character currently accepted as thousands separator. |
boolean |
hasThousandsSeparator()
Returns true, if grouping of thousands in floating point numbers is currently supported. |
void |
setDecimalSeparator(char decSep)
Sets the decimal separator to the specified character. |
void |
setMissingValuePattern(String missingValuePattern)
Sets a new missing value pattern. |
void |
setThousandsSeparator(char thousandsSep)
Sets the separator for groups of thousands to the specified character. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataCellFactory()
DataCell
s from
a string representation of data. By default the decimal separator for
floating point number is a point, thousands grouping is disabled, and no
missing value pattern is set.
Method Detail |
---|
public void setDecimalSeparator(char decSep)
DoubleCell
. It is highly discouraged to
set 'e' or '-' as a decimal separator.
decSep
- the new decimal separator (default is '.')public char getDecimalSeparator()
public boolean hasThousandsSeparator()
public char getThousandsSeparator()
public void setThousandsSeparator(char thousandsSep)
DoubleCell
. It is highly
discouraged to set 'e' or '-' as a decimal separator.
thousandsSep
- the character separating groups of thousands. if the
NUL character ('\0') is provided this separator is disabled
(which is the default).public void clearThousandsSeparator()
public void setMissingValuePattern(String missingValuePattern)
createDataCellOfType(DataType, String)
creates a
DataCell
with a missing value, it the provided data there equals
(see String.equals(Object)
) the missing value pattern.
missingValuePattern
- the new pattern to set as missing value
pattern. Set to null
to clear the missing value
pattern.createDataCellOfType(DataType, String)
,
DataType.getMissingCell()
public String getMissingValuePattern()
null
is returned, the missing value pattern is disabled.
setMissingValuePattern(String)
public final DataCell createDataCellOfType(DataType type, String data)
DataCell
of the specified type from the data passed.
Supported are the types of StringCell
, IntCell
, and
DoubleCell
, as well as smiles cells, if the corresponding
plug-in is installed (see SmilesTypeHelper
). A DataCell
with a missing value is created if the passed data equals (see
String.equals(Object)
the currently set missing value pattern
(disabled by default, see setMissingValuePattern(String)
).StringCell
can always be created, returns only
null
, if null
was provided as data (a
StringCell
can't hold null
). IntCell
fails, if the provided data is not a valid
string representation of an integer number (see
Integer.parseInt(String)
).DoubleCell
fails, if the provided data is not a
valid string representation of a double number (see
Double.parseDouble(String)
, with respect to the currently set
decimal and thousands separators.
type
- the type of the data cell to create. If the provided data
can't be translated to the corresponding type, null is
returned. The error message can be retrieved through the
getErrorMessage()
.data
- the string representation of the data to store in the newly
created cell. Can't be null.
Null
is returned if the cell couldn't be created.
Mostly due to incompatible string data, probably. The error
message can then be retrieved through the
getErrorMessage()
method.
IllegalArgumentException
- if the passed type is not supported.
NullPointerException
- if the passed data or type is null.setMissingValuePattern(String)
,
getErrorMessage()
,
DataType.getMissingCell()
public String getErrorMessage()
createDataCellOfType(DataType, String)
returned
null
.
DataCell
. Will be null, if creation succeeded.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |