Package adams.core

Class AbstractDataBackedUnorderedRange<T>

    • Field Detail

      • m_Data

        protected T m_Data
        the underlying dataset.
    • Constructor Detail

      • AbstractDataBackedUnorderedRange

        public AbstractDataBackedUnorderedRange()
        Initializes with no range.
      • AbstractDataBackedUnorderedRange

        public AbstractDataBackedUnorderedRange​(String range)
        Initializes with the given range, but no maximum.
        Parameters:
        range - the range to use
      • AbstractDataBackedUnorderedRange

        public AbstractDataBackedUnorderedRange​(String range,
                                                int max)
        Initializes with the given range and maximum.
        Parameters:
        range - the range to use
        max - the maximum of the 1-based index (e.g., use "10" to allow "1-10" or -1 for uninitialized)
    • Method Detail

      • setData

        public void setData​(T value)
        Sets the data to use for interpreting the names.
        Parameters:
        value - the data to use, can be null
      • getData

        public T getData()
        Returns the underlying data.
        Returns:
        the underlying data, null if none set
      • getIntIndices

        public int[] getIntIndices​(T data)
        Returns the integer indices. Gets always generated on-the-fly! Uses on a clone of itself as not to keep a reference to the data.
        Parameters:
        data - the data to use for the indices
        Returns:
        the indices, 0-length array if not possible
      • isInRange

        public boolean isInRange​(T data,
                                 int index)
        Checks whether the provided 0-based index is within the range. Uses on a clone of itself as not to keep a reference to the data.
        Parameters:
        data - the data to use for the indices
        index - the index to check
        Returns:
        true if in range
      • getNumNames

        protected abstract int getNumNames​(T data)
        Returns the number of names the data has.
        Parameters:
        data - the data to retrieve the number of names
      • getName

        protected abstract String getName​(T data,
                                          int colIndex)
        Returns the name at the specified index.
        Parameters:
        data - the data to use
        colIndex - the name index
        Returns:
        the name