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 classSimplePolygonParser.ParParameterization 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.PatternCOORDPattern to catch coordinatesprivate java.util.List<double[]>coords(Reused) storage of coordinates.protected ExternalIDcureidCurrent external id.protected LabelListcurlblCurrent labels.protected 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 LoggingLOGClass loggerprotected BundleMetametaMetadata.(package private) BundleStreamSource.EventnexteventEvent to report next.static java.lang.StringPOLYGON_SEPARATORPolygon 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 voidbuildMeta()Update the meta element.java.lang.Objectdata(int rnum)Access a particular object and representation.protected LogginggetLogger()Get the logger for this class.BundleMetagetMeta()Get the current meta data.BundleStreamSource.EventnextEvent()Get the next eventprivate 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 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:BundleStreamSourceGet the next event- Returns:
- Event type
-
buildMeta
protected void buildMeta()
Update the meta element.
-
getMeta
public BundleMeta getMeta()
Description copied from interface:BundleStreamSourceGet the current meta data.- Returns:
- Metadata
-
data
public java.lang.Object data(int rnum)
Description copied from interface:BundleStreamSourceAccess a particular object and representation.- Parameters:
rnum- Representation number- Returns:
- Contained data
-
parseLine
private boolean parseLine()
Parse a single line.- Returns:
trueif the line was read successful.
-
getLogger
protected Logging getLogger()
Description copied from class:AbstractStreamingParserGet the logger for this class.- Specified by:
getLoggerin classAbstractStreamingParser- Returns:
- Logger.
-
-