svn commit: r13263 - branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: b00__1
Date: 2007-08-07 07:18:24-0700
New Revision: 13263
Modified:
branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
Log:
Implemented getAssocationEnds()
Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java?view=diff&rev=13263&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java&r1=13262&r2=13263
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java (original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java 2007-08-07 07:18:24-0700
@@ -215,15 +215,21 @@
}
public Collection getAssociationEnds(Object handle) {
- // TODO: Do we want near end, far end, or both here? - tfm
- // We'll just return them all for now
- Collection<Association> associations =
- ((Classifier) handle).getAssociations();
- Collection<Property> ends = new ArrayList<Property>();
- for (Association assoc : associations) {
- ends.addAll(assoc.getMemberEnds());
+ if (!(handle instanceof Classifier)) {
+ throw new IllegalArgumentException(
+ "handle must be instance of Classifier"); //$NON-NLS-1$
+ }
+ // CoreHelper#getAssociateEnds specifies that the opposite association
+ // ends should be returned
+ Collection result = new ArrayList();
+ for (Association a : ((Classifier) handle).getAssociations()) {
+ for (Property p : a.getMemberEnds()) {
+ if (p.getType() == handle) {
+ result.add(p);
+ }
+ }
}
- return ends;
+ return result;
}
public Collection getAssociationRoles(Object handle) {