Class CategoricalColumn

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void fill​(double[] array, int rowIndex)
      Fills the given array with column data starting with the given row index.
      void fill​(double[] array, int startIndex, int arrayOffset, int arrayStepSize)
      Fills the given array with column data starting with the given row index and using the given array offset and step size.
      void fill​(int[] array, int rowIndex)
      Fills the given array with column data starting with the given row index.
      void fill​(int[] array, int startIndex, int arrayOffset, int arrayStepSize)
      Fills the given array with column data starting with the given row index and using the given array offset and step size.
      void fill​(java.lang.Object[] array, int rowIndex)
      Fills the given array with column data starting with the given row index.
      void fill​(java.lang.Object[] array, int startIndex, int arrayOffset, int arrayStepSize)
      Fills the given array with column data starting with the given row index and using the given array offset and step size.
      protected abstract IntegerFormats.PackedIntegers getByteData()
      Returns the underlying byte category indices of this column.
      abstract IntegerFormats.Format getFormat()
      Returns the format of the underlying category indices.
      protected abstract int[] getIntData()
      Returns the underlying int category indices of this column.
      protected abstract short[] getShortData()
      Returns the underlying unsigned short category indices of this column.
      Column stripData()
      Strips the data from the column so that it has length 0 and no mapping or remapping.
      protected abstract CategoricalColumn swapDictionary​(Dictionary newDictionary)
      Creates a new categorical column with the same data and the given dictionary.
      java.lang.String toString()  
      ColumnType<java.lang.String> type()
      Returns the ColumnType of this column.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • fill

        public void fill​(double[] array,
                         int rowIndex)
        Description copied from class: Column
        Fills the given array with column data starting with the given row index. Throws an UnsupportedOperationException if this column has not the capability Column.Capability.NUMERIC_READABLE.

        Please note that accessing rows outside of the columns bounds will lead to undefined results.

        Overrides:
        fill in class Column
        Parameters:
        array - the target array
        rowIndex - the row index
      • fill

        public void fill​(double[] array,
                         int startIndex,
                         int arrayOffset,
                         int arrayStepSize)
        Description copied from class: Column
        Fills the given array with column data starting with the given row index and using the given array offset and step size. For instance, given the row index 256, the array offset 4 and a step size of 8, the method writes the values at index 256, 257, 258, ... to array positions array[4], array[12], array[20], ... respectively. Throws an UnsupportedOperationException if this column has not the capability Column.Capability.NUMERIC_READABLE.

        Please note that accessing rows outside of the columns bounds will lead to undefined results.

        Overrides:
        fill in class Column
        Parameters:
        array - the target array
        startIndex - the row index
        arrayOffset - the offset in the array
        arrayStepSize - the positive step size in between values
      • fill

        public void fill​(int[] array,
                         int rowIndex)
        Description copied from class: Column
        Fills the given array with column data starting with the given row index. Throws an UnsupportedOperationException if the category of this column is not Column.Category.CATEGORICAL.

        Please note that accessing rows outside of the columns bounds will lead to undefined results.

        Overrides:
        fill in class Column
        Parameters:
        array - the target array
        rowIndex - the row index
      • fill

        public void fill​(int[] array,
                         int startIndex,
                         int arrayOffset,
                         int arrayStepSize)
        Description copied from class: Column
        Fills the given array with column data starting with the given row index and using the given array offset and step size. For instance, given the row index 256, the array offset 4 and a step size of 8, the method writes the values at index 256, 257, 268, ... to array positions array[4], array[12], array[20], ... respectively. Throws an UnsupportedOperationException if the category of this column is not Column.Category.CATEGORICAL.

        Please note that accessing rows outside of the columns bounds will lead to undefined results.

        Overrides:
        fill in class Column
        Parameters:
        array - the target array
        startIndex - the row index
        arrayOffset - the offset in the array
        arrayStepSize - the step size in between values
      • fill

        public void fill​(java.lang.Object[] array,
                         int rowIndex)
        Description copied from class: Column
        Fills the given array with column data starting with the given row index. Throws an UnsupportedOperationException if this column has not the capability Column.Capability.OBJECT_READABLE.
        Overrides:
        fill in class Column
        Parameters:
        array - the target array
        rowIndex - the row index
      • fill

        public void fill​(java.lang.Object[] array,
                         int startIndex,
                         int arrayOffset,
                         int arrayStepSize)
        Description copied from class: Column
        Fills the given array with column data starting with the given row index and using the given array offset and step size. For instance, given the row index 256, the array offset 4 and a step size of 8, the method writes the values at index 256, 257, 268, ... to array positions array[4], array[12], array[20], ... respectively. Throws an UnsupportedOperationException if this column has not the capability Column.Capability.OBJECT_READABLE.
        Overrides:
        fill in class Column
        Parameters:
        array - the target array
        startIndex - the row index
        arrayOffset - the offset in the array
        arrayStepSize - the step size in between values
      • getFormat

        public abstract IntegerFormats.Format getFormat()
        Returns the format of the underlying category indices.
        Returns:
        the index format
      • getShortData

        protected abstract short[] getShortData()
        Returns the underlying unsigned short category indices of this column. Returns null if the column is not of format IntegerFormats.Format.UNSIGNED_INT16.
        Returns:
        the index array or null
      • getIntData

        protected abstract int[] getIntData()
        Returns the underlying int category indices of this column. Returns null if the column is not of format IntegerFormats.Format.SIGNED_INT32.
        Returns:
        the index array or null
      • toString

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

        public final ColumnType<java.lang.String> type()
        Description copied from class: Column
        Returns the ColumnType of this column.
        Specified by:
        type in class Column
        Returns:
        the column type
      • swapDictionary

        protected abstract CategoricalColumn swapDictionary​(Dictionary newDictionary)
        Creates a new categorical column with the same data and the given dictionary. The new dictionary must be compatible with the data of the column in the sense that every category index in the data is mapped to a different non-null object value except for 0 which is mapped to null. The compatibility is not checked by this method.
        Parameters:
        newDictionary - the new dictionary
        Returns:
        a new categorical column
      • stripData

        public Column stripData()
        Description copied from class: Column
        Strips the data from the column so that it has length 0 and no mapping or remapping.
        Specified by:
        stripData in class Column
        Returns:
        a column of the same type, with the same dictionary but with length 0