public class PowerOfTwoOperation extends java.lang.Object implements DatasetOperation
Constructor and Description |
---|
PowerOfTwoOperation() |
Modifier and Type | Method and Description |
---|---|
long |
getSerializationVersion()
Returns the current version of the serialization format.
|
int |
getVersion()
Returns the current class version.
|
void |
initCurrentVersion(java.util.Map<java.lang.String,java.lang.Object> objectMap)
Initializes an instance with a current-version object graph.
|
static boolean |
isPowerOf2(int a)
Determines whether a number is a power of 2
|
static int |
nextPowerOf2(int a)
Returns the next power of two i.e.
|
static int |
pad(int a)
Returns the next number >= the input which is a power of two
i.e.
|
Dataset |
run(Dataset input)
For each dimension in the input, if the dimension is not a power of 2 add elements of value 0 until this
condition is satisified.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getObjectMap, init, initPreviousVersion, initUnknownVersion, load, read, save, write
public static int nextPowerOf2(int a)
a
- number to padpublic static int pad(int a)
a
- number to padpublic static boolean isPowerOf2(int a)
a
- number to examinepublic Dataset run(Dataset input)
run
in interface DatasetOperation
input
- Dataset on which to operatepublic long getSerializationVersion()
ObjectMap
getSerializationVersion
in interface ObjectMap
public int getVersion()
ObjectMap
getVersion
in interface ObjectMap
public void initCurrentVersion(java.util.Map<java.lang.String,java.lang.Object> objectMap)
ObjectMap
initCurrentVersion
in interface ObjectMap
objectMap
- object graph for initialization