svn commit: r18615 - trunk/src/argouml-app: src/org/argouml/notation/providers src/org/argouml/notation/providers/java src/org/argouml/notation/providers/uml tests/org/argouml/notation/providers/uml

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2010-08-03 01:23:26-0700
New Revision: 18615

Modified:
   trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java
   trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java
   trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java
   trunk/src/argouml-app/src/org/argouml/notation/providers/java/AssociationEndNameNotationJava.java
   trunk/src/argouml-app/src/org/argouml/notation/providers/java/AttributeNotationJava.java
   trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ActionStateNotationUml.java
   trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
   trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AttributeNotationUml.java
   trunk/src/argouml-app/tests/org/argouml/notation/providers/uml/TestAttributeAndOperationNotationUml.java

Log:
A first step in the Notation subsystem modification: The Notationproviders are not singletons any more - there is one NotationProvider object per Fig (where it is used). 
See proposal by Bob on the dev list of 2010.07.16.

Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java?view=diff&pathrev=18615&r1=18614&r2=18615
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationEndNameNotation.java	2010-08-03 01:23:26-0700
@@ -1,6 +1,6 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 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
@@ -59,8 +59,13 @@
 
     /**
      * The constructor. 
+     *
+     * @param associationEnd the uml element
      */
-    protected AssociationEndNameNotation() {
+    public AssociationEndNameNotation(Object associationEnd) {
+        if (!Model.getFacade().isAAssociationEnd(associationEnd)) {
+            throw new IllegalArgumentException("This is not an AssociationEnd.");
+        }
     }
 
     /*

Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java?view=diff&pathrev=18615&r1=18614&r2=18615
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/AssociationNameNotation.java	2010-08-03 01:23:26-0700
@@ -1,6 +1,6 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 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
@@ -50,7 +50,7 @@
  * for the text shown above the association Fig.
  * Subclass this for all languages.
  *
- * @author [email protected]
+ * @author mvw
  */
 public abstract class AssociationNameNotation extends NotationProvider {
 

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=18615&r1=18614&r2=18615
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/AttributeNotation.java	2010-08-03 01:23:26-0700
@@ -1,6 +1,6 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 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
@@ -57,8 +57,12 @@
 
     /**
      * The constructor.
+     * @param attribute the UML element
      */
-    protected AttributeNotation() {
+    public AttributeNotation(Object attribute) {
+        if (!Model.getFacade().isAAttribute(attribute)) {
+            throw new IllegalArgumentException("This is not an Attribute.");
+        }
     }
 
     @Override

Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/java/AssociationEndNameNotationJava.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/java/AssociationEndNameNotationJava.java?view=diff&pathrev=18615&r1=18614&r2=18615
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/java/AssociationEndNameNotationJava.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/java/AssociationEndNameNotationJava.java	2010-08-03 01:23:26-0700
@@ -1,6 +1,6 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 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
@@ -47,28 +47,19 @@
 import org.argouml.notation.providers.uml.NotationUtilityUml;
 
 /**
- * The Java notation for an associationend name (i.e. the  role).
+ * The Java notation for an associationEnd name (i.e. the  role).
  * 
  * @author michiel
  */
 public class AssociationEndNameNotationJava extends AssociationEndNameNotation {
 
-    private static final AssociationEndNameNotationJava INSTANCE =
-		new AssociationEndNameNotationJava();
-	
-	/**
-	 * Create a new instance of AssociationEndNameNotationUml
-	 * @return the notation
-	 */
-    public static final AssociationEndNameNotationJava getInstance() {
-    	return INSTANCE;
-    }
-
     /**
      * The constructor.
+     * 
+     * @param associationEnd the UML element
      */
-    protected AssociationEndNameNotationJava() {
-        super();
+    public AssociationEndNameNotationJava(Object associationEnd) {
+        super(associationEnd);
     }
 
     /*

Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/java/AttributeNotationJava.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/java/AttributeNotationJava.java?view=diff&pathrev=18615&r1=18614&r2=18615
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/java/AttributeNotationJava.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/java/AttributeNotationJava.java	2010-08-03 01:23:26-0700
@@ -1,6 +1,6 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 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
@@ -52,19 +52,10 @@
 
     /**
      * The constructor.
+     * @param attribute the UML object
      */
-    protected AttributeNotationJava() {
-        super();
-    }
-
-    private static final AttributeNotationJava INSTANCE =
-        new AttributeNotationJava();
-
-    /**
-     * @return the singleton instance
-     */
-    public static final AttributeNotationJava getInstance() {
-        return INSTANCE;
+    public AttributeNotationJava(Object attribute) {
+        super(attribute);
     }
 
     /*

Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ActionStateNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ActionStateNotationUml.java?view=diff&pathrev=18615&r1=18614&r2=18615
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ActionStateNotationUml.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/ActionStateNotationUml.java	2010-08-03 01:23:26-0700
@@ -1,6 +1,6 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 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
@@ -46,7 +46,7 @@
 /**
  * The Notation for an ActionState.
  * 
- * @author [email protected]
+ * @author mvw
  */
 public class ActionStateNotationUml extends ActionStateNotation {
 

Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java?view=diff&pathrev=18615&r1=18614&r2=18615
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AssociationEndNameNotationUml.java	2010-08-03 01:23:26-0700
@@ -1,6 +1,6 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 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
@@ -60,25 +60,20 @@
  * There is no support for the interface specifier
  * (that maps to the "specification" of an AssociationEnd). <p>
  * 
- * TODO: This is the only notation (that I'm aware of) that requires state.
- * All others should become effectively singletons. - Bob.
+ * This is the only notation (that I'm aware of) that requires state.
+ * All others could become effectively singletons. - Bob.
+ * 
  * @author michiel
  */
 public class AssociationEndNameNotationUml extends AssociationEndNameNotation {
-
-    /**
-     * Create a new instance of AssociationEndNameNotationUml
-     * @return the notation
-     */
-    public static final AssociationEndNameNotationUml getInstance() {
-    	return new AssociationEndNameNotationUml();
-    }
 	
     /**
      * The constructor.
+     * 
+     * @param associationEnd the UML element
      */
-    protected AssociationEndNameNotationUml() {
-        super();
+    public AssociationEndNameNotationUml(Object associationEnd) {
+        super(associationEnd);
     }
 
     /*

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=18615&r1=18614&r2=18615
==============================================================================
--- 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	2010-08-03 01:23:26-0700
@@ -1,6 +1,6 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 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
@@ -70,23 +70,13 @@
      */
     private static final Logger LOG = 
         Logger.getLogger(AttributeNotationUml.class);
-
-    private static final AttributeNotationUml INSTANCE =
-            new AttributeNotationUml();
-    
-    /**
-     * @return the singleton
-     */
-    public static final AttributeNotationUml getInstance() {
-    	return INSTANCE;
-    }
     
     /**
      * The constructor.
+     * @param attribute the UML object
      */
-    protected AttributeNotationUml() {
-        super();
-        LOG.info("Creating AttributeNotationUml");
+    public AttributeNotationUml(Object attribute) {
+        super(attribute);
     }
 
     /*

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=18615&r1=18614&r2=18615
==============================================================================
--- 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	2010-08-03 01:23:26-0700
@@ -1,6 +1,6 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2009-2010 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
@@ -8,6 +8,7 @@
  *
  * Contributors:
  *    tfmorris
+ *    mvw
  *****************************************************************************
  *
  * Some portions of this file was previously release using the BSD License:
@@ -244,7 +245,7 @@
         Object attrType = project.getDefaultAttributeType();
         attr = Model.getCoreFactory().buildAttribute2(cl, attrType);       
 
-        AttributeNotationUml anu = new AttributeNotationUml(); 
+        AttributeNotationUml anu = new AttributeNotationUml(attr); 
         anu.parse(attr, ATTR14);
                 
         List attrs = Model.getFacade().getAttributes(cl);
@@ -726,7 +727,7 @@
         throws ParseException {
 
         if (Model.getFacade().isAAttribute(element)) {
-            AttributeNotationUml anu = new AttributeNotationUml(); 
+            AttributeNotationUml anu = new AttributeNotationUml(element); 
             anu.parseAttribute(text, element);
             assertTrue(text
                        + " gave wrong name: "
@@ -748,7 +749,7 @@
     private void checkType(Object feature, String text, String type)
         throws ParseException {
         if (Model.getFacade().isAAttribute(feature)) {
-            AttributeNotationUml anu = new AttributeNotationUml(); 
+            AttributeNotationUml anu = new AttributeNotationUml(feature); 
             anu.parseAttribute(text, feature);
             assertTrue(text + " gave wrong type: (null)",
                        Model.getFacade().getType(feature) != null);
@@ -832,7 +833,7 @@
     private void checkVisibility(Object feature, String text, String vis)
         throws ParseException {
         if (Model.getFacade().isAAttribute(feature)) {
-            AttributeNotationUml anu = new AttributeNotationUml(); 
+            AttributeNotationUml anu = new AttributeNotationUml(feature); 
             anu.parseAttribute(text, feature);
             assertTrue(text + " gave wrong visibility: (null)",
                        Model.getFacade().getVisibility(feature) != null);
@@ -864,7 +865,7 @@
 
         if (Model.getFacade().isAAttribute(feature)) {
             int i;
-            AttributeNotationUml anu = new AttributeNotationUml(); 
+            AttributeNotationUml anu = new AttributeNotationUml(feature);
             anu.parseAttribute(text, feature);
             for (i = 0; i + 1 < props.length; i += 2) {
                 if (props[i + 1] == null) {
@@ -912,7 +913,7 @@
                    Object mult)
         throws ParseException {
 
-        AttributeNotationUml anu = new AttributeNotationUml(); 
+        AttributeNotationUml anu = new AttributeNotationUml(attr); 
         anu.parseAttribute(text, attr);
         if (mult == null) {
             assertTrue(
@@ -945,7 +946,7 @@
                  boolean ex3) {
         if (Model.getFacade().isAAttribute(element)) {
             try {
-                AttributeNotationUml anu = new AttributeNotationUml(); 
+                AttributeNotationUml anu = new AttributeNotationUml(element);
                 anu.parseAttribute(text, element);
                 fail("didn't throw for " + text);
             } catch (ParseException pe) {
@@ -965,7 +966,7 @@
     private void checkValue(Object attr, String text, String val)
         throws ParseException {
 
-        AttributeNotationUml anu = new AttributeNotationUml(); 
+        AttributeNotationUml anu = new AttributeNotationUml(attr);
         anu.parseAttribute(text, attr);
         if (val == null) {
             assertTrue(
@@ -1006,7 +1007,7 @@
 
         NotationProvider np = null;
         if (Model.getFacade().isAAttribute(feature)) {
-            AttributeNotationUml anu = new AttributeNotationUml(); 
+            AttributeNotationUml anu = new AttributeNotationUml(feature);
             anu.parseAttribute(text, feature);
             np = anu;
         } else if (Model.getFacade().isAOperation(feature)) {
@@ -1043,7 +1044,10 @@
      * Test if help is correctly provided.
      */
     public void testGetHelpAttribute() {
-        AttributeNotationUml notation = new AttributeNotationUml();
+        Object attr;
+        attr = Model.getCoreFactory().createAttribute();
+        
+        AttributeNotationUml notation = new AttributeNotationUml(attr);
         String help = notation.getParsingHelp();
         assertTrue("No help at all given", help.length() > 0);
         assertTrue("Parsing help not conform for translation",

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2642236

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.