|
19 | 19 |
|
20 | 20 | package org.tzi.use.uml.mm;
|
21 | 21 |
|
22 |
| -import java.util.Collections; |
23 |
| -import java.util.HashSet; |
24 |
| -import java.util.LinkedList; |
25 |
| -import java.util.List; |
26 |
| -import java.util.Set; |
27 |
| - |
28 | 22 | import org.tzi.use.uml.ocl.expr.Expression;
|
29 | 23 | import org.tzi.use.uml.ocl.expr.VarDecl;
|
30 | 24 | import org.tzi.use.uml.ocl.expr.VarDeclList;
|
31 | 25 | import org.tzi.use.uml.ocl.type.Type;
|
32 | 26 | import org.tzi.use.uml.ocl.type.TypeFactory;
|
33 | 27 | import org.tzi.use.util.collections.CollectionUtil;
|
34 | 28 |
|
| 29 | +import java.util.*; |
| 30 | + |
35 | 31 | /**
|
36 | 32 | * An AssociationEnd stores information about the role a class plays
|
37 | 33 | * in an association.
|
|
41 | 37 | public final class MAssociationEnd extends MModelElementImpl implements MNavigableElement {
|
42 | 38 |
|
43 | 39 | private MAssociation fAssociation; // Owner of this association end
|
44 |
| - private MClass fClass; // associated class |
45 |
| - private MMultiplicity fMultiplicity; // multiplicity spec |
| 40 | + private final MClass fClass; // associated class |
| 41 | + private final MMultiplicity fMultiplicity; // multiplicity spec |
46 | 42 | private int fKind; // none, aggregation, or composition
|
47 |
| - private boolean fIsOrdered; // use as Set or OrderedSet |
| 43 | + private final boolean fIsOrdered; // use as Set or OrderedSet |
48 | 44 | private boolean fIsNavigable = true;
|
49 | 45 | private boolean fIsExplicitNavigable = false;
|
50 | 46 |
|
@@ -113,11 +109,8 @@ public MAssociationEnd(MClass cls,
|
113 | 109 | fMultiplicity = mult;
|
114 | 110 | setAggregationKind(kind);
|
115 | 111 | fIsOrdered = isOrdered;
|
116 |
| - |
117 |
| - if (qualifiers == null) |
118 |
| - this.qualifier = Collections.emptyList(); |
119 |
| - else |
120 |
| - this.qualifier = qualifiers; |
| 112 | + |
| 113 | + this.qualifier = Objects.requireNonNullElse(qualifiers, Collections.emptyList()); |
121 | 114 | }
|
122 | 115 |
|
123 | 116 | /**
|
@@ -248,7 +241,7 @@ public boolean equals(Object obj) {
|
248 | 241 | public Type getType( Type sourceObjectType, MNavigableElement src, boolean qualifiedAccess ) {
|
249 | 242 | Type t;
|
250 | 243 |
|
251 |
| - if (this.getRedefiningEnds().size() > 0) { |
| 244 | + if (!this.getRedefiningEnds().isEmpty()) { |
252 | 245 | t = getRedefinedType((MClass)sourceObjectType);
|
253 | 246 | } else {
|
254 | 247 | t = cls();
|
@@ -480,7 +473,7 @@ public List<VarDecl> getQualifiers() {
|
480 | 473 |
|
481 | 474 | @Override
|
482 | 475 | public boolean hasQualifiers() {
|
483 |
| - return getQualifiers().size() > 0; |
| 476 | + return !getQualifiers().isEmpty(); |
484 | 477 | }
|
485 | 478 |
|
486 | 479 | /* (non-Javadoc)
|
|
0 commit comments