Skip to content

Commit

Permalink
count how many trees are added per rule application, provide max
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyaDaleh committed Mar 10, 2024
1 parent 394a1e3 commit e30506b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,14 @@ private int checkForGoal(ChartItemInterface goal) {
* Applies an axiom rule, that is a rule without antecedence items and adds
* the consequence items to chart and agenda.
*/
@SuppressWarnings("serial") private void applyAxiomRule(
private void applyAxiomRule(
StaticDeductionRule rule) {
for (ChartItemInterface item : rule.consequences) {
if (chart.contains(item)) {
continue;
}
chart.add(item);
currentAddedTrees += item.getTrees().size();
addToAgenda(item);
deductedFrom.add(new ArrayList<List<Integer>>() {
{
Expand Down Expand Up @@ -370,7 +371,7 @@ private void applyRule(DynamicDeductionRuleInterface rule,
rule.clearItems();
rule.setAntecedences(antecedences);
List<ChartItemInterface> newItems = rule.getConsequences();
if (newItems.size() > 0) {
if (!newItems.isEmpty()) {
processNewItems(newItems, rule, triggerItems);
}
}
Expand Down Expand Up @@ -470,6 +471,7 @@ private void processNewItems(List<ChartItemInterface> newItems,
triggerTreeUpdate(oldId, newTriggerItems);
}
} else {
currentAddedTrees += newItem.getTrees().size();
chart.add(newItem);
addToAgenda(newItem);
appliedRule.add(new ArrayList<>());
Expand Down Expand Up @@ -650,7 +652,7 @@ private static String[] getLineData(int i, String item, List<String> rules,
* form.
*/
private static String rulesToString(List<String> rules) {
if (rules.size() == 0)
if (rules.isEmpty())
return "";
StringBuilder builder = new StringBuilder();
for (String rule : rules) {
Expand All @@ -666,7 +668,7 @@ private static String rulesToString(List<String> rules) {
* human friendly form.
*/
private static String backpointersToString(List<List<Integer>> backpointers) {
if (backpointers.size() == 0)
if (backpointers.isEmpty())
return "";
StringBuilder builder = new StringBuilder();
for (List<Integer> pointertuple : backpointers) {
Expand Down

0 comments on commit e30506b

Please sign in to comment.