Author: thn Date: 2010-06-10 01:22:02-0700 New Revision: 18439 Modified: trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
Log: UML2: an implementation for getConstraints(Object handle) Modified: trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java?view=diff&pathrev=18439&r1=18438&r2=18439 ============================================================================== --- trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java (original) +++ trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java 2010-06-10 01:22:02-0700 @@ -540,7 +540,20 @@ } public Collection getConstraints(Object handle) { - throw new NotYetImplementedException(); + if (!(handle instanceof Element)) { + throw new IllegalArgumentException( + "handle must be instance of Element"); //$NON-NLS-1$ + } + ArrayList<Constraint> result = new ArrayList<Constraint>(); + Namespace ns = ((Element) handle).getNearestPackage(); + if (ns != null) { + for (Constraint c : ns.getOwnedRules()) { + if (c.getConstrainedElements().contains(handle)) { + result.add(c); + } + } + } + return result; } public Object getContainer(Object handle) { ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2619142 To unsubscribe from this discussion, e-mail: [[email protected]].
