svn commit: r15369 - branches/gsoc2008/work_issue5042_maurelio1234: src/org/argouml/profile/internal/ocl src/org/argouml/profile/internal/ocl/uml14 tests/org/argouml/profile/internal/ocl

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2008-07-25 02:55:55-0700
New Revision: 15369

Added:
   branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
   branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/OclExpressionEvaluator.java
   branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestDefaultOclEvaluator.java
Modified:
   branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateExpression.java
   branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/CollectionsModelInterpreter.java
   branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestCrOCL2.java

Log:
testing ocl implementation

Added: branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java?view=auto&rev=15369
==============================================================================
--- (empty file)
+++ branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java	2008-07-25 02:55:55-0700
@@ -0,0 +1,76 @@
+// $Id: eclipse-argo-codetemplates.xml 11347 2006-10-26 22:37:44Z linus $
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.profile.internal.ocl;
+
+import java.io.PushbackReader;
+import java.io.StringReader;
+import java.util.HashMap;
+
+import tudresden.ocl.parser.OclParser;
+import tudresden.ocl.parser.lexer.Lexer;
+import tudresden.ocl.parser.node.Start;
+
+/**
+ * Evaluates ocl expressions
+ *
+ * @author maurelio
+ */
+public class DefaultOclEvaluator implements OclExpressionEvaluator {
+
+    private static OclExpressionEvaluator instance = null;
+    
+    /**
+     * @return unique instance
+     */
+    public static OclExpressionEvaluator getInstance() {
+        if (instance == null) {
+            instance = new DefaultOclEvaluator();
+        }
+        return instance;
+    }
+    /**
+     * @throws InvalidOclException 
+     * @see org.argouml.profile.internal.ocl.OclExpressionEvaluator#evaluate(java.util.HashMap, org.argouml.profile.internal.ocl.ModelInterpreter, java.lang.String)
+     */
+    public Object evaluate(HashMap<String, Object> vt, ModelInterpreter mi,
+            String ocl) throws InvalidOclException {
+        // XXX this seems to be a bug of the parser, 
+        // it always requires a context
+        Lexer lexer = new Lexer(new PushbackReader(new StringReader("context X inv: " + ocl), 2));
+        OclParser parser = new OclParser(lexer);
+        Start tree = null;
+        
+        try {
+            tree = parser.parse();
+        } catch (Exception e) {
+            throw new InvalidOclException("Invalid OCL!");
+        }
+        
+        EvaluateExpression ee = new EvaluateExpression(vt,mi);
+        tree.apply(ee);
+        return ee.getValue();
+    }
+
+}

Modified: branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateExpression.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateExpression.java?view=diff&rev=15369&p1=branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateExpression.java&p2=branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateExpression.java&r1=15368&r2=15369
==============================================================================
--- branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateExpression.java	(original)
+++ branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateExpression.java	2008-07-25 02:55:55-0700
@@ -24,10 +24,14 @@
 
 package org.argouml.profile.internal.ocl;
 
+import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Vector;
 
 import org.apache.log4j.Logger;
+import org.argouml.profile.internal.ocl.uml14.HashBag;
 
 import tudresden.ocl.parser.analysis.DepthFirstAdapter;
 import tudresden.ocl.parser.node.AActualParameterList;
@@ -39,6 +43,7 @@
 import tudresden.ocl.parser.node.AEmptyFeatureCallParameters;
 import tudresden.ocl.parser.node.AEnumLiteral;
 import tudresden.ocl.parser.node.AEqualRelationalOperator;
+import tudresden.ocl.parser.node.AExpressionListOrRange;
 import tudresden.ocl.parser.node.AFeatureCall;
 import tudresden.ocl.parser.node.AFeatureCallParameters;
 import tudresden.ocl.parser.node.AFeaturePrimaryExpression;
@@ -49,6 +54,7 @@
 import tudresden.ocl.parser.node.AIntegerLiteral;
 import tudresden.ocl.parser.node.AIterateDeclarator;
 import tudresden.ocl.parser.node.ALetExpression;
+import tudresden.ocl.parser.node.AListExpressionListOrRangeTail;
 import tudresden.ocl.parser.node.ALiteralCollection;
 import tudresden.ocl.parser.node.ALogicalExpressionTail;
 import tudresden.ocl.parser.node.ALtRelationalOperator;
@@ -71,6 +77,7 @@
 import tudresden.ocl.parser.node.PActualParameterListTail;
 import tudresden.ocl.parser.node.PDeclaratorTail;
 import tudresden.ocl.parser.node.PExpression;
+import tudresden.ocl.parser.node.PExpressionListTail;
 
 /**
  * Evaluates OCL expressions, this class should not depend on the model
@@ -106,7 +113,7 @@
      * The model interpreter
      */
     private ModelInterpreter interp = null;
-
+    
     /**
      * Constructor
      * 
@@ -118,18 +125,37 @@
     }
 
     /**
+     * Constructor
+     * 
+     * @param vt the variable table
+     * @param mi model interpreter
+     */
+    public EvaluateExpression(HashMap<String, Object> vt, ModelInterpreter mi) {
+        reset(vt, mi);
+    }
+    
+    /**
      * Resets the internal state of this adapter
      * 
      * @param mi the model interpreter
      * @param element the model element
      */
-    public void reset(Object element, ModelInterpreter mi) {
-        this.interp = mi;
-
-        val = null;
-        fwd = null;
+    public void reset(Object element, ModelInterpreter mi) {        
         vt = new HashMap<String, Object>();
         vt.put("self", element);
+        reset(vt, mi);
+    }
+
+    /**
+     * @param newVT the variable table
+     * @param mi the model interpreter
+     */
+    public void reset(HashMap<String, Object> newVT, ModelInterpreter mi) {
+        this.interp = mi;
+
+        this.val = null;
+        this.fwd = null;
+        this.vt = newVT;
     }
 
     /**
@@ -138,7 +164,7 @@
     public Object getValue() {
         return val;
     }
-
+    
     /** Interpreter Code * */
 
     /**
@@ -565,7 +591,8 @@
      * @see tudresden.ocl.parser.analysis.DepthFirstAdapter#outAStringLiteral(tudresden.ocl.parser.node.AStringLiteral)
      */
     public void outAStringLiteral(AStringLiteral node) {
-        val = node.getStringLit().getText();
+        String text = node.getStringLit().getText();
+        val = text.substring(1,text.length()-1); 
         defaultOut(node);
     }
 
@@ -602,15 +629,91 @@
         val = null;
         defaultOut(node);
     }
+    
+    /**
+     * @see tudresden.ocl.parser.analysis.DepthFirstAdapter#caseALiteralCollection(tudresden.ocl.parser.node.ALiteralCollection)
+     */
+    public void caseALiteralCollection(ALiteralCollection node)
+    {
+        Collection<Object> col = null;
+        
+        inALiteralCollection(node);
+        if(node.getCollectionKind() != null)
+        {
+            node.getCollectionKind().apply(this);
+            
+            String kind = node.getCollectionKind().toString();
+            if (kind.equalsIgnoreCase("Set")) {
+                col = new HashSet<Object>();
+            } else if (kind.equals("Sequence")) {
+                col = new ArrayList<Object>();
+            } else if (kind.equals("Bag")) {
+                col = new HashBag<Object>();                
+            }
+        }        
+        if(node.getLBrace() != null)
+        {
+            node.getLBrace().apply(this);
+        }
+        if(node.getExpressionListOrRange() != null)
+        {
+            val = null;
+            node.getExpressionListOrRange().apply(this);
+            col.addAll((Collection<Object>) val);
+        }
+        if(node.getRBrace() != null)
+        {
+            node.getRBrace().apply(this);
+        }
+        val = col;
+        outALiteralCollection(node);
+    }
 
     /**
-     * @see tudresden.ocl.parser.analysis.DepthFirstAdapter#outALiteralCollection(tudresden.ocl.parser.node.ALiteralCollection)
+     * @see tudresden.ocl.parser.analysis.DepthFirstAdapter#caseAExpressionListOrRange(tudresden.ocl.parser.node.AExpressionListOrRange)
      */
-    public void outALiteralCollection(ALiteralCollection node) {
-        // TODO support collections
-        val = new Vector<Object>();
-        defaultOut(node);
+    public void caseAExpressionListOrRange(AExpressionListOrRange node)
+    {
+        Vector<Object> ret = new Vector<Object>();
+        inAExpressionListOrRange(node);
+        if(node.getExpression() != null)
+        {
+            val = null;
+            node.getExpression().apply(this);     
+            ret.add(val);
+        }
+        if(node.getExpressionListOrRangeTail() != null)
+        {
+            val = null;
+            node.getExpressionListOrRangeTail().apply(this);
+            ret.addAll((Collection<? extends Object>) val);
+        }
+        val = ret;
+        outAExpressionListOrRange(node);
+    }
+
+    /**
+     * @see tudresden.ocl.parser.analysis.DepthFirstAdapter#caseAListExpressionListOrRangeTail(tudresden.ocl.parser.node.AListExpressionListOrRangeTail)
+     */
+    public void caseAListExpressionListOrRangeTail(AListExpressionListOrRangeTail node)
+    {
+        // TODO support other kinds of tail
+        
+        inAListExpressionListOrRangeTail(node);
+        {
+            Vector<Object> ret = new Vector<Object>();
+            Object temp[] = node.getExpressionListTail().toArray();
+            for(int i = 0; i < temp.length; i++)
+            {
+                val = null;
+                ((PExpressionListTail) temp[i]).apply(this);
+                ret.add(val);
+            }
+            val = ret;
+        }
+        outAListExpressionListOrRangeTail(node);
     }
+    
 
     /**
      * @see tudresden.ocl.parser.analysis.DepthFirstAdapter#caseAFeatureCall(tudresden.ocl.parser.node.AFeatureCall)

Added: branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/OclExpressionEvaluator.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/OclExpressionEvaluator.java?view=auto&rev=15369
==============================================================================
--- (empty file)
+++ branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/OclExpressionEvaluator.java	2008-07-25 02:55:55-0700
@@ -0,0 +1,47 @@
+// $Id: eclipse-argo-codetemplates.xml 11347 2006-10-26 22:37:44Z linus $
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.profile.internal.ocl;
+
+import java.util.HashMap;
+
+/**
+ * Represents a generic Ocl Expression Evaluator
+ *
+ * @author maurelio1234
+ */
+public interface OclExpressionEvaluator {
+    /**
+     * Interprets the given ocl expression under the given variable table
+     * and model interpreter
+     * 
+     * @param vt variable table
+     * @param mi model interpreter
+     * @param ocl ocl expression
+     * @return the return value
+     * @throws InvalidOclException if the ocl expression is not valid
+     */
+    Object evaluate(HashMap<String, Object> vt, ModelInterpreter mi, String ocl)
+        throws InvalidOclException;
+}

Modified: branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/CollectionsModelInterpreter.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/CollectionsModelInterpreter.java?view=diff&rev=15369&p1=branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/CollectionsModelInterpreter.java&p2=branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/CollectionsModelInterpreter.java&r1=15368&r2=15369
==============================================================================
--- branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/CollectionsModelInterpreter.java	(original)
+++ branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/CollectionsModelInterpreter.java	2008-07-25 02:55:55-0700
@@ -50,6 +50,15 @@
     @SuppressWarnings("unchecked")
     public Object invokeFeature(HashMap<String, Object> vt, Object subject,
             String feature, String type, Object[] parameters) {
+
+        if (!(subject instanceof Collection)) {
+            if (type.equals("->")) {
+                Set ns = new HashSet();
+                ns.add(subject);
+                subject = ns;
+            }
+        }
+        
         if (subject instanceof Collection) {
             if (type.equals("->")) {
                 if (feature.toString().trim().equals("select")) {
@@ -419,13 +428,6 @@
             }
         }
 
-        if (!(subject instanceof Collection)) {
-            if (type.equals("->")) {
-                Set ns = new HashSet();
-                ns.add(subject);
-                return ns;
-            }
-        }
         return null;
     }
 

Modified: branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestCrOCL2.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestCrOCL2.java?view=diff&rev=15369&p1=branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestCrOCL2.java&p2=branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestCrOCL2.java&r1=15368&r2=15369
==============================================================================
--- branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestCrOCL2.java	(original)
+++ branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestCrOCL2.java	2008-07-25 02:55:55-0700
@@ -45,17 +45,44 @@
     }
 
     /**
-     * Test collections operations in objects
+     * Test collections operations in objects (section ?)
      * 
      * @throws Exception if something goes wrong
      */
-    public void test6_5_4_2() throws Exception {
+    public void testObjectAsCollection() throws Exception {
         Object obj = Model.getUseCasesFactory().createActor();
 
-        CrOCL ocl = new CrOCL("context Actor inv: 2->size() = 1", null, null,
+        testOclOK(obj, "context Actor inv: 2->size() = 1");
+        testOclFails(obj, "context Actor inv: 2->size() = 0");
+    }
+
+    /**
+     * Test the self variable (section 8.3.1)
+     * 
+     * @throws Exception if something goes wrong
+     */
+    public void testSelf() throws Exception {
+        Object obj = Model.getUseCasesFactory().createActor();
+
+        Model.getCoreHelper().setName(obj, "actor1");
+        testOclOK(obj, "context Actor inv: self.name = 'actor1'");
+        testOclFails(obj, "context Actor inv: self.name.size() = 7");
+    }
+    
+    private void testOclOK(Object obj, String oclExp) throws InvalidOclException {
+        CrOCL ocl = new CrOCL(oclExp, null, null,
                 null, null, null, null);
 
         assertEquals(ocl.predicate2(obj, Designer.theDesigner()),
                 Critic.NO_PROBLEM);
     }
+
+    private void testOclFails(Object obj, String oclExp) throws InvalidOclException {
+        CrOCL ocl = new CrOCL(oclExp, null, null,
+                null, null, null, null);
+
+        assertEquals(ocl.predicate2(obj, Designer.theDesigner()),
+                Critic.PROBLEM_FOUND);
+    }
+
 }

Added: branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestDefaultOclEvaluator.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestDefaultOclEvaluator.java?view=auto&rev=15369
==============================================================================
--- (empty file)
+++ branches/gsoc2008/work_issue5042_maurelio1234/tests/org/argouml/profile/internal/ocl/TestDefaultOclEvaluator.java	2008-07-25 02:55:55-0700
@@ -0,0 +1,56 @@
+// $Id: eclipse-argo-codetemplates.xml 11347 2006-10-26 22:37:44Z linus $
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.profile.internal.ocl;
+
+import junit.framework.TestCase;
+
+import org.argouml.cognitive.Critic;
+import org.argouml.cognitive.Designer;
+import org.argouml.model.InitializeModel;
+import org.argouml.model.Model;
+
+/**
+ * Tests for the EvaluateExpression class.
+ * 
+ * @author maurelio1234
+ */
+public class TestDefaultOclEvaluator extends TestCase {
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        InitializeModel.initializeDefault();
+    }
+
+    /**
+     * Test the basic values and types (section 8.4)
+     * 
+     * @throws Exception if something goes wrong
+     */
+    public void testBasicValuesAndTypes() throws Exception {
+        assertEquals(DefaultOclEvaluator.getInstance()
+                .evaluate(null, null, "5"), 5);
+    }
+}
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.