tempRules.add(copy);
}
}
ArrayList<TextRulerRule> rules = new ArrayList<TextRulerRule>(tempRules);
testRulesIfNotCached(rules);
TextRulerRule best = null;
for (TextRulerRule each : rules) {
if (best == null) {
best = each;
} else {
if (each.getCoveringStatistics().getCoveredPositivesCount() > best
.getCoveringStatistics().getCoveredPositivesCount()) {
best = each;
}
}
}
WhiskRule base2 = (WhiskRule) best;
List<TextRulerRule> testRules = new ArrayList<TextRulerRule>();
if (base1 != null) {
TextRulerToolkit.log("base1: " + base1.getRuleString());
testRules.add(base1);
}
if (base2 != null) {
TextRulerToolkit.log("base2: " + base2.getRuleString());
testRules.add(base2);
}
testRulesIfNotCached(testRules);
if (shouldAbort()) {
return null;
}
if (base1 != null && base2 == null) {
TextRulerToolkit.log("\tbase1: " + base1.getCoveringStatistics() + " --> laplacian = "
+ base1.getLaplacian());
result.add(base1);
} else {
TextRulerToolkit.log("\tbase1: " + base1.getCoveringStatistics() + " --> laplacian = "
+ base1.getLaplacian());
TextRulerToolkit.log("\tbase2: " + base2.getCoveringStatistics() + " --> laplacian = "
+ base2.getLaplacian());
if (base2.getCoveringStatistics().getCoveredPositivesCount() > base1
.getCoveringStatistics().getCoveredPositivesCount()) {
result.add(base2);
} else {
result.add(base1);
}
}
}
TextRulerRule best = null;
for (TextRulerRule each : result) {
if (best == null) {
best = each;
} else {
if (each.getCoveringStatistics().getCoveredPositivesCount() > best.getCoveringStatistics()
.getCoveredPositivesCount()) {
best = each;
}
}
}