44package de .uka .ilkd .key .logic ;
55
66
7+ import java .util .Objects ;
8+
79import de .uka .ilkd .key .logic .op .IProgramVariable ;
810import de .uka .ilkd .key .logic .op .ParametricFunctionDecl ;
911import de .uka .ilkd .key .logic .sort .ParametricSortDecl ;
1921import org .key_project .prover .rules .RuleSet ;
2022
2123import org .jspecify .annotations .NonNull ;
24+ import org .jspecify .annotations .NullMarked ;
2225import org .jspecify .annotations .Nullable ;
2326
27+ @ NullMarked
2428public class NamespaceSet {
2529
26- private Namespace <@ NonNull QuantifiableVariable > varNS = new Namespace <>();
27- private Namespace <@ NonNull IProgramVariable > progVarNS = new Namespace <>();
30+ private Namespace <QuantifiableVariable > varNS = new Namespace <>();
31+ private Namespace <IProgramVariable > progVarNS = new Namespace <>();
2832 // TODO: Operators should not be local to goals
29- private Namespace <@ NonNull Function > funcNS = new Namespace <>();
30- private Namespace <@ NonNull RuleSet > ruleSetNS = new Namespace <>();
31- private Namespace <@ NonNull Sort > sortNS = new Namespace <>();
33+ private Namespace <Function > funcNS = new Namespace <>();
34+ private Namespace <RuleSet > ruleSetNS = new Namespace <>();
35+ private Namespace <Sort > sortNS = new Namespace <>();
3236 private Namespace <@ NonNull SortAlias > sortAliases = new Namespace <>();
33- private Namespace <@ NonNull ParametricSortDecl > parametricSortNS = new Namespace <>();
34- private Namespace <@ NonNull ParametricFunctionDecl > parametricFuncNS = new Namespace <>();
35- private Namespace <@ NonNull Choice > choiceNS = new Namespace <>();
37+ private Namespace <ParametricSortDecl > parametricSortNS = new Namespace <>();
38+ private Namespace <ParametricFunctionDecl > parametricFuncNS = new Namespace <>();
39+ private Namespace <Choice > choiceNS = new Namespace <>();
40+ private DocSpace documentation = new DocSpace ();
3641
3742 public NamespaceSet () {
3843 }
3944
40- public NamespaceSet (Namespace <@ NonNull QuantifiableVariable > varNS ,
41- Namespace <@ NonNull Function > funcNS ,
42- Namespace <@ NonNull Sort > sortNS , Namespace <@ NonNull SortAlias > sortAliases ,
43- Namespace <@ NonNull RuleSet > ruleSetNS ,
44- Namespace <@ NonNull ParametricSortDecl > parametricSortNS ,
45- Namespace <@ NonNull ParametricFunctionDecl > parametricFuncNS ,
46- Namespace <@ NonNull Choice > choiceNS ,
47- Namespace <@ NonNull IProgramVariable > programVarNS ) {
45+ public NamespaceSet (Namespace <QuantifiableVariable > varNS ,
46+ Namespace <Function > funcNS ,
47+ Namespace <Sort > sortNS ,
48+ Namespace <SortAlias > sortAliases ,
49+ Namespace <RuleSet > ruleSetNS ,
50+ Namespace <ParametricSortDecl > parametricSortNS ,
51+ Namespace <ParametricFunctionDecl > parametricFuncNS ,
52+ Namespace <Choice > choiceNS ,
53+ Namespace <IProgramVariable > programVarNS ) {
54+ this (varNS , funcNS , sortNS , sortAliases , ruleSetNS ,
55+ parametricSortNS , parametricFuncNS ,
56+ choiceNS , programVarNS , new DocSpace ());
57+ }
58+
59+ public NamespaceSet (Namespace <QuantifiableVariable > varNS ,
60+ Namespace <Function > funcNS ,
61+ Namespace <Sort > sortNS ,
62+ Namespace <SortAlias > sortAliases ,
63+ Namespace <RuleSet > ruleSetNS ,
64+ Namespace <ParametricSortDecl > parametricSortNS ,
65+ Namespace <ParametricFunctionDecl > parametricFuncNS ,
66+ Namespace <Choice > choiceNS ,
67+ Namespace <IProgramVariable > programVarNS ,
68+ DocSpace documentation ) {
4869 this .varNS = varNS ;
4970 this .progVarNS = programVarNS ;
5071 this .funcNS = funcNS ;
@@ -54,21 +75,23 @@ public NamespaceSet(Namespace<@NonNull QuantifiableVariable> varNS,
5475 this .choiceNS = choiceNS ;
5576 this .parametricSortNS = parametricSortNS ;
5677 this .parametricFuncNS = parametricFuncNS ;
78+ this .documentation = Objects .requireNonNull (documentation );
5779 }
5880
81+
5982 public NamespaceSet copy () {
6083 return new NamespaceSet (variables ().copy (), functions ().copy (),
6184 sorts ().copy (), sortAliases ().copy (),
6285 ruleSets ().copy (), parametricSortNS .copy (), parametricFuncNS .copy (), choices ().copy (),
63- programVariables ().copy ());
86+ programVariables ().copy (),
87+ documentation .copy ());
6488 }
6589
6690 public NamespaceSet shallowCopy () {
6791 return new NamespaceSet (variables (), functions (), sorts (), sortAliases (), ruleSets (),
6892 parametricSorts (),
6993 parametricFunctions (),
70- choices (),
71- programVariables ());
94+ choices (), programVariables (), new DocSpace (documentation ));
7295 }
7396
7497 // TODO MU: Rename into sth with wrap or similar
@@ -77,46 +100,47 @@ public NamespaceSet copyWithParent() {
77100 new Namespace <>(functions ()), new Namespace <>(sorts ()), new Namespace <>(sortAliases ()),
78101 new Namespace <>(ruleSets ()), new Namespace <>(parametricSorts ()),
79102 new Namespace <>(parametricFunctions ()), new Namespace <>(choices ()),
80- new Namespace <>(programVariables ()));
103+ new Namespace <>(programVariables ()),
104+ new DocSpace (documentation ));
81105 }
82106
83- public Namespace <@ NonNull QuantifiableVariable > variables () {
107+ public Namespace <QuantifiableVariable > variables () {
84108 return varNS ;
85109 }
86110
87- public void setVariables (Namespace <@ NonNull QuantifiableVariable > varNS ) {
111+ public void setVariables (Namespace <QuantifiableVariable > varNS ) {
88112 this .varNS = varNS ;
89113 }
90114
91- public Namespace <@ NonNull IProgramVariable > programVariables () {
115+ public Namespace <IProgramVariable > programVariables () {
92116 return progVarNS ;
93117 }
94118
95- public void setProgramVariables (Namespace <@ NonNull IProgramVariable > progVarNS ) {
119+ public void setProgramVariables (Namespace <IProgramVariable > progVarNS ) {
96120 this .progVarNS = progVarNS ;
97121 }
98122
99- public Namespace <@ NonNull Function > functions () {
123+ public Namespace <Function > functions () {
100124 return funcNS ;
101125 }
102126
103- public void setFunctions (Namespace <@ NonNull Function > funcNS ) {
127+ public void setFunctions (Namespace <Function > funcNS ) {
104128 this .funcNS = funcNS ;
105129 }
106130
107- public Namespace <@ NonNull RuleSet > ruleSets () {
131+ public Namespace <RuleSet > ruleSets () {
108132 return ruleSetNS ;
109133 }
110134
111- public void setRuleSets (Namespace <@ NonNull RuleSet > ruleSetNS ) {
135+ public void setRuleSets (Namespace <RuleSet > ruleSetNS ) {
112136 this .ruleSetNS = ruleSetNS ;
113137 }
114138
115- public Namespace <@ NonNull Sort > sorts () {
139+ public Namespace <Sort > sorts () {
116140 return sortNS ;
117141 }
118142
119- public void setSorts (Namespace <@ NonNull Sort > sortNS ) {
143+ public void setSorts (Namespace <Sort > sortNS ) {
120144 this .sortNS = sortNS ;
121145 }
122146
@@ -128,28 +152,28 @@ public void setSortAliases(Namespace<@NonNull SortAlias> sortAliases) {
128152 this .sortAliases = sortAliases ;
129153 }
130154
131- public Namespace <@ NonNull ParametricSortDecl > parametricSorts () {
155+ public Namespace <ParametricSortDecl > parametricSorts () {
132156 return parametricSortNS ;
133157 }
134158
135- public void setParametricSorts (Namespace <@ NonNull ParametricSortDecl > parametricSortNS ) {
159+ public void setParametricSorts (Namespace <ParametricSortDecl > parametricSortNS ) {
136160 this .parametricSortNS = parametricSortNS ;
137161 }
138162
139- public Namespace <@ NonNull ParametricFunctionDecl > parametricFunctions () {
163+ public Namespace <ParametricFunctionDecl > parametricFunctions () {
140164 return parametricFuncNS ;
141165 }
142166
143167 public void setParametricFunctions (
144- Namespace <@ NonNull ParametricFunctionDecl > parametricFuncNS ) {
168+ Namespace <ParametricFunctionDecl > parametricFuncNS ) {
145169 this .parametricFuncNS = parametricFuncNS ;
146170 }
147171
148- public Namespace <@ NonNull Choice > choices () {
172+ public Namespace <Choice > choices () {
149173 return choiceNS ;
150174 }
151175
152- public void setChoices (Namespace <@ NonNull Choice > choiceNS ) {
176+ public void setChoices (Namespace <Choice > choiceNS ) {
153177 this .choiceNS = choiceNS ;
154178 }
155179
@@ -278,14 +302,14 @@ public NamespaceSet simplify() {
278302 return new NamespaceSet (varNS .simplify (), funcNS .simplify (), sortNS .simplify (),
279303 sortAliases .simplify (),
280304 ruleSetNS .simplify (), parametricSortNS .simplify (), parametricFuncNS .simplify (),
281- choiceNS .simplify (), progVarNS .simplify ());
305+ choiceNS .simplify (), progVarNS .simplify (), documentation );
282306 }
283307
284308 public NamespaceSet getCompression () {
285309 return new NamespaceSet (varNS .compress (), funcNS .compress (), sortNS .compress (),
286310 sortAliases .compress (),
287311 ruleSetNS .compress (), parametricSortNS .compress (), parametricFuncNS .compress (),
288- choiceNS .compress (), progVarNS .compress ());
312+ choiceNS .compress (), progVarNS .compress (), documentation );
289313 }
290314
291315 public void flushToParent () {
@@ -298,7 +322,10 @@ public NamespaceSet getParent() {
298322 return new NamespaceSet (varNS .parent (), funcNS .parent (), sortNS .parent (),
299323 sortAliases .parent (),
300324 ruleSetNS .parent (), parametricSortNS .parent (), parametricFuncNS .parent (),
301- choiceNS .parent (), progVarNS .parent ());
325+ choiceNS .parent (), progVarNS .parent (), documentation . parent () );
302326 }
303327
328+ public DocSpace docs () {
329+ return documentation ;
330+ }
304331}
0 commit comments