Don't put null entries into the key array
This commit is contained in:
parent
bdf5945dcc
commit
81993b08e2
|
|
@ -110,7 +110,7 @@ public class BQSRKeyManager {
|
||||||
* @return one key in long representation per covariate
|
* @return one key in long representation per covariate
|
||||||
*/
|
*/
|
||||||
public Long[] longsFromAllKeys(final Long[] allKeys, final EventType eventType) {
|
public Long[] longsFromAllKeys(final Long[] allKeys, final EventType eventType) {
|
||||||
final Long[] allFinalKeys = new Long[optionalCovariatesInfo.length > 0 ? optionalCovariatesInfo.length : 1]; // Generate one key per optional covariate
|
final ArrayList<Long> allFinalKeys = new ArrayList<Long>(); // Generate one key per optional covariate
|
||||||
|
|
||||||
int covariateIndex = 0;
|
int covariateIndex = 0;
|
||||||
long masterKey = 0L; // This will be a master key holding all the required keys, to replicate later on
|
long masterKey = 0L; // This will be a master key holding all the required keys, to replicate later on
|
||||||
|
|
@ -128,13 +128,13 @@ public class BQSRKeyManager {
|
||||||
long newKey = masterKey | (covariateKey << optionalCovariateOffset);
|
long newKey = masterKey | (covariateKey << optionalCovariateOffset);
|
||||||
newKey |= (optionalCovariatesInfo[i].covariateID << optionalCovariateIDOffset);
|
newKey |= (optionalCovariatesInfo[i].covariateID << optionalCovariateIDOffset);
|
||||||
|
|
||||||
allFinalKeys[i] = newKey; // add this key to the list of keys
|
allFinalKeys.add(newKey); // add this key to the list of keys
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optionalCovariatesInfo.length == 0) // special case when we have no optional covariates
|
if (optionalCovariatesInfo.length == 0) // special case when we have no optional covariates
|
||||||
allFinalKeys[0] = masterKey;
|
allFinalKeys.add(masterKey);
|
||||||
|
|
||||||
return allFinalKeys;
|
return allFinalKeys.toArray(new Long[allFinalKeys.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue