svn commit: r13210 - branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CopyHelperEUMLImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: b00__1
Date: 2007-08-03 01:54:49-0700
New Revision: 13210

Modified:
   branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CopyHelperEUMLImpl.java

Log:
Implemented the copy() method

Modified: branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CopyHelperEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CopyHelperEUMLImpl.java?view=diff&rev=13210&p1=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CopyHelperEUMLImpl.java&p2=branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CopyHelperEUMLImpl.java&r1=13209&r2=13210
==============================================================================
--- branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CopyHelperEUMLImpl.java	(original)
+++ branches/gsoc2007/b00__1/model-euml/src/org/argouml/model/euml/CopyHelperEUMLImpl.java	2007-08-03 01:54:49-0700
@@ -27,6 +27,7 @@
 package org.argouml.model.euml;
 
 import org.argouml.model.CopyHelper;
+import org.eclipse.uml2.uml.Element;
 
 /**
  * The implementation of the CopyHelper for EUML2.
@@ -40,17 +41,26 @@
 
     /**
      * Constructor.
-     *
-     * @param implementation The ModelImplementation.
+     * 
+     * @param implementation
+     *                The ModelImplementation.
      */
     public CopyHelperEUMLImpl(EUMLModelImplementation implementation) {
         modelImpl = implementation;
     }
 
-    public Object copy(Object source, Object destination) {
-        // TODO Auto-generated method stub
-        return null;
+    public Element copy(Object source, Object destination) {
+        if (!(source instanceof Element) || !(destination instanceof Element)) {
+            throw new IllegalArgumentException(
+                    "The source and destination must be instances of Element"); //$NON-NLS-1$
+        }
+        Element copiedElement = UMLUtil.copy(
+                modelImpl, (Element) source, (Element) destination);
+        if (copiedElement == null) {
+            throw new UnsupportedOperationException(
+                    "Could not copy " + source + " to destination " + destination); //$NON-NLS-1$//$NON-NLS-2$
+        }
+        return copiedElement;
     }
 
-
 }
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.