@@ -70,7 +70,7 @@ public String getStringRep() {
70
70
}
71
71
72
72
public void setStringRep (String stringRep ) {
73
- fStringRep = stringRep .trim ().replaceAll (" " , " " );
73
+ fStringRep = stringRep .trim ().replaceAll (" {2} " , " " );
74
74
}
75
75
76
76
public void setIsPre () {
@@ -93,7 +93,7 @@ public Token getStartToken() {
93
93
public abstract Expression gen (Context ctx ) throws SemanticException ;
94
94
95
95
/**
96
- * Used by template method {@link getFreeVariables()} to create
96
+ * Used by template method {@link # getFreeVariables()} to create
97
97
* a set of all free variables of an expression by asking its
98
98
* sub-expressions.
99
99
* <p>Implementors need to add all free variables to the provided set <code>freeVars</code>.</p>
@@ -107,7 +107,7 @@ public Token getStartToken() {
107
107
* @return A <code>Set</code> of all free variables.
108
108
*/
109
109
public Set <String > getFreeVariables () {
110
- Set <String > result = new HashSet <String >();
110
+ Set <String > result = new HashSet <>();
111
111
getFreeVariables (result );
112
112
return result ;
113
113
}
@@ -122,7 +122,7 @@ protected Expression genStdOperation(Context ctx,
122
122
Expression [] args )
123
123
throws SemanticException
124
124
{
125
- Expression res = null ;
125
+ Expression res ;
126
126
try {
127
127
// lookup operation
128
128
res = ExpStdOp .create (opname , args );
@@ -166,7 +166,7 @@ protected Expression genNavigation( Token rolenameToken,
166
166
Expression srcExpr ,
167
167
MNavigableElement dst )
168
168
throws SemanticException {
169
- return genNavigation ( null , rolenameToken , srcClass , srcExpr , dst , Collections .< ASTExpression > emptyList (), Collections .< ASTExpression > emptyList () );
169
+ return genNavigation ( null , rolenameToken , srcClass , srcExpr , dst , Collections .emptyList (), Collections .emptyList () );
170
170
}
171
171
172
172
protected Expression genNavigation (Context ctx , Token rolenameToken ,
@@ -177,17 +177,17 @@ protected Expression genNavigation(Context ctx, Token rolenameToken,
177
177
List <ASTExpression > qualifiers )
178
178
throws SemanticException
179
179
{
180
- Expression res = null ;
180
+ Expression res ;
181
181
182
182
// find source end
183
- MNavigableElement src = null ;
183
+ MNavigableElement src ;
184
184
185
185
if (srcClass .equals (dst .association ())) {
186
186
return new ExpNavigationClassifierSource (dst .cls (), srcExpr , dst );
187
187
}
188
188
189
189
if (navigationNeedsExplicitRolename (srcClass , dst )) {
190
- if (explicitRolenameOrQualifiers .size () == 0 ) {
190
+ if (explicitRolenameOrQualifiers .isEmpty () ) {
191
191
// an explicit rolename is needed, but not provided
192
192
throw new SemanticException (
193
193
rolenameToken ,
@@ -211,16 +211,15 @@ protected Expression genNavigation(Context ctx, Token rolenameToken,
211
211
+ " was given. May be you interchanged it with qualifier values?" );
212
212
}
213
213
214
- ASTExpression explicitRolenameExp = explicitRolenameOrQualifiers .get ( 0 );
214
+ ASTExpression explicitRolenameExp = explicitRolenameOrQualifiers .getFirst ( );
215
215
216
- if (!(explicitRolenameExp instanceof ASTOperationExpression )) {
216
+ if (!(explicitRolenameExp instanceof ASTOperationExpression explicitRolenameOpExp )) {
217
217
// Must be a OperationExpression which encapsulates an IDENT
218
218
throw new SemanticException (rolenameToken ,
219
219
"Invalid qualification given" );
220
220
}
221
-
222
- ASTOperationExpression explicitRolenameOpExp = (ASTOperationExpression )explicitRolenameExp ;
223
- Token explicitRolenameToken = explicitRolenameOpExp .getOpToken ();
221
+
222
+ Token explicitRolenameToken = explicitRolenameOpExp .getOpToken ();
224
223
225
224
src = dst .association ().getSourceEnd (srcClass , dst , explicitRolenameToken .getText ());
226
225
@@ -250,7 +249,7 @@ protected Expression genNavigation(Context ctx, Token rolenameToken,
250
249
if (qualifiers .isEmpty ()) {
251
250
qualifierExpressions = Collections .emptyList ();
252
251
} else {
253
- qualifierExpressions = new ArrayList <Expression >();
252
+ qualifierExpressions = new ArrayList <>();
254
253
for (ASTExpression qualifierExp : qualifiers ) {
255
254
qualifierExpressions .add (qualifierExp .gen (ctx ));
256
255
}
@@ -269,11 +268,11 @@ protected Expression genNavigation(Context ctx, Token rolenameToken,
269
268
}
270
269
271
270
/**
272
- * True if a navigation from an object of class <code>srcClass</code> to
273
- * the association end <code>dst</code> needs an explicit rolename.
271
+ * <p> True if a navigation from an object of class <code>srcClass</code> to
272
+ * the association end <code>dst</code> needs an explicit rolename.</p>
274
273
*
275
- * Only reflexive associations with more then two reachable ends
276
- * can have an ambiguous path.
274
+ * <p> Only reflexive associations with more then two reachable ends
275
+ * can have an ambiguous path.</p>
277
276
* @param srcClass The <code>MClass</code> to navigate from
278
277
* @param dst The <code>MNavigableElement</code> to navigate to.
279
278
* @return <code>true</code> if the navigation needs a rolename, otherwise <code>false</code>.
@@ -304,7 +303,7 @@ protected boolean navigationNeedsExplicitRolename(MClassifier srcClass, MNavigab
304
303
* @param srcExpr the source collection
305
304
* @param expr the argument expression for collect
306
305
* @param elemType type of elements of the source collection
307
- * @throws SemanticException
306
+ * @throws SemanticException If the internal used instance of <code>ExpCollect</code> could not be created.
308
307
*/
309
308
protected Expression genImplicitCollect (Expression srcExpr ,
310
309
Expression expr ,
0 commit comments