@@ -48,17 +48,20 @@ public abstract class TacletIndex implements RuleIndex<NoPosTacletApp> {
4848 /**
4949 * contains rewrite Taclets
5050 */
51- protected HashMap <Object , ImmutableList <NoPosTacletApp >> rwList = new LinkedHashMap <>();
51+ protected CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> rwList =
52+ new CopyOnWriteIndexMap <>();
5253
5354 /**
5455 * contains antecedent Taclets
5556 */
56- protected HashMap <Object , ImmutableList <NoPosTacletApp >> antecList = new LinkedHashMap <>();
57+ protected CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> antecList =
58+ new CopyOnWriteIndexMap <>();
5759
5860 /**
5961 * contains succedent Taclets
6062 */
61- protected HashMap <Object , ImmutableList <NoPosTacletApp >> succList = new LinkedHashMap <>();
63+ protected CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> succList =
64+ new CopyOnWriteIndexMap <>();
6265
6366 /**
6467 * contains NoFind-Taclets
@@ -81,16 +84,16 @@ public abstract class TacletIndex implements RuleIndex<NoPosTacletApp> {
8184 * creates a new TacletIndex with the given Taclets as initial contents.
8285 */
8386 TacletIndex (Iterable <Taclet > tacletSet ) {
84- rwList = new LinkedHashMap <>();
85- antecList = new LinkedHashMap <>();
86- succList = new LinkedHashMap <>();
87+ rwList = new CopyOnWriteIndexMap <>();
88+ antecList = new CopyOnWriteIndexMap <>();
89+ succList = new CopyOnWriteIndexMap <>();
8790 noFindList = ImmutableList .nil ();
8891 addTaclets (toNoPosTacletApp (tacletSet ));
8992 }
9093
91- protected TacletIndex (HashMap <Object , ImmutableList <NoPosTacletApp >> rwList ,
92- HashMap <Object , ImmutableList <NoPosTacletApp >> antecList ,
93- HashMap <Object , ImmutableList <NoPosTacletApp >> succList ,
94+ protected TacletIndex (CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> rwList ,
95+ CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> antecList ,
96+ CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> succList ,
9497 ImmutableList <NoPosTacletApp > noFindList ,
9598 HashSet <NoPosTacletApp > partialInstantiatedRuleApps ) {
9699 this .rwList = rwList ;
@@ -141,7 +144,7 @@ private static Object getIndexObj(FindTaclet tac) {
141144
142145
143146 private void insertToMap (NoPosTacletApp tacletApp ,
144- HashMap <Object , ImmutableList <NoPosTacletApp >> map ) {
147+ CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> map ) {
145148 Object indexObj = getIndexObj ((FindTaclet ) tacletApp .taclet ());
146149 ImmutableList <NoPosTacletApp > opList = map .get (indexObj );
147150 opList = Objects .requireNonNullElseGet (opList ,
@@ -151,7 +154,7 @@ private void insertToMap(NoPosTacletApp tacletApp,
151154
152155
153156 private void removeFromMap (NoPosTacletApp tacletApp ,
154- HashMap <Object , ImmutableList <NoPosTacletApp >> map ) {
157+ CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> map ) {
155158 Object op = getIndexObj ((FindTaclet ) tacletApp .taclet ());
156159 ImmutableList <NoPosTacletApp > opList = map .get (op );
157160 if (opList != null ) {
@@ -305,7 +308,7 @@ protected abstract ImmutableList<NoPosTacletApp> matchTaclets(
305308 * prefix elements
306309 */
307310 private ImmutableList <NoPosTacletApp > getJavaTacletList (
308- HashMap <Object , ImmutableList <NoPosTacletApp >> map , ProgramElement pe ,
311+ CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> map , ProgramElement pe ,
309312 PrefixOccurrences prefixOccurrences ) {
310313 ImmutableList <NoPosTacletApp > res = ImmutableList .nil ();
311314 if (pe instanceof ProgramPrefix nt ) {
@@ -324,7 +327,7 @@ private ImmutableList<NoPosTacletApp> getJavaTacletList(
324327
325328 @ SuppressWarnings ("deprecation" )
326329 private ImmutableList <NoPosTacletApp > getListHelp (
327- final HashMap <Object , ImmutableList <NoPosTacletApp >> map , final JTerm term ,
330+ final CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> map , final JTerm term ,
328331 final boolean ignoreUpdates , final PrefixOccurrences prefixOccurrences ) {
329332
330333 ImmutableList <NoPosTacletApp > res = ImmutableList .nil ();
@@ -405,7 +408,8 @@ private ImmutableList<NoPosTacletApp> merge(ImmutableList<NoPosTacletApp> first,
405408 * @param term the term that is used to find the selection
406409 */
407410 private ImmutableList <NoPosTacletApp > getList (
408- HashMap <Object , ImmutableList <NoPosTacletApp >> map , JTerm term , boolean ignoreUpdates ) {
411+ CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> map , JTerm term ,
412+ boolean ignoreUpdates ) {
409413 return getListHelp (map , term , ignoreUpdates , new PrefixOccurrences ());
410414 }
411415
@@ -445,7 +449,8 @@ public ImmutableList<NoPosTacletApp> getSuccedentTaclet(
445449 }
446450
447451 private ImmutableList <NoPosTacletApp > getTopLevelTaclets (
448- HashMap <Object , ImmutableList <NoPosTacletApp >> findTaclets , RuleFilter filter ,
452+ CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> findTaclets ,
453+ RuleFilter filter ,
449454 PosInOccurrence pos , LogicServices services ) {
450455
451456 assert pos .isTopLevel ();
@@ -626,7 +631,7 @@ public int occurred(ProgramElement pe) {
626631 * @param map a map to select from
627632 */
628633 public ImmutableList <NoPosTacletApp > getList (
629- HashMap <Object , ImmutableList <NoPosTacletApp >> map ) {
634+ CopyOnWriteIndexMap <Object , ImmutableList <NoPosTacletApp >> map ) {
630635 ImmutableList <NoPosTacletApp > result = ImmutableList .nil ();
631636 for (int i = 0 ; i < PREFIXTYPES ; i ++) {
632637 if (occurred [i ]) {
0 commit comments