|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.epochx.util.BoolUtils
public class BoolUtils
This class provides static utility methods for working with booleans and boolean arrays.
| Constructor Summary | |
|---|---|
BoolUtils()
|
|
| Method Summary | |
|---|---|
static boolean[] |
generateBoolSequence(int noBits,
long index)
Provides an alternative to BoolUtils.generateBoolSequences(int) particularly for larger numbers of bits greater than 30 which that method will struggle with. |
static boolean[][] |
generateBoolSequences(int noBits)
Generates an array of boolean arrays of all possible combinations of true/false values for the given number of elements. |
static boolean[] |
toArray(java.lang.String input)
Translates a String of zeros ('0') and ones ('1') to an array of booleans. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BoolUtils()
| Method Detail |
|---|
public static boolean[] toArray(java.lang.String input)
input - An input String made up of 1s and 0s
public static boolean[][] generateBoolSequences(int noBits)
This function will not cope with large values of noBits over about 30 due to the size limitations of the int datatype, and maximum array sizes. There are also likely to be issues with heap space. Alternatively users should use the BoolUtils.generateBoolSequence(int, long) method which generates the same boolean arrays on an individual basis.
noBits - The number of boolean values in which different
combinations are made.
public static boolean[] generateBoolSequence(int noBits,
long index)
noBits - The number of boolean values in which different
combinations are made.index - An index into the possible combinations to allow iteration
through the possibilities. There will be 2^noBits
combinations and so indexes up to 2^noBits-1 will be valid.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||