Author: mvw Date: 2011-04-20 06:55:00-0700 New Revision: 19264 Modified: trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AttributeNotationUml.java trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java trunk/src/argouml-app/src/org/argouml/notation/providers/uml/OperationNotationUml.java trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java
Log: Issue 4252 for Attributes and Operations: Support Derived elements notation. You can now enter a "/" in front of the notation of an attribute and a tagged value "derived" is created, according the standard. So far, checked for UML1.4 only. Still to do: all other ModelElements. Modified: trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties?view=diff&pathrev=19264&r1=19263&r2=19264 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties (original) +++ trunk/src/argouml-app/src/org/argouml/i18n/parsing.properties 2011-04-20 06:55:00-0700 @@ -1,13 +1,13 @@ # $Id$ #****************************************************************************** -# Copyright (c) 2009 Contributors - see below +# Copyright (c) 2009-2011 Contributors - see below # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html # # Contributors: -# mvw +# Michiel van der Wulp #****************************************************************************** # # Some portions of this file was previously release using the BSD License: @@ -58,13 +58,13 @@ # See http://en.wikipedia.org/wiki/Backus-Naur_form for syntax explanation. # parsing.help.attribute = Enter the attribute definition according: \ - [ "+" | "-" | "#" | "~" ] name [ "[" multiplicity "]" ] : type [= \ + ["/"] ["<<" stereo ">>"] [ "+" | "-" | "#" | "~" ] name [ "[" multiplicity "]" ] [ ":" type ] ["=" \ initial-value] ["{" property "}"] parsing.help.comment = Enter the comment text. \ Multiple lines are allowed. Press F2 to end. parsing.help.operation = Enter the operation definition according: \ - [ "+" | "-" | "#" | "~" ] [name] ["("parameter-list")"] \ - [":" return-type-expression] {property-string} + ["/"] ["<<" stereo ">>"] [ "+" | "-" | "#" | "~" ] [name] ["("parameter-list")"] \ + [":" return-type-expression] ["{" property "}"] parsing.help.fig-actionstate = Enter the action expression. parsing.help.fig-association-name = Enter the name of the association. parsing.help.fig-association-end-name = Enter the association role name according: \ Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java?view=diff&pathrev=19264&r1=19263&r2=19264 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java (original) +++ trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java 2011-04-20 06:55:00-0700 @@ -1,6 +1,6 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009-2010 Contributors - see below + * Copyright (c) 2009-2011 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -77,6 +77,10 @@ if (type != null) { addElementListener(type); } + // We also show tagged values (the / for derived) + for (Object uml : Model.getFacade().getTaggedValuesCollection(modelElement)) { + addElementListener(uml); + } } } @@ -84,6 +88,7 @@ public void updateListener(Object modelElement, PropertyChangeEvent pce) { if (pce.getSource() == modelElement && ("stereotype".equals(pce.getPropertyName()) + || ("taggedValue".equals(pce.getPropertyName())) || ("type".equals(pce.getPropertyName())))) { if (pce instanceof AddAssociationEvent) { addElementListener(pce.getNewValue()); Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AttributeNotationUml.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AttributeNotationUml.java?view=diff&pathrev=19264&r1=19263&r2=19264 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AttributeNotationUml.java (original) +++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AttributeNotationUml.java 2011-04-20 06:55:00-0700 @@ -1,13 +1,13 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009-2010 Contributors - see below + * Copyright (c) 2009-2011 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * mvw + * Michiel van der Wulp ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -51,6 +51,7 @@ import org.argouml.kernel.Project; import org.argouml.kernel.ProjectManager; import org.argouml.kernel.ProjectSettings; +import org.argouml.model.Facade; import org.argouml.model.InvalidElementException; import org.argouml.model.Model; import org.argouml.notation.NotationSettings; @@ -185,10 +186,12 @@ /** * Parse a line on the form:<pre> - * visibility name [: type-expression] [= initial-value] + * [/] visibility name [: type-expression] [= initial-value] * </pre> * * <ul> + * <li>The / for derived is optional but has to be the first non-white + * character. * <li>If only one of visibility and name is given, then it is assumed to * be the name and the visibility is left unchanged. * <li>Type and initial value can be given in any order. @@ -234,12 +237,21 @@ String type = null; StringBuilder value = null; String visibility = null; + boolean derived = false; boolean hasColon = false; boolean hasEq = false; int multindex = -1; MyTokenizer st; text = text.trim(); + /* Handle Derived: */ + if (text.length() > 0 && "/".indexOf(text.charAt(0)) >= 0) { + derived = true; + text = text.substring(1); + text = text.trim(); + } + + /* Handle Visibility: */ if (text.length() > 0 && NotationUtilityUml.VISIBILITYCHARS.indexOf(text.charAt(0)) >= 0) { @@ -432,6 +444,7 @@ } } + dealWithDerived(attribute, derived); dealWithVisibility(attribute, visibility); dealWithName(attribute, name); dealWithType(attribute, type); @@ -441,6 +454,10 @@ StereotypeUtility.dealWithStereotypes(attribute, stereotype, true); } + private void dealWithDerived(Object umlObject, boolean derived) { + NotationUtilityUml.setDerived(umlObject, derived); + } + private void dealWithProperties(Object attribute, List<String> properties) { if (properties != null) { NotationUtilityUml.setProperties(attribute, properties, @@ -531,6 +548,16 @@ boolean showVisibility, boolean showMultiplicity, boolean showTypes, boolean showInitialValues, boolean showProperties) { try { + String derived = ""; + Object tv = Model.getFacade().getTaggedValue(modelElement, + Facade.DERIVED_TAG); + if (tv != null) { + String tag = Model.getFacade().getValueOfTag(tv); + if ("true".equalsIgnoreCase(tag)) { + derived = "/"; + } + } + String stereo = NotationUtilityUml.generateStereotype(modelElement, useGuillemets); String name = Model.getFacade().getName(modelElement); @@ -543,6 +570,8 @@ } StringBuilder sb = new StringBuilder(20); + sb.append(derived); + if ((stereo != null) && (stereo.length() > 0)) { sb.append(stereo).append(" "); } Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java?view=diff&pathrev=19264&r1=19263&r2=19264 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java (original) +++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/NotationUtilityUml.java 2011-04-20 06:55:00-0700 @@ -1,6 +1,6 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009-2010 Contributors - see below + * Copyright (c) 2009-2011 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -51,6 +51,7 @@ import org.argouml.kernel.Project; import org.argouml.kernel.ProjectManager; import org.argouml.kernel.ProjectSettings; +import org.argouml.model.Facade; import org.argouml.model.Model; import org.argouml.uml.StereotypeUtility; import org.argouml.util.CustomSeparator; @@ -778,6 +779,51 @@ } } + /** + * Make the given UML object derived or not. The UML standard + * defines "derived" as a tagged value for any ModelElement. + * + * @param umlObject the UML ModelElement to be adapted (null is not + * allowed) + * @param derived boolean flag for derived according the UML standard + */ + static void setDerived(Object umlObject, boolean derived) { + /* This code was copied from ActionBooleanTaggedValue: */ + String tagName = Facade.DERIVED_TAG; + Object taggedValue = Model.getFacade().getTaggedValue(umlObject, tagName); + if (derived) { + if (taggedValue == null) { + /* This automatically pulls in a TagDefinition from the profile: */ + taggedValue = + Model.getExtensionMechanismsFactory().buildTaggedValue( + tagName, "true"); + /* We need to extend the ExtensionMechanismsFactory so that + * we can replace the above deprecated call with something like this: */ +// Model.getExtensionMechanismsFactory().buildTaggedValue( +// tagName, new String[] {"true"}, Model.getFacade().getRoot(umlObject)); + + Model.getExtensionMechanismsHelper().addTaggedValue( + umlObject, taggedValue); + } else { + /* The TV existed, but maybe it was not "true": */ + /* TODO: For UML2: Check if the type of the TV is String. */ + Model.getExtensionMechanismsHelper().setDataValues( + taggedValue, new String[] {"true"}); + } + } else { + if (taggedValue != null) { + /* There are 2 possibilities: either (1) we follow the traditional notation + * philosophy, and set the tagged value to false, or (2) we restore to + * the pristine situation and delete the taggedValue (whatever the + * value was). I chose the latter (mvw).*/ + /* This would be solution (1): + * Model.getExtensionMechanismsHelper().setDataValues( + * taggedValue, new String[] {"false"}); + */ + Model.getUmlFactory().delete(taggedValue); + } + } + } /** * Interface specifying the operation to take when a Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/OperationNotationUml.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/OperationNotationUml.java?view=diff&pathrev=19264&r1=19263&r2=19264 ============================================================================== --- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/OperationNotationUml.java (original) +++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/OperationNotationUml.java 2011-04-20 06:55:00-0700 @@ -1,13 +1,13 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009 Contributors - see below + * Copyright (c) 2009-2011 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * mvw + * Michiel van der Wulp ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -61,7 +61,7 @@ /** * The UML notation for an Operation or a Reception. * - * @author [email protected] + * @author mvw */ public class OperationNotationUml extends OperationNotation { @@ -173,13 +173,15 @@ /** * Parse a line of text and aligns the Operation to the specification * given. The line should be on the following form:<ul> - * <li> visibility name (parameter list) : return-type-expression + * <li> / visibility name (parameter list) : return-type-expression * {property-string} * </ul> * * All elements are optional and, if left unspecified, will preserve their * old values.<p> * + * The / for derived has to be the first non-white character. <p> + * * <em>Stereotypes</em> can be given between any element in the line on the * form: <<stereotype1,stereotype2,stereotype3>><p> * @@ -208,11 +210,19 @@ String token; String type = null; String visibility = null; + boolean derived = false; List<String> properties = null; int paramOffset = 0; s = s.trim(); + /* Handle Derived: */ + if (s.length() > 0 && "/".indexOf(s.charAt(0)) >= 0) { + derived = true; + s = s.substring(1); + s = s.trim(); + } + if (s.length() > 0 && NotationUtilityUml.VISIBILITYCHARS.indexOf(s.charAt(0)) >= 0) { @@ -318,6 +328,8 @@ throw pre; } + NotationUtilityUml.setDerived(op, derived); + if (parameterlist != null) { // parameterlist is guaranteed to contain at least "(" if (parameterlist.charAt(parameterlist.length() - 1) != ')') { Modified: trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java?view=diff&pathrev=19264&r1=19263&r2=19264 ============================================================================== --- trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java (original) +++ trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java 2011-04-20 06:55:00-0700 @@ -1,14 +1,14 @@ /* $Id$ ***************************************************************************** - * Copyright (c) 2009-2010 Contributors - see below + * Copyright (c) 2009-2011 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * tfmorris - * mvw + * Tom Morris + * Michiel van der Wulp ***************************************************************************** * * Some portions of this file was previously release using the BSD License: @@ -49,6 +49,9 @@ import org.argouml.kernel.Project; import org.argouml.kernel.ProjectManager; +import org.argouml.model.ExtensionMechanismsFactory; +import org.argouml.model.ExtensionMechanismsHelper; +import org.argouml.model.Facade; import org.argouml.model.InitializeModel; import org.argouml.model.Model; import org.argouml.notation.InitNotation; @@ -84,6 +87,12 @@ private static final String ATTR13 = "<<attrstereo1,attrstereo2>> +name : String = a[15]"; private static final String ATTR14 = "a : int; b : Foo"; + private static final String ATTR15 = " / name"; + private static final String ATTR16 = " /name"; + private static final String ATTR17 = "/-name : void"; + private static final String ATTR18 = + "/ private name {a=b, c = d } [0..*] : int = 15 {frozen}"; + private static final String ATTR19 = "x2 : Integer {frozen}"; private static final String NATTR01 = "too many string in an attribute"; private static final String NATTR02 = "+vis name"; @@ -98,6 +107,8 @@ private static final String NATTR11 = "(vis) name"; private static final String NATTR12 = "vis name : \"type\""; private static final String NATTR13 = "vis name : (type)"; + private static final String NATTR14 = + "private / name {a=b, c = d } [0..*] : int = 15 {frozen}"; private static final String OPER01 = "name()"; private static final String OPER02 = @@ -109,6 +120,8 @@ + "{leaf,query} : String"; private static final String OPER04 = "<<>> # name2()"; private static final String OPER05 = "<< opstereo1, opstereo2 >> name5()"; + private static final String OPER06 = "/name"; + private static final String OPER07 = "/<<stereo>>#name(a:Integer=1,b:String):Boolean{query, x=1,y=2,z}"; private static final String NOPER01 = "name("; private static final String NOPER02 = "\"name\"()"; @@ -195,6 +208,21 @@ Model.getCoreHelper().setNamespace(attr, model); checkName(attr, ATTR06, "name"); + + attr = Model.getCoreFactory().buildAttribute2(attrType); + Model.getCoreHelper().setNamespace(attr, model); + + checkName(attr, ATTR15, "name"); + + attr = Model.getCoreFactory().buildAttribute2(attrType); + Model.getCoreHelper().setNamespace(attr, model); + + checkName(attr, ATTR16, "name"); + + attr = Model.getCoreFactory().buildAttribute2(attrType); + Model.getCoreHelper().setNamespace(attr, model); + + checkName(attr, ATTR17, "name"); } @@ -227,6 +255,11 @@ Model.getCoreHelper().setNamespace(attr, model); checkType(attr, ATTR06, "int"); + + attr = Model.getCoreFactory().buildAttribute2(attrType); + Model.getCoreHelper().setNamespace(attr, model); + + checkType(attr, ATTR17, "void"); } /** @@ -310,6 +343,11 @@ Model.getCoreHelper().setNamespace(attr, model); checkVisibility(attr, ATTR11, "public"); + + attr = Model.getCoreFactory().buildAttribute2(attrType); + Model.getCoreHelper().setNamespace(attr, model); + + checkVisibility(attr, ATTR17, "private"); } /** @@ -376,6 +414,65 @@ } /** + * Test the parsing of derived for an attribute. + * + * @throws ParseException if the parsing fails. + */ + public void testAttributeDerived() + throws ParseException { + Object attr; + Object tv; + Object attrType = project.getDefaultAttributeType(); + ExtensionMechanismsFactory emFactory = + Model.getExtensionMechanismsFactory(); + ExtensionMechanismsHelper emHelper = + Model.getExtensionMechanismsHelper(); + Object stereo = emFactory.buildStereotype("mystereo", model); + + attr = Model.getCoreFactory().buildAttribute2(attrType); + Model.getCoreHelper().setNamespace(attr, model); + + checkDerived(attr, ATTR15, true); + checkDerived(attr, ATTR01, false); + checkDerived(attr, ATTR15, true); + + attr = Model.getCoreFactory().buildAttribute2(attrType); + Model.getCoreHelper().setNamespace(attr, model); + + checkDerived(attr, ATTR16, true); + + attr = Model.getCoreFactory().buildAttribute2(attrType); + Model.getCoreHelper().setNamespace(attr, model); + + checkDerived(attr, ATTR17, true); + + attr = Model.getCoreFactory().buildAttribute2(attrType); + Model.getCoreHelper().setNamespace(attr, model); + + checkDerived(attr, ATTR18, true); + + attr = Model.getCoreFactory().buildAttribute2(attrType); + Model.getCoreHelper().setNamespace(attr, model); + + checkDerived(attr, ATTR19, false); + + Object td = emFactory.buildTagDefinition( + Facade.DERIVED_TAG, stereo, null); + + tv = emFactory.buildTaggedValue(td, + new String[] {"true"}); + emHelper.addTaggedValue(attr, tv); + + checkDerived(attr, ATTR19, false); + + tv = emFactory.buildTaggedValue(td, + new String[] {"false"}); + emHelper.addTaggedValue(attr, tv); + + checkDerived(attr, ATTR15, true); + } + + /** * Test that the parser throws the correct exceptions. */ public void testAttributeParseExceptions() { @@ -399,6 +496,7 @@ checkThrows(attr, NATTR11, true); checkThrows(attr, NATTR12, true); checkThrows(attr, NATTR13, true); + checkThrows(attr, NATTR14, true); } /** @@ -527,6 +625,12 @@ op = Model.getCoreFactory().buildOperation(cl, returnType); checkName(op, OPER03, "name2"); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkName(op, OPER06, "name"); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkName(op, OPER07, "name"); } /** @@ -552,6 +656,9 @@ op = Model.getCoreFactory().buildOperation(cl, returnType); checkType(op, OPER03, "String"); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkType(op, OPER07, "Boolean"); } /** @@ -581,6 +688,9 @@ op = Model.getCoreFactory().buildOperation(cl, returnType); checkVisibility(op, OPER04, "protected"); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkVisibility(op, OPER07, "protected"); } /** @@ -611,7 +721,11 @@ "String", "\"\"some\"\"", }; - + String[] res4 = { + "in", "a", "Integer", "1", + "in", "b", "String", null, + }; + op = Model.getCoreFactory().buildOperation(cl, returnType); checkParameters(op, OPER01, res1); @@ -622,6 +736,9 @@ checkParameters(op, OPER03, res3); checkParameters(op, OPER01, res1); checkParameters(op, OPER02, res2); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkParameters(op, OPER07, res4); } /** @@ -645,7 +762,23 @@ "query", null, "root", null, "sequential", null, + "derived", null, }; + + String[] res7 = { + "abstract", null, + "concurrency", null, + "concurrent", null, + "guarded", null, + "leaf", null, + "query", null, + "root", null, + "sequential", null, + "derived", "true", + "x", "1", + "y", "2", + "z", "", + }; op = Model.getCoreFactory().buildOperation(cl, returnType); checkProperties(op, OPER01, res1); @@ -655,6 +788,70 @@ op = Model.getCoreFactory().buildOperation(cl, returnType); checkProperties(op, OPER03, res1); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkProperties(op, OPER07, res7); + } + /** + * Test the parsing of derived for an operation. + * + * @throws ParseException if the parsing fails. + */ + public void testOperationDerived() + throws ParseException { + Object tv; + Object op; + Object returnType = project.getDefaultReturnType(); + Object cl = Model.getCoreFactory().buildClass(); + ExtensionMechanismsFactory emFactory = + Model.getExtensionMechanismsFactory(); + ExtensionMechanismsHelper emHelper = + Model.getExtensionMechanismsHelper(); + + Model.getCoreHelper().setNamespace(cl, model); + Object stereo = emFactory.buildStereotype("mystereo", model); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkDerived(op, OPER01, false); + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkDerived(op, OPER02, false); + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkDerived(op, OPER03, false); + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkDerived(op, OPER04, false); + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkDerived(op, OPER05, false); + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkDerived(op, OPER06, true); + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkDerived(op, OPER07, true); + + Object td = emFactory.buildTagDefinition( + Facade.DERIVED_TAG, stereo, null); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + tv = emFactory.buildTaggedValue(td, + new String[] {"true"}); + emHelper.addTaggedValue(op, tv); + checkDerived(op, OPER01, false); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + tv = emFactory.buildTaggedValue(td, + new String[] {"false"}); + emHelper.addTaggedValue(op, tv); + checkDerived(op, OPER06, true); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + tv = emFactory.buildTaggedValue(td, + new String[] {"foo"}); + emHelper.addTaggedValue(op, tv); + checkDerived(op, OPER01, false); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + tv = emFactory.buildTaggedValue(td, + new String[] {"bar"}); + emHelper.addTaggedValue(op, tv); + checkDerived(op, OPER06, true); } /** @@ -686,6 +883,9 @@ checkStereotype(op, OPER03, new String [] {"opstereo2"}); checkStereotype(op, OPER04, new String[] {}); checkStereotype(op, OPER05, new String [] {"opstereo1", "opstereo2"}); + + op = Model.getCoreFactory().buildOperation(cl, returnType); + checkStereotype(op, OPER07, new String[] {"stereo"}); } /** @@ -895,6 +1095,8 @@ } else { Object tv = Model.getFacade().getTaggedValue(feature, props[i]); + assertTrue("TaggedValue " + props[i] + " does not exist!", + tv != null); Object tvValue = Model.getFacade().getValueOfTag(tv); assertTrue( "TaggedValue " + props[i] + " wrong!", @@ -922,6 +1124,41 @@ (lower == l && upper == u)); } + + private void checkDerived( + Object feature, + String text, + boolean derived) + throws ParseException { + + if (Model.getFacade().isAAttribute(feature)) { + AttributeNotationUml anu = new AttributeNotationUml(feature); + anu.parseAttribute(text, feature); + } else if (Model.getFacade().isAOperation(feature)) { + OperationNotationUml onu = new OperationNotationUml(feature); + onu.parseOperation(text, feature); + } + + Object tv = + Model.getFacade().getTaggedValue(feature, Facade.DERIVED_TAG); + if (derived) { + assertTrue( + "TaggedValue " + Facade.DERIVED_TAG + " does not exist!", + tv != null); + String tvValue = Model.getFacade().getValueOfTag(tv); + assertTrue( + "TaggedValue " + Facade.DERIVED_TAG + " wrong!", + "true".equalsIgnoreCase(tvValue)); + } else { + if (tv != null) { + String tvValue = Model.getFacade().getValueOfTag(tv); + assertFalse( + "TaggedValue " + Facade.DERIVED_TAG + " wrong!", + "true".equalsIgnoreCase(tvValue)); + } + } + } + private void checkThrows( Object element, ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2721815 To unsubscribe from this discussion, e-mail: [[email protected]].
