Package elki.datasource.parser
Class SimplePolygonParser
- java.lang.Object
-
- elki.datasource.parser.AbstractStreamingParser
-
- elki.datasource.parser.SimplePolygonParser
-
- All Implemented Interfaces:
elki.datasource.bundle.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 classSimplePolygonParser.ParParameterization class.
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.PatternCOORDPattern to catch coordinatesprivate java.util.List<double[]>coords(Reused) storage of coordinates.protected elki.data.ExternalIDcureidCurrent external id.protected elki.data.LabelListcurlblCurrent labels.protected elki.data.spatial.PolygonsObjectcurpolyCurrent polygon.protected booleanhaslabelsWhether or not the data set has labels.private java.util.ArrayList<java.lang.String>labels(Reused) store for labels.private static elki.logging.LoggingLOGClass loggerprotected elki.datasource.bundle.BundleMetametaMetadata.(package private) elki.datasource.bundle.BundleStreamSource.EventnexteventEvent to report next.static java.lang.StringPOLYGON_SEPARATORPolygon separatorprivate java.util.List<elki.data.spatial.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 voidbuildMeta()Update the meta element.java.lang.Objectdata(int rnum)protected elki.logging.LogginggetLogger()Get the logger for this class.elki.datasource.bundle.BundleMetagetMeta()elki.datasource.bundle.BundleStreamSource.EventnextEvent()private booleanparseLine()Parse a single line.-
Methods inherited from class elki.datasource.parser.AbstractStreamingParser
asMultipleObjectsBundle, assignDBID, cleanup, hasDBIDs, initStream, parse
-
-
-
-
Field Detail
-
LOG
private static final elki.logging.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
elki.datasource.bundle.BundleStreamSource.Event nextevent
Event to report next.
-
meta
protected elki.datasource.bundle.BundleMeta meta
Metadata.
-
haslabels
protected boolean haslabels
Whether or not the data set has labels.
-
curpoly
protected elki.data.spatial.PolygonsObject curpoly
Current polygon.
-
curlbl
protected elki.data.LabelList curlbl
Current labels.
-
cureid
protected elki.data.ExternalID cureid
Current external id.
-
coords
private final java.util.List<double[]> coords
(Reused) storage of coordinates.
-
polys
private final java.util.List<elki.data.spatial.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 elki.datasource.bundle.BundleStreamSource.Event nextEvent()
-
buildMeta
protected void buildMeta()
Update the meta element.
-
getMeta
public elki.datasource.bundle.BundleMeta getMeta()
-
data
public java.lang.Object data(int rnum)
-
parseLine
private boolean parseLine()
Parse a single line.- Returns:
trueif the line was read successful.
-
getLogger
protected elki.logging.Logging getLogger()
Description copied from class:AbstractStreamingParserGet the logger for this class.- Specified by:
getLoggerin classAbstractStreamingParser- Returns:
- Logger.
-
-