Class DimensionDictionary<T extends Comparable<T>>

  • Direct Known Subclasses:
    StringDimensionDictionary

    public abstract class DimensionDictionary<T extends Comparable<T>>
    extends Object
    Buildable dictionary for some comparable type. Values are unsorted, or rather sorted in the order which they are added. A SortedDimensionDictionary can be constructed with a mapping of ids from this dictionary to the sorted dictionary with the sort() method.

    Concrete implementations of this dictionary must be thread-safe.

    • Constructor Detail

      • DimensionDictionary

        public DimensionDictionary​(Class<T> cls)
    • Method Detail

      • getValue

        @Nullable
        public T getValue​(int id)
      • getValues

        public T[] getValues​(int[] ids)
      • size

        public int size()
      • sizeInBytes

        public long sizeInBytes()
        Gets the current size of this dictionary in bytes.
        Throws:
        IllegalStateException - if size computation is disabled.
      • add

        public int add​(@Nullable
                       T originalValue)
      • getMinValue

        public T getMinValue()
      • getMaxValue

        public T getMaxValue()
      • getIdForNull

        public int getIdForNull()
      • estimateSizeOfValue

        public abstract long estimateSizeOfValue​(T value)
        Estimates the size of the dimension value in bytes.

        This method is called when adding a new dimension value to the lookup only if computeOnHeapSize() returns true.

      • computeOnHeapSize

        public abstract boolean computeOnHeapSize()
        Whether on-heap size of this dictionary should be computed.