diff --git a/src/dr/app/tools/treeannotator/BiClade.java b/src/dr/app/tools/treeannotator/BiClade.java index 68a8ef6f87..c1cc28800e 100644 --- a/src/dr/app/tools/treeannotator/BiClade.java +++ b/src/dr/app/tools/treeannotator/BiClade.java @@ -165,18 +165,18 @@ public Object getKey() { } public static Object makeKey(Object key1, Object key2) { - FastBitSet bits = new FastBitSet(); + BitSet bits = new BitSet(); if (key1 instanceof Integer) { bits.set((Integer) key1); } else { - assert key1 instanceof FastBitSet; - bits.or((FastBitSet) key1); + assert key1 instanceof BitSet; + bits.or((BitSet) key1); } if (key2 instanceof Integer) { bits.set((Integer) key2); } else { - assert key2 instanceof FastBitSet; - bits.or((FastBitSet) key2); + assert key2 instanceof BitSet; + bits.or((BitSet) key2); } return bits; } diff --git a/src/dr/app/tools/treeannotator/Embiggulator.java b/src/dr/app/tools/treeannotator/Embiggulator.java index 2eaf1575f0..bdb3645660 100644 --- a/src/dr/app/tools/treeannotator/Embiggulator.java +++ b/src/dr/app/tools/treeannotator/Embiggulator.java @@ -142,7 +142,7 @@ public void embiggenBiClades(final int minCladeSize, final int minCladeCount) { long embiggulationCount = 0; // create and reuse a bitset to avoid reallocating it - final FastBitSet bits = new FastBitSet(); + final BitSet bits = new BitSet(); int rejectCount = 0; @@ -157,7 +157,7 @@ public void embiggenBiClades(final int minCladeSize, final int minCladeCount) { // if (superClades1 == null) { // continue; // } - FastBitSet bits1 = ((FastBitSet) clade1.getKey()); + BitSet bits1 = ((BitSet) clade1.getKey()); for (int j = Math.max(i + 1, sizeIndices[maxSize - clade1.getSize()]); j < n; j++) { BiClade clade2 = clades[j]; @@ -173,14 +173,13 @@ public void embiggenBiClades(final int minCladeSize, final int minCladeCount) { // } // } -// bits.clear(); -// bits.or(bits1); - bits.set(bits1); + bits.clear(); + bits.or(bits1); if (clade2.key instanceof Integer) { bits.set((Integer) clade2.key); } else { - bits.or((FastBitSet) clade2.key); + bits.or((BitSet) clade2.key); } int size = clade1.size + clade2.size; diff --git a/src/dr/app/tools/treeannotator/FastBitSet.java b/src/dr/app/tools/treeannotator/FastBitSet.java index 3bb84033ff..fd63ef0a91 100644 --- a/src/dr/app/tools/treeannotator/FastBitSet.java +++ b/src/dr/app/tools/treeannotator/FastBitSet.java @@ -370,28 +370,17 @@ public void and(FastBitSet set) { * @param set a bit set */ public void or(FastBitSet set) { - if (this == set) - return; - - int wordsInCommon = Math.min(wordsInUse, set.wordsInUse); +// int wordsInCommon = Math.min(wordsInUse, set.wordsInUse); if (wordsInUse < set.wordsInUse) { ensureCapacity(set.wordsInUse); wordsInUse = set.wordsInUse; + for (int i = 0; i < wordsInUse; i++) + words[i] |= set.words[i]; + } else { + for (int i = 0; i < set.wordsInUse; i++) + words[i] |= set.words[i]; } - - // Perform logical OR on words in common - for (int i = 0; i < wordsInCommon; i++) - words[i] |= set.words[i]; - - // Copy any remaining words - if (wordsInCommon < set.wordsInUse) - System.arraycopy(set.words, wordsInCommon, - words, wordsInCommon, - wordsInUse - wordsInCommon); - - // recalculateWordsInUse() is unnecessary - checkInvariants(); } /**