Interface MapToFactory
public interface MapToFactory
Interface for the factory design pattern for construction all AMapToData.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe different supported types of mappings. -
Field Summary
Fields -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic AMapToDatacreate(int[] values, int nUnique) Construct a mapping with the given values contained.static AMapToDatacreate(int[] values, MapToFactory.MAP_TYPE t) Create a specific mapping based on the integer values given.static AMapToDatacreate(int size, int unique) Create and allocate a map with the given size and support for up to the num tuples argument of valuesstatic AMapToDatacreate(int size, int[] values, int nUnique) Construct a mapping with the given values contained.static AMapToDatacreate(int size, int[] values, int nUnique, int k) static AMapToDatacreate(int size, MapToFactory.MAP_TYPE t) Allocate a specific type of map.static AMapToDatacreate(int unique, IntArrayList values) static longestimateInMemorySize(int size, int unique) Estimate the size in memory of a MapToFactory.static intGet the maximum value possible to encode in a specific mapping type.static AMapToDataGeneral interface to read in an AMapToData.static AMapToDataForce the mapping into an other mapping type.
-
Field Details
-
LOG
static final org.apache.commons.logging.Log LOG
-
-
Method Details
-
create
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
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
-
create
- Throws:
Exception
-
create
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 allocateunique- The number of unique values to support (can encode unique -1)- Returns:
- A new map
-
create
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 allocatet- The mapping type.- Returns:
- An AMapToData allocation
-
create
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 mappingt- The mapping type to use- Returns:
- The filled mapping with the values
-
resizeForce
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 mappingunique- The number of unique values to support (can encode unique -1)- Returns:
- The size in number of bytes.
-
readIn
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
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.
-