Class 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 class  SimplePolygonParser.Par
      Parameterization class.
      • Nested classes/interfaces inherited from interface elki.datasource.bundle.BundleStreamSource

        elki.datasource.bundle.BundleStreamSource.Event
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.regex.Pattern COORD
      Pattern to catch coordinates
      private java.util.List<double[]> coords
      (Reused) storage of coordinates.
      protected elki.data.ExternalID cureid
      Current external id.
      protected elki.data.LabelList curlbl
      Current labels.
      protected elki.data.spatial.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 elki.logging.Logging LOG
      Class logger
      protected elki.datasource.bundle.BundleMeta meta
      Metadata.
      (package private) elki.datasource.bundle.BundleStreamSource.Event nextevent
      Event to report next.
      static java.lang.String POLYGON_SEPARATOR
      Polygon separator
      private java.util.List<elki.data.spatial.Polygon> polys
      (Reused) storage of polygons.
    • 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:
        true if the line was read successful.