@@ -255,7 +255,7 @@ private void fireAutomaticStateChanged(boolean oldAutomatic, boolean newAutomati
255255 private void setNode (Node p_node ) {
256256 if (node ().sequent () != p_node .sequent ()) {
257257 node = p_node ;
258- resetTagManager ( );
258+ tagManager = new FormulaTagManager ( this );
259259 } else {
260260 node = p_node ;
261261 }
@@ -458,18 +458,6 @@ public void clearAndDetachRuleAppIndex() {
458458 ruleAppIndex .clearAndDetachCache ();
459459 }
460460
461- // @Deprecated
462- // public void setProgramVariables(Namespace ns) {
463- // // final Iterator<Named> it=ns.elements().iterator();
464- // // ImmutableSet<ProgramVariable> s = DefaultImmutableSet.<ProgramVariable>nil();
465- // // while (it.hasNext()) {
466- // // s = s.add((ProgramVariable)it.next());
467- // // }
468- // // node().setGlobalProgVars(DefaultImmutableSet.<ProgramVariable>nil());
469- // // proof().getNamespaces().programVariables().set(s);
470- // // setGlobalProgVars(s);
471- // }
472-
473461 public void addProgramVariable (ProgramVariable pv ) {
474462 localNamespaces .programVariables ().addSafely (pv );
475463 }
@@ -532,6 +520,7 @@ public void removeLastAppliedRuleApp() {
532520 * creates n new nodes as children of the referenced node and new n goals that have references
533521 * to these new nodes.
534522 *
523+ * @param n number of goals to create
535524 * @return the list of new created goals.
536525 */
537526 @ Nonnull
@@ -571,10 +560,6 @@ public ImmutableList<Goal> split(int n) {
571560 return goalList ;
572561 }
573562
574- private void resetTagManager () {
575- tagManager = new FormulaTagManager (this );
576- }
577-
578563 public void setBranchLabel (String s ) {
579564 node .getNodeInfo ().setBranchLabel (s );
580565 }
@@ -600,14 +585,21 @@ private void resetLocalSymbols() {
600585 localNamespaces = newNS .copyWithParent ();
601586 }
602587
588+ /**
589+ * Perform the provided rule application on this goal.
590+ * Returns the new goal(s), if any.
591+ * This will also populate a {@link RuleAppInfo} object and fire the corresponding event.
592+ * The state of the proof is also updated.
593+ *
594+ * @param ruleApp the rule app
595+ * @return new goal(s)
596+ */
603597 public ImmutableList <Goal > apply (final RuleApp ruleApp ) {
604-
605598 final Proof proof = proof ();
606599
607600 final NodeChangeJournal journal = new NodeChangeJournal (proof , this );
608601 addGoalListener (journal );
609602
610-
611603 final Node n = node ;
612604
613605 /*
@@ -630,19 +622,14 @@ public ImmutableList<Goal> apply(final RuleApp ruleApp) {
630622
631623 proof .getServices ().saveNameRecorder (n );
632624
633- if (goalList != null ) { // TODO: can goalList be null?
634- if (goalList .isEmpty ()) {
635- proof .closeGoal (this );
636- } else {
637- proof .replace (this , goalList );
638- if (ruleApp instanceof TacletApp && ((TacletApp ) ruleApp ).taclet ().closeGoal ()) {
639- // the first new goal is the one to be closed
640- proof .closeGoal (goalList .head ());
641- }
642- if (ruleApp instanceof SMTRuleApp ) {
643- // the first new goal is the one to be closed
644- proof .closeGoal (goalList .head ());
645- }
625+ if (goalList .isEmpty ()) {
626+ proof .closeGoal (this );
627+ } else {
628+ proof .replace (this , goalList );
629+ if (ruleApp instanceof TacletApp tacletApp && tacletApp .taclet ().closeGoal ()
630+ || ruleApp instanceof SMTRuleApp ) {
631+ // the first new goal is the one to be closed
632+ proof .closeGoal (goalList .head ());
646633 }
647634 }
648635
@@ -680,6 +667,7 @@ private void adaptNamespacesNewGoals(final ImmutableList<Goal> goalList) {
680667 }
681668 }
682669
670+ @ Override
683671 public String toString () {
684672 LogicPrinter lp = LogicPrinter .purePrinter (new NotationInfo (), proof ().getServices ());
685673 lp .printSequent (node .sequent ());
@@ -711,9 +699,6 @@ public void makeLocalNamespacesFrom(NamespaceSet ns) {
711699 this .localNamespaces = ns .copyWithParent ().copyWithParent ();
712700 }
713701
714- /**
715- *
716- */
717702 public List <RuleApp > getAllBuiltInRuleApps () {
718703 final BuiltInRuleAppIndex index = ruleAppIndex ().builtInRuleAppIndex ();
719704 LinkedList <RuleApp > ruleApps = new LinkedList <>();
0 commit comments