Package org.apache.sysds.runtime.compress.colgroup.mapping

## Class MapToByte

- java.lang.Object
- - org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData
  - - org.apache.sysds.runtime.compress.colgroup.mapping.MapToByte

- All Implemented Interfaces:
    `Serializable`
  Direct Known Subclasses:
    `MapToUByte`

      public class MapToByte
      extends AMapToData

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `MapToByte​(int unique, int size)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `copyBit​(BitSet d)` |
    `void` | `copyInt​(int[] d)` |
    `void` | `count​(int[] ret)` |
    `void` | `fill​(int v)` | Fill the map with a given value.
    `long` | `getExactSizeOnDisk()` | Get the size of this Mapping object on disk.
    `int` | `getIndex​(int n)` | Get the given index back as a integer
    `long` | `getInMemorySize()` | Get the in memory size of this Mapping object.
    `static long` | `getInMemorySize​(int dataLength)` |
    `MapToFactory.MAP_TYPE` | `getType()` |
    `int` | `getUpperBoundValue()` | Get the maximum value that is possible to allocate inside this map.
    `void` | `replace​(int v, int r)` | Replace v with r for all entries, NOTE! It is assumed that you call this correctly: - with two distinct values that is representable inside the given AMapToData.
    `AMapToData` | `resize​(int unique)` |
    `void` | `set​(int n, int v)` | Set the index to the value.
    `int` | `setAndGet​(int n, int v)` | Set the index to the value and get the contained value after.
    `int` | `size()` | The size of the Mapping object, signaling how many value cells are stored in this mapping object.
    `void` | `write​(DataOutput out)` | Serialize this object to the DataOutput given.

    - ### Methods inherited from class org.apache.sysds.runtime.compress.colgroup.mapping.AMapToData

      `copy, getCounts, getMax, getUnique, preAggregateDDC_DDC, preAggregateDDC_SDCZ, preAggregateDDC_SDCZMultiCol, preAggregateDDC_SDCZSingleCol, preAggregateDense, preAggregateDense, preAggregateSDCZ_DDC, preAggregateSDCZ_SDCZ, preAggregateSparse, preAggregateSparse, setUnique, toString`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MapToByte

          public MapToByte​(int unique,
                           int size)

  - ### Method Detail

    - #### getType

          public MapToFactory.MAP_TYPE getType()

      Specified by:
        `getType` in class `AMapToData`

    - #### getIndex

          public int getIndex​(int n)

      Description copied from class: `AMapToData`
      Get the given index back as a integer
      Specified by:
        `getIndex` in class `AMapToData`
      Parameters:
        `n` - the index to get
      Returns:
        the value represented in that cell as integer

    - #### fill

          public void fill​(int v)

      Description copied from class: `AMapToData`
      Fill the map with a given value. NOTE! The value should be representable inside the map. This requirement is not checked.
      Specified by:
        `fill` in class `AMapToData`
      Parameters:
        `v` - the value to fill

    - #### getInMemorySize

          public long getInMemorySize()

      Description copied from class: `AMapToData`
      Get the in memory size of this Mapping object.
      Specified by:
        `getInMemorySize` in class `AMapToData`
      Returns:
        The size in Bytes.

    - #### getInMemorySize

          public static long getInMemorySize​(int dataLength)

    - #### getExactSizeOnDisk

          public long getExactSizeOnDisk()

      Description copied from class: `AMapToData`
      Get the size of this Mapping object on disk.
      Specified by:
        `getExactSizeOnDisk` in class `AMapToData`
      Returns:
        The on disk size in Bytes.

    - #### set

          public void set​(int n,
                          int v)

      Description copied from class: `AMapToData`
      Set the index to the value. NOTE! The value should be representable inside the map. This requirement is not checked.
      Specified by:
        `set` in class `AMapToData`
      Parameters:
        `n` - index to set.
        `v` - the value to set it to.

    - #### setAndGet

          public int setAndGet​(int n,
                               int v)

      Description copied from class: `AMapToData`
      Set the index to the value and get the contained value after.
      Specified by:
        `setAndGet` in class `AMapToData`
      Parameters:
        `n` - index to set.
        `v` - the value to set it to.
      Returns:
        v as encoded, note this value can be different that the one put in if the map is not able to represent the value

    - #### size

          public int size()

      Description copied from class: `AMapToData`
      The size of the Mapping object, signaling how many value cells are stored in this mapping object.
      Specified by:
        `size` in class `AMapToData`
      Returns:
        The length of the mapping object.

    - #### write

          public void write​(DataOutput out)
                     throws IOException

      Description copied from class: `AMapToData`
      Serialize this object to the DataOutput given.
      Specified by:
        `write` in class `AMapToData`
      Parameters:
        `out` - The object to serialize this object into.
      Throws:
        `IOException` - An IO exception if the Serialization fails.

    - #### replace

          public void replace​(int v,
                              int r)

      Description copied from class: `AMapToData`
      Replace v with r for all entries, NOTE! It is assumed that you call this correctly: - with two distinct values that is representable inside the given AMapToData.
      Specified by:
        `replace` in class `AMapToData`
      Parameters:
        `v` - The value to replace
        `r` - The value to put instead

    - #### copyInt

          public void copyInt​(int[] d)

      Specified by:
        `copyInt` in class `AMapToData`

    - #### copyBit

          public void copyBit​(BitSet d)

      Specified by:
        `copyBit` in class `AMapToData`

    - #### count

          public void count​(int[] ret)

    - #### getUpperBoundValue

          public int getUpperBoundValue()

      Description copied from class: `AMapToData`
      Get the maximum value that is possible to allocate inside this map.
      Specified by:
        `getUpperBoundValue` in class `AMapToData`
      Returns:
        The maximum value.

    - #### resize

          public AMapToData resize​(int unique)

      Specified by:
        `resize` in class `AMapToData`