[157714] Include all interfaces realized by classifiers (not just those targeted by interface realizations).
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ComponentOperations.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ComponentOperations.java
index c5f6f2d..8743288 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ComponentOperations.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ComponentOperations.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ComponentOperations.java,v 1.10.2.2 2006/09/19 17:59:40 khussey Exp $
+ * $Id: ComponentOperations.java,v 1.10.2.3 2006/10/11 15:19:05 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.operations;
@@ -124,12 +124,18 @@
*/
public static EList realizedInterfaces(Component component,
Classifier classifier) {
- return realizedInterfaces(component, classifier, true);
+ return ECollections.unmodifiableEList(realizedInterfaces(component,
+ classifier, true));
}
protected static EList realizedInterfaces(Component component,
Classifier classifier, boolean resolve) {
- EList realizedInterfaces = new UniqueEList.FastCompare();
+ return realizedInterfaces(component, classifier, resolve,
+ new UniqueEList.FastCompare());
+ }
+
+ protected static EList realizedInterfaces(Component component,
+ Classifier classifier, boolean resolve, EList realizedInterfaces) {
for (Iterator clientDependencies = classifier.getClientDependencies()
.iterator(); clientDependencies.hasNext();) {
@@ -152,7 +158,7 @@
}
}
- return ECollections.unmodifiableEList(realizedInterfaces);
+ return realizedInterfaces;
}
/**
@@ -168,12 +174,18 @@
*/
public static EList usedInterfaces(Component component,
Classifier classifier) {
- return usedInterfaces(component, classifier, true);
+ return ECollections.unmodifiableEList(usedInterfaces(component,
+ classifier, true));
}
protected static EList usedInterfaces(Component component,
Classifier classifier, boolean resolve) {
- EList usedInterfaces = new UniqueEList.FastCompare();
+ return usedInterfaces(component, classifier, resolve,
+ new UniqueEList.FastCompare());
+ }
+
+ protected static EList usedInterfaces(Component component,
+ Classifier classifier, boolean resolve, EList usedInterfaces) {
for (Iterator clientDependencies = classifier.getClientDependencies()
.iterator(); clientDependencies.hasNext();) {
@@ -196,7 +208,7 @@
}
}
- return ECollections.unmodifiableEList(usedInterfaces);
+ return usedInterfaces;
}
/**
@@ -216,8 +228,8 @@
* @generated NOT
*/
public static EList getRequireds(Component component) {
- EList requireds = new UniqueEList.FastCompare(usedInterfaces(component,
- component, false));
+ EList requireds = usedInterfaces(component, component, false,
+ new UniqueEList.FastCompare());
for (Iterator realizations = component.getRealizations().iterator(); realizations
.hasNext();) {
@@ -226,14 +238,13 @@
.next()).getRealizingClassifier();
if (realizingClassifier != null) {
- requireds.addAll(usedInterfaces(component, realizingClassifier,
- false));
+ usedInterfaces(component, realizingClassifier, false, requireds);
for (Iterator allParents = realizingClassifier.allParents()
.iterator(); allParents.hasNext();) {
- requireds.addAll(usedInterfaces(component,
- (Classifier) allParents.next(), false));
+ usedInterfaces(component, (Classifier) allParents.next(),
+ false, requireds);
}
}
}
@@ -269,8 +280,8 @@
* @generated NOT
*/
public static EList getProvideds(Component component) {
- EList provideds = new UniqueEList.FastCompare(realizedInterfaces(
- component, component, false));
+ EList provideds = realizedInterfaces(component, component, false,
+ new UniqueEList.FastCompare());
for (Iterator realizations = component.getRealizations().iterator(); realizations
.hasNext();) {
@@ -279,14 +290,14 @@
.next()).getRealizingClassifier();
if (realizingClassifier != null) {
- provideds.addAll(realizedInterfaces(component,
- realizingClassifier, false));
+ realizedInterfaces(component, realizingClassifier, false,
+ provideds);
for (Iterator allParents = realizingClassifier.allParents()
.iterator(); allParents.hasNext();) {
- provideds.addAll(realizedInterfaces(component,
- (Classifier) allParents.next(), false));
+ realizedInterfaces(component, (Classifier) allParents
+ .next(), false, provideds);
}
}
}
@@ -315,8 +326,8 @@
if (parent instanceof Component) {
allProvideds.addAll(((Component) parent).getProvideds());
} else {
- allProvideds.addAll(realizedInterfaces(component,
- (Classifier) parent));
+ realizedInterfaces(component, (Classifier) parent, true,
+ allProvideds);
}
}
@@ -335,8 +346,8 @@
if (parent instanceof Component) {
allRequireds.addAll(((Component) parent).getRequireds());
} else {
- allRequireds.addAll(usedInterfaces(component,
- (Classifier) parent));
+ usedInterfaces(component, (Classifier) parent, true,
+ allRequireds);
}
}
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ConnectableElementOperations.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ConnectableElementOperations.java
index 9d9d471..96b4a48 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ConnectableElementOperations.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ConnectableElementOperations.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ConnectableElementOperations.java,v 1.1.2.1 2006/09/19 18:02:36 khussey Exp $
+ * $Id: ConnectableElementOperations.java,v 1.1.2.2 2006/10/11 15:19:05 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.operations;
@@ -17,7 +17,6 @@
import org.eclipse.emf.common.util.ECollections;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.UniqueEList;
-import org.eclipse.uml2.uml.BehavioredClassifier;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.ConnectableElement;
@@ -50,8 +49,17 @@
ComponentOperations.getAllRequireds((Component) type,
requiredInterfaces);
} else if (type instanceof Classifier) {
- requiredInterfaces.addAll(((Classifier) type)
- .getAllUsedInterfaces());
+ Classifier classifier = (Classifier) type;
+ ComponentOperations.usedInterfaces(null, classifier, true,
+ requiredInterfaces);
+
+ for (Iterator allParents = classifier.allParents().iterator(); allParents
+ .hasNext();) {
+
+ ComponentOperations.usedInterfaces(null,
+ (Classifier) allParents.next(), true,
+ requiredInterfaces);
+ }
}
}
@@ -86,9 +94,18 @@
providedInterfaces);
} else if (type instanceof Interface) {
providedInterfaces.add(type);
- } else if (type instanceof BehavioredClassifier) {
- providedInterfaces.addAll(((BehavioredClassifier) type)
- .getAllImplementedInterfaces());
+ } else if (type instanceof Classifier) {
+ Classifier classifier = (Classifier) type;
+ ComponentOperations.realizedInterfaces(null, classifier, true,
+ providedInterfaces);
+
+ for (Iterator allParents = classifier.allParents().iterator(); allParents
+ .hasNext();) {
+
+ ComponentOperations.realizedInterfaces(null,
+ (Classifier) allParents.next(), true,
+ providedInterfaces);
+ }
}
}
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/PortOperations.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/PortOperations.java
index 2c0663d..06304e3 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/PortOperations.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/PortOperations.java
@@ -8,10 +8,11 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: PortOperations.java,v 1.11 2006/04/05 19:26:35 khussey Exp $
+ * $Id: PortOperations.java,v 1.11.2.1 2006/10/11 15:19:05 khussey Exp $
*/
package org.eclipse.uml2.uml.internal.operations;
+import java.util.Iterator;
import java.util.Map;
import org.eclipse.emf.common.util.BasicDiagnostic;
@@ -25,7 +26,6 @@
import org.eclipse.uml2.common.util.UnionEObjectEList;
import org.eclipse.uml2.uml.AggregationKind;
-import org.eclipse.uml2.uml.BehavioredClassifier;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Interface;
import org.eclipse.uml2.uml.Port;
@@ -202,9 +202,17 @@
if (type instanceof Interface) {
provideds.add(type);
- } else if (type instanceof BehavioredClassifier) {
- BehavioredClassifierOperations.getAllRealizedInterfaces(
- (BehavioredClassifier) port.getType(), provideds);
+ } else if (type instanceof Classifier) {
+ Classifier classifier = (Classifier) port.getType();
+ ComponentOperations.realizedInterfaces(null, classifier, false,
+ provideds);
+
+ for (Iterator allParents = classifier.allParents().iterator(); allParents
+ .hasNext();) {
+
+ ComponentOperations.realizedInterfaces(null,
+ (Classifier) allParents.next(), false, provideds);
+ }
}
return new UnionEObjectEList((InternalEObject) port,
@@ -224,8 +232,16 @@
false);
if (type instanceof Classifier && !(type instanceof Interface)) {
- ClassifierOperations.getAllUsedInterfaces((Classifier) port
- .getType(), requireds);
+ Classifier classifier = (Classifier) port.getType();
+ ComponentOperations.usedInterfaces(null, classifier, false,
+ requireds);
+
+ for (Iterator allParents = classifier.allParents().iterator(); allParents
+ .hasNext();) {
+
+ ComponentOperations.usedInterfaces(null,
+ (Classifier) allParents.next(), false, requireds);
+ }
}
return new UnionEObjectEList((InternalEObject) port,