Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 50479 Details for
Bug 157715
Incorrect validation rule : ConnectorOperations::validateAssemblyConnector()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch for validation rule
requiredProvided20060919.patch (text/plain), 18.62 KB, created by
James Bruck
on 2006-09-19 11:51:46 EDT
(
hide
)
Description:
patch for validation rule
Filename:
MIME Type:
Creator:
James Bruck
Created:
2006-09-19 11:51:46 EDT
Size:
18.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.uml2.uml >Index: src/org/eclipse/uml2/uml/internal/operations/ComponentOperations.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ComponentOperations.java,v >retrieving revision 1.10 >diff -u -r1.10 ComponentOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/ComponentOperations.java 8 Mar 2006 19:03:02 -0000 1.10 >+++ src/org/eclipse/uml2/uml/internal/operations/ComponentOperations.java 19 Sep 2006 15:52:43 -0000 >@@ -8,28 +8,28 @@ > * Contributors: > * IBM - initial API and implementation > * >- * $Id: ComponentOperations.java,v 1.10 2006/03/08 19:03:02 khussey Exp $ >+ * $Id: ComponentOperations.java,v 1.10.2.1 2006/08/16 17:19:40 khussey Exp $ > */ > package org.eclipse.uml2.uml.internal.operations; > >+import java.util.Iterator; >+ > import org.eclipse.emf.common.util.ECollections; > import org.eclipse.emf.common.util.EList; >- >-import java.util.Iterator; > import org.eclipse.emf.common.util.UniqueEList; > import org.eclipse.emf.ecore.InternalEObject; > import org.eclipse.emf.ecore.util.InternalEList; > import org.eclipse.uml2.common.util.UnionEObjectEList; >+import org.eclipse.uml2.uml.BehavioredClassifier; > import org.eclipse.uml2.uml.Classifier; > import org.eclipse.uml2.uml.Component; >-import org.eclipse.uml2.uml.Enumeration; > import org.eclipse.uml2.uml.ComponentRealization; > import org.eclipse.uml2.uml.Dependency; >+import org.eclipse.uml2.uml.Enumeration; > import org.eclipse.uml2.uml.Interface; >-import org.eclipse.uml2.uml.PrimitiveType; >- >-import org.eclipse.uml2.uml.InterfaceRealization; > import org.eclipse.uml2.uml.Port; >+import org.eclipse.uml2.uml.PrimitiveType; >+import org.eclipse.uml2.uml.Realization; > import org.eclipse.uml2.uml.UMLPackage; > import org.eclipse.uml2.uml.Usage; > >@@ -123,9 +123,13 @@ > * <!-- end-model-doc --> > * @generated NOT > */ >- public static EList realizedInterfaces(Component component, >+ public static EList realizedInterfaces( Component component, > Classifier classifier) { >+ return realizedInterfaces(component, classifier, true); >+ } > >+ protected static EList realizedInterfaces(Component component, >+ Classifier classifier, boolean resolve) { > EList realizedInterfaces = new UniqueEList.FastCompare(); > > for (Iterator clientDependencies = classifier.getClientDependencies() >@@ -133,11 +137,13 @@ > > Dependency dependency = (Dependency) clientDependencies.next(); > >- if (dependency instanceof ComponentRealization) { >- >- for (Iterator suppliers = ((InternalEList) dependency >- .getSuppliers()).basicIterator(); suppliers.hasNext();) { >+ if (dependency instanceof Realization) { >+ Iterator suppliers = resolve >+ ? dependency.getSuppliers().iterator() >+ : ((InternalEList) dependency.getSuppliers()) >+ .basicIterator(); > >+ while (suppliers.hasNext()) { > Object supplier = suppliers.next(); > > if (supplier instanceof Interface) { >@@ -163,29 +169,36 @@ > */ > public static EList usedInterfaces(Component component, > Classifier classifier) { >- EList usedInterfaces = new UniqueEList.FastCompare(); >- >- for (Iterator clientDependencies = classifier.getClientDependencies() >- .iterator(); clientDependencies.hasNext();) { >- >- Dependency dependency = (Dependency) clientDependencies.next(); >- >- if (dependency instanceof Usage) { >+ return usedInterfaces(component, classifier, true); >+ } > >- for (Iterator suppliers = ((InternalEList) dependency >- .getSuppliers()).basicIterator(); suppliers.hasNext();) { >+ >+ protected static EList usedInterfaces(Component component, Classifier classifier, boolean resolve) { >+ EList usedInterfaces = new UniqueEList.FastCompare(); >+ >+ for (Iterator clientDependencies = classifier.getClientDependencies() >+ .iterator(); clientDependencies.hasNext();) { >+ >+ Dependency dependency = (Dependency) clientDependencies.next(); >+ >+ if (dependency instanceof Usage) { >+ Iterator suppliers = resolve ? dependency.getSuppliers() >+ .iterator() >+ : ((InternalEList) dependency.getSuppliers()) >+ .basicIterator(); >+ >+ while (suppliers.hasNext()) { >+ Object supplier = suppliers.next(); >+ >+ if (supplier instanceof Interface) { >+ usedInterfaces.add(supplier); >+ } >+ } >+ } >+ } > >- Object supplier = suppliers.next(); >- >- if (supplier instanceof Interface) { >- usedInterfaces.add(supplier); >- } >- } >- } >- } >- >- return ECollections.unmodifiableEList(usedInterfaces); >- } >+ return ECollections.unmodifiableEList(usedInterfaces); >+ } > > /** > * <!-- begin-user-doc --> >@@ -204,90 +217,117 @@ > * @generated NOT > */ > public static EList getRequireds(Component component) { >- EList requireds = new UniqueEList.FastCompare(component >- .usedInterfaces(component)); >- >- for (Iterator realizations = component.getRealizations().iterator(); realizations >- .hasNext();) { >+ EList requireds = new UniqueEList.FastCompare(usedInterfaces(component, >+ component, false)); > >- Classifier realizingClassifier = ((ComponentRealization) realizations >- .next()).getRealizingClassifier(); >- >- if (realizingClassifier != null) { >- requireds.addAll(component.usedInterfaces(realizingClassifier)); >- } >- } >- >- for (Iterator ownedPorts = component.getOwnedPorts().iterator(); ownedPorts >- .hasNext();) { >- >- requireds.addAll(((InternalEList) ((Port) ownedPorts.next()) >- .getRequireds()).basicList()); >- } >- >- return new UnionEObjectEList((InternalEObject) component, >- UMLPackage.Literals.COMPONENT__REQUIRED, requireds.size(), >- requireds.toArray()); >- } >+ for (Iterator realizations = component.getRealizations().iterator(); realizations >+ .hasNext();) { >+ Classifier realizingClassifier = ((ComponentRealization) realizations >+ .next()).getRealizingClassifier(); >+ if (realizingClassifier != null) { >+ requireds.addAll(usedInterfaces(component, realizingClassifier, >+ false)); >+ for (Iterator allParents = realizingClassifier.allParents() >+ .iterator(); allParents.hasNext();) { >+ requireds.addAll(usedInterfaces(component, >+ (Classifier) allParents.next(), false)); >+ } >+ } >+ } >+ for (Iterator ownedPorts = component.getOwnedPorts().iterator(); ownedPorts >+ .hasNext();) { >+ >+ requireds.addAll(((InternalEList) ((Port) ownedPorts.next()) >+ .getRequireds()).basicList()); >+ } >+ return new UnionEObjectEList((InternalEObject) component, >+ UMLPackage.Literals.COMPONENT__REQUIRED, requireds.size(), >+ requireds.toArray()); >+ } > > /** >- * <!-- begin-user-doc --> >- * <!-- end-user-doc --> >- * <!-- begin-model-doc --> >- * result = let implementedInterfaces = self.implementation->collect(impl|impl.contract) and >- * >- * let realizedInterfaces = RealizedInterfaces(self) and >- * >- * let realizingClassifierInterfaces = RealizedInterfaces(self.realizingClassifier) and >- * >- * let typesOfRequiredPorts = self.ownedPort.provided in >- * >- * (((implementedInterfaces->union(realizedInterfaces)->union(realizingClassifierInterfaces))-> >- * >- * union(typesOfRequiredPorts))->asSet() >- * <!-- end-model-doc --> >- * @generated NOT >- */ >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * <!-- begin-model-doc --> >+ * result = let implementedInterfaces = >+ * self.implementation->collect(impl|impl.contract) and >+ * >+ * let realizedInterfaces = RealizedInterfaces(self) and >+ * >+ * let realizingClassifierInterfaces = >+ * RealizedInterfaces(self.realizingClassifier) and >+ * >+ * let typesOfRequiredPorts = self.ownedPort.provided in >+ * >+ * (((implementedInterfaces->union(realizedInterfaces)->union(realizingClassifierInterfaces))-> >+ * >+ * union(typesOfRequiredPorts))->asSet() >+ * <!-- end-model-doc --> >+ * >+ * @generated NOT >+ */ > public static EList getProvideds(Component component) { >- EList provideds = new UniqueEList.FastCompare(); >- >- for (Iterator interfaceRealizations = component >- .getInterfaceRealizations().iterator(); interfaceRealizations >- .hasNext();) { >- >- Interface contract = (Interface) ((InterfaceRealization) interfaceRealizations >- .next()).eGet( >- UMLPackage.Literals.INTERFACE_REALIZATION__CONTRACT, false); >- >- if (contract != null) { >- provideds.add(contract); >- } >- } >- >- provideds.addAll(component.realizedInterfaces(component)); >- >- for (Iterator realizations = component.getRealizations().iterator(); realizations >- .hasNext();) { >- >- Classifier realizingClassifier = ((ComponentRealization) realizations >- .next()).getRealizingClassifier(); >+ EList provideds = new UniqueEList.FastCompare(realizedInterfaces( >+ component, component, false)); > >- if (realizingClassifier != null) { >- provideds.addAll(component >- .realizedInterfaces(realizingClassifier)); >- } >- } >- >- for (Iterator ownedPorts = component.getOwnedPorts().iterator(); ownedPorts >- .hasNext();) { >- >- provideds.addAll(((InternalEList) ((Port) ownedPorts.next()) >- .getProvideds()).basicList()); >- } >- >- return new UnionEObjectEList((InternalEObject) component, >- UMLPackage.Literals.COMPONENT__PROVIDED, provideds.size(), >- provideds.toArray()); >- } >+ for (Iterator realizations = component.getRealizations().iterator(); realizations >+ .hasNext();) { >+ Classifier realizingClassifier = ((ComponentRealization) realizations >+ .next()).getRealizingClassifier(); >+ if (realizingClassifier != null) { >+ provideds.addAll(realizedInterfaces(component, >+ realizingClassifier, false)); >+ for (Iterator allParents = realizingClassifier.allParents() >+ .iterator(); allParents.hasNext();) { >+ provideds.addAll(realizedInterfaces(component, >+ (Classifier) allParents.next(), false)); >+ } >+ } >+ } >+ for (Iterator ownedPorts = component.getOwnedPorts().iterator(); ownedPorts >+ .hasNext();) { >+ provideds.addAll(((InternalEList) ((Port) ownedPorts.next()) >+ .getProvideds()).basicList()); >+ } >+ return new UnionEObjectEList((InternalEObject) component, >+ UMLPackage.Literals.COMPONENT__PROVIDED, provideds.size(), >+ provideds.toArray()); >+ } >+ >+ protected static EList getAllProvideds(Component component) { >+ EList directlyProvidedInterfaces = new UniqueEList.FastCompare( >+ component.getProvideds()); >+ >+ for (Iterator allComponentParents = component.allParents().iterator(); allComponentParents >+ .hasNext();) { >+ Classifier parent = (Classifier) allComponentParents.next(); >+ if (parent instanceof Component) { >+ directlyProvidedInterfaces.addAll(((Component) parent) >+ .getProvideds()); >+ } else if (parent instanceof BehavioredClassifier) { >+ directlyProvidedInterfaces >+ .addAll(((BehavioredClassifier) parent) >+ .getImplementedInterfaces()); >+ } >+ } >+ return ECollections.unmodifiableEList(directlyProvidedInterfaces); >+ } >+ >+ protected static EList getAllRequireds(Component component) { >+ EList directlyRequiredInterfaces = new UniqueEList.FastCompare( >+ component.getRequireds()); >+ >+ for (Iterator allComponentParents = component.allParents().iterator(); allComponentParents >+ .hasNext();) { >+ Classifier parent = (Classifier) allComponentParents.next(); >+ if (parent instanceof Component) { >+ directlyRequiredInterfaces.addAll(((Component) parent) >+ .getRequireds()); >+ } else { >+ directlyRequiredInterfaces.addAll(parent.getUsedInterfaces()); >+ } >+ } >+ return ECollections.unmodifiableEList(directlyRequiredInterfaces); >+ } > >-} // ComponentOperations >\ No newline at end of file >+} // ComponentOperations >Index: src/org/eclipse/uml2/uml/internal/operations/ConnectableElementOperations.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ConnectableElementOperations.java,v >retrieving revision 1.1 >diff -u -r1.1 ConnectableElementOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/ConnectableElementOperations.java 28 Mar 2006 18:26:14 -0000 1.1 >+++ src/org/eclipse/uml2/uml/internal/operations/ConnectableElementOperations.java 19 Sep 2006 15:52:43 -0000 >@@ -12,12 +12,12 @@ > */ > package org.eclipse.uml2.uml.internal.operations; > >-import java.util.Collection; > import java.util.Iterator; > > import org.eclipse.emf.common.util.ECollections; > import org.eclipse.emf.common.util.EList; > import org.eclipse.emf.common.util.UniqueEList; >+import org.eclipse.emf.ecore.EObject; > import org.eclipse.uml2.uml.BehavioredClassifier; > import org.eclipse.uml2.uml.Classifier; > import org.eclipse.uml2.uml.Component; >@@ -40,69 +40,62 @@ > protected static EList getRequiredInterfaces( > ConnectableElement connectableElement) { > >- if (connectableElement instanceof Port) { >- Collection requireds = ((Port) connectableElement).getRequireds(); >- EList requiredInterfaces = new UniqueEList.FastCompare(requireds); >- >- for (Iterator r = requireds.iterator(); r.hasNext();) { >- ClassifierOperations.allParents((Interface) r.next(), >- requiredInterfaces); >- } >- >- return requiredInterfaces; >- } else if (connectableElement instanceof Property) { >- Type type = ((Property) connectableElement).getType(); >- >- if (type instanceof Component) { >- return ((Component) type).getRequireds(); >- } else if (type instanceof Classifier) { >- return ((Classifier) type).getAllUsedInterfaces(); >- } >- } >- >- return ECollections.EMPTY_ELIST; >- } >+ EList directlyRequiredInterfaces = new UniqueEList.FastCompare(); >+ if (connectableElement instanceof Port) { >+ directlyRequiredInterfaces.addAll(((Port) connectableElement) >+ .getRequireds()); >+ } else if (connectableElement instanceof Property) { >+ Type type = ((Property) connectableElement).getType(); >+ if (type instanceof Component) { >+ directlyRequiredInterfaces.addAll(ComponentOperations >+ .getAllRequireds((Component) type)); >+ } else if (type instanceof Classifier) { >+ directlyRequiredInterfaces.addAll(((Classifier) type) >+ .getAllUsedInterfaces()); >+ } >+ } >+ EList allRequiredInterfaces = new UniqueEList.FastCompare( >+ directlyRequiredInterfaces); >+ for (Iterator r = directlyRequiredInterfaces.iterator(); r.hasNext();) { >+ EObject requiredInterface = (EObject) r.next(); >+ if (requiredInterface instanceof Interface) { >+ ClassifierOperations.allParents((Interface) requiredInterface, >+ allRequiredInterfaces); >+ } >+ } >+ return ECollections.unmodifiableEList(allRequiredInterfaces); >+ } > >+ > protected static EList getProvidedInterfaces( > ConnectableElement connectableElement) { > >- if (connectableElement instanceof Port) { >- Collection provideds = ((Port) connectableElement).getProvideds(); >- EList providedInterfaces = new UniqueEList.FastCompare(provideds); >- >- for (Iterator p = provideds.iterator(); p.hasNext();) { >- ClassifierOperations.allParents((Interface) p.next(), >- providedInterfaces); >- } >- >- return providedInterfaces; >- } else if (connectableElement instanceof Property) { >- Type type = ((Property) connectableElement).getType(); >- >- if (type instanceof Component) { >- Collection provideds = ((Component) type).getProvideds(); >- EList providedInterfaces = new UniqueEList.FastCompare( >- provideds); >- >- for (Iterator p = provideds.iterator(); p.hasNext();) { >- ClassifierOperations.allParents((Interface) p.next(), >- providedInterfaces); >- } >- >- return providedInterfaces; >- } else if (type instanceof Interface) { >- EList providedInterfaces = new UniqueEList.FastCompare(); >- providedInterfaces.add(type); >- ClassifierOperations.allParents((Interface) type, >- providedInterfaces); >- return providedInterfaces; >- } else if (type instanceof BehavioredClassifier) { >- return ((BehavioredClassifier) type) >- .getAllImplementedInterfaces(); >- } >- } >+ EList directlyProvidedInterfaces = new UniqueEList.FastCompare(); >+ if (connectableElement instanceof Port) { >+ directlyProvidedInterfaces.addAll(((Port) connectableElement) >+ .getProvideds()); >+ } else if (connectableElement instanceof Property) { >+ Type type = ((Property) connectableElement).getType(); >+ >+ if (type instanceof Component) { >+ directlyProvidedInterfaces.addAll(ComponentOperations >+ .getAllProvideds((Component) type)); >+ } else if (type instanceof Interface) { >+ directlyProvidedInterfaces.add(type); >+ } else if (type instanceof BehavioredClassifier) { >+ directlyProvidedInterfaces.addAll(((BehavioredClassifier) type) >+ .getAllImplementedInterfaces()); >+ } >+ } >+ EList allProvidedInterfaces = new UniqueEList.FastCompare( >+ directlyProvidedInterfaces); >+ >+ for (Iterator r = directlyProvidedInterfaces.iterator(); r.hasNext();) { >+ ClassifierOperations.allParents((Interface) r.next(), >+ allProvidedInterfaces); >+ } >+ return ECollections.unmodifiableEList(allProvidedInterfaces); > >- return ECollections.EMPTY_ELIST; >- } >+ } > > } // ConnectableElementOperations
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
Kenn.Hussey
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 157715
: 50479