Minor optimizations

This commit is contained in:
Eric Banks 2012-06-08 12:07:58 -04:00
parent d463ab2cbf
commit 898a0e6161
2 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ public class BQSRKeyManager {
* @return one key in bitset representation per covariate
*/
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
int eventTypeBitIndex = nRequiredBits + nOptionalBits + nOptionalIDBits; // Location in the bit set to add the event type bits

View File

@ -82,7 +82,7 @@ public class BitSetUtils {
* @return a bitset representation of the integer
*/
public static BitSet bitSetFrom(long number, int nBits) {
BitSet bitSet = new BitSet();
BitSet bitSet = new BitSet(nBits);
boolean isNegative = number < 0;
int bitIndex = 0;
while (number != 0) {