org.apache.sysds.runtime.compress.colgroup.offset

## Class AOffset

- java.lang.Object
- - org.apache.sysds.runtime.compress.colgroup.offset.AOffset

Direct Known Subclasses:
  OffsetByte, OffsetChar

    public abstract class AOffset
    extends Object

Offset list encoder interface. It is assumed that the input is in sorted order, all values are positive and there are no duplicates. The no duplicate is important since 0 values are exploited to encode an offset of max representable value + 1. This gives the ability to encode data, where the offsets are greater than the available highest value that can be represented size.

### Constructor Summary

Constructors
Constructor and Description
`AOffset()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`abstract long` `getExactSizeOnDisk()` Remember to include the ordinal of the type of offset list.
`abstract long` `getInMemorySize()` Get the in memory size of the Offset object
`abstract AIterator` `getIterator()` Get an iterator of the offsets.
`AIterator` `getIterator(int row)` Get an iterator that is pointing at a specific offset.
`abstract int` `getSize()` Get the number of contained elements, This method iterate the entire offset list, so it is not constant lookup.
`String` `toString()`
`abstract void` `write(DataOutput out)` Write the offsets to disk.

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

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

### Constructor Detail

#### AOffset

    public AOffset()

### Method Detail

#### getIterator

    public abstract AIterator getIterator()

Get an iterator of the offsets.

Returns:
  AIterator that iterate through index and dictionary offset values.

#### getIterator

    public AIterator getIterator(int row)

Get an iterator that is pointing at a specific offset.

Parameters:
  `row` - The row requested.
Returns:
  AIterator that iterate through index and dictionary offset values.

#### write

    public abstract void write(DataOutput out)
                        throws IOException

Write the offsets to disk. If you implement another remember to write the ordinal of the new type to disk as well and add it to the OffsetFactory.

Parameters:
  `out` - The output to write to
Throws:
  `IOException` - Exception that happens if the IO fails to write.

#### getInMemorySize

    public abstract long getInMemorySize()

Get the in memory size of the Offset object

Returns:
  In memory size as a long.

#### getExactSizeOnDisk

    public abstract long getExactSizeOnDisk()

Remember to include the ordinal of the type of offset list.

Returns:
  the size on disk as a long.

#### getSize

    public abstract int getSize()

Get the number of contained elements, This method iterate the entire offset list, so it is not constant lookup.

Returns:
  The number of indexes.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`