1717import de .uka .ilkd .key .proof .mgt .RuleJustification ;
1818import de .uka .ilkd .key .proof .mgt .RuleJustificationByAddRules ;
1919import de .uka .ilkd .key .proof .mgt .RuleJustificationInfo ;
20- import de .uka .ilkd .key .rule .*;
20+ import de .uka .ilkd .key .rule .BuiltInRule ;
21+ import de .uka .ilkd .key .rule .NoPosTacletApp ;
22+ import de .uka .ilkd .key .rule .Rule ;
23+ import de .uka .ilkd .key .rule .Taclet ;
2124import de .uka .ilkd .key .rule .tacletbuilder .TacletBuilder ;
2225import de .uka .ilkd .key .settings .ProofSettings ;
2326
@@ -75,10 +78,14 @@ public class InitConfig {
7578 */
7679 private ImmutableSet <Choice > activatedChoices = DefaultImmutableSet .nil ();
7780
78- /** HashMap for quick lookups taclet name->taclet */
81+ /**
82+ * HashMap for quick lookups taclet name->taclet
83+ */
7984 private Map <Name , Taclet > activatedTacletCache = null ;
8085
81- /** the fileRepo which is responsible for consistency between source code and proof */
86+ /**
87+ * the fileRepo which is responsible for consistency between source code and proof
88+ */
8289 private FileRepo fileRepo ;
8390
8491 // weigl this field is never set
@@ -106,7 +113,6 @@ public InitConfig(Services services) {
106113 // -------------------------------------------------------------------------
107114
108115
109-
110116 // -------------------------------------------------------------------------
111117 // public interface
112118 // -------------------------------------------------------------------------
@@ -255,7 +261,7 @@ private void fillActiveTacletCache() {
255261 if (activatedTacletCache != null ) {
256262 return ;
257263 }
258- final LinkedHashMap <Name , Taclet > tacletCache = new LinkedHashMap <>();
264+ final Map <Name , Taclet > tacletCache = new TreeMap <>();
259265 var choices = Collections .unmodifiableSet (activatedChoices .toSet ());
260266 for (Taclet t : taclets ) {
261267 TacletBuilder <? extends Taclet > b = taclet2Builder .get (t );
@@ -266,6 +272,9 @@ private void fillActiveTacletCache() {
266272 }
267273
268274 if (t != null ) {
275+ if (tacletCache .containsKey (t .name ())) {
276+ throw new IllegalArgumentException ();
277+ }
269278 tacletCache .put (t .name (), t );
270279 }
271280 }
@@ -441,7 +450,6 @@ public InitConfig copyWithServices(Services services) {
441450 }
442451
443452
444-
445453 @ Override
446454 public String toString () {
447455 return "Namespaces:" + namespaces () + "\n " + "Services:" + services + "\n " + "Taclets:"
@@ -474,4 +482,19 @@ public void activateChoice(Choice choice) {
474482 public void setHeader (KeyAst .@ Nullable Declarations header ) {
475483 this .header = header ;
476484 }
485+
486+ public Collection <NoPosTacletApp > filterTaclets (ImmutableSet <NoPosTacletApp > taclets ) {
487+ var result = new HashMap <Name , NoPosTacletApp >();
488+ var choices = Collections .unmodifiableSet (activatedChoices .toSet ());
489+ for (var app : taclets ) {
490+ var t = app .taclet ();
491+ if (t .getChoices ().eval (choices )) {
492+ if (result .containsKey (t .name ())) {
493+ throw new IllegalArgumentException ("Duplicate choice: " + t .name () + " by PO" );
494+ }
495+ result .put (t .name (), app );
496+ }
497+ }
498+ return result .values ();
499+ }
477500}
0 commit comments