Class TransposedDataSet

  • All Implemented Interfaces:
    DataSet, EventSource, java.io.Serializable
    Direct Known Subclasses:
    TransposedDataSet.TransposedGridDataSet

    public class TransposedDataSet
    extends java.lang.Object
    implements DataSet
    Allows permutation of the axes of an underlying DataSet, for applications like: - transposed display - reduction of multi-dimensional DataSets to lower dimensions To be able to handle different DataSet Interface types, the constructors are private and only accessible via the static class methods, which return the correct sub-type.
    Author:
    Alexander Krimm
    See Also:
    Serialized Form
    • Field Detail

      • dataSet

        protected final DataSet dataSet
      • nDims

        protected final int nDims
      • permutation

        protected int[] permutation
    • Method Detail

      • autoNotification

        public java.util.concurrent.atomic.AtomicBoolean autoNotification()
        Description copied from interface: EventSource
        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. true for automatic notification
        Specified by:
        autoNotification in interface EventSource
        Returns:
        the atomic boolean
      • get

        public double get​(int dimIndex,
                          int index)
        Description copied from interface: DataSet
        Gets the x value of the data point with the index i
        Specified by:
        get in interface DataSet
        Parameters:
        dimIndex - the dimension index (ie. '0' equals 'X', '1' equals 'Y')
        index - data point index
        Returns:
        the x value
      • getAxisDescription

        public AxisDescription getAxisDescription​(int dimIndex)
        Description copied from interface: DataSet
        Return the axis description of the i-th axis.
        Specified by:
        getAxisDescription in interface DataSet
        Parameters:
        dimIndex - 0: X-Axis, 1: Y-Axis, ...
        Returns:
        Axis Label
      • getDataCount

        public int getDataCount()
        Description copied from interface: DataSet
        Get the number of data points in the data set.
        Specified by:
        getDataCount in interface DataSet
        Returns:
        the number of data points
      • getDataLabel

        public java.lang.String getDataLabel​(int index)
        Description copied from interface: DataSet
        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 - the data index
        Returns:
        label of a data point specified by the index or null if none label has been specified for this data point.
      • getDimension

        public int getDimension()
        Specified by:
        getDimension in interface DataSet
        Returns:
        number of dimensions
      • getIndex

        public int getIndex​(int dimIndex,
                            double... value)
        Description copied from interface: DataSet
        Gets the index of the data point closest to the given 'value' 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:
        getIndex in interface DataSet
        Parameters:
        dimIndex - the dimension index (ie. '0' equals 'X', '1' equals 'Y')
        value - the data point coordinates to search for
        Returns:
        the index of the data point
      • 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
      • getPermutation

        public int[] getPermutation()
      • getStyle

        public java.lang.String getStyle()
        Description copied from interface: DataSet
        A string representation of the CSS style associated with this specific DataSet. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.
        Specified by:
        getStyle in interface DataSet
        Returns:
        user-specific data set style description (ie. may be set by user)
      • getStyle

        public java.lang.String getStyle​(int index)
        Description copied from interface: DataSet
        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 specific data point index
        Returns:
        user-specific data set style description (ie. may be set by user)
      • getValues

        public double[] getValues​(int dimIndex)
        Specified by:
        getValues in interface DataSet
        Parameters:
        dimIndex - the dimension index (ie. '0' equals 'X', '1' equals 'Y')
        Returns:
        the x value array
      • isTransposed

        public boolean isTransposed()
      • lock

        public <D extends DataSetDataSetLock<D> lock()
        Specified by:
        lock in interface DataSet
        Type Parameters:
        D - generics (fluent design)
        Returns:
        Read-Write Lock to guard the DataSet
        See Also:
        DataSetLock
      • recomputeLimits

        public DataSet recomputeLimits​(int dimension)
        Specified by:
        recomputeLimits in interface DataSet
        Parameters:
        dimension - the dimension to recompute the range for (-1 for all dimensions)
        Returns:
        itself for method chaining
      • setPermutation

        public void setPermutation​(int[] permutation)
      • setStyle

        public DataSet setStyle​(java.lang.String style)
        Description copied from interface: DataSet
        A string representation of the CSS style associated with this specific DataSet. This is analogous to the "style" attribute of an HTML element. Note that, like the HTML style attribute, this variable contains style properties and values and not the selector portion of a style rule.
        Specified by:
        setStyle in interface DataSet
        Parameters:
        style - the new user-specific style
        Returns:
        itself (fluent interface)
      • getValue

        public double getValue​(int dimIndex,
                               double... x)
        Description copied from interface: DataSet
        Returns the value along the 'dimIndex' axis of a point specified by the x coordinate.
        Specified by:
        getValue in interface DataSet
        Parameters:
        dimIndex - the dimension index (ie. '0' equals 'X', '1' equals 'Y')
        x - horizontal 'dimIndex' coordinate
        Returns:
        'dimIndex' value
      • set

        public DataSet set​(DataSet other,
                           boolean copy)
        Specified by:
        set in interface DataSet
        Parameters:
        other - Other DataSet to copy into this DataSet
        copy - true: perform a deep copy (default), false: reuse the other dataset's internal data structures (if applicable)
        Returns:
        itself (fluent design) -- N.B. existing update listener are preserved
      • setTransposed

        public void setTransposed​(boolean transposed)
      • 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)