Minor optimizations
This commit is contained in:
parent
d463ab2cbf
commit
898a0e6161
|
|
@ -98,7 +98,7 @@ public class BQSRKeyManager {
|
||||||
* @return one key in bitset representation per covariate
|
* @return one key in bitset representation per covariate
|
||||||
*/
|
*/
|
||||||
public List<BitSet> bitSetsFromAllKeys(BitSet[] allKeys, EventType eventType) {
|
public List<BitSet> bitSetsFromAllKeys(BitSet[] allKeys, EventType eventType) {
|
||||||
List<BitSet> allBitSets = new LinkedList<BitSet>(); // Generate one key per optional covariate
|
List<BitSet> allBitSets = new ArrayList<BitSet>(); // Generate one key per optional covariate
|
||||||
|
|
||||||
BitSet eventBitSet = BitSetUtils.bitSetFrom(eventType.index); // create a bitset with the event type
|
BitSet eventBitSet = BitSetUtils.bitSetFrom(eventType.index); // create a bitset with the event type
|
||||||
int eventTypeBitIndex = nRequiredBits + nOptionalBits + nOptionalIDBits; // Location in the bit set to add the event type bits
|
int eventTypeBitIndex = nRequiredBits + nOptionalBits + nOptionalIDBits; // Location in the bit set to add the event type bits
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class BitSetUtils {
|
||||||
* @return a bitset representation of the integer
|
* @return a bitset representation of the integer
|
||||||
*/
|
*/
|
||||||
public static BitSet bitSetFrom(long number, int nBits) {
|
public static BitSet bitSetFrom(long number, int nBits) {
|
||||||
BitSet bitSet = new BitSet();
|
BitSet bitSet = new BitSet(nBits);
|
||||||
boolean isNegative = number < 0;
|
boolean isNegative = number < 0;
|
||||||
int bitIndex = 0;
|
int bitIndex = 0;
|
||||||
while (number != 0) {
|
while (number != 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue