|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectprefuse.data.parser.TypeInferencer
public class TypeInferencer
Infers the data types for a table of data by testing each value
of the data against a bank of parsers and eliminating candidate
parsers that do not successfully parse the data. This class leverages
the mechanisms of ParserFactory, but while that class only
supports one data field at a time, TypeInferencer maintains a collection
of ParserFactory instances to infer type for multiple data columns
simultaneously.
ParserFactory| Field Summary | |
|---|---|
java.util.ArrayList |
m_factories
|
ParserFactory |
m_template
|
| Constructor Summary | |
|---|---|
TypeInferencer()
Create a new TypeInferencer using the default ParserFactory settings, thus the default parsers and parser ordering will be used. |
|
TypeInferencer(ParserFactory template)
Create a new TypeInferenced using the input ParserFactory as a template for the desired parsers to check and parser ordering to use. |
|
| Method Summary | |
|---|---|
DataParser |
getParser(int column)
Get the top-ranking candidate data parser for the given column index. |
java.lang.Class |
getType(int column)
Get the data type for the highest ranking candidate parser still in the running for the given column index. |
void |
sample(int column,
java.lang.String value)
Sample the given text string for the given data column index. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public ParserFactory m_template
public java.util.ArrayList m_factories
| Constructor Detail |
|---|
public TypeInferencer()
public TypeInferencer(ParserFactory template)
template - the template ParserFactory to use for included
parsers and their precedence.| Method Detail |
|---|
public void sample(int column,
java.lang.String value)
column - the data column index of the samplevalue - the text string samplepublic java.lang.Class getType(int column)
column - the data column index
public DataParser getParser(int column)
column - the data column index
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||