@@ -170,16 +170,14 @@ public void setDescription(final String description) {
170
170
this .description = description ;
171
171
}
172
172
173
- public void addMetadata (final String key , String value ) {
173
+ public void addMetadata (final String key , final String value ) {
174
174
if (metadata == null ) {
175
175
metadata = new HashMap <>(5 );
176
176
}
177
177
final String old = metadata .get (key );
178
- if (old != null ) {
179
- // if the key exists, simply append the new value
180
- value = old + ", " + value ;
181
- }
182
- metadata .put (key , value );
178
+ // if the key exists, append the new value
179
+ final String newValue = old == null ? value : old + ", " + value ;
180
+ metadata .put (key , newValue );
183
181
}
184
182
185
183
public String getMetadata (final String key ) {
@@ -232,7 +230,7 @@ public String toString() {
232
230
buf .append (name .getStringValue ());
233
231
buf .append ('(' );
234
232
if (arguments != null ) {
235
- final char var = 'a' ;
233
+ final char ANON_VAR = 'a' ;
236
234
for (int i = 0 ; i < arguments .length ; i ++) {
237
235
if (i > 0 ) {
238
236
buf .append (", " );
@@ -241,7 +239,7 @@ public String toString() {
241
239
if (arguments [i ] instanceof FunctionParameterSequenceType ) {
242
240
buf .append (((FunctionParameterSequenceType )arguments [i ]).getAttributeName ());
243
241
} else {
244
- buf .append ((char )(var + i ));
242
+ buf .append ((char )(ANON_VAR + i ));
245
243
}
246
244
buf .append (" as " );
247
245
buf .append (arguments [i ].toString ());
@@ -251,15 +249,15 @@ public String toString() {
251
249
buf .append (", ..." );
252
250
}
253
251
}
254
- buf .append (") " );
252
+ buf .append (") as " );
255
253
buf .append (returnType .toString ());
256
254
257
255
return buf .toString ();
258
256
}
259
257
260
258
@ Override
261
259
public boolean equals (final Object obj ) {
262
- if ( obj == null || !(obj instanceof FunctionSignature )) {
260
+ if ( !(obj instanceof FunctionSignature )) {
263
261
return false ;
264
262
}
265
263
// quick comparison by object identity
@@ -275,11 +273,8 @@ public boolean equals(final Object obj) {
275
273
return false ;
276
274
}
277
275
278
- if (name .equals (other .name )) {
279
- return getArgumentCount () == other .getArgumentCount ();
280
- }
281
-
282
- return false ;
276
+ // compare by QName and arity
277
+ return (name .equals (other .name ) && getArgumentCount () == other .getArgumentCount ());
283
278
}
284
279
285
280
/**
0 commit comments