Class AbstractDataSet<D extends AbstractStylable<D>>

    • Field Detail

      • name

        protected java.lang.String name
      • updateListeners

        protected final java.util.List<EventListener> updateListeners
      • lock

        protected final java.util.concurrent.locks.ReentrantLock lock
      • dataLabels

        protected java.util.Map<java.lang.Integer,​java.lang.String> dataLabels
      • dataStyles

        protected java.util.Map<java.lang.Integer,​java.lang.String> dataStyles
      • metaInfoMap

        protected final java.util.Map<java.lang.String,​java.lang.String> metaInfoMap
    • Constructor Detail

      • AbstractDataSet

        public AbstractDataSet​(java.lang.String name)
        default constructor
        Parameters:
        name - the default name of the data set (meta data)
    • Method Detail

      • setName

        public D setName​(java.lang.String name)
        Sets the name of data set (meta data)
        Parameters:
        name - the new name
        Returns:
        itself (fluent design)
      • getName

        public java.lang.String getName()
        Description copied from interface: DataSet
        Gets the name of the data set.
        Specified by:
        getName in interface DataSet
        Returns:
        the name of the DataSet
      • lock

        public D lock()
        Description copied from interface: DataSet
        Locks access to the data set. Multi-threaded applications should lock the data set before setting the data.
        Specified by:
        lock in interface DataSet
        Returns:
        itself (fluent interface)
      • unlock

        public D unlock()
        Description copied from interface: DataSet
        Unlock the data set.
        Specified by:
        unlock in interface DataSet
        Returns:
        itself (fluent interface)
      • updateEventListener

        public java.util.List<EventListener> updateEventListener()
        Specified by:
        updateEventListener in interface EventSource
        Returns:
        list containing all update event listener (needs to be provided by implementing class)
      • setAutoNotifaction

        public D setAutoNotifaction​(boolean flag)
        Description copied from interface: DataSet
        Set the automatic notification of invalidation listeners. In general, data sets should notify registered invalidation listeners, if the data in the data set has changed. Charts usually register an invalidation listener with the data set to be notified of any changes and update the charts. Setting the automatic notification to false, allows applications to prevent this behaviour, in case data sets are updated multiple times during an acquisition cycle but the chart update is only required at the end of the cycle.
        Specified by:
        setAutoNotifaction in interface DataSet
        Parameters:
        flag - true for automatic notification
        Returns:
        itself (fluent interface)
      • isAutoNotification

        public boolean isAutoNotification()
        Description copied from interface: DataSet
        Checks it automatic notification is enabled.
        Specified by:
        isAutoNotification in interface DataSet
        Returns:
        true if automatic notification is enabled
      • getUndefValue

        public java.lang.Double getUndefValue()
        Description copied from interface: DataSet
        Returns the value for undefined data points.
        Specified by:
        getUndefValue in interface DataSet
        Returns:
        the value indicating undefined data points
      • getXMin

        public double getXMin()
        Gets the minimum x value of the data set.
        Specified by:
        getXMin in interface DataSet
        Returns:
        minimum x value
      • getXMax

        public double getXMax()
        Gets the maximum x value of the data set.
        Specified by:
        getXMax in interface DataSet
        Returns:
        maximum x value
      • getYMin

        public double getYMin()
        Gets the minimum y value of the data set.
        Specified by:
        getYMin in interface DataSet
        Returns:
        minimum y value
      • getYMax

        public double getYMax()
        Gets the maximum y value of the data set.
        Specified by:
        getYMax in interface DataSet
        Returns:
        maximum y value
      • getXRange

        public DataRange getXRange()
        Returns:
        horizontal range of data set
      • getYRange

        public DataRange getYRange()
        Returns:
        vertical range of data set
      • computeLimits

        protected D computeLimits()
        Computes limits (ranges) of this DataSet.
        Returns:
        itself (fluent design)
      • getDataCount

        public int getDataCount​(double xmin,
                                double xmax)
        Gets the number of data points in the range xmin to xmax.
        Specified by:
        getDataCount in interface DataSet
        Parameters:
        xmin - the lower end of the range
        xmax - the upper end of the range
        Returns:
        the number of data points
      • getXIndex

        public int getXIndex​(double x)
        Gets the index of the data point closest to the given x coordinate. The index returned may be less then zero or larger the the number of data points in the data set, if the x coordinate lies outside the range of the data set.
        Specified by:
        getXIndex in interface DataSet
        Parameters:
        x - the x position of the data point
        Returns:
        the index of the data point
      • getYIndex

        public int getYIndex​(double y)
        Gets the first index of the data point closest to the given y coordinate.
        Specified by:
        getYIndex in interface DataSet
        Parameters:
        y - the y position of the data point
        Returns:
        the index of the data point
      • binarySearchX

        protected int binarySearchX​(double search,
                                    int indexMin,
                                    int indexMax)
      • binarySearchY

        protected int binarySearchY​(double search,
                                    int indexMin,
                                    int indexMax)
      • minNeigbourSearchX

        protected int minNeigbourSearchX​(double search,
                                         int indexMin,
                                         int indexMax)
      • fireInvalidated

        public D fireInvalidated​(UpdateEvent event)
        Notifies listeners that the data has been invalidated. If the data is added to the chart, it triggers repaint.
        Parameters:
        event - the change event
        Returns:
        itself (fluent design)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • addDataLabel

        public java.lang.String addDataLabel​(int index,
                                             java.lang.String label)
        adds a custom new data label for a point The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.
        Parameters:
        index - of the data point
        label - for the data point specified by the index
        Returns:
        the previously set label or null if no label has been specified
      • removeDataLabel

        public java.lang.String removeDataLabel​(int index)
        remove a custom data label for a point The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.
        Parameters:
        index - of the data point
        Returns:
        the previously set label or null if no label has been specified
      • getDefaultDataLabel

        protected java.lang.String getDefaultDataLabel​(int index)
        Returns label of a data point specified by the index. The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.
        Parameters:
        index - data point index
        Returns:
        label of a data point specified by the index or null if none label has been specified for this data point.
      • getDataLabel

        public java.lang.String getDataLabel​(int index)
        Returns label of a data point specified by the index. The label can be used as a category name if CategoryStepsDefinition is used or for annotations displayed for data points.
        Specified by:
        getDataLabel in interface DataSet
        Parameters:
        index - of the data label
        Returns:
        data point label specified by the index or null if no label has been specified
      • addDataStyle

        public java.lang.String addDataStyle​(int index,
                                             java.lang.String style)
        A string representation of the CSS style associated with this specific DataSet data point. @see #getStyle()
        Parameters:
        index - the index of the specific data point
        style - string for the data point specific CSS-styling
        Returns:
        itself (fluent interface)
      • removeStyle

        public java.lang.String removeStyle​(int index)
        A string representation of the CSS style associated with this specific DataSet data point. @see #getStyle()
        Parameters:
        index - the index of the specific data point
        Returns:
        itself (fluent interface)
      • getStyle

        public java.lang.String getStyle​(int index)
        A string representation of the CSS style associated with this specific DataSet data point. @see #getStyle()
        Specified by:
        getStyle in interface DataSet
        Parameters:
        index - the index of the specific data point
        Returns:
        user-specific data set style description (ie. may be set by user)
      • setEditConstraints

        public D setEditConstraints​(EditConstraints constraints)
      • getMetaInfo

        public java.util.Map<java.lang.String,​java.lang.String> getMetaInfo()
        Specified by:
        getMetaInfo in interface DataSetMetaData