Interface MapToFactory


  • public interface MapToFactory
    Interface for the factory design pattern for construction all AMapToData.
    • Field Detail

      • LOG

        static final org.apache.commons.logging.Log LOG
    • Method Detail

      • create

        static AMapToData create​(int[] values,
                                 int nUnique)
        Construct a mapping with the given values contained. The size is the length of the int array given.
        Parameters:
        values - The values contained.
        nUnique - The number of unique expected to be contained (is not verified.)
        Returns:
        An appropriate AMapToData
      • create

        static AMapToData create​(int size,
                                 int[] values,
                                 int nUnique)
        Construct a mapping with the given values contained. Only copies the values from the array given until size.
        Parameters:
        size - The number of elements to take from the values array.
        values - The values contained.
        nUnique - The number of unique expected to be contained (is not verified.)
        Returns:
        An appropriate AMapToData
      • create

        static AMapToData create​(int size,
                                 int unique)
        Create and allocate a map with the given size and support for up to the num tuples argument of values
        Parameters:
        size - The number of cells to allocate
        unique - The number of unique values to support (can encode unique -1)
        Returns:
        A new map
      • create

        static AMapToData create​(int size,
                                 MapToFactory.MAP_TYPE t)
        Allocate a specific type of map. Note that once in use it is recommended to set the number of unique values.
        Parameters:
        size - The size to allocate
        t - The mapping type.
        Returns:
        An AMapToData allocation
      • create

        static AMapToData create​(int[] values,
                                 MapToFactory.MAP_TYPE t)
        Create a specific mapping based on the integer values given. This constructor does not guarantee the values in the int array is encode-able in the given mapping.
        Parameters:
        values - The values to encode into the mapping
        t - The mapping type to use
        Returns:
        The filled mapping with the values
      • resizeForce

        static AMapToData resizeForce​(AMapToData d,
                                      MapToFactory.MAP_TYPE t)
        Force the mapping into an other mapping type. This method is unsafe since if there is overflows in the conversions, they are not handled. Also if the change is into the same type a new map is allocated anyway.
        Parameters:
        d - The map to resize.
        t - The type to resize to.
        Returns:
        A new allocated mapToData with the specified type.
      • estimateInMemorySize

        static long estimateInMemorySize​(int size,
                                         int unique)
        Estimate the size in memory of a MapToFactory.
        Parameters:
        size - The size of the mapping
        unique - The number of unique values to support (can encode unique -1)
        Returns:
        The size in number of bytes.
      • readIn

        static AMapToData readIn​(DataInput in)
                          throws IOException
        General interface to read in an AMapToData.
        Parameters:
        in - The data input to read from
        Returns:
        The parsed AMapToData
        Throws:
        IOException - If there is complications or errors in reading.
      • getMaxPossible

        static int getMaxPossible​(MapToFactory.MAP_TYPE t)
        Get the maximum value possible to encode in a specific mapping type.
        Parameters:
        t - The mapping type to analyze
        Returns:
        The maximum value to encode.