Interface MapToFactory


  • public interface MapToFactory
    Interface for the factory design pattern for construction all AMapToData.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  MapToFactory.MAP_TYPE
      The different supported types of mappings.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.apache.commons.logging.Log LOG  
    • 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 numTuples)
        Create and allocate a map with the given size and support for upto the num tuples argument of values
        Parameters:
        size - The number of cells to allocate
        numTuples - The maximum value to be able to represent inside the map.
        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
      • 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 numTuples)
        Estimate the size in memory of a MapToFactory.
        Parameters:
        size - The size of the mapping
        numTuples - The number of unique values to be supported by the mapping
        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.