Package elki.datasource.parser
Class SimplePolygonParser
- java.lang.Object
-
- elki.datasource.parser.AbstractStreamingParser
-
- elki.datasource.parser.SimplePolygonParser
-
- All Implemented Interfaces:
BundleStreamSource
,Parser
,StreamingParser
public class SimplePolygonParser extends AbstractStreamingParser
Parser to load polygon data (2D and 3D only) from a simple format. One record per line, points separated by whitespace, numbers separated by commas. Multiple polygons components can be separated using--
.Unparseable parts will be treated as labels.
- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SimplePolygonParser.Par
Parameterization class.-
Nested classes/interfaces inherited from interface elki.datasource.bundle.BundleStreamSource
BundleStreamSource.Event
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.Pattern
COORD
Pattern to catch coordinatesprivate java.util.List<double[]>
coords
(Reused) storage of coordinates.protected ExternalID
cureid
Current external id.protected LabelList
curlbl
Current labels.protected PolygonsObject
curpoly
Current polygon.protected boolean
haslabels
Whether or not the data set has labels.private java.util.ArrayList<java.lang.String>
labels
(Reused) store for labels.private static Logging
LOG
Class loggerprotected BundleMeta
meta
Metadata.(package private) BundleStreamSource.Event
nextevent
Event to report next.static java.lang.String
POLYGON_SEPARATOR
Polygon separatorprivate java.util.List<Polygon>
polys
(Reused) storage of polygons.-
Fields inherited from class elki.datasource.parser.AbstractStreamingParser
reader, tokenizer
-
-
Constructor Summary
Constructors Constructor Description SimplePolygonParser(CSVReaderFormat format)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
buildMeta()
Update the meta element.java.lang.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.BundleStreamSource.Event
nextEvent()
Get the next eventprivate boolean
parseLine()
Parse a single line.-
Methods inherited from class elki.datasource.parser.AbstractStreamingParser
asMultipleObjectsBundle, assignDBID, cleanup, hasDBIDs, initStream, parse
-
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Class logger
-
COORD
public static final java.util.regex.Pattern COORD
Pattern to catch coordinates
-
POLYGON_SEPARATOR
public static final java.lang.String POLYGON_SEPARATOR
Polygon separator- See Also:
- Constant Field Values
-
nextevent
BundleStreamSource.Event nextevent
Event to report next.
-
meta
protected BundleMeta meta
Metadata.
-
haslabels
protected boolean haslabels
Whether or not the data set has labels.
-
curpoly
protected PolygonsObject curpoly
Current polygon.
-
curlbl
protected LabelList curlbl
Current labels.
-
cureid
protected ExternalID cureid
Current external id.
-
coords
private final java.util.List<double[]> coords
(Reused) storage of coordinates.
-
polys
private final java.util.List<Polygon> polys
(Reused) storage of polygons.
-
labels
private final java.util.ArrayList<java.lang.String> labels
(Reused) store for labels.
-
-
Constructor Detail
-
SimplePolygonParser
public SimplePolygonParser(CSVReaderFormat format)
Constructor.- Parameters:
format
- Input format
-
-
Method Detail
-
nextEvent
public BundleStreamSource.Event nextEvent()
Description copied from interface:BundleStreamSource
Get the next event- Returns:
- Event type
-
buildMeta
protected void buildMeta()
Update the meta element.
-
getMeta
public BundleMeta getMeta()
Description copied from interface:BundleStreamSource
Get the current meta data.- Returns:
- Metadata
-
data
public java.lang.Object data(int rnum)
Description copied from interface:BundleStreamSource
Access a particular object and representation.- Parameters:
rnum
- Representation number- Returns:
- Contained data
-
parseLine
private boolean parseLine()
Parse a single line.- Returns:
true
if the line was read successful.
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractStreamingParser
Get the logger for this class.- Specified by:
getLogger
in classAbstractStreamingParser
- Returns:
- Logger.
-
-