public final class PrimitiveTypePartitioner extends java.lang.Object implements DataPartitioner
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BYTE |
static java.lang.String |
CHAR |
static java.lang.String |
DOUBLE |
static java.lang.String |
FLOAT |
static java.lang.String |
INT |
static java.lang.String |
LONG |
static java.lang.String |
SHORT |
static java.lang.String |
STRING |
Constructor and Description |
---|
PrimitiveTypePartitioner() |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.math.BigInteger> |
arrayToPartitions(java.util.List<?> elementList,
java.lang.String type)
Create partitions for an array of the same type of elements - used when a data value field is an array and we wish to encode these into the return value
|
static java.math.BigInteger |
formBitMask(int partitionSize)
Returns a
BigInteger bit mask for the given partitionSize. |
java.lang.Object |
fromPartitions(java.util.List<java.math.BigInteger> parts,
int partsIndex,
java.lang.String type)
Reconstructs the object from the partitions
|
int |
getBits(java.lang.String type)
Get the bit size of the allowed primitive java types
|
int |
getNumPartitions(java.lang.String type)
Method to get the number of 8-bit partitions given the element type
|
java.util.List<java.math.BigInteger> |
getPaddedPartitions(java.lang.String type)
Method to get an empty set of partitions by data type - used for padding return array values
|
static java.util.List<java.math.BigInteger> |
partitionBits(java.math.BigInteger value,
int partitionSize,
java.math.BigInteger mask)
Splits the given BigInteger into partitions given by the partitionSize.
|
java.util.List<java.math.BigInteger> |
toPartitions(java.lang.Object obj,
java.lang.String type)
Partitions an object to a List of BigInteger values, currently represents an 8-bit partitioning
|
public static final java.lang.String BYTE
public static final java.lang.String SHORT
public static final java.lang.String INT
public static final java.lang.String LONG
public static final java.lang.String FLOAT
public static final java.lang.String DOUBLE
public static final java.lang.String CHAR
public static final java.lang.String STRING
public static java.util.List<java.math.BigInteger> partitionBits(java.math.BigInteger value, int partitionSize, java.math.BigInteger mask) throws PIRException
PIRException
public static java.math.BigInteger formBitMask(int partitionSize)
BigInteger
bit mask for the given partitionSize.public int getNumPartitions(java.lang.String type) throws PIRException
getNumPartitions
in interface DataPartitioner
PIRException
public int getBits(java.lang.String type) throws PIRException
getBits
in interface DataPartitioner
PIRException
public java.lang.Object fromPartitions(java.util.List<java.math.BigInteger> parts, int partsIndex, java.lang.String type) throws PIRException
fromPartitions
in interface DataPartitioner
PIRException
public java.util.List<java.math.BigInteger> toPartitions(java.lang.Object obj, java.lang.String type) throws PIRException
toPartitions
in interface DataPartitioner
PIRException
public java.util.List<java.math.BigInteger> getPaddedPartitions(java.lang.String type) throws PIRException
getPaddedPartitions
in interface DataPartitioner
PIRException
public java.util.List<java.math.BigInteger> arrayToPartitions(java.util.List<?> elementList, java.lang.String type) throws PIRException
arrayToPartitions
in interface DataPartitioner
PIRException