V
- the type of NumberVector usedpublic class NumberVectorLabelParser<V extends NumberVector> extends AbstractStreamingParser
Modifier and Type | Class and Description |
---|---|
static class |
NumberVectorLabelParser.Parameterizer<V extends NumberVector>
Parameterization class.
|
BundleStreamSource.Event
Modifier and Type | Field and Description |
---|---|
protected DoubleArray |
attributes
Double array storing the numerical attributes during parsing.
|
protected List<String> |
columnnames
Column names.
|
protected LabelList |
curlbl
Current labels.
|
protected V |
curvec
Current vector.
|
protected NumberVector.Factory<V> |
factory
Vector factory class.
|
protected boolean |
haslabels
Whether or not the data set has labels.
|
private long[] |
labelIndices
Keeps the indices of the attributes to be treated as a string label.
|
(package private) ArrayList<String> |
labels
(Reused) store for labels.
|
private static Logging |
LOG
Logging class.
|
protected int |
maxdim
Dimensionality reported.
|
protected BundleMeta |
meta
Metadata.
|
protected int |
mindim
Dimensionality reported.
|
(package private) BundleStreamSource.Event |
nextevent
Event to report next.
|
(package private) Unique<String> |
unique
For String unification.
|
reader, tokenizer
Constructor and Description |
---|
NumberVectorLabelParser(CSVReaderFormat format,
long[] labelIndices,
NumberVector.Factory<V> factory)
Constructor.
|
NumberVectorLabelParser(NumberVector.Factory<V> factory)
Constructor with defaults.
|
NumberVectorLabelParser(Pattern colSep,
String quoteChars,
Pattern comment,
long[] labelIndices,
NumberVector.Factory<V> factory)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
buildMeta()
Update the meta element.
|
void |
cleanup()
Perform cleanup operations after parsing.
|
protected V |
createVector()
Creates a database object of type V.
|
Object |
data(int rnum)
Access a particular object and representation.
|
protected Logging |
getLogger()
Get the logger for this class.
|
BundleMeta |
getMeta()
Get the current meta data.
|
(package private) SimpleTypeInformation<V> |
getTypeInformation(int mindim,
int maxdim)
Get a prototype object for the given dimensionality.
|
void |
initStream(InputStream in)
Init the streaming parser for the given input stream.
|
protected boolean |
isLabelColumn(int col)
Test if the current column is marked as label column.
|
BundleStreamSource.Event |
nextEvent()
Get the next event
|
protected boolean |
parseLineInternal()
Internal method for parsing a single line.
|
asMultipleObjectsBundle, assignDBID, hasDBIDs, parse
private static final Logging LOG
private long[] labelIndices
protected NumberVector.Factory<V extends NumberVector> factory
protected int mindim
protected int maxdim
protected BundleMeta meta
protected boolean haslabels
protected V extends NumberVector curvec
protected LabelList curlbl
protected DoubleArray attributes
BundleStreamSource.Event nextevent
public NumberVectorLabelParser(CSVReaderFormat format, long[] labelIndices, NumberVector.Factory<V> factory)
format
- Input formatlabelIndices
- Column indexes that are not numeric.factory
- Vector factorypublic NumberVectorLabelParser(NumberVector.Factory<V> factory)
factory
- Vector factorypublic NumberVectorLabelParser(Pattern colSep, String quoteChars, Pattern comment, long[] labelIndices, NumberVector.Factory<V> factory)
colSep
- Column separatorquoteChars
- Quote charactercomment
- Comment patternlabelIndices
- Column indexes that are not numeric.factory
- Vector factoryprotected boolean isLabelColumn(int col)
col
- Column numbertrue
when a label column.public void initStream(InputStream in)
StreamingParser
initStream
in interface StreamingParser
initStream
in class AbstractStreamingParser
in
- the stream to parse objects frompublic BundleMeta getMeta()
BundleStreamSource
public BundleStreamSource.Event nextEvent()
BundleStreamSource
public void cleanup()
Parser
cleanup
in interface Parser
cleanup
in class AbstractStreamingParser
protected void buildMeta()
public Object data(int rnum)
BundleStreamSource
rnum
- Representation numberprotected boolean parseLineInternal()
true
when a valid line was read, false
on a label
row.protected V createVector()
SimpleTypeInformation<V> getTypeInformation(int mindim, int maxdim)
mindim
- Minimum dimensionalitymaxdim
- Maximum dimensionalityprotected Logging getLogger()
AbstractStreamingParser
getLogger
in class AbstractStreamingParser
Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.