/**
* Returns a conditional FP tree based on the targetAttr, containing
* only items that are more frequent.
*/
public FPTree createMoreFreqConditionalTree(int targetAttr) {
LongArrayList counts = new LongArrayList();
List<FPNode> nodeList = attrNodeLists.get(targetAttr);
for (FPNode currNode : nodeList) {
long pathCount = currNode.count();
while (currNode != root) {
int currAttr = currNode.attribute();
if (counts.size() <= currAttr) {
counts.setSize(currAttr + 1);
}
long count = counts.get(currAttr);
counts.set(currNode.attribute(), count + pathCount);
currNode = currNode.parent();
}
}
if (counts.get(targetAttr) != attrCountList.get(targetAttr)) {
throw new IllegalStateException("mismatched counts for targetAttr="
+ targetAttr + ", (" + counts.get(targetAttr)
+ " != " + attrCountList.get(targetAttr) + "); "
+ "thisTree=" + this + '\n');
}
counts.set(targetAttr, 0L);
FPTree toRet = new FPTree(counts, minSupport);
IntArrayList attrLst = new IntArrayList();
for (FPNode currNode : attrNodeLists.get(targetAttr)) {
long count = currNode.count();