Tag from trunk representing most of the 1.2.1 release (post-merge), but includes the svn build map for babel
git-svn-id: http://dev.eclipse.org/svnroot/technology/org.eclipse.stem/tags/STEM_1_2_1_FOR_BABEL@2408 92a21009-5b66-0410-b83a-dc787c41c6e9
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/.classpath b/analysis/org.eclipse.stem.analysis.automaticexperiment/.classpath
new file mode 100644
index 0000000..304e861
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/.project b/analysis/org.eclipse.stem.analysis.automaticexperiment/.project
new file mode 100644
index 0000000..31a21f4
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.stem.analysis.automaticexperiment</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/META-INF/MANIFEST.MF b/analysis/org.eclipse.stem.analysis.automaticexperiment/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..bd6c050
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.stem.analysis.automaticexperiment;singleton:=true
+Bundle-Version: 1.2.1
+Bundle-Activator: org.eclipse.stem.analysis.automaticexperiment.Activator
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.stem.core,
+ org.eclipse.stem.analysis,
+ org.eclipse.stem.diseasemodels,
+ org.eclipse.stem.util.loggers,
+ org.eclipse.stem.ui,
+ org.eclipse.stem.analysis,
+ org.eclipse.ui.navigator.resources
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: .
+Import-Package: org.eclipse.emf.ecore.provider
+Export-Package: org.eclipse.stem.analysis.automaticexperiment,
+ org.eclipse.stem.analysis.automaticexperiment,
+ org.eclipse.stem.analysis.automaticexperiment.views
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/build.properties b/analysis/org.eclipse.stem.analysis.automaticexperiment/build.properties
new file mode 100644
index 0000000..f2684c5
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/build.properties
@@ -0,0 +1,12 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ epl-v10.html,\
+ notice.html,\
+ plugin_zh.properties,\
+ plugin_kr.properties,\
+ plugin_de.properties
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/epl-v10.html b/analysis/org.eclipse.stem.analysis.automaticexperiment/epl-v10.html
new file mode 100644
index 0000000..ed4b196
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/ctool16/CreateAutomaticExperiment_errorFunc_ErrorFunction.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/ctool16/CreateAutomaticExperiment_errorFunc_ErrorFunction.gif
new file mode 100644
index 0000000..7be6ec4
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/ctool16/CreateAutomaticExperiment_errorFunc_ErrorFunction.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/ctool16/CreateAutomaticExperiment_errorFunc_SimpleErrorFunction.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/ctool16/CreateAutomaticExperiment_errorFunc_SimpleErrorFunction.gif
new file mode 100644
index 0000000..d63245c
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/ctool16/CreateAutomaticExperiment_errorFunc_SimpleErrorFunction.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/ctool16/CreateAutomaticExperiment_errorFunc_ThresholdErrorFunction.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/ctool16/CreateAutomaticExperiment_errorFunc_ThresholdErrorFunction.gif
new file mode 100644
index 0000000..9a3eff9
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/ctool16/CreateAutomaticExperiment_errorFunc_ThresholdErrorFunction.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/customobj16/AutomaticExperiment.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/customobj16/AutomaticExperiment.gif
new file mode 100644
index 0000000..87fc678
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/customobj16/AutomaticExperiment.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/customobj16/AutomaticexperimentModelFile.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/customobj16/AutomaticexperimentModelFile.gif
new file mode 100755
index 0000000..d721ef0
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/customobj16/AutomaticexperimentModelFile.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/Algorithm.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/Algorithm.gif
new file mode 100644
index 0000000..a26660e
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/Algorithm.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/AnalysisModelFile.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/AnalysisModelFile.gif
new file mode 100644
index 0000000..4ef24bd
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/AnalysisModelFile.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/AutomaticExperiment.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/AutomaticExperiment.gif
new file mode 100644
index 0000000..87fc678
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/AutomaticExperiment.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/AutomaticexperimentModelFile.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/AutomaticexperimentModelFile.gif
new file mode 100644
index 0000000..d721ef0
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/AutomaticexperimentModelFile.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ErrorFunction.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ErrorFunction.gif
new file mode 100644
index 0000000..badaab0
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ErrorFunction.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ErrorResult.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ErrorResult.gif
new file mode 100644
index 0000000..98b351f
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ErrorResult.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ModifiableParameter.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ModifiableParameter.gif
new file mode 100644
index 0000000..45731fe
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ModifiableParameter.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/OptimizerAlgorithm.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/OptimizerAlgorithm.gif
new file mode 100644
index 0000000..ed87474
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/OptimizerAlgorithm.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ReferenceScenarioDataMap.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ReferenceScenarioDataMap.gif
new file mode 100644
index 0000000..ed87474
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ReferenceScenarioDataMap.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/SimpleErrorFunction.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/SimpleErrorFunction.gif
new file mode 100644
index 0000000..2124f3e
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/SimpleErrorFunction.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ThresholdErrorFunction.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ThresholdErrorFunction.gif
new file mode 100644
index 0000000..498364f
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/obj16/ThresholdErrorFunction.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/wizban/NewAnalysis.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/wizban/NewAnalysis.gif
new file mode 100644
index 0000000..440f369
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/wizban/NewAnalysis.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/wizban/NewAutomaticexperiment.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/wizban/NewAutomaticexperiment.gif
new file mode 100644
index 0000000..87fc678
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/full/wizban/NewAutomaticexperiment.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/sample.gif b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/sample.gif
new file mode 100644
index 0000000..34fb3c9
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/icons/sample.gif
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/model/automaticexperience.genmodel b/analysis/org.eclipse.stem.analysis.automaticexperiment/model/automaticexperience.genmodel
new file mode 100644
index 0000000..d0787c2
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/model/automaticexperience.genmodel
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.stem.analysis.automaticexperiment/src"
+ editDirectory="/org.eclipse.stem.analysis.automaticexperiment/src" editorDirectory="/org.eclipse.stem.analysis.automaticexperiment/src"
+ modelPluginID="org.eclipse.stem.analysis.automaticexperiment" modelName="Automaticexperience"
+ importerID="org.eclipse.emf.importer.ecore" complianceLevel="6.0" copyrightFields="false"
+ usedGenPackages="../../org.eclipse.stem.analysis/model/analysis.genmodel#//analysis ../../org.eclipse.stem.core/model/core.genmodel#//common ../../org.eclipse.stem.core/model/core.genmodel#//graph ../../org.eclipse.stem.core/model/core.genmodel#//model ../../org.eclipse.stem.core/model/core.genmodel#//modifier ../../org.eclipse.stem.core/model/core.genmodel#//scenario ../../org.eclipse.stem.core/model/core.genmodel#//sequencer ../../org.eclipse.stem.core/model/core.genmodel#//solver platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
+ <foreignModel>automaticexperiment.ecore</foreignModel>
+ <genPackages prefix="Automaticexperiment" basePackage="org.eclipse.stem.analysis"
+ disposableProviderFactory="true" generateExampleClass="false" multipleEditorPages="false"
+ generateModelWizard="false" ecorePackage="automaticexperiment.ecore#/">
+ <genClasses ecoreClass="automaticexperiment.ecore#//AutomaticExperiment">
+ <genFeatures notify="false" children="true" createChild="false" propertySortChoices="true"
+ ecoreFeature="ecore:EReference automaticexperiment.ecore#//AutomaticExperiment/baseScenario"/>
+ <genFeatures notify="false" children="true" createChild="false" propertyCategory=""
+ propertySortChoices="true" ecoreFeature="ecore:EReference automaticexperiment.ecore#//AutomaticExperiment/parameters"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//AutomaticExperiment/errorAnalysisAlgorithm"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//AutomaticExperiment/errorFunction"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//AutomaticExperiment/tolerance"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//AutomaticExperiment/referanceDataDir"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//AutomaticExperiment/maximumNumberOfIterations"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//AutomaticExperiment/reInit"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference automaticexperiment.ecore#//AutomaticExperiment/errorFunc"/>
+ </genClasses>
+ <genClasses ecoreClass="automaticexperiment.ecore#//ModifiableParameter">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//ModifiableParameter/initialValue"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference automaticexperiment.ecore#//ModifiableParameter/feature"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//ModifiableParameter/step"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//ModifiableParameter/featureName"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//ModifiableParameter/lowerBound"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//ModifiableParameter/upperBound"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute automaticexperiment.ecore#//ModifiableParameter/targetURI"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/model/automaticexperiment.ecore b/analysis/org.eclipse.stem.analysis.automaticexperiment/model/automaticexperiment.ecore
new file mode 100644
index 0000000..83c3048
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/model/automaticexperiment.ecore
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="automaticexperiment"
+ nsURI="http:///org/eclipse/stem/core/automaticexperiment.ecore" nsPrefix="org.eclipse.stem.analysis.automaticexperiment">
+ <eClassifiers xsi:type="ecore:EClass" name="AutomaticExperiment" eSuperTypes="#//OptimizerAlgorithm">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="baseScenario" lowerBound="1"
+ eType="ecore:EClass ../../org.eclipse.stem.core/model/scenario.ecore#//Scenario"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="parameters" lowerBound="1"
+ upperBound="-1" eType="#//ModifiableParameter" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="errorAnalysisAlgorithm"
+ lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="errorFunction" lowerBound="1"
+ eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="tolerance" lowerBound="1"
+ eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDouble"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="referanceDataDir" lowerBound="1"
+ eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="maximumNumberOfIterations"
+ lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ELong"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="reInit" lowerBound="1"
+ eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="errorFunc" lowerBound="1"
+ eType="ecore:EClass ../../org.eclipse.stem.analysis/model/analysis.ecore#//ErrorFunction"
+ containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="ModifiableParameter">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="initialValue" lowerBound="1"
+ eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDouble"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="feature" lowerBound="1"
+ eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EStructuralFeature"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="step" lowerBound="1" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDouble"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="featureName" lowerBound="1"
+ eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="lowerBound" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDouble"
+ defaultValueLiteral="-1"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="upperBound" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDouble"
+ defaultValueLiteral="-1"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="targetURI" eType="ecore:EDataType ../../org.eclipse.stem.core/model/common.ecore#//URI"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="OptimizerAlgorithm" eSuperTypes="../../org.eclipse.stem.core/model/common.ecore#//Identifiable"/>
+</ecore:EPackage>
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/notice.html b/analysis/org.eclipse.stem.analysis.automaticexperiment/notice.html
new file mode 100644
index 0000000..c6af966
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/notice.html
@@ -0,0 +1,79 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
+<title>Eclipse.org Software User Agreement</title>
+</head>
+
+<body lang="EN-US" link=blue vlink=purple>
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>March 17, 2005</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS
+ modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
+</body>
+</html>
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin.properties b/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin.properties
new file mode 100644
index 0000000..a8ab47f
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin.properties
Binary files differ
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin.xml b/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin.xml
new file mode 100644
index 0000000..9957ddf
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+ <extension-point id="algorithm" name="%EP_Algorithm" schema="schema/algorithm.exsd"/>
+
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.eclipse.stem.ui.wizards.stemcategory"
+ class="org.eclipse.stem.analysis.automaticexperiment.ui.NewAutomaticExperimentWizard"
+ icon="icons/full/customobj16/AutomaticExperiment.gif"
+ id="org.eclipse.stem.ui.wizards.newautoexperiment"
+ name="Automatic Experiment">
+ </wizard>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar
+ id="org.eclipse.stem.ui.toolbar.newwizards">
+ <command
+ commandId="org.eclipse.stem.ui.command.wiz.autoexperiment"
+ icon="icons/full/customobj16/AutomaticExperiment.gif"
+ label="Automatic Experiment"
+ style="push"
+ tooltip="Automatic Experiment">
+ </command>
+ <separator
+ name="additions">
+ </separator>
+ </toolbar>
+ </menuContribution>
+
+ </extension>
+
+ <extension
+ id="org.eclipse.stem.ui.STEMPerspective"
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ class="org.eclipse.stem.analysis.automaticexperiment.perspectives.AutomaticExperiment"
+ icon="icons/full/customobj16/AutomaticExperiment.gif"
+ id="org.eclipse.stem.analysis.automaticexperiment.perspective"
+ name="%_UI_AutomaticExperiment_Perspective">
+ </perspective>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ allowMultiple="true"
+ category="org.eclipse.stem.ui.views"
+ class="org.eclipse.stem.analysis.automaticexperiment.views.AutoExpView"
+ icon="icons/full/customobj16/AutomaticExperiment.gif"
+ id="org.eclipse.stem.analysis.automaticexperiment"
+ name="%AE_View">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <category
+ description="%_UI_STEM_WizCmd_Cat_Desc"
+ id="org.eclipse.stem.ui.wizards"
+ name="%_UI_STEM_WizCmd_Cat_Name">
+ </category>
+ <command
+ defaultHandler="org.eclipse.stem.analysis.automaticexperiment.ui.NewAutomaticExperimentWizard$NewAutomaticExperimentWizardCommandHandler"
+ description="New Automatic Experiment"
+ id="org.eclipse.stem.ui.command.wiz.autoexperiment"
+ name="New Automatic Experiment">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.stem.analysis.automaticexperiment.presentation.AutomaticexperimentEditor"
+ contributorClass="org.eclipse.stem.analysis.automaticexperiment.presentation.AutomaticexperimentActionBarContributor"
+ default="false"
+ extensions="automaticexperiment"
+ icon="icons/full/customobj16/AutomaticExperiment.gif"
+ id="automaticexperiment.presentation.AutomaticExperimentEditorID"
+ name="Automatic Experiment Editor">
+ </editor>
+ </extension>
+
+ <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
+ <factory
+ uri="http:///org/eclipse/stem/core/automaticexperiment.ecore"
+ class="org.eclipse.stem.analysis.automaticexperiment.provider.AutomaticexperimentItemProviderAdapterFactory"
+ supportedTypes=
+ "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
+ org.eclipse.emf.edit.provider.IStructuredItemContentProvider
+ org.eclipse.emf.edit.provider.ITreeItemContentProvider
+ org.eclipse.emf.edit.provider.IItemLabelProvider
+ org.eclipse.emf.edit.provider.IItemPropertySource"/>
+ </extension>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri="http:///org/eclipse/stem/core/automaticexperiment.ecore"
+ class="org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage"
+ genModel="model/automaticexperiment.genmodel"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ class="org.eclipse.stem.jobs.adapters.executable.IdentifiableExecutableAdapterFactory"
+ adaptableType="org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl">
+ <adapter type="org.eclipse.stem.jobs.execution.IExecutable"/>
+ </factory>
+ </extension>
+
+ <extension
+ point="org.eclipse.stem.analysis.automaticexperiment.algorithm">
+ <classdef class="org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl"/>
+ <dublin_core
+ category_id="/"
+ creator="%dc_creator_edlund"
+ description="%dc_desc_NELDER"
+ identifier="foo"
+ title="%dc_desc_NELDER"/>
+ </extension>
+
+</plugin>
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin_de.properties b/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin_de.properties
new file mode 100644
index 0000000..ae78c89
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin_de.properties
@@ -0,0 +1,159 @@
+#
+# /*******************************************************************
+# * Copyright (c) 2006, 2008 IBM Corporation and others.
+# * 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:
+# * IBM Corporation - initial API and implementation
+# ******************************************************************/
+
+# ====================================================================
+# To code developer:
+# Do NOT change the properties between this line and the
+# "%%% END OF TRANSLATED PROPERTIES %%%" line.
+# Make a new property name, append to the end of the file and change
+# the code to use the new property.
+# ====================================================================
+# ====================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# ====================================================================
+
+pluginName=STEM Atomatisches-Experiment-Tool
+providerName=Eclipse.org
+AE_View=Automatisches Experiment
+
+# product name
+_UI_Product_Name=STEM
+
+# Common Keys
+_UI_STEM=STEM
+_UI_Decorators=Dekorierer
+_UI_Experiments=Experimente
+_UI_Graphs=Graphen
+_UI_Identifiables=Identifizierbare
+_UI_Models=Modelle
+_UI_Modifiers=Modifikatoren
+_UI_Predicates=Eigenschaft
+_UI_Scenarios=Szenarien
+_UI_Sequencers=Sequenzer
+_UI_Triggers=Ausl\u00f6ser
+
+
+
+# Perspectives
+_UI_AutomaticExperiment_Perspective=Automatisches Experiment
+
+
+_UI_AutomaticExperiment_type=Automatisches Experiment
+_UI_ModifiableParameter_type=Ver\u00e4nderbare Parameter
+_UI_Unknown_type=Objekt
+
+_UI_Unknown_datatype=Wert
+
+_UI_AutomaticExperiment_baseScenario_feature=Basis-Szenario
+_UI_AutomaticExperiment_parameters_feature=Parameter
+_UI_AutomaticExperiment_errorAnalysisAlgorithm_feature=Fehleranalyse-Algorithmus
+_UI_AutomaticExperiment_errorFunction_feature=Error-Funktion
+_UI_AutomaticExperiment_tolerance_feature=Toleranz
+_UI_AutomaticExperiment_referanceDataDir_feature=Refrenzendaten Verzeichnis
+_UI_AutomaticExperiment_maximumNumberOfIterations_feature=Maximale Anzahl der Iterationen
+_UI_ModifiableParameter_initialValue_feature=Initialer Wert
+_UI_ModifiableParameter_feature_feature=Merkmal
+_UI_ModifiableParameter_step_feature=Schritt
+_UI_ModifiableParameter_featureName_feature=Merkmalsname
+_UI_Unknown_feature=Nicht spezifiziert
+
+
+_UI_AutomaticexperimentEditor_menu=&Automaticexperiment Editor
+
+_UI_AutomaticexperimentModelWizard_label=Automatisches Experiments Modell
+_UI_AutomaticexperimentModelWizard_description=Neues Automaticexperiment-Modell erstellen
+
+_UI_AutomaticexperimentEditor_label=Automatisches Experiments Modell Editor
+
+_UI_AutomaticexperimentEditorFilenameDefaultBase=Mein
+_UI_AutomaticexperimentEditorFilenameExtensions=Automatisches Experiment
+
+
+_UI_ModifiableParameter_lowerBound_feature=Unterer Grenze
+_UI_ModifiableParameter_upperBound_feature=Obere Grenze
+_UI_ModifiableParameter_decorator_feature=Dekorierer
+_UI_ModifiableParameter_targetURI_feature=Ziel-URI
+_UI_AutomaticExperiment_reInit_feature=Re Init
+_UI_CreateChild_text={0}
+_UI_CreateChild_text2={1} {0}
+_UI_CreateChild_text3={1}
+_UI_CreateChild_tooltip=Neues {0} unter {1} Feature erstellen
+_UI_CreateChild_description=Neues Kind vom Typ {0} f\u00fcr das {1} Merkmal der ausgew\u00e4hlten {2} erstellen
+_UI_CreateSibling_description=Neues Geschwisterteil vom Typ {0} f\u00fcr den ausgew\u00e4hlten {2} unter dem {1} Merkmal des Elternteil erstellen
+
+_UI_PropertyDescriptor_description={0} von {1}
+
+_UI_GenericAutomaticExperiment_type=Generisches Autoexperiment
+_UI_CreateChild_menu_item=&New Child
+_UI_CreateSibling_menu_item=N&eues Geschwisterteil
+
+_UI_ShowPropertiesView_menu_item=Show & Properties View
+_UI_RefreshViewer_menu_item=&Refresh
+
+_UI_SelectionPage_label=Auswahl
+
+_UI_NoObjectSelected=Nichts ausgew\u00e4hlt
+_UI_SingleObjectSelected=Ausgew\u00e4hltes Objekt: {0}
+_UI_MultiObjectSelected=Ausgew\u00e4hlte {0} Objekte
+
+_UI_OpenEditorError_label=Editor \u00f6ffnen
+
+_UI_Wizard_category=Beispiel EMF Modell Erstellungsassistent
+
+_UI_CreateModelError_message=Aufgetretene Probleme in der Datei "{0}"
+
+_UI_Wizard_label=Neu
+
+_WARN_FilenameExtension=Der Dateiname muss auf ".{0}" enden
+_WARN_FilenameExtensions=Der Dateiname muss eine der folgenden Endungen haben: {0}
+
+_UI_ModelObject=&Model Object
+_UI_XMLEncoding=&XML Encoding
+_UI_XMLEncodingChoices=UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1
+_UI_Wizard_initial_object_description=Zu erzeugendes Modellobjekt w\u00e4hlen
+
+_UI_FileConflict_label=Dateikonflikt
+_WARN_FileConflict=Es gibt nicht gespeicherte \u00c4nderungen, die Konflikte mit \u00c4nderungen au\u00dferhalb des Editors erzeugen. M\u00f6chten Sie die \u00c4nderungen im Editor verwerfen?
+
+
+_UI_Algorithm_type=Algorithmus
+_UI_ErrorFunction_type=Error-Funktion
+_UI_ThresholdErrorFunction_type=Genzwert-Error-Funktion
+_UI_ReferenceScenarioDataMap_type=Referenzszenario-Datenkarte
+_UI_SimpleErrorFunction_type=Simple Error-Funktion
+_UI_ErrorResult_type=Fehlerresultat
+_UI_AutomaticExperiment_errorFunc_feature=Error Funk
+_UI_ErrorResult_errorByTimeStep_feature=Fehler durch Time Step
+_UI_ErrorResult_error_feature=Fehler
+_UI_ErrorResult_referenceByTime_feature=Referenz nach Zeit
+_UI_ErrorResult_modelByTime_feature=Modell nach Zeit
+_UI_ErrorResult_validationError_feature=Validierungsfehler
+_UI_AnalysisEditor_menu=&Analysis Editor
+
+_UI_ParentPage_label=Elternteil
+_UI_ListPage_label=Liste
+_UI_TreePage_label=Baum
+_UI_TablePage_label=Tabelle
+_UI_TreeWithColumnsPage_label=Baum mit Spalten
+_UI_ObjectColumn_label=Objekt
+_UI_SelfColumn_label=Selbst
+
+_UI_AnalysisModelWizard_label=Analysemodel
+_UI_AnalysisModelWizard_description=Neues Analyse-Modell erstellen
+
+_UI_AnalysisEditor_label=Analysemodel Editor
+
+_UI_AnalysisEditorFilenameDefaultBase=Mein
+_UI_AnalysisEditorFilenameExtensions=Analyse
+
+
+_UI_OptimizerAlgorithm_type=Optimierer Algorithmus
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin_kr.properties b/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin_kr.properties
new file mode 100644
index 0000000..1c37b9f
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin_kr.properties
@@ -0,0 +1,159 @@
+#
+# /*******************************************************************
+# * Copyright (c) 2006, 2008 IBM Corporation and others.
+# * 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:
+# * IBM Corporation - initial API and implementation
+# ******************************************************************/
+
+# ====================================================================
+# To code developer:
+# Do NOT change the properties between this line and the
+# "%%% END OF TRANSLATED PROPERTIES %%%" line.
+# Make a new property name, append to the end of the file and change
+# the code to use the new property.
+# ====================================================================
+# ====================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# ====================================================================
+
+pluginName=STEM \uc790\ub3d9 \uc2e4\ud5d8 \ub3c4\uad6c
+providerName=Eclipse.org
+AE_View=\uc790\ub3d9\ud654\ub41c \uc2e4\ud5d8
+
+# product name
+_UI_Product_Name=STEM
+
+# Common Keys
+_UI_STEM=STEM
+_UI_Decorators=\uc7a5\uc2dd\uc790\ub4e4
+_UI_Experiments=\uc2e4\ud5d8
+_UI_Graphs=\uadf8\ub798\ud504
+_UI_Identifiables=\uc2dd\ubcc4\uac00\ub2a5\ud568
+_UI_Models=\ubaa8\ub378
+_UI_Modifiers=\uc218\uc815\uc790
+_UI_Predicates=\uc220\uc5b4
+_UI_Scenarios=\uc2dc\ub098\ub9ac\uc624
+_UI_Sequencers=\uc2dc\ud000\uc11c
+_UI_Triggers=\ud2b8\ub9ac\uac70
+
+
+
+# Perspectives
+_UI_AutomaticExperiment_Perspective=\uc790\ub3d9\ud654\ub41c \uc2e4\ud5d8
+
+
+_UI_AutomaticExperiment_type=\uc790\ub3d9\ud654\ub41c \uc2e4\ud5d8
+_UI_ModifiableParameter_type=\uc218\uc815 \uac00\ub2a5 \ubcc0\uc218
+_UI_Unknown_type=\uac1c\uccb4
+
+_UI_Unknown_datatype=\uac12
+
+_UI_AutomaticExperiment_baseScenario_feature=\uae30\ubcf8 \uc2dc\ub098\ub9ac\uc624
+_UI_AutomaticExperiment_parameters_feature=\ub9e4\uac1c \ubcc0\uc218
+_UI_AutomaticExperiment_errorAnalysisAlgorithm_feature=\uc624\ub958 \ubd84\uc11d \uc54c\uace0\ub9ac\uc998
+_UI_AutomaticExperiment_errorFunction_feature=\uc624\ub958 \ud568\uc218
+_UI_AutomaticExperiment_tolerance_feature=\ub0b4\uc5f0\uc131
+_UI_AutomaticExperiment_referanceDataDir_feature=\ucc38\uc870 \ub370\uc774\ud130 \ub514\ub809\ud1a0\ub9ac
+_UI_AutomaticExperiment_maximumNumberOfIterations_feature=\ubc18\ubcf5 \ucd5c\ub300 \uc778\uc6d0
+_UI_ModifiableParameter_initialValue_feature=\ucd08\uae30\uac12
+_UI_ModifiableParameter_feature_feature=\uae30\ub2a5
+_UI_ModifiableParameter_step_feature=\ub2e8\uacc4
+_UI_ModifiableParameter_featureName_feature=\uae30\ub2a5 \uc774\ub984
+_UI_Unknown_feature=\uc9c0\uc815\ub418\uc9c0 \uc54a\uc74c
+
+
+_UI_AutomaticexperimentEditor_menu=&Automaticexperiment Editor
+
+_UI_AutomaticexperimentModelWizard_label=\uc790\ub3d9\ud654\ub41c\uc2e4\ud5d8 \ubaa8\ub378
+_UI_AutomaticexperimentModelWizard_description=\uc0c8\ub85c\uc6b4 \uc790\ub3d9\ud654\ub41c\uc2e4\ud5d8 \ubaa8\ub378 \ub9cc\ub4e4\uae30
+
+_UI_AutomaticexperimentEditor_label=\uc790\ub3d9\ud654\ub41c\uc2e4\ud5d8 \ubaa8\ub378 \ud3b8\uc9d1\uae30
+
+_UI_AutomaticexperimentEditorFilenameDefaultBase=\ub098\uc758
+_UI_AutomaticexperimentEditorFilenameExtensions=\uc790\ub3d9\ud654\ub41c\uc2e4\ud5d8
+
+
+_UI_ModifiableParameter_lowerBound_feature=\ud558\uc704 \uacbd\uacc4
+_UI_ModifiableParameter_upperBound_feature=\uc0c1\uc704 \ubc94\uc704
+_UI_ModifiableParameter_decorator_feature=\uc7a5\uc2dd\uc790
+_UI_ModifiableParameter_targetURI_feature=\ub300\uc0c1 URI
+_UI_AutomaticExperiment_reInit_feature=\ub2e4\uc2dc \ucd08\uae30\ud654
+_UI_CreateChild_text={0}
+_UI_CreateChild_text2={1} {0}
+_UI_CreateChild_text3={1}
+_UI_CreateChild_tooltip={1} \uae30\ub2a5 \ud558\uc5d0 \uc0c8 {0} \ub9cc\ub4e4\uae30
+_UI_CreateChild_description=\uc120\ud0dd\ud55c {2}\uc758 {1} \uae30\ub2a5\uc5d0 \ub300\ud55c \ud615\uc2dd {0}\uc758 \uc0c8\ub85c\uc6b4 Child\ub97c \ub9cc\ub4ed\ub2c8\ub2e4.
+_UI_CreateSibling_description=\ubd80\ubaa8\uc758 \uc120\ud0dd\ub41c {2}\uc5d0\uc11c {1} \uae30\ub2a5\uc5d0 \ub300\ud55c \ud615\uc2dd {0}\uc758 \uc0c8\ub85c\uc6b4 \ud615\uc81c\ub97c \ub9cc\ub4ed\ub2c8\ub2e4.
+
+_UI_PropertyDescriptor_description={1} \uc911 {0}
+
+_UI_GenericAutomaticExperiment_type=\uc77c\ubc18 \uc790\ub3d9\ud654\ub41c \uc2e4\ud5d8
+_UI_CreateChild_menu_item=&New Child
+_UI_CreateSibling_menu_item=N& \ud615\uc81c \uc790\ub9e4
+
+_UI_ShowPropertiesView_menu_item=\ud45c\uc2dc \ubc0f \uc18d\uc131\ubcf4\uae30
+_UI_RefreshViewer_menu_item=&Refresh
+
+_UI_SelectionPage_label=\uc120\ud0dd
+
+_UI_NoObjectSelected=\uc544\ubb34\uac83\ub3c4 \uc548 \uc120\ud0dd\ud568
+_UI_SingleObjectSelected=\uc120\ud0dd\ud55c \uac1d\uccb4 : {0}
+_UI_MultiObjectSelected=\uc120\ud0dd\ub41c {0} \uac1d\uccb4
+
+_UI_OpenEditorError_label=\uc624\ud508 \uc5d0\ub514\ud130
+
+_UI_Wizard_category=\uc608\uc81c EMF \ubaa8\ub378 \uc0dd\uc131 \ub9c8\ubc95\uc0ac
+
+_UI_CreateModelError_message=\ud30c\uc77c '{0} "\uc5d0\uc11c \ubb38\uc81c \ubc1c\uc0dd
+
+_UI_Wizard_label=\uc0c8\ub85c\uc6b4
+
+_WARN_FilenameExtension=\ud30c\uc77c \uc774\ub984\uc740 ".{0}"\ub85c \ub05d\ub098\uc57c\ud568.
+_WARN_FilenameExtensions=\ud30c\uc77c \uc774\ub984\uc740 \ub2e4\uc74c \ud655\uc7a5\uc790 \uc911 \ud558\ub098\ub97c \uac00\uc838\uc57c\ud568 : {0}
+
+_UI_ModelObject=&Model Object
+_UI_XMLEncoding=&XML Encoding
+_UI_XMLEncodingChoices=UTF - 8 ASCII UTF - 16 UTF - 16BE UTF - 16LE ISO - 8859 - 1
+_UI_Wizard_initial_object_description=\uc0dd\uc131\ud560 \ubaa8\ub378 \uac1c\uccb4 \uc120\ud0dd
+
+_UI_FileConflict_label=\ud30c\uc77c \ucda9\ub3cc
+_WARN_FileConflict=\uc800\uc7a5\ub418\uc9c0 \uc54a\uc740 \uc0ac\ud56d\ub4e4\uc774 \ud3b8\uc9d1\uae30 \uc678\ubd80\uc758 \ubcc0\uacbd \uc0ac\ud56d\ub4e4\uacfc \ucda9\ub3cc\ud568. \uc774 \ud3b8\uc9d1\uae30\uc758 \ubcc0\uacbd \uc0ac\ud56d\ub4e4\uc744 \ucde8\uc18c \ud558\uc2dc\uaca0\uc2b5\ub2c8\uae4c?
+
+
+_UI_Algorithm_type=\uc54c\uace0\ub9ac\uc998
+_UI_ErrorFunction_type=\uc624\ub958 \ud568\uc218
+_UI_ThresholdErrorFunction_type=\uc784\uacc4\uac12 \uc5d0\ub7ec \ud568\uc218
+_UI_ReferenceScenarioDataMap_type=\ucc38\uc870 \uc2dc\ub098\ub9ac\uc624 \ub370\uc774\ud130\uc9c0\ub3c4
+_UI_SimpleErrorFunction_type=\uac04\ub2e8\ud55c \uc5d0\ub7ec \ud568\uc218
+_UI_ErrorResult_type=\uc624\ub958 \uacb0\uacfc
+_UI_AutomaticExperiment_errorFunc_feature=\uc624\ub958 FUNC
+_UI_ErrorResult_errorByTimeStep_feature=\uc2dc\uac04 \ub2e8\uacc4\uc5d0\uc11c \uc624\ub958 \ubc1c\uc0dd
+_UI_ErrorResult_error_feature=\uc624\ub958
+_UI_ErrorResult_referenceByTime_feature=\uc2dc\uac04 \ub300\ube44 \ucc38\uc870
+_UI_ErrorResult_modelByTime_feature=\uc2dc\uac04\uc5d0 \ub530\ub978 \ubaa8\ub378
+_UI_ErrorResult_validationError_feature=\uc720\ud6a8\uc131 \uac80\uc0ac \uc624\ub958
+_UI_AnalysisEditor_menu=&Analysis Editor
+
+_UI_ParentPage_label=\ubd80\ubaa8
+_UI_ListPage_label=\ubaa9\ub85d
+_UI_TreePage_label=\ub098\ubb34
+_UI_TablePage_label=\ud14c\uc774\ube14
+_UI_TreeWithColumnsPage_label=\ub098\ubb34\uc640 \uc5f4
+_UI_ObjectColumn_label=\uac1c\uccb4
+_UI_SelfColumn_label=\uc140\ud504
+
+_UI_AnalysisModelWizard_label=\ubd84\uc11d \ubaa8\ub378
+_UI_AnalysisModelWizard_description=\uc0c8\ub85c\uc6b4 \ubd84\uc11d \ubaa8\ub378\uc744 \uc791\uc131
+
+_UI_AnalysisEditor_label=\ubd84\uc11d \ubaa8\ub378 \ud3b8\uc9d1\uae30
+
+_UI_AnalysisEditorFilenameDefaultBase=\ub098\uc758
+_UI_AnalysisEditorFilenameExtensions=\ubd84\uc11d
+
+
+_UI_OptimizerAlgorithm_type=\ucd5c\uc801\ud654 \uc54c\uace0\ub9ac\uc998
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin_zh.properties b/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin_zh.properties
new file mode 100644
index 0000000..028c822
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/plugin_zh.properties
@@ -0,0 +1,159 @@
+#
+# /*******************************************************************
+# * Copyright (c) 2006, 2008 IBM Corporation and others.
+# * 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:
+# * IBM Corporation - initial API and implementation
+# ******************************************************************/
+
+# ====================================================================
+# To code developer:
+# Do NOT change the properties between this line and the
+# "%%% END OF TRANSLATED PROPERTIES %%%" line.
+# Make a new property name, append to the end of the file and change
+# the code to use the new property.
+# ====================================================================
+# ====================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# ====================================================================
+
+pluginName=STEM\u81ea\u52a8\u5316\u5b9e\u9a8c\u5de5\u5177
+providerName=Eclipse.org
+AE_View=\u81ea\u52a8\u8bd5\u9a8c
+
+# product name
+_UI_Product_Name=STEM
+
+# Common Keys
+_UI_STEM=STEM
+_UI_Decorators=\u88c5\u9970\u5668
+_UI_Experiments=\u5b9e\u9a8c
+_UI_Graphs=\u56fe
+_UI_Identifiables=\u53ef\u8bc6\u522b\u7684
+_UI_Models=\u6a21\u578b
+_UI_Modifiers=\u4fee\u6539\u5668
+_UI_Predicates=\u63cf\u8ff0
+_UI_Scenarios=\u65b9\u6848
+_UI_Sequencers=\u5e8f\u5217\u53d1\u751f\u5668
+_UI_Triggers=\u89e6\u53d1\u5668
+
+
+
+# Perspectives
+_UI_AutomaticExperiment_Perspective=\u81ea\u52a8\u8bd5\u9a8c
+
+
+_UI_AutomaticExperiment_type=\u81ea\u52a8\u8bd5\u9a8c
+_UI_ModifiableParameter_type=\u53ef\u4fee\u6539\u7684\u53c2\u6570
+_UI_Unknown_type=\u5bf9\u8c61
+
+_UI_Unknown_datatype=\u4ef7\u503c
+
+_UI_AutomaticExperiment_baseScenario_feature=\u57fa\u672c\u65b9\u6848
+_UI_AutomaticExperiment_parameters_feature=\u53c2\u6570
+_UI_AutomaticExperiment_errorAnalysisAlgorithm_feature=\u8bef\u5dee\u5206\u6790\u7b97\u6cd5
+_UI_AutomaticExperiment_errorFunction_feature=\u8bef\u5dee\u51fd\u6570
+_UI_AutomaticExperiment_tolerance_feature=\u516c\u5dee
+_UI_AutomaticExperiment_referanceDataDir_feature=\u53c2\u8003\u6587\u732e\u6570\u636e\u76ee\u5f55
+_UI_AutomaticExperiment_maximumNumberOfIterations_feature=\u6700\u5927\u8fed\u4ee3\u6b21\u6570
+_UI_ModifiableParameter_initialValue_feature=\u521d\u59cb\u503c
+_UI_ModifiableParameter_feature_feature=\u529f\u80fd
+_UI_ModifiableParameter_step_feature=\u6b65
+_UI_ModifiableParameter_featureName_feature=\u529f\u80fd\u540d\u79f0
+_UI_Unknown_feature=\u672a\u6307\u5b9a
+
+
+_UI_AutomaticexperimentEditor_menu=&Automaticexperiment Editor
+
+_UI_AutomaticexperimentModelWizard_label=\u81ea\u52a8\u5b9e\u9a8c\u6a21\u578b
+_UI_AutomaticexperimentModelWizard_description=\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u81ea\u52a8\u5b9e\u9a8c\u6a21\u578b
+
+_UI_AutomaticexperimentEditor_label=\u81ea\u52a8\u5b9e\u9a8c\u6a21\u578b\u7f16\u8f91\u5668
+
+_UI_AutomaticexperimentEditorFilenameDefaultBase=\u6211\u7684
+_UI_AutomaticexperimentEditorFilenameExtensions=\u81ea\u52a8\u8bd5\u9a8c
+
+
+_UI_ModifiableParameter_lowerBound_feature=\u4e0b\u754c
+_UI_ModifiableParameter_upperBound_feature=\u4e0a\u754c
+_UI_ModifiableParameter_decorator_feature=\u88c5\u9970\u5668
+_UI_ModifiableParameter_targetURI_feature=\u76ee\u6807URI
+_UI_AutomaticExperiment_reInit_feature=\u91cd\u65b0\u521d\u59cb\u5316
+_UI_CreateChild_text={0}
+_UI_CreateChild_text2={1} {0}
+_UI_CreateChild_text3={1}
+_UI_CreateChild_tooltip=\u521b\u5efa\u5728{1} {0}\u65b0\u529f\u80fd
+_UI_CreateChild_description=\u4e3a\u9009\u5b9a\u7684{2}\u7684{1}\u7279\u6027\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684{0}\u5b50\u7c7b
+_UI_CreateSibling_description=\u5728{1}\u7684\u7236\u96c6\u4e2d\u4e3a\u9009\u5b9a\u7684{2}\u6765\u521b\u5efa\u4e00\u4e2a{0}\u7c7b\u578b\u7684\u65b0\u7684\u5144\u5f1f\u7c7b
+
+_UI_PropertyDescriptor_description={0}\u4ece\u5c5e{1}
+
+_UI_GenericAutomaticExperiment_type=\u901a\u7528\u81ea\u52a8\u8bd5\u9a8c
+_UI_CreateChild_menu_item=&New Child
+_UI_CreateSibling_menu_item=\u65b0\u751f\u6210\u4e00\u4e2a\u5144\u5f1f\u7c7b
+
+_UI_ShowPropertiesView_menu_item=\u663e\u793a\u548c\u5c5e\u6027\u67e5\u770b
+_UI_RefreshViewer_menu_item=&Refresh
+
+_UI_SelectionPage_label=\u9009\u62e9
+
+_UI_NoObjectSelected=\u65e0\u9009\u5b9a\u5185\u5bb9
+_UI_SingleObjectSelected=\u9009\u62e9\u5bf9\u8c61\uff1a{0}
+_UI_MultiObjectSelected=\u9009\u62e9{0}\u5bf9\u8c61
+
+_UI_OpenEditorError_label=\u6253\u5f00\u7f16\u8f91\u5668
+
+_UI_Wizard_category=\u4f8b\u5982EMF\u6a21\u578b\u521b\u5efa\u5411\u5bfc
+
+_UI_CreateModelError_message=\u5728\u6587\u4ef6\u201c{0}\u201d\u4e2d\u9047\u5230\u7684\u95ee\u9898
+
+_UI_Wizard_label=\u65b0\u5efa
+
+_WARN_FilenameExtension=\u6587\u4ef6\u540d\u5fc5\u987b\u4ee5'{0} ''\u7ed3\u5c3e
+_WARN_FilenameExtensions=\u6587\u4ef6\u540d\u5fc5\u987b\u5177\u6709\u4ee5\u4e0b\u6269\u5c55\u540d\u4e4b\u4e00\uff1a{0}
+
+_UI_ModelObject=&Model Object
+_UI_XMLEncoding=&XML Encoding
+_UI_XMLEncodingChoices=UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1
+_UI_Wizard_initial_object_description=\u9009\u62e9\u521b\u5efa\u4e00\u4e2a\u6a21\u578b\u5bf9\u8c61
+
+_UI_FileConflict_label=\u6587\u4ef6\u51b2\u7a81
+_WARN_FileConflict=\u6709\u672a\u4fdd\u5b58\u7684\u66f4\u6539\u4e0e\u7f16\u8f91\u5668\u5916\u7684\u66f4\u6539\u51b2\u7a81\u3002\u4f60\u60f3\u653e\u5f03\u8fd9\u4e2a\u7f16\u8f91\u5668\u7684\u66f4\u6539\u5417\uff1f
+
+
+_UI_Algorithm_type=\u7b97\u6cd5
+_UI_ErrorFunction_type=\u8bef\u5dee\u51fd\u6570
+_UI_ThresholdErrorFunction_type=\u9608\u503c\u8bef\u5dee\u51fd\u6570
+_UI_ReferenceScenarioDataMap_type=\u53c2\u8003\u60c5\u666f\u7684\u6570\u636e\u6620\u5c04
+_UI_SimpleErrorFunction_type=\u7b80\u5355\u8bef\u5dee\u65b9\u7a0b
+_UI_ErrorResult_type=\u9519\u8bef\u7684\u7ed3\u679c
+_UI_AutomaticExperiment_errorFunc_feature=\u8bef\u5dee\u51fd\u6570
+_UI_ErrorResult_errorByTimeStep_feature=\u8bef\u5dee\u65f6\u95f4\u6b65\u957f
+_UI_ErrorResult_error_feature=\u9519\u8bef
+_UI_ErrorResult_referenceByTime_feature=\u53c2\u8003\u6587\u732e\u6309\u65f6\u95f4\u6392\u5e8f
+_UI_ErrorResult_modelByTime_feature=\u6a21\u578b\u7684\u65f6\u95f4
+_UI_ErrorResult_validationError_feature=\u9a8c\u8bc1\u9519\u8bef
+_UI_AnalysisEditor_menu=&Analysis Editor
+
+_UI_ParentPage_label=\u5bb6\u957f
+_UI_ListPage_label=\u76ee\u5f55
+_UI_TreePage_label=\u6811
+_UI_TablePage_label=\u8868
+_UI_TreeWithColumnsPage_label=\u5206\u5217\u7684\u6811
+_UI_ObjectColumn_label=\u5bf9\u8c61
+_UI_SelfColumn_label=\u81ea\u5df1
+
+_UI_AnalysisModelWizard_label=\u5206\u6790\u6a21\u578b
+_UI_AnalysisModelWizard_description=\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5206\u6790\u6a21\u578b
+
+_UI_AnalysisEditor_label=\u5206\u6790\u6a21\u578b\u7f16\u8f91\u5668
+
+_UI_AnalysisEditorFilenameDefaultBase=\u6211\u7684
+_UI_AnalysisEditorFilenameExtensions=\u5206\u6790
+
+
+_UI_OptimizerAlgorithm_type=\u4f18\u5316\u7b97\u6cd5
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/schema/algorithm.exsd b/analysis/org.eclipse.stem.analysis.automaticexperiment/schema/algorithm.exsd
new file mode 100644
index 0000000..c4f8edc
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/schema/algorithm.exsd
@@ -0,0 +1,100 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.stem.analysis.automaticexperiment" xmlns="http://www.w3.org/2001/XMLSchema">
+ <annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.stem.analysis.automaticexperiment" id="org.eclipse.stem.analysis.automaticexperiment.algorithm" name="Algorithm"/>
+ </appInfo>
+ <documentation>
+ The expension point is used for adding new algorithms for numerical optimization of STEM models
+ </documentation>
+ </annotation>
+
+ <include schemaLocation="schema://org.eclipse.stem.core/schema/dublin_core.exsd"/>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="classdef"/>
+ <element ref="dublin_core"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="classdef">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.stem.diseasemodels.standard.impl.DiseaseModelImpl:org.eclipse.stem.diseasemodels.standard.DiseaseModel"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ALGORITHM_STATUS.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ALGORITHM_STATUS.java
new file mode 100644
index 0000000..0971476
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ALGORITHM_STATUS.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2009,2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.stem.analysis.automaticexperiment;
+
+public enum ALGORITHM_STATUS {
+ STARTING_SIMULATION,
+ FINISHED_SIMULATION,
+ FINISHED_ALGORITHM,
+ RESTARTED_ALGORITHM;
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AbstractErrorAnalysisAlgorithm.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AbstractErrorAnalysisAlgorithm.java
new file mode 100644
index 0000000..5973f59
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AbstractErrorAnalysisAlgorithm.java
@@ -0,0 +1,127 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.stem.analysis.AnalysisFactory;
+import org.eclipse.stem.analysis.ErrorFunction;
+import org.eclipse.stem.core.scenario.Scenario;
+
+
+public abstract class AbstractErrorAnalysisAlgorithm implements
+ ErrorAnalysisAlgorithm {
+
+ protected Scenario baseScenario = null;
+ protected SimplexAlgorithm simplexAlgorithm = new NelderMeadAlgorithm();
+ protected SimplexFunction simplexFnToMinimize = null;
+ protected ErrorFunction errorFunction = null;
+ protected double[] initialParamsValues = null;
+ protected double[] paramsInitialSteps = null;
+ protected double tolerance = -1;
+ protected String referenceDataDirectory = null;
+ protected long maxNumOfIterations = -1;
+ protected List<ModifiableParameter> parameters = null;
+ boolean repeat = false;
+ private ArrayList<ErrorAnalysisAlgorithmListener> listeners = new ArrayList<ErrorAnalysisAlgorithmListener>();
+
+ abstract public void execute();
+
+ public void setBaseScenario(Scenario baseScenario) {
+ this.baseScenario = baseScenario;
+ }
+
+ public void setTolerance(double tolerance) {
+ this.tolerance = tolerance;
+ }
+
+ public void setErrorFunction(ErrorFunction errorFunction) {
+ this.errorFunction = errorFunction;
+ }
+
+ public void setReferenceDataDirectory(String referenceDataDir) {
+ this.referenceDataDirectory = referenceDataDir;
+ }
+
+ public void init(AutomaticExperiment automaticExperiment) {
+ setBaseScenario(automaticExperiment.getBaseScenario());
+ setParameters(automaticExperiment.getParameters());
+
+ double tolerance = automaticExperiment.getTolerance();
+ setTolerance(tolerance);
+ long maxIterations = automaticExperiment.getMaximumNumberOfIterations();
+ setMaximumNumberOfIterations(maxIterations);
+
+ boolean repeatUntilNoImprovement = automaticExperiment.isReInit();
+ setReInit(repeatUntilNoImprovement);
+
+ ErrorFunction errorFunction = null;
+ String errorFunctionName = automaticExperiment.getErrorFunction();
+ errorFunction = automaticExperiment.getErrorFunc();
+ if(errorFunction == null) {
+ // This is for backwards compatability with old versions of automated experiments
+ if (errorFunctionName.equals("Threshold error function")) { //$NON-NLS-1$
+ errorFunction = AnalysisFactory.eINSTANCE.createThresholdErrorFunction();
+ }
+ if (errorFunctionName.equals("Simple error function")) { //$NON-NLS-1$
+ errorFunction = AnalysisFactory.eINSTANCE.createSimpleErrorFunction();
+ }
+ }
+ setErrorFunction(errorFunction);
+
+ String refDir = automaticExperiment.getReferanceDataDir();
+ setReferenceDataDirectory(refDir);
+ }
+
+ public void reinitStartParams(AutomaticExperiment experiment, double [] vals) {
+ int i=0;
+ for(ModifiableParameter p:experiment.getParameters()) {
+ p.setInitialValue(vals[i++]);
+ }
+ init(experiment);
+ }
+ public double[] getResultParameters() {
+ return simplexAlgorithm.getMinimumParametersValues();
+ }
+
+ public double getResultValue() {
+ return simplexAlgorithm.getMinimumFunctionValue();
+ }
+
+ public void setMaximumNumberOfIterations(long maxNumOfIterations) {
+ this.maxNumOfIterations = maxNumOfIterations;
+ }
+
+ public void setReInit(boolean repeat) {
+ this.repeat = repeat;
+ }
+ public void setParameters(List<ModifiableParameter> parameters) {
+ this.parameters = parameters;
+ paramsInitialSteps = new double[parameters.size()];
+ initialParamsValues = new double[parameters.size()];
+ int i=0;
+ for (final ModifiableParameter param:parameters) {
+ paramsInitialSteps[i] = param.getStep();
+ initialParamsValues[i] = param.getInitialValue();
+ i++;
+ }
+ }
+
+ public void addListener(ErrorAnalysisAlgorithmListener l) {this.listeners.add(l);}
+ public void clearListeners() {this.listeners.clear();}
+
+ protected void fireEvent(ErrorAnalysisAlgorithmEvent evt) {
+ for(ErrorAnalysisAlgorithmListener l:listeners) l.eventReceived(evt);
+ }
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/Activator.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/Activator.java
new file mode 100644
index 0000000..17de2d8
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/Activator.java
@@ -0,0 +1,167 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.stem.analysis.automaticexperiment.executable.AutomaticExperimentExecutableAdapterFactory;
+import org.eclipse.stem.analysis.automaticexperiment.ui.AutomaticExperimentCompositeEditorAdapterFactory;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.stem.analysis.automaticexperiment"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ new AutomaticExperimentExecutableAdapterFactory();
+ new AutomaticExperimentCompositeEditorAdapterFactory();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given plug-in
+ * relative path
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ /**
+ * Log an error to the ILog for this plugin
+ *
+ * @param message
+ * the localized error message text
+ * @param exception
+ * the associated exception, or null
+ */
+ public static void logError(String message, Throwable exception) {
+ // Do we have a plugin?
+ if (plugin != null) {
+ // Yes
+ plugin.getLog().log(
+ new Status(IStatus.ERROR, plugin.getBundle()
+ .getSymbolicName(), 0, message, exception));
+ } else {
+ // No
+ System.out.println(message);
+ // Exception?
+ if (exception != null) {
+ // Yes
+ System.out.println(exception.getMessage());
+ } // if
+ }
+ } // logError
+
+
+
+ /**
+ * Log information to the ILog for this plugin
+ *
+ * @param message
+ * the localized information message text
+ * @param exception
+ * the associated exception, or null
+ */
+ public static void logInformation(String message, Throwable exception) {
+ // Do we have a plugin?
+ if (plugin != null) {
+ // Yes
+ plugin.getLog().log(
+ new Status(IStatus.INFO, plugin.getBundle().getSymbolicName(),
+ 0, message, exception));
+ }
+ else {
+ // No
+ System.out.println(message);
+ // Exception?
+ if (exception != null) {
+ // Yes
+ System.out.println(exception.getMessage());
+ } // if
+ }
+ } // logInformation
+
+
+ /**
+ * Log information to the ILog for this plugin
+ * The method is overloaded to allow for logInformation without an error
+ * method sets the error to null. This should be used instead of System.out.println
+ * throughout the code.
+ * @param message
+ * the localized information message text
+ *
+ */
+ public static void logInformation(String message) {
+ // Do we have a plugin?
+ if (plugin != null) {
+ // Yes
+ plugin.getLog().log(
+ new Status(IStatus.INFO, plugin.getBundle().getSymbolicName(),
+ 0, message, null));
+ }
+ else {
+ // No
+ System.out.println(message);
+ }
+ } // logInformation
+
+
+
+
+
+
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperiment.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperiment.java
new file mode 100644
index 0000000..00467bf
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperiment.java
@@ -0,0 +1,271 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.stem.analysis.ErrorFunction;
+import org.eclipse.stem.core.scenario.Scenario;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Automatic Experiment</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getBaseScenario <em>Base Scenario</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getParameters <em>Parameters</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorAnalysisAlgorithm <em>Error Analysis Algorithm</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorFunction <em>Error Function</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getTolerance <em>Tolerance</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getReferanceDataDir <em>Referance Data Dir</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getMaximumNumberOfIterations <em>Maximum Number Of Iterations</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#isReInit <em>Re Init</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorFunc <em>Error Func</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getAutomaticExperiment()
+ * @model
+ * @generated
+ */
+public interface AutomaticExperiment extends OptimizerAlgorithm {
+ /**
+ * Returns the value of the '<em><b>Base Scenario</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Base Scenario</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Base Scenario</em>' reference.
+ * @see #setBaseScenario(Scenario)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getAutomaticExperiment_BaseScenario()
+ * @model required="true"
+ * @generated
+ */
+ Scenario getBaseScenario();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getBaseScenario <em>Base Scenario</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Base Scenario</em>' reference.
+ * @see #getBaseScenario()
+ * @generated
+ */
+ void setBaseScenario(Scenario value);
+
+ /**
+ * Returns the value of the '<em><b>Parameters</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Parameters</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Parameters</em>' containment reference list.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getAutomaticExperiment_Parameters()
+ * @model containment="true" required="true"
+ * @generated
+ */
+ EList<ModifiableParameter> getParameters();
+
+ /**
+ * Returns the value of the '<em><b>Error Analysis Algorithm</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Error Analysis Algorithm</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Error Analysis Algorithm</em>' attribute.
+ * @see #setErrorAnalysisAlgorithm(String)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getAutomaticExperiment_ErrorAnalysisAlgorithm()
+ * @model required="true"
+ * @generated NOT
+ * @deprecated
+ */
+ String getErrorAnalysisAlgorithm();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorAnalysisAlgorithm <em>Error Analysis Algorithm</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Error Analysis Algorithm</em>' attribute.
+ * @see #getErrorAnalysisAlgorithm()
+ * @generated NOT
+ * @deprecated
+ */
+ void setErrorAnalysisAlgorithm(String value);
+
+ /**
+ * Returns the value of the '<em><b>Error Function</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Error Function</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Error Function</em>' attribute.
+ * @see #setErrorFunction(String)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getAutomaticExperiment_ErrorFunction()
+ * @model required="true"
+ * @generated NOT
+ * @deprecated
+ */
+ String getErrorFunction();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorFunction <em>Error Function</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Error Function</em>' attribute.
+ * @see #getErrorFunction()
+ * @generated NOT
+ * @deprecated
+ */
+ void setErrorFunction(String value);
+
+ /**
+ * Returns the value of the '<em><b>Tolerance</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Tolerance</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Tolerance</em>' attribute.
+ * @see #setTolerance(double)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getAutomaticExperiment_Tolerance()
+ * @model required="true"
+ * @generated
+ */
+ double getTolerance();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getTolerance <em>Tolerance</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Tolerance</em>' attribute.
+ * @see #getTolerance()
+ * @generated
+ */
+ void setTolerance(double value);
+
+ /**
+ * Returns the value of the '<em><b>Referance Data Dir</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Referance Data Dir</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Referance Data Dir</em>' attribute.
+ * @see #setReferanceDataDir(String)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getAutomaticExperiment_ReferanceDataDir()
+ * @model required="true"
+ * @generated
+ */
+ String getReferanceDataDir();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getReferanceDataDir <em>Referance Data Dir</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Referance Data Dir</em>' attribute.
+ * @see #getReferanceDataDir()
+ * @generated
+ */
+ void setReferanceDataDir(String value);
+
+ /**
+ * Returns the value of the '<em><b>Maximum Number Of Iterations</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Maximum Number Of Iterations</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Maximum Number Of Iterations</em>' attribute.
+ * @see #setMaximumNumberOfIterations(long)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getAutomaticExperiment_MaximumNumberOfIterations()
+ * @model required="true"
+ * @generated
+ */
+ long getMaximumNumberOfIterations();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getMaximumNumberOfIterations <em>Maximum Number Of Iterations</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Maximum Number Of Iterations</em>' attribute.
+ * @see #getMaximumNumberOfIterations()
+ * @generated
+ */
+ void setMaximumNumberOfIterations(long value);
+
+ /**
+ * Returns the value of the '<em><b>Re Init</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Re Init</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Re Init</em>' attribute.
+ * @see #setReInit(boolean)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getAutomaticExperiment_ReInit()
+ * @model required="true"
+ * @generated
+ */
+ boolean isReInit();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#isReInit <em>Re Init</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Re Init</em>' attribute.
+ * @see #isReInit()
+ * @generated
+ */
+ void setReInit(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Error Func</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Error Func</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Error Func</em>' containment reference.
+ * @see #setErrorFunc(ErrorFunction)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getAutomaticExperiment_ErrorFunc()
+ * @model containment="true" required="true"
+ * @generated
+ */
+ ErrorFunction getErrorFunc();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorFunc <em>Error Func</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Error Func</em>' containment reference.
+ * @see #getErrorFunc()
+ * @generated
+ */
+ void setErrorFunc(ErrorFunction value);
+
+} // AutomaticExperiment
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentJob.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentJob.java
new file mode 100644
index 0000000..c06d572
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentJob.java
@@ -0,0 +1,130 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.stem.jobs.execution.Executable;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+
+
+public class AutomaticExperimentJob extends Executable {
+
+ protected AutomaticExperiment automaticExperiment = null;
+ protected Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
+ protected boolean isRunning = false;
+
+ public AutomaticExperimentJob(String title, int sequenceNumber) {
+ super(title == null ? "" : title, sequenceNumber); //$NON-NLS-1$
+ }
+
+ public AutomaticExperimentJob(AutomaticExperiment toRun) {
+ this(toRun.getDublinCore().getTitle(), 1);
+ this.automaticExperiment = toRun;
+ }
+
+ /**
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IStatus retValue = Status.OK_STATUS;
+// isRunning = true;
+//
+// //Run
+// ErrorAnalysisAlgorithm algorithm = null;
+// String algorithmName = automaticExperiment.getErrorAnalysisAlgorithm();
+// if (algorithmName.equals("Nedler-Mead Algorithm")) {
+// algorithm = new SimplexAlgorithmExecuter(shell);
+// }
+// algorithm.setBaseScenario(automaticExperiment.getBaseScenario());
+//
+// int numOfParams = automaticExperiment.getParameters().size();
+// double[] initialParamsValues = new double[numOfParams];
+// double[] paramsSteps = new double[numOfParams];
+// String[] paramsNames = new String[numOfParams];
+//
+// int index = 0;
+// for (ModifiableParameter parameter:automaticExperiment.getParameters()) {
+// initialParamsValues[index] = parameter.getInitialValue();
+// paramsSteps[index] = parameter.getStep();
+// paramsNames[index] = parameter.getFeatureName();
+// index++;
+// }
+// algorithm.setInitialParametersValues(initialParamsValues);
+// algorithm.setParametersSteps(paramsSteps);
+// algorithm.setParameters(automaticExperiment.getParameters());
+//
+// double tolerance = automaticExperiment.getTolerance();
+// algorithm.setTolerance(tolerance);
+//
+// ErrorFunction errorFunction = null;
+// String errorFunctionName = automaticExperiment.getErrorFunction();
+// if (errorFunctionName.equals("Threshold error function")) {
+// errorFunction = AnalysisFactory.eINSTANCE.createThresholdErrorFunction();
+// }
+// if (errorFunctionName.equals("Simple error function")) {
+// errorFunction = AnalysisFactory.eINSTANCE.createSimpleErrorFunction();
+// }
+// algorithm.setErrorFunction(errorFunction);
+//
+// String refDir = automaticExperiment.getReferanceDataDir();
+// algorithm.setReferenceDataDirectory(refDir);
+//
+// algorithm.init();
+//
+// long before = System.currentTimeMillis();
+// algorithm.execute();
+// long after = System.currentTimeMillis();
+// Activator.logInformation("Time to execute the Nedler-Mead Algorithm: " + (after-before)/1000 + " seconds");
+// Activator.logInformation("Minimum value: " + algorithm.getResultValue());
+// System.out.print("Parameters values: ");
+// for (double param:algorithm.getResultParameters()) {
+// System.out.print(param + ", ");
+// }
+// Activator.logInformation();
+//
+// isRunning = false;
+ return retValue;
+ }
+
+ public boolean isRunning() {
+ return isRunning;
+ }
+
+ public void pause() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void reset() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void run() {
+ schedule();
+ }
+
+ public void step() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void stop() {
+ // TODO Auto-generated method stub
+ }
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentManager.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentManager.java
new file mode 100644
index 0000000..02e486e
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentManager.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2009,2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.stem.analysis.automaticexperiment;
+
+import java.util.ArrayList;
+import java.util.concurrent.CountDownLatch;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+
+
+public class AutomaticExperimentManager {
+ private static final AutomaticExperimentManager instance = new AutomaticExperimentManager();
+ protected static boolean QUIT_NOW = false;
+ protected static boolean PAUSE_NOW = false;
+ protected static CountDownLatch stopLatch = null;
+ protected static ErrorAnalysisAlgorithm currentRunningAlgorithm = null;
+ protected static AutomaticExperiment currentRunningExperient;
+
+ public void quitNow() {
+ stopLatch = new CountDownLatch(1);
+ QUIT_NOW = true;
+ try {
+ stopLatch.await();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void pause() {
+ PAUSE_NOW = true;
+ // TODO Please pause now if we want pause
+ }
+ public static void continueRun() {
+ PAUSE_NOW = false;
+ // TODO Please continue now if we want Continue
+ }
+
+ public void restartNow(double[] restartParamValues) {
+ // TODO Restart with the valued provided
+ QUIT_NOW = false;
+ currentRunningAlgorithm.reinitStartParams(currentRunningExperient, restartParamValues);
+ currentRunningAlgorithm.clearListeners();
+ // Stefan fix, we can't hold up the UI thread, it causes memory leaks
+ Job j = new Job("Minimizer algorith") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ currentRunningAlgorithm.execute();
+ return Status.OK_STATUS;
+ }
+ };
+
+ AutomaticExperimentManagerEvent newEvent = new AutomaticExperimentManagerEvent(currentRunningExperient, currentRunningAlgorithm, MANAGER_STATUS.SCHEDULED);
+ fireEvent(newEvent);
+ j.schedule();
+ }
+
+ private ArrayList<AutomaticExperimentManagerListener> listeners = new ArrayList<AutomaticExperimentManagerListener>();
+
+ private AutomaticExperimentManager() {
+ }
+ public static AutomaticExperimentManager getInstance()
+ {
+ return instance;
+ }
+
+ public ErrorAnalysisAlgorithm createAlgorithm(OptimizerAlgorithm alg) {
+ QUIT_NOW = false; // in case RESTARTING
+ PAUSE_NOW = false;
+ ErrorAnalysisAlgorithm result = ErrorAnalysisAlgorithmFactory.INSTANCE.createErrorAnalysisAlgorithm(alg);
+ return result;
+ }
+
+ public void executeAlgorithm(final ErrorAnalysisAlgorithm algorithm, final AutomaticExperiment automaticExperiment) {
+ QUIT_NOW = false; // in case RESTARTING
+ PAUSE_NOW = false;
+ currentRunningAlgorithm = algorithm;
+ currentRunningExperient = automaticExperiment;
+
+ algorithm.init(automaticExperiment, algorithm);
+ // Stefan fix, we can't hold up the UI thread, it causes memory leaks
+ Job j = new Job("Minimizer algorith") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ algorithm.execute();
+ return Status.OK_STATUS;
+ }
+ };
+
+ AutomaticExperimentManagerEvent newEvent = new AutomaticExperimentManagerEvent(automaticExperiment, algorithm, MANAGER_STATUS.SCHEDULED);
+ fireEvent(newEvent);
+ j.schedule();
+ }
+
+ private void fireEvent(AutomaticExperimentManagerEvent evt) {
+ for(AutomaticExperimentManagerListener l:listeners) l.eventReceived(evt);
+ }
+
+ public void addListener(AutomaticExperimentManagerListener l) {
+ this.listeners.add(l);
+ }
+
+ public void clearListeners() {
+ this.listeners.clear();
+ }
+ public static void main() {
+ QUIT_NOW = false; // in case RESTARTING
+ PAUSE_NOW = false;
+ AutomaticExperimentManager manager = AutomaticExperimentManager.getInstance();
+ manager.addListener(new AutomaticExperimentManagerListener() {
+
+ public void eventReceived(AutomaticExperimentManagerEvent evt) {
+ if(evt.status == MANAGER_STATUS.SCHEDULED) {
+ ErrorAnalysisAlgorithm alg = evt.algorithm;
+
+ alg.addListener(new ErrorAnalysisAlgorithmListener() {
+
+ public void eventReceived(ErrorAnalysisAlgorithmEvent evt) {
+ if(evt.status == ALGORITHM_STATUS.FINISHED_ALGORITHM) {
+ // The algorithm has finished. Smallest value in
+ //evt.result
+ } else if(evt.status == ALGORITHM_STATUS.FINISHED_SIMULATION) {
+ // One simulation is done. The result is in evt.result
+ } else if(evt.status == ALGORITHM_STATUS.RESTARTED_ALGORITHM) {
+ // The algorithm has restarted. Smallest value in
+ // evt.result
+ }
+ }
+ });
+ }
+ }
+ });
+ }
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentManagerEvent.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentManagerEvent.java
new file mode 100644
index 0000000..9633491
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentManagerEvent.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009,2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.stem.analysis.automaticexperiment;
+
+
+public class AutomaticExperimentManagerEvent {
+
+ public AutomaticExperiment experiment;
+ public ErrorAnalysisAlgorithm algorithm;
+ public MANAGER_STATUS status;
+
+ public AutomaticExperimentManagerEvent(AutomaticExperiment automaticExperiment, ErrorAnalysisAlgorithm algorithm, MANAGER_STATUS stat) {
+ this.experiment = automaticExperiment;
+ this.algorithm = algorithm;
+ this.status = stat;
+ }
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentManagerListener.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentManagerListener.java
new file mode 100644
index 0000000..33c8e24
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticExperimentManagerListener.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2009,2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.stem.analysis.automaticexperiment;
+
+public interface AutomaticExperimentManagerListener {
+
+ public void eventReceived(AutomaticExperimentManagerEvent evt);
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticexperimentFactory.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticexperimentFactory.java
new file mode 100644
index 0000000..e4eb2f1
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticexperimentFactory.java
@@ -0,0 +1,69 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage
+ * @generated
+ */
+public interface AutomaticexperimentFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ AutomaticexperimentFactory eINSTANCE = org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticexperimentFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Automatic Experiment</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Automatic Experiment</em>'.
+ * @generated
+ */
+ AutomaticExperiment createAutomaticExperiment();
+
+ /**
+ * Returns a new object of class '<em>Modifiable Parameter</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Modifiable Parameter</em>'.
+ * @generated
+ */
+ ModifiableParameter createModifiableParameter();
+
+ /**
+ * Returns a new object of class '<em>Optimizer Algorithm</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Optimizer Algorithm</em>'.
+ * @generated
+ */
+ OptimizerAlgorithm createOptimizerAlgorithm();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ AutomaticexperimentPackage getAutomaticexperimentPackage();
+
+} //AutomaticexperimentFactory
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticexperimentPackage.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticexperimentPackage.java
new file mode 100644
index 0000000..dcae907
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/AutomaticexperimentPackage.java
@@ -0,0 +1,712 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.stem.core.common.CommonPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface AutomaticexperimentPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "automaticexperiment";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http:///org/eclipse/stem/core/automaticexperiment.ecore";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "org.eclipse.stem.analysis.automaticexperiment";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ AutomaticexperimentPackage eINSTANCE = org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticexperimentPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.stem.analysis.automaticexperiment.impl.OptimizerAlgorithmImpl <em>Optimizer Algorithm</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.OptimizerAlgorithmImpl
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticexperimentPackageImpl#getOptimizerAlgorithm()
+ * @generated
+ */
+ int OPTIMIZER_ALGORITHM = 2;
+
+ /**
+ * The feature id for the '<em><b>URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int OPTIMIZER_ALGORITHM__URI = CommonPackage.IDENTIFIABLE__URI;
+
+ /**
+ * The feature id for the '<em><b>Type URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int OPTIMIZER_ALGORITHM__TYPE_URI = CommonPackage.IDENTIFIABLE__TYPE_URI;
+
+ /**
+ * The feature id for the '<em><b>Dublin Core</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int OPTIMIZER_ALGORITHM__DUBLIN_CORE = CommonPackage.IDENTIFIABLE__DUBLIN_CORE;
+
+ /**
+ * The number of structural features of the '<em>Optimizer Algorithm</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int OPTIMIZER_ALGORITHM_FEATURE_COUNT = CommonPackage.IDENTIFIABLE_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl <em>Automatic Experiment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticexperimentPackageImpl#getAutomaticExperiment()
+ * @generated
+ */
+ int AUTOMATIC_EXPERIMENT = 0;
+
+ /**
+ * The feature id for the '<em><b>URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__URI = OPTIMIZER_ALGORITHM__URI;
+
+ /**
+ * The feature id for the '<em><b>Type URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__TYPE_URI = OPTIMIZER_ALGORITHM__TYPE_URI;
+
+ /**
+ * The feature id for the '<em><b>Dublin Core</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__DUBLIN_CORE = OPTIMIZER_ALGORITHM__DUBLIN_CORE;
+
+ /**
+ * The feature id for the '<em><b>Base Scenario</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__BASE_SCENARIO = OPTIMIZER_ALGORITHM_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Parameters</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__PARAMETERS = OPTIMIZER_ALGORITHM_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Error Analysis Algorithm</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__ERROR_ANALYSIS_ALGORITHM = OPTIMIZER_ALGORITHM_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Error Function</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__ERROR_FUNCTION = OPTIMIZER_ALGORITHM_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Tolerance</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__TOLERANCE = OPTIMIZER_ALGORITHM_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Referance Data Dir</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__REFERANCE_DATA_DIR = OPTIMIZER_ALGORITHM_FEATURE_COUNT + 5;
+
+ /**
+ * The feature id for the '<em><b>Maximum Number Of Iterations</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__MAXIMUM_NUMBER_OF_ITERATIONS = OPTIMIZER_ALGORITHM_FEATURE_COUNT + 6;
+
+ /**
+ * The feature id for the '<em><b>Re Init</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__RE_INIT = OPTIMIZER_ALGORITHM_FEATURE_COUNT + 7;
+
+ /**
+ * The feature id for the '<em><b>Error Func</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT__ERROR_FUNC = OPTIMIZER_ALGORITHM_FEATURE_COUNT + 8;
+
+ /**
+ * The number of structural features of the '<em>Automatic Experiment</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int AUTOMATIC_EXPERIMENT_FEATURE_COUNT = OPTIMIZER_ALGORITHM_FEATURE_COUNT + 9;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl <em>Modifiable Parameter</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticexperimentPackageImpl#getModifiableParameter()
+ * @generated
+ */
+ int MODIFIABLE_PARAMETER = 1;
+
+ /**
+ * The feature id for the '<em><b>Initial Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MODIFIABLE_PARAMETER__INITIAL_VALUE = 0;
+
+ /**
+ * The feature id for the '<em><b>Feature</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MODIFIABLE_PARAMETER__FEATURE = 1;
+
+ /**
+ * The feature id for the '<em><b>Step</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MODIFIABLE_PARAMETER__STEP = 2;
+
+ /**
+ * The feature id for the '<em><b>Feature Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MODIFIABLE_PARAMETER__FEATURE_NAME = 3;
+
+ /**
+ * The feature id for the '<em><b>Lower Bound</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MODIFIABLE_PARAMETER__LOWER_BOUND = 4;
+
+ /**
+ * The feature id for the '<em><b>Upper Bound</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MODIFIABLE_PARAMETER__UPPER_BOUND = 5;
+
+ /**
+ * The feature id for the '<em><b>Target URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MODIFIABLE_PARAMETER__TARGET_URI = 6;
+
+ /**
+ * The number of structural features of the '<em>Modifiable Parameter</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int MODIFIABLE_PARAMETER_FEATURE_COUNT = 7;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment <em>Automatic Experiment</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Automatic Experiment</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment
+ * @generated
+ */
+ EClass getAutomaticExperiment();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getBaseScenario <em>Base Scenario</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Base Scenario</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getBaseScenario()
+ * @see #getAutomaticExperiment()
+ * @generated
+ */
+ EReference getAutomaticExperiment_BaseScenario();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getParameters <em>Parameters</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Parameters</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getParameters()
+ * @see #getAutomaticExperiment()
+ * @generated
+ */
+ EReference getAutomaticExperiment_Parameters();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorAnalysisAlgorithm <em>Error Analysis Algorithm</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Error Analysis Algorithm</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorAnalysisAlgorithm()
+ * @see #getAutomaticExperiment()
+ * @generated
+ */
+ EAttribute getAutomaticExperiment_ErrorAnalysisAlgorithm();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorFunction <em>Error Function</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Error Function</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorFunction()
+ * @see #getAutomaticExperiment()
+ * @generated
+ */
+ EAttribute getAutomaticExperiment_ErrorFunction();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getTolerance <em>Tolerance</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Tolerance</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getTolerance()
+ * @see #getAutomaticExperiment()
+ * @generated
+ */
+ EAttribute getAutomaticExperiment_Tolerance();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getReferanceDataDir <em>Referance Data Dir</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Referance Data Dir</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getReferanceDataDir()
+ * @see #getAutomaticExperiment()
+ * @generated
+ */
+ EAttribute getAutomaticExperiment_ReferanceDataDir();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getMaximumNumberOfIterations <em>Maximum Number Of Iterations</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Maximum Number Of Iterations</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getMaximumNumberOfIterations()
+ * @see #getAutomaticExperiment()
+ * @generated
+ */
+ EAttribute getAutomaticExperiment_MaximumNumberOfIterations();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#isReInit <em>Re Init</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Re Init</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#isReInit()
+ * @see #getAutomaticExperiment()
+ * @generated
+ */
+ EAttribute getAutomaticExperiment_ReInit();
+
+ /**
+ * Returns the meta object for the containment reference '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorFunc <em>Error Func</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference '<em>Error Func</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment#getErrorFunc()
+ * @see #getAutomaticExperiment()
+ * @generated
+ */
+ EReference getAutomaticExperiment_ErrorFunc();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter <em>Modifiable Parameter</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Modifiable Parameter</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter
+ * @generated
+ */
+ EClass getModifiableParameter();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getInitialValue <em>Initial Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Initial Value</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getInitialValue()
+ * @see #getModifiableParameter()
+ * @generated
+ */
+ EAttribute getModifiableParameter_InitialValue();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getFeature <em>Feature</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Feature</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getFeature()
+ * @see #getModifiableParameter()
+ * @generated
+ */
+ EReference getModifiableParameter_Feature();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getStep <em>Step</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Step</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getStep()
+ * @see #getModifiableParameter()
+ * @generated
+ */
+ EAttribute getModifiableParameter_Step();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getFeatureName <em>Feature Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Feature Name</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getFeatureName()
+ * @see #getModifiableParameter()
+ * @generated
+ */
+ EAttribute getModifiableParameter_FeatureName();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getLowerBound <em>Lower Bound</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Lower Bound</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getLowerBound()
+ * @see #getModifiableParameter()
+ * @generated
+ */
+ EAttribute getModifiableParameter_LowerBound();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getUpperBound <em>Upper Bound</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Upper Bound</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getUpperBound()
+ * @see #getModifiableParameter()
+ * @generated
+ */
+ EAttribute getModifiableParameter_UpperBound();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getTargetURI <em>Target URI</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Target URI</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getTargetURI()
+ * @see #getModifiableParameter()
+ * @generated
+ */
+ EAttribute getModifiableParameter_TargetURI();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm <em>Optimizer Algorithm</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Optimizer Algorithm</em>'.
+ * @see org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm
+ * @generated
+ */
+ EClass getOptimizerAlgorithm();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ AutomaticexperimentFactory getAutomaticexperimentFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl <em>Automatic Experiment</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticexperimentPackageImpl#getAutomaticExperiment()
+ * @generated
+ */
+ EClass AUTOMATIC_EXPERIMENT = eINSTANCE.getAutomaticExperiment();
+
+ /**
+ * The meta object literal for the '<em><b>Base Scenario</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference AUTOMATIC_EXPERIMENT__BASE_SCENARIO = eINSTANCE.getAutomaticExperiment_BaseScenario();
+
+ /**
+ * The meta object literal for the '<em><b>Parameters</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference AUTOMATIC_EXPERIMENT__PARAMETERS = eINSTANCE.getAutomaticExperiment_Parameters();
+
+ /**
+ * The meta object literal for the '<em><b>Error Analysis Algorithm</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute AUTOMATIC_EXPERIMENT__ERROR_ANALYSIS_ALGORITHM = eINSTANCE.getAutomaticExperiment_ErrorAnalysisAlgorithm();
+
+ /**
+ * The meta object literal for the '<em><b>Error Function</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute AUTOMATIC_EXPERIMENT__ERROR_FUNCTION = eINSTANCE.getAutomaticExperiment_ErrorFunction();
+
+ /**
+ * The meta object literal for the '<em><b>Tolerance</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute AUTOMATIC_EXPERIMENT__TOLERANCE = eINSTANCE.getAutomaticExperiment_Tolerance();
+
+ /**
+ * The meta object literal for the '<em><b>Referance Data Dir</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute AUTOMATIC_EXPERIMENT__REFERANCE_DATA_DIR = eINSTANCE.getAutomaticExperiment_ReferanceDataDir();
+
+ /**
+ * The meta object literal for the '<em><b>Maximum Number Of Iterations</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute AUTOMATIC_EXPERIMENT__MAXIMUM_NUMBER_OF_ITERATIONS = eINSTANCE.getAutomaticExperiment_MaximumNumberOfIterations();
+
+ /**
+ * The meta object literal for the '<em><b>Re Init</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute AUTOMATIC_EXPERIMENT__RE_INIT = eINSTANCE.getAutomaticExperiment_ReInit();
+
+ /**
+ * The meta object literal for the '<em><b>Error Func</b></em>' containment reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference AUTOMATIC_EXPERIMENT__ERROR_FUNC = eINSTANCE.getAutomaticExperiment_ErrorFunc();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl <em>Modifiable Parameter</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticexperimentPackageImpl#getModifiableParameter()
+ * @generated
+ */
+ EClass MODIFIABLE_PARAMETER = eINSTANCE.getModifiableParameter();
+
+ /**
+ * The meta object literal for the '<em><b>Initial Value</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute MODIFIABLE_PARAMETER__INITIAL_VALUE = eINSTANCE.getModifiableParameter_InitialValue();
+
+ /**
+ * The meta object literal for the '<em><b>Feature</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference MODIFIABLE_PARAMETER__FEATURE = eINSTANCE.getModifiableParameter_Feature();
+
+ /**
+ * The meta object literal for the '<em><b>Step</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute MODIFIABLE_PARAMETER__STEP = eINSTANCE.getModifiableParameter_Step();
+
+ /**
+ * The meta object literal for the '<em><b>Feature Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute MODIFIABLE_PARAMETER__FEATURE_NAME = eINSTANCE.getModifiableParameter_FeatureName();
+
+ /**
+ * The meta object literal for the '<em><b>Lower Bound</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute MODIFIABLE_PARAMETER__LOWER_BOUND = eINSTANCE.getModifiableParameter_LowerBound();
+
+ /**
+ * The meta object literal for the '<em><b>Upper Bound</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute MODIFIABLE_PARAMETER__UPPER_BOUND = eINSTANCE.getModifiableParameter_UpperBound();
+
+ /**
+ * The meta object literal for the '<em><b>Target URI</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute MODIFIABLE_PARAMETER__TARGET_URI = eINSTANCE.getModifiableParameter_TargetURI();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.stem.analysis.automaticexperiment.impl.OptimizerAlgorithmImpl <em>Optimizer Algorithm</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.OptimizerAlgorithmImpl
+ * @see org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticexperimentPackageImpl#getOptimizerAlgorithm()
+ * @generated
+ */
+ EClass OPTIMIZER_ALGORITHM = eINSTANCE.getOptimizerAlgorithm();
+
+ }
+
+} //AutomaticexperimentPackage
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/Constants.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/Constants.java
new file mode 100644
index 0000000..089bc79
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/Constants.java
@@ -0,0 +1,21 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2009,2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+public class Constants {
+
+
+ public final static String ID_ALGORITHM_EXTENSION_POINT = org.eclipse.stem.core.Constants.ID_ROOT
+ + ".analysis.automaticexperiment.algorithm";
+
+ public final static String ALGORITHM_ELEMENT = "classdef";
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/CustomSimulationManager.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/CustomSimulationManager.java
new file mode 100644
index 0000000..4670f2f
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/CustomSimulationManager.java
@@ -0,0 +1,252 @@
+// SimulationManager.java
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+import org.eclipse.stem.core.graph.Graph;
+import org.eclipse.stem.core.graph.GraphFactory;
+import org.eclipse.stem.core.model.Model;
+import org.eclipse.stem.core.scenario.Scenario;
+import org.eclipse.stem.core.scenario.ScenarioPackage;
+import org.eclipse.stem.core.sequencer.Sequencer;
+import org.eclipse.stem.jobs.execution.ExecutableManager;
+import org.eclipse.stem.jobs.simulation.ISimulation;
+import org.eclipse.stem.jobs.simulation.Messages;
+import org.eclipse.stem.jobs.simulation.Simulation;
+import org.eclipse.stem.jobs.simulation.SimulationCaching;
+import org.eclipse.stem.jobs.simulation.SimulationEvent;
+
+/**
+ * This class manages the life-cycle of active {@link Simulation}s. There is a
+ * singleton instance of the manager that is referenced by other parts of the
+ * system to manage {@link Simulation}. It creates {@link Simulation} instances
+ * from {@link Scenario} instances and can obtain {@link Scenario} instances
+ * from file URI's or from {@link IConfigurationElement}'s. It maintains a
+ * collection of all of the active {@link Simulation}s in the system and
+ * generates {@link SimulationEvent}'s whenever a {@link Simulation} is added to
+ * that collection or removed.
+ * <p>
+ * The {@link CustomSimulationManager} maintains a sequence number and assigns
+ * successive values of that number to the {@link Simulation} instances it
+ * creates.
+ */
+public class CustomSimulationManager extends ExecutableManager {
+
+ /**
+ * Singleton instance of the manager
+ */
+ private volatile static CustomSimulationManager INSTANCE = null;
+
+ /**
+ * This is the sequence number assigned to each successive
+ * {@link Simulation} instance the manager creates.
+ */
+ private static int sequenceNumber = 0;
+
+ /**
+ * Constant empty array.
+ */
+ public static final ISimulation[] NONE = new Simulation[] {};
+
+ /**
+ * This is the collection of active {@link Simulation} jobs
+ */
+ private List<ISimulation> activeSimulations = null;
+
+ /**
+ * Constructor
+ */
+ private CustomSimulationManager() {
+ activeSimulations = new ArrayList<ISimulation>();
+
+ Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
+ ScenarioPackage.eNAME, new XMIResourceFactoryImpl());
+ } // SimulationManager
+
+ /**
+ * @return the singleton instance of the model
+ */
+ public static final CustomSimulationManager getManager() {
+ if (INSTANCE == null) {
+ synchronized (CustomSimulationManager.class) {
+ if (INSTANCE == null) {
+ INSTANCE = new CustomSimulationManager();
+ }
+ }
+ }
+ return INSTANCE;
+ } // getModel
+
+ /**
+ * Return the next simulation sequence number and increment the value.
+ *
+ * @return the next simulation sequence number
+ */
+ synchronized private static final int getAndIncrementSimulationSequenceNumber() {
+ return sequenceNumber++;
+ } // getAndIncrementSimulationSequenceNumber
+
+ /**
+ * This is used for testing purposes to reset the state of the model.
+ */
+ public static final void resetSimulationManager() {
+ INSTANCE = null;
+ sequenceNumber = 0;
+ } // resetSimulationManager
+
+ /**
+ * @return the active {@link Simulation}s
+ */
+ public final List<ISimulation> getActiveSimulations() {
+ return activeSimulations;
+ } // getActiveSimulations
+
+ /**
+ * Add a {@link Simulation} to the collection of active {@link Simulation}s.
+ *
+ * @param simulation
+ * the {@link ISimulation} to add
+ */
+ private final void addActiveSimulation(final ISimulation simulation) {
+ activeSimulations.add(simulation);
+ } // addActiveSimulation
+
+ /**
+ * Remove an {@link ISimulation} from the collection of active
+ * {@link ISimulation}s.
+ *
+ * @param simulation
+ * the {@link ISimulation} to remove
+ */
+ public final void removeActiveSimulation(final ISimulation simulation) {
+ activeSimulations.remove(simulation);
+ } // removeActiveSimulation
+
+ /**
+ * Create a {@link ISimulation} from a {@link Scenario} instance.
+ *
+ * @param scenario
+ * the {@link Scenario} to simulate
+ * @param monitor
+ * Progress monitor
+ * @return a {@link ISimulation} that's ready to run.
+ */
+ public ISimulation createSimulation(final Scenario scenario, final IProgressMonitor monitor) {
+ ISimulation retValue = null;
+ try {
+ boolean useCache = false;
+
+ Scenario simulationScenario = null;
+
+ if (useCache) {
+ if (SimulationCaching.INSTANCE.isScenarioInCache(scenario.getURI())) {
+ simulationScenario = SimulationCaching.INSTANCE.getCachedScenario(scenario.getURI());
+ boolean running = false;
+ for(ISimulation sim : getActiveSimulations()) {
+ if(sim.getScenario().equals(simulationScenario)) {
+ // The scenario is already running. Copy the whole scenario before resetting
+ Scenario newSimulation = null;
+ newSimulation = (Scenario)EcoreUtil.copy(simulationScenario);
+ if(simulationScenario.getModel() != null) newSimulation.setModel((Model)EcoreUtil.copy(simulationScenario.getModel()));
+ if(simulationScenario.getSequencer() != null) newSimulation.setSequencer((Sequencer)EcoreUtil.copy(simulationScenario.getSequencer()));
+ running = true;
+ break;
+ }
+ }
+ if(!running)simulationScenario.reset(); // safe since canonical graph is set
+ }
+ else {
+ // Read scenario
+ // Add to cache
+ SimulationCaching.INSTANCE.addScenarioToCache(scenario);
+ }
+
+ }
+
+ if(scenario.getCanonicalGraph() == null)
+ scenario.initialize(); // needed for preferences ...
+ else scenario.reset();
+ final Simulation simulation = new Simulation(scenario,
+ getAndIncrementSimulationSequenceNumber(), GraphFactory.eINSTANCE.createSimpleGraphPartitioner());
+ simulation.setPriority(Job.LONG);
+ retValue = simulation;
+
+ addActiveSimulation(retValue);
+ } catch (final RuntimeException e) {
+ // We could get an exception here if the Scenario doesn't have
+ // a Sequencer or Model which would cause problems when trying to
+ // initialize
+ Simulation.handleException(scenario, scenario.getDublinCore()
+ .getTitle(), true, e);
+ retValue = null;
+ }
+ return retValue;
+ } // createSimulation
+
+ /**
+ * Create a {@link ISimulation} from a {@link Scenario} instance and then
+ * start it running.
+ *
+ * @param scenario
+ * the {@link Scenario} to be simulated
+ */
+ public void createAndRunSimulation(final Scenario scenario) {
+ new Job(Messages.getString("SimMgr.Start_Sim")) { //$NON-NLS-1$
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ try {
+ final ISimulation simulation = createSimulation(scenario, monitor);
+ monitor.subTask(Messages.getString("SimMgr.Run")); //$NON-NLS-1$
+ simulation.run();
+ } catch (final Exception e) {
+ // The error was logged in createSimulation
+ monitor.done();
+ } // catch Exception
+ return Status.OK_STATUS;
+ } // run
+ }.schedule();
+ } // createAndRunSimulation
+
+ /**
+ * Given a {@link Graph} find the {@link ISimulation} that created it.
+ *
+ * @param graph
+ * an instance of a {@link Graph}
+ * @return the {@link ISimulation} instance that created the {@link Graph},
+ * <code>null</code>, if no match could be found.
+ */
+ public ISimulation mapGraphToSimulation(final Graph graph) {
+ ISimulation retValue = null;
+ for (final ISimulation simulation : activeSimulations) {
+ final Graph simulationGraph = simulation.getScenario()
+ .getCanonicalGraph();
+ // Is this the one we're looking for?
+ if (graph == simulationGraph) {
+ // Yes
+ retValue = simulation;
+ break;
+ } // if
+ } // for each ISimulation
+ return retValue;
+ } // mapGraphToSimulation
+} // SimulationManager
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithm.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithm.java
new file mode 100644
index 0000000..b6b7fab
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithm.java
@@ -0,0 +1,36 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import java.util.List;
+
+import org.eclipse.stem.analysis.ErrorFunction;
+import org.eclipse.stem.core.scenario.Scenario;
+
+
+public interface ErrorAnalysisAlgorithm {
+ public void setErrorFunction(final ErrorFunction errorFunction);
+ public void setParameters(final List<ModifiableParameter> parameters);
+ public void setTolerance(final double tolerance);
+ public void setBaseScenario(final Scenario baseScenario);
+ public void setReferenceDataDirectory(final String referenceDataDir);
+ public void setMaximumNumberOfIterations(final long maxNumOfIterations);
+ public double[] getResultParameters();
+ public double getResultValue();
+ public void execute();
+ public void init(AutomaticExperiment automaticExperiment, ErrorAnalysisAlgorithm alg);
+ public void reinitStartParams(AutomaticExperiment exp, double [] vals);
+ public void addListener(ErrorAnalysisAlgorithmListener listener);
+ public void clearListeners();
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithmEvent.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithmEvent.java
new file mode 100644
index 0000000..899ed36
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithmEvent.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009,2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.stem.analysis.automaticexperiment;
+
+import org.eclipse.stem.analysis.ErrorResult;
+
+public class ErrorAnalysisAlgorithmEvent {
+ public ErrorResult result;
+ public ALGORITHM_STATUS status;
+ public String [] parameterNames;
+ public double [] parameterValues;
+
+ public ErrorAnalysisAlgorithmEvent(ErrorResult res, ALGORITHM_STATUS status) {
+ this.result = res;
+ this.status = status;
+ }
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithmFactory.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithmFactory.java
new file mode 100644
index 0000000..acc39b3
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithmFactory.java
@@ -0,0 +1,27 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+public class ErrorAnalysisAlgorithmFactory {
+ public final static ErrorAnalysisAlgorithmFactory INSTANCE = new ErrorAnalysisAlgorithmFactory();
+
+ public ErrorAnalysisAlgorithm createErrorAnalysisAlgorithm(final OptimizerAlgorithm alg)
+ {
+ ErrorAnalysisAlgorithm algorithm = null;
+
+ if (alg instanceof AutomaticExperiment) { // Need to fix this
+ algorithm = new SimplexAlgorithmExecuter();
+ }
+ return algorithm;
+ }
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithmListener.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithmListener.java
new file mode 100644
index 0000000..a53d077
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ErrorAnalysisAlgorithmListener.java
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2009,2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.stem.analysis.automaticexperiment;
+
+public interface ErrorAnalysisAlgorithmListener {
+
+ public void eventReceived(ErrorAnalysisAlgorithmEvent evt);
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/MANAGER_STATUS.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/MANAGER_STATUS.java
new file mode 100644
index 0000000..b579f2b
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/MANAGER_STATUS.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2009,2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.stem.analysis.automaticexperiment;
+
+public enum MANAGER_STATUS {
+ SCHEDULED;
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ModifiableParameter.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ModifiableParameter.java
new file mode 100644
index 0000000..8ffcb41
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ModifiableParameter.java
@@ -0,0 +1,225 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Modifiable Parameter</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getInitialValue <em>Initial Value</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getFeature <em>Feature</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getStep <em>Step</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getFeatureName <em>Feature Name</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getLowerBound <em>Lower Bound</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getUpperBound <em>Upper Bound</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getTargetURI <em>Target URI</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getModifiableParameter()
+ * @model
+ * @generated
+ */
+public interface ModifiableParameter extends EObject {
+ /**
+ * Returns the value of the '<em><b>Initial Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Initial Value</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Initial Value</em>' attribute.
+ * @see #setInitialValue(double)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getModifiableParameter_InitialValue()
+ * @model required="true"
+ * @generated
+ */
+ double getInitialValue();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getInitialValue <em>Initial Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Initial Value</em>' attribute.
+ * @see #getInitialValue()
+ * @generated
+ */
+ void setInitialValue(double value);
+
+ /**
+ * Returns the value of the '<em><b>Feature</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Feature</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Feature</em>' reference.
+ * @see #setFeature(EStructuralFeature)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getModifiableParameter_Feature()
+ * @model required="true"
+ * @generated
+ */
+ EStructuralFeature getFeature();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getFeature <em>Feature</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Feature</em>' reference.
+ * @see #getFeature()
+ * @generated
+ */
+ void setFeature(EStructuralFeature value);
+
+ /**
+ * Returns the value of the '<em><b>Step</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Step</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Step</em>' attribute.
+ * @see #setStep(double)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getModifiableParameter_Step()
+ * @model required="true"
+ * @generated
+ */
+ double getStep();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getStep <em>Step</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Step</em>' attribute.
+ * @see #getStep()
+ * @generated
+ */
+ void setStep(double value);
+
+ /**
+ * Returns the value of the '<em><b>Feature Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Feature Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Feature Name</em>' attribute.
+ * @see #setFeatureName(String)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getModifiableParameter_FeatureName()
+ * @model required="true"
+ * @generated
+ */
+ String getFeatureName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getFeatureName <em>Feature Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Feature Name</em>' attribute.
+ * @see #getFeatureName()
+ * @generated
+ */
+ void setFeatureName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Lower Bound</b></em>' attribute.
+ * The default value is <code>"-1"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Lower Bound</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Lower Bound</em>' attribute.
+ * @see #setLowerBound(double)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getModifiableParameter_LowerBound()
+ * @model default="-1"
+ * @generated
+ */
+ double getLowerBound();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getLowerBound <em>Lower Bound</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Lower Bound</em>' attribute.
+ * @see #getLowerBound()
+ * @generated
+ */
+ void setLowerBound(double value);
+
+ /**
+ * Returns the value of the '<em><b>Upper Bound</b></em>' attribute.
+ * The default value is <code>"-1"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Upper Bound</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Upper Bound</em>' attribute.
+ * @see #setUpperBound(double)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getModifiableParameter_UpperBound()
+ * @model default="-1"
+ * @generated
+ */
+ double getUpperBound();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getUpperBound <em>Upper Bound</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Upper Bound</em>' attribute.
+ * @see #getUpperBound()
+ * @generated
+ */
+ void setUpperBound(double value);
+
+ /**
+ * Returns the value of the '<em><b>Target URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target URI</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target URI</em>' attribute.
+ * @see #setTargetURI(URI)
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getModifiableParameter_TargetURI()
+ * @model dataType="org.eclipse.stem.core.common.URI"
+ * @generated
+ */
+ URI getTargetURI();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter#getTargetURI <em>Target URI</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target URI</em>' attribute.
+ * @see #getTargetURI()
+ * @generated
+ */
+ void setTargetURI(URI value);
+
+} // ModifiableParameter
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/NelderMeadAlgorithm.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/NelderMeadAlgorithm.java
new file mode 100644
index 0000000..38dd678
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/NelderMeadAlgorithm.java
@@ -0,0 +1,444 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+import java.util.ArrayList;
+
+import org.eclipse.stem.analysis.ErrorResult;
+
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/**
+ * Minimizes a function using the Nelder-Mead algorithm.
+ *
+ * Simplex function minimisation procedure due to Nelder+Mead(1965), as
+ * implemented by O'Neill(1971, Appl.Statist. 20, 338-45), with subsequent
+ * comments by Chambers+Ertel(1974, 23, 250-1), Benyon(1976, 25, 97) and
+ * Hill(1978, 27, 380-2)
+ *
+ * Authors:
+ *
+ * Based on FORTRAN77 version by R ONeill
+ *
+ * Reference:
+ *
+ * John Nelder, Roger Mead, A simplex method for function minimization, Computer
+ * Journal, Volume 7, 1965, pages 308-313.
+ *
+ * This Java version by Yossi Mesika
+ * R ONeill, Algorithm AS 47: Function Minimization Using a Simplex Procedure,
+ * Applied Statistics, Volume 20, Number 3, 1971, pages 338-345.
+ */
+public class NelderMeadAlgorithm implements SimplexAlgorithm {
+
+ double ccoeff = 0.5;
+ double del;
+ double dn;
+ double dnn;
+ double ecoeff = 2.0;
+ double eps = 0.001;
+ int i;
+ int ihi;
+ int ilo;
+ int j;
+ int jcount;
+ int l;
+ int nn;
+ double[] p;
+ double[] p2star;
+ double[] pbar;
+ double[] pstar;
+ double rcoeff = 1.0;
+ double rq;
+ double x;
+ ErrorResult[] y;
+ ErrorResult y2star;
+ ErrorResult ylo;
+ ErrorResult ystar;
+ double z;
+
+ int ifault = -1;
+ int numres = -1;
+ int icount = -1;
+ ErrorResult ynewlo;
+ double[] xmin;
+
+ ArrayList<Double> minParamValues = new ArrayList<Double>();
+ ArrayList<Double> maxParamValues = new ArrayList<Double>();
+
+ public void execute(final SimplexFunction fn, final double[] startPoint,
+ final double[] step, final double terminatingVariance, long maxIter) {
+ execute(fn, startPoint, terminatingVariance, step,
+ 1, (int)maxIter);
+ }
+
+ /**
+ * @param fn the {@link SimplexFunction} to be minimized
+ * @param start a starting point for the first iteration
+ * @param reqmin the terminating limit for the variance of function values
+ * @param step determines the size and shape of the initial simplex. The relative magnitudes of
+ * its elements should reflect the units of the variables.
+ * @param konvge the convergence check is carried out every KONVGE iterations
+ * @param kcoun the maximum number of function evaluations
+ */
+ private void execute(SimplexFunction fn, double start[], double reqmin, double step[], int konvge, int kcount) {
+ int n = start.length;
+ //
+ // Check the input parameters.
+ //
+ if (reqmin <= 0.0) {
+ ifault = 1;
+ return;
+ }
+
+ if (n < 1) {
+ ifault = 1;
+ return;
+ }
+
+ if (konvge < 1) {
+ ifault = 1;
+ return;
+ }
+
+ p = new double[n * (n + 1)];
+ pstar = new double[n];
+ p2star = new double[n];
+ pbar = new double[n];
+ y = new ErrorResult[n + 1];
+ xmin = new double[n];
+
+ icount = 0;
+ numres = 0;
+
+ jcount = konvge;
+ dn = (n);
+ nn = n + 1;
+ dnn = (nn);
+ del = 1.0;
+ rq = reqmin * dn;
+ //
+ // Initial or restarted loop.
+ //
+ for (;;) {
+ if(AutomaticExperimentManager.QUIT_NOW) break;
+ for (i = 0; i < n; i++) {
+ p[i + n * n] = start[i];
+ }
+ limit(start);
+ y[n] = fn.getValue(start).copy();
+ icount = icount + 1;
+
+ for (j = 0; j < n; j++) {
+ x = start[j];
+ start[j] = start[j] + step[j] * del;
+ for (i = 0; i < n; i++) {
+ p[i + j * n] = start[i];
+ }
+ limit(start);
+ y[j] = fn.getValue(start).copy();
+ icount = icount + 1;
+ start[j] = x;
+ if(AutomaticExperimentManager.QUIT_NOW) break;
+ }
+ if(AutomaticExperimentManager.QUIT_NOW) break;
+
+ //
+ // The simplex construction is complete.
+ //
+ // Find highest and lowest Y values. YNEWLO = Y(IHI) indicates
+ // the vertex of the simplex to be replaced.
+ //
+ ylo = y[0].copy();
+ ilo = 0;
+
+ for (i = 1; i < nn; i++) {
+ if (y[i].getError() < ylo.getError()) {
+ ylo = y[i].copy();
+ ilo = i;
+ }
+ }
+ //
+ // Inner loop.
+ //
+ for (;;) {
+ if(AutomaticExperimentManager.QUIT_NOW) break;
+ if (kcount != -1 && kcount <= icount) {
+ break;
+ }
+ ynewlo = y[0].copy();
+ ihi = 0;
+
+ for (i = 1; i < nn; i++) {
+ if (ynewlo.getError() < y[i].getError()) {
+ ynewlo = y[i].copy();
+ ihi = i;
+ }
+ }
+ //
+ // Calculate PBAR, the centroid of the simplex vertices
+ // excepting the vertex with Y value YNEWLO.
+ //
+ for (i = 0; i < n; i++) {
+ z = 0.0;
+ for (j = 0; j < nn; j++) {
+ z = z + p[i + j * n];
+ }
+ z = z - p[i + ihi * n];
+ pbar[i] = z / dn;
+ }
+ //
+ // Reflection through the centroid.
+ //
+ for (i = 0; i < n; i++) {
+ pstar[i] = pbar[i] + rcoeff * (pbar[i] - p[i + ihi * n]);
+ }
+ limit(pstar);
+ ystar = fn.getValue(pstar).copy();
+ icount = icount + 1;
+ //
+ // Successful reflection, so extension.
+ //
+ if (ystar.getError() < ylo.getError()) {
+ for (i = 0; i < n; i++) {
+ p2star[i] = pbar[i] + ecoeff * (pstar[i] - pbar[i]);
+ }
+ limit(p2star);
+ y2star = fn.getValue(p2star).copy();
+ icount = icount + 1;
+ //
+ // Check extension.
+ //
+ if (ystar.getError() < y2star.getError()) {
+ for (i = 0; i < n; i++) {
+ p[i + ihi * n] = pstar[i];
+ }
+ y[ihi] = ystar.copy();
+ }
+ //
+ // Retain extension or contraction.
+ //
+ else {
+ for (i = 0; i < n; i++) {
+ p[i + ihi * n] = p2star[i];
+ }
+ y[ihi] = y2star.copy();
+ }
+ }
+ //
+ // No extension.
+ //
+ else {
+ l = 0;
+ for (i = 0; i < nn; i++) {
+ if (ystar.getError() < y[i].getError()) {
+ l = l + 1;
+ }
+ }
+
+ if (1 < l) {
+ for (i = 0; i < n; i++) {
+ p[i + ihi * n] = pstar[i];
+ }
+ y[ihi] = ystar.copy();
+ }
+ //
+ // Contraction on the Y(IHI) side of the centroid.
+ //
+ else if (l == 0) {
+ for (i = 0; i < n; i++) {
+ p2star[i] = pbar[i] + ccoeff
+ * (p[i + ihi * n] - pbar[i]);
+ }
+ limit(p2star);
+ y2star = fn.getValue(p2star).copy();
+ icount = icount + 1;
+ //
+ // Contract the whole simplex.
+ //
+ if (y[ihi].getError() < y2star.getError()) {
+ for (j = 0; j < nn; j++) {
+ for (i = 0; i < n; i++) {
+ p[i + j * n] = (p[i + j * n] + p[i + ilo
+ * n]) * 0.5;
+ xmin[i] = p[i + j * n];
+ }
+ limit(xmin);
+ y[j] = fn.getValue(xmin).copy();
+ icount = icount + 1;
+ }
+ ylo = y[0];
+ ilo = 0;
+
+ for (i = 1; i < nn; i++) {
+ if (y[i].getError() < ylo.getError()) {
+ ylo = y[i].copy();
+ ilo = i;
+ }
+ }
+ continue;
+ }
+ //
+ // Retain contraction.
+ //
+ else {
+ for (i = 0; i < n; i++) {
+ p[i + ihi * n] = p2star[i];
+ }
+ y[ihi] = y2star.copy();
+ }
+ }
+ //
+ // Contraction on the reflection side of the centroid.
+ //
+ else if (l == 1) {
+ for (i = 0; i < n; i++) {
+ p2star[i] = pbar[i] + ccoeff * (pstar[i] - pbar[i]);
+ }
+ limit(p2star);
+ y2star = fn.getValue(p2star).copy();
+ icount = icount + 1;
+ //
+ // Retain reflection?
+ //
+ if (y2star.getError() <= ystar.getError()) {
+ for (i = 0; i < n; i++) {
+ p[i + ihi * n] = p2star[i];
+ }
+ y[ihi] = y2star.copy();
+ } else {
+ for (i = 0; i < n; i++) {
+ p[i + ihi * n] = pstar[i];
+ }
+ y[ihi] = ystar.copy();
+ }
+ }
+ }
+ //
+ // Check if YLO improved.
+ //
+ if (y[ihi].getError() < ylo.getError()) {
+ ylo = y[ihi].copy();
+ ilo = ihi;
+ }
+ jcount = jcount - 1;
+
+ if (0 < jcount) {
+ continue;
+ }
+ //
+ // Check to see if minimum reached.
+ //
+ if (kcount == -1 || icount <= kcount) {
+ jcount = konvge;
+
+ z = 0.0;
+ for (i = 0; i < nn; i++) {
+ z = z + y[i].getError();
+ }
+ x = z / dnn;
+
+ z = 0.0;
+ for (i = 0; i < nn; i++) {
+ z = z + Math.pow(y[i].getError() - x, 2);
+ }
+
+ if (z <= rq) {
+ break;
+ }
+ }
+ }
+ //
+ // Factorial tests to check that YNEWLO is a local minimum.
+ //
+ for (i = 0; i < n; i++) {
+ xmin[i] = p[i + ilo * n];
+ }
+ ynewlo = y[ilo].copy();
+ break;
+ /* Commented out for 1.2.1 release. The automatic experiment
+ * does not converge without taking out the local minimum check.
+ *
+ if (kcount != -1 && kcount < icount) {
+ ifault = 2;
+ break;
+ }
+
+ ifault = 0;
+
+ for (i = 0; i < n; i++) {
+ del = step[i] * eps;
+ xmin[i] = xmin[i] + del;
+ limit(xmin);
+ z = fn.getValue(xmin).getError();
+ icount = icount + 1;
+ if (z < ynewlo.getError()) {
+ ifault = 2;
+ break;
+ }
+ xmin[i] = xmin[i] - del - del;
+ limit(xmin);
+ z = fn.getValue(xmin).getError();
+ icount = icount + 1;
+ if (z < ynewlo.getError()) {
+ ifault = 2;
+ break;
+ }
+ xmin[i] = xmin[i] + del;
+ if(AutomaticExperimentManager.QUIT_NOW) break;
+ }
+
+ if (ifault == 0 || AutomaticExperimentManager.QUIT_NOW) {
+ break;
+ }
+ //
+ // Restart the procedure.
+ //
+ for (i = 0; i < n; i++) {
+ start[i] = xmin[i];
+ }
+ del = eps;
+ numres = numres + 1;
+ if(AutomaticExperimentManager.QUIT_NOW) break;
+ */
+ }
+ }
+
+ private void limit(double []vals) {
+ for(int i=0;i<vals.length;++i) {
+ if(vals[i]<minParamValues.get(i)) vals[i] = minParamValues.get(i);
+ else if(vals[i]>maxParamValues.get(i)) vals[i] = maxParamValues.get(i);
+ }
+ }
+ public double getMinimumFunctionValue() {
+ if(this.ynewlo != null)
+ return this.ynewlo.getError();
+ return -1; // the algorithm was probably interrupted.
+ }
+ public ErrorResult getMinimumErrorResult() {
+ return this.ynewlo;
+ }
+ public double[] getMinimumParametersValues() {
+ return this.xmin;
+ }
+
+ public void setParameterLimits(final int parameterIndex,
+ final double lowerBound, final double upperBound) {
+ for(int i=0;i<parameterIndex+1-minParamValues.size();++i) minParamValues.add(0.0);
+ for(int i=0;i<parameterIndex+1-maxParamValues.size();++i) maxParamValues.add(0.0);
+ minParamValues.ensureCapacity(parameterIndex+1);
+ maxParamValues.ensureCapacity(parameterIndex+1);
+ minParamValues.set(parameterIndex, lowerBound);
+ maxParamValues.set(parameterIndex,upperBound);
+
+ }
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/OptimizerAlgorithm.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/OptimizerAlgorithm.java
new file mode 100644
index 0000000..aca357b
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/OptimizerAlgorithm.java
@@ -0,0 +1,27 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.stem.core.common.Identifiable;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Optimizer Algorithm</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#getOptimizerAlgorithm()
+ * @model
+ * @generated
+ */
+public interface OptimizerAlgorithm extends Identifiable {
+} // OptimizerAlgorithm
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexAlgorithm.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexAlgorithm.java
new file mode 100644
index 0000000..5f0a74b
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexAlgorithm.java
@@ -0,0 +1,24 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+import org.eclipse.stem.analysis.ErrorResult;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+public interface SimplexAlgorithm {
+ public final static double NO_LIMIT = -1;
+
+ public void execute(final SimplexFunction fn, final double[] startPoints, final double[] step, final double terminatingVariance, long maxIter);
+ public double getMinimumFunctionValue();
+ public ErrorResult getMinimumErrorResult();
+ public double[] getMinimumParametersValues();
+ public void setParameterLimits(final int parameterIndex, final double lowerBound, final double upperBound);
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexAlgorithmExecuter.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexAlgorithmExecuter.java
new file mode 100644
index 0000000..1d4ab8a
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexAlgorithmExecuter.java
@@ -0,0 +1,336 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+/**
+ * Implementation was taken from: http://www.ee.ucl.ac.uk/~mflanaga/java/Minimisation.html#simplex
+ */
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.stem.analysis.ErrorFunction;
+import org.eclipse.stem.analysis.ErrorResult;
+import org.eclipse.stem.analysis.ScenarioInitializationException;
+import org.eclipse.stem.analysis.automaticexperiment.views.AutoExpControl;
+import org.eclipse.stem.analysis.impl.ReferenceScenarioDataMapImpl;
+import org.eclipse.stem.analysis.util.CSVscenarioLoader;
+import org.eclipse.stem.core.model.Decorator;
+import org.eclipse.stem.core.model.IntegrationDecorator;
+import org.eclipse.stem.core.scenario.Scenario;
+import org.eclipse.stem.diseasemodels.standard.DiseaseModel;
+import org.eclipse.stem.jobs.simulation.ISimulation;
+import org.eclipse.stem.jobs.simulation.Simulation;
+import org.eclipse.stem.util.loggers.views.CustomCSVLogger;
+
+
+public class SimplexAlgorithmExecuter
+ extends AbstractErrorAnalysisAlgorithm {
+
+ private ISimulation simulation = null;
+ private CustomCSVLogger csvLogger = null;
+ private final static String SIMULATION_OUTPUT_DIR = Platform.getLocation() + File.separator + "AutoExpTempDir";
+ private final static String LOG_FILE_NAME = SIMULATION_OUTPUT_DIR+File.separator+"resultLog.csv";
+ static String LS = System.getProperty("line.separator");
+ private final CustomSimulationManager simMgr = CustomSimulationManager.getManager();
+ private ReferenceScenarioDataMapImpl ref;
+ private static AutoExpControl aeControl = null;
+
+
+ /**
+ * @see org.eclipse.stem.analysis.automaticexperiment.AbstractErrorAnalysisAlgorithm#execute()
+ */
+ @Override
+ public void execute() {
+ double prevmin = Double.MAX_VALUE;
+ double [] prevvals = new double[initialParamsValues.length];
+ double [] minvals;
+ String [] parameterNames=null;
+ if (parameters != null) {
+ parameterNames = new String[parameters.size()];
+ int i=0;
+ for (final ModifiableParameter param:parameters) {
+ parameterNames[i++] = param.getFeatureName();
+ }
+ }
+
+ for(;;) {
+ for(int i=0;i<initialParamsValues.length;++i) prevvals[i] = initialParamsValues[i];
+ long before = System.currentTimeMillis();
+ simplexAlgorithm.execute(simplexFnToMinimize, initialParamsValues, paramsInitialSteps, tolerance, this.maxNumOfIterations);
+ long after = System.currentTimeMillis();
+ if(AutomaticExperimentManager.QUIT_NOW)
+ AutomaticExperimentManager.stopLatch.countDown();
+ if(!this.repeat || AutomaticExperimentManager.QUIT_NOW) {
+// Activator.logInformation("splunge");
+// Activator.logInformation("\n\nTime to execute the Nedler-Mead Algorithm: " + (after-before)/1000 + " seconds");
+// Activator.logInformation("Minimum value: " + simplexAlgorithm.getMinimumFunctionValue());
+// Activator.logInformation("Validation error: " + simplexAlgorithm.getMinimumErrorResult().getValidationError());
+// Activator.logInformation("Parameters values: " + Arrays.toString(simplexAlgorithm.getMinimumParametersValues()));
+ minvals = simplexAlgorithm.getMinimumParametersValues();
+ break;
+ }
+ double newmin = simplexAlgorithm.getMinimumFunctionValue();
+ if(newmin >= prevmin) {
+// Activator.logInformation("\n\nTime to execute the Nedler-Mead Algorithm: " + (after-before)/1000 + " seconds");
+// Activator.logInformation("Minimum value: " + prevmin);
+// Activator.logInformation("Validation error: " + simplexAlgorithm.getMinimumErrorResult().getValidationError());
+// Activator.logInformation("Parameters values: " + Arrays.toString(prevvals));
+ minvals = prevvals;
+ break; // we couldn't improve
+ }
+ // Not same, reinit with new minimum
+ prevmin = simplexAlgorithm.getMinimumFunctionValue();
+
+ for(int i=0;i<initialParamsValues.length;++i){
+ initialParamsValues[i] = simplexAlgorithm.getMinimumParametersValues()[i];
+ prevvals[i] = simplexAlgorithm.getMinimumParametersValues()[i];
+ }
+ ErrorAnalysisAlgorithmEvent newEvent = new ErrorAnalysisAlgorithmEvent(simplexAlgorithm.getMinimumErrorResult(), ALGORITHM_STATUS.RESTARTED_ALGORITHM);
+ newEvent.parameterNames = parameterNames;
+ newEvent.parameterValues = simplexAlgorithm.getMinimumParametersValues();
+ this.fireEvent(newEvent);
+
+ }
+ ErrorAnalysisAlgorithmEvent newEvent = new ErrorAnalysisAlgorithmEvent(simplexAlgorithm.getMinimumErrorResult(), ALGORITHM_STATUS.FINISHED_ALGORITHM);
+ newEvent.parameterNames = parameterNames;
+ newEvent.parameterValues = minvals;
+ this.fireEvent(newEvent);
+ }
+
+ public void init(AutomaticExperiment automaticExperiment, ErrorAnalysisAlgorithm alg) {
+ super.init(automaticExperiment);
+ simplexFnToMinimize = new NedlearMeadSimplexFunction(parameters, baseScenario, errorFunction, alg);
+ try {
+ CSVscenarioLoader loader1 = new CSVscenarioLoader(referenceDataDirectory);
+ int res = loader1.getMaxResolution();
+ ref = loader1.parseAllFiles(res);
+ } catch (ScenarioInitializationException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void setParameters(List<ModifiableParameter> parameters) {
+ super.setParameters(parameters);
+
+ //Set lower and upper bounds constraints for the parameters
+ int paramIndex=0;
+ for (final ModifiableParameter param:parameters) {
+ simplexAlgorithm.setParameterLimits(paramIndex, param.getLowerBound(), param.getUpperBound());
+ paramIndex++;
+ }
+ }
+
+ /**
+ *
+ */
+ public class NedlearMeadSimplexFunction
+ implements SimplexFunction
+ {
+ private ErrorFunction errorFunction = null;
+ private String[] parameterNames = null;
+ private FileWriter resultWriter;
+ private URI[] decoratorURIs = null;
+ private ErrorAnalysisAlgorithm algorithm = null;
+
+ public NedlearMeadSimplexFunction(
+ final List<ModifiableParameter> parameters,
+ final Scenario pBaseScenario,
+ final ErrorFunction errorFunction,
+ final ErrorAnalysisAlgorithm algorithm) {
+
+ try {
+ File d= new File(SIMULATION_OUTPUT_DIR);
+ if(!d.exists())d.mkdirs();
+ resultWriter = new FileWriter(LOG_FILE_NAME);
+ baseScenario = pBaseScenario;
+ this.errorFunction = errorFunction;
+ this.algorithm = algorithm;
+
+ if (parameters != null) {
+ parameterNames = new String[parameters.size()];
+ decoratorURIs = new URI[parameters.size()];
+ int i=0;
+ for (final ModifiableParameter param:parameters) {
+ decoratorURIs[i]=param.getTargetURI();
+ parameterNames[i++] = param.getFeatureName();
+ resultWriter.write(parameterNames[i-1]);
+ resultWriter.write(",");
+ }
+ resultWriter.write("error");
+ resultWriter.write(LS);
+ }
+ } catch(IOException ioe) {
+ ioe.printStackTrace();
+ }
+ }
+
+ public ErrorResult getValue(double[] parameters) {
+
+
+ simulation = createSimulation(baseScenario);
+ simulation.setSequenceNumber(simulation.getSequenceNumber()+1);
+
+ // Descend into the Scenario looking for something with a double field
+ final EList<Decorator> decs = baseScenario.getCanonicalGraph().getDecorators();
+
+ Decorator defaultDecorator = null;
+ for (Decorator decorator : decs) {
+ if (decorator instanceof DiseaseModel) {
+ defaultDecorator = decorator;
+ break;
+ }
+ }
+
+ for(int i=0;i<parameterNames.length;++i) {
+ Decorator decorator = defaultDecorator;
+ if(decoratorURIs[i] != null)
+ for(Decorator scenarioDec:decs)
+ if(decoratorURIs[i].toString().equals(scenarioDec.getURI().toString())) {
+ decorator = scenarioDec;
+ break;
+ }
+ for (EAttribute attribute : decorator.eClass().getEAllAttributes())
+ if(attribute.getName().equals(parameterNames[i]))
+ decorator.eSet(attribute, new Double(parameters[i]));
+ }
+
+
+ String uniqueID = null;
+
+ if (simulation != null) {
+ uniqueID = simulation.getUniqueIDString();
+ }
+ String directoryName = SIMULATION_OUTPUT_DIR + File.separator+uniqueID + File.separator;
+
+ File dir = new File(directoryName);
+ if(!dir.exists())
+ dir.mkdirs();
+
+
+ csvLogger = new CustomCSVLogger(directoryName, simulation, (IntegrationDecorator) defaultDecorator);
+
+ // This will reinit the infectors/inoc etc to the new values
+ baseScenario.reset();
+
+
+ //Run the simulation with the new parameters and return the error value
+// Activator.logInformation("Running the simulation with the following parameters: ");
+// Activator.logInformation("\tParameters Names: " + Arrays.toString(parameterNames));
+// Activator.logInformation("\tParameters Values: " + Arrays.toString(parameters));
+ double error = 0.0;
+ ErrorResult result = null;
+ try {
+ for(double val:parameters) resultWriter.write(val+",");
+ ErrorAnalysisAlgorithmEvent newEvent = new ErrorAnalysisAlgorithmEvent(null, ALGORITHM_STATUS.STARTING_SIMULATION);
+ newEvent.parameterNames = parameterNames;
+ newEvent.parameterValues = parameters;
+ ((AbstractErrorAnalysisAlgorithm)algorithm).fireEvent(
+ newEvent);
+ runSimulation(simulation);
+
+ result = getErrorValue(simulation.getUniqueIDString());
+
+ newEvent = new ErrorAnalysisAlgorithmEvent(result, ALGORITHM_STATUS.FINISHED_SIMULATION);
+ newEvent.parameterNames = parameterNames;
+ newEvent.parameterValues = parameters;
+
+ ((AbstractErrorAnalysisAlgorithm)algorithm).fireEvent(
+ newEvent);
+
+ error = result.getError();
+
+// Activator.logInformation(" Error is: " + error);
+// Activator.logInformation(" Error in validation data set is: " + result.getValidationError());
+ resultWriter.write(error+"");
+ resultWriter.write(LS);
+ resultWriter.flush();
+
+ // TODO: GUI output here
+
+
+
+ } catch(IOException ioe) {
+ ioe.printStackTrace();
+ }
+ cleanup();
+
+ return result;
+ }
+
+ private ErrorResult getErrorValue(String simulationUniqueId) {
+ ErrorResult result = null;
+ try {
+ final EList<Decorator> decs = baseScenario.getCanonicalGraph().getDecorators();
+
+ DiseaseModel defaultDecorator = null;
+ for (Decorator decorator : decs) {
+ if (decorator instanceof DiseaseModel) {
+ defaultDecorator = (DiseaseModel)decorator;
+ break;
+ }
+ }
+
+ if (defaultDecorator != null) {
+ CSVscenarioLoader loader2 = new CSVscenarioLoader(SIMULATION_OUTPUT_DIR + File.separator + simulationUniqueId +"/"+defaultDecorator.getDiseaseName()+"/"+defaultDecorator.getPopulationIdentifier());
+ int maxres = loader2.getMaxResolution();
+ ReferenceScenarioDataMapImpl data = loader2.parseAllFiles(maxres);
+
+ result = errorFunction.calculateError(ref, data);
+ }
+ } catch (ScenarioInitializationException e) {
+ e.printStackTrace();
+ }
+ return result;
+ }
+
+ private void runSimulation(final ISimulation simulationToRun) {
+ long before = System.currentTimeMillis();
+ simulationToRun.run();
+ try {
+ simulationToRun.join();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ simulationToRun.stop();
+
+ long after = System.currentTimeMillis();
+// Activator.logInformation("It took " + (after-before)/1000 + " seconds to run the simulation");
+ }
+
+ private void cleanup() {
+ if (csvLogger != null) {
+ csvLogger.close();
+ csvLogger = null;
+ }
+ simMgr.removeActiveSimulation(simulation);
+ ((Simulation)simulation).destroy();
+ simulation = null;
+ CustomSimulationManager.resetSimulationManager();
+ }
+
+ private ISimulation createSimulation(Scenario scenario) {
+ Simulation simulation = (Simulation)simMgr.createSimulation(scenario, null);
+ simulation.simulationSleep = false;
+ return simulation;
+ }
+ }
+}
+
+
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexFunction.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexFunction.java
new file mode 100644
index 0000000..a2646fb
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/SimplexFunction.java
@@ -0,0 +1,19 @@
+package org.eclipse.stem.analysis.automaticexperiment;
+
+import org.eclipse.stem.analysis.ErrorResult;
+;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+public interface SimplexFunction {
+ public ErrorResult getValue(double[] parameters);
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/executable/AutomaticExperimentExecutableAdapterFactory.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/executable/AutomaticExperimentExecutableAdapterFactory.java
new file mode 100644
index 0000000..680736e
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/executable/AutomaticExperimentExecutableAdapterFactory.java
@@ -0,0 +1,76 @@
+package org.eclipse.stem.analysis.automaticexperiment.executable;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperimentManager;
+import org.eclipse.stem.analysis.automaticexperiment.ErrorAnalysisAlgorithm;
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+import org.eclipse.stem.analysis.automaticexperiment.util.AutomaticexperimentAdapterFactory;
+import org.eclipse.stem.jobs.adapters.executable.emf.ExecutableAdapter;
+import org.eclipse.stem.jobs.adapters.executable.emf.ExecutableAdapterFactory;
+import org.eclipse.stem.jobs.execution.IExecutable;
+
+
+/**
+ * This class is an {@link ExecutableAdapterFactory} that creates adapters that
+ * adapt {@link AutomaticExperiment}s to {@link IExecutable}s.
+ */
+public class AutomaticExperimentExecutableAdapterFactory
+ extends AutomaticexperimentAdapterFactory
+ implements ExecutableAdapterFactory
+{
+
+ /**
+ * Default Constructor
+ */
+ public AutomaticExperimentExecutableAdapterFactory() {
+ super();
+ ExecutableAdapterFactory.INSTANCE.addAdapterFactory(this);
+ }
+
+ /**
+ * @see org.eclipse.stem.analysis.automaticexperiment.util.AutomaticexperimentAdapterFactory#createAutomaticExperimentAdapter()
+ */
+ @Override
+ public Adapter createAutomaticExperimentAdapter() {
+ return new AutomaticExperimentExecutableAdapter();
+ }
+
+ /**
+ * @see org.eclipse.stem.analysis.automaticexperiment.util.AutomaticexperimentAdapterFactory#isFactoryForType(java.lang.Object)
+ */
+ @Override
+ public boolean isFactoryForType(final Object type) {
+ return type == IExecutable.class || super.isFactoryForType(type);
+ }
+
+ /**
+ * This class adapts an {@link AutomaticExperiment} to an {@link IExecutable}.
+ */
+ protected static class AutomaticExperimentExecutableAdapter extends
+ ExecutableAdapter implements Adapter {
+
+ /**
+ * @see org.eclipse.stem.jobs.adapters.executable.emf.ExecutableAdapter#run()
+ */
+ @Override
+ public void run() {
+ org.eclipse.stem.ui.Activator.switchToPerspective(org.eclipse.stem.analysis.automaticexperiment.perspectives.AutomaticExperiment.ID_STEM_AUTOMATIC_EXPERIMENT_PERSPECTIVE);
+ AutomaticExperimentManager manager = AutomaticExperimentManager.getInstance();
+ OptimizerAlgorithm alg = (OptimizerAlgorithm)getTarget();
+ ErrorAnalysisAlgorithm algorithm = manager.createAlgorithm(alg);
+ manager.executeAlgorithm(algorithm, (AutomaticExperiment)alg);
+ }
+ }
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/AutomaticExperimentImpl.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/AutomaticExperimentImpl.java
new file mode 100644
index 0000000..28f132b
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/AutomaticExperimentImpl.java
@@ -0,0 +1,625 @@
+package org.eclipse.stem.analysis.automaticexperiment.impl;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.stem.analysis.ErrorFunction;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+import org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter;
+import org.eclipse.stem.core.scenario.Scenario;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Automatic Experiment</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl#getBaseScenario <em>Base Scenario</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl#getParameters <em>Parameters</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl#getErrorAnalysisAlgorithm <em>Error Analysis Algorithm</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl#getErrorFunction <em>Error Function</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl#getTolerance <em>Tolerance</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl#getReferanceDataDir <em>Referance Data Dir</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl#getMaximumNumberOfIterations <em>Maximum Number Of Iterations</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl#isReInit <em>Re Init</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.AutomaticExperimentImpl#getErrorFunc <em>Error Func</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class AutomaticExperimentImpl extends OptimizerAlgorithmImpl implements AutomaticExperiment {
+ /**
+ * The cached value of the '{@link #getBaseScenario() <em>Base Scenario</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getBaseScenario()
+ * @generated
+ * @ordered
+ */
+ protected Scenario baseScenario;
+
+ /**
+ * The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getParameters()
+ * @generated
+ * @ordered
+ */
+ protected EList<ModifiableParameter> parameters;
+
+ /**
+ * The default value of the '{@link #getErrorAnalysisAlgorithm() <em>Error Analysis Algorithm</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getErrorAnalysisAlgorithm()
+ * @generated
+ * @ordered
+ */
+ protected static final String ERROR_ANALYSIS_ALGORITHM_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getErrorAnalysisAlgorithm() <em>Error Analysis Algorithm</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getErrorAnalysisAlgorithm()
+ * @generated
+ * @ordered
+ */
+ protected String errorAnalysisAlgorithm = ERROR_ANALYSIS_ALGORITHM_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getErrorFunction() <em>Error Function</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getErrorFunction()
+ * @generated
+ * @ordered
+ */
+ protected static final String ERROR_FUNCTION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getErrorFunction() <em>Error Function</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getErrorFunction()
+ * @generated
+ * @ordered
+ */
+ protected String errorFunction = ERROR_FUNCTION_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTolerance() <em>Tolerance</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTolerance()
+ * @generated
+ * @ordered
+ */
+ protected static final double TOLERANCE_EDEFAULT = 0.0;
+
+ /**
+ * The cached value of the '{@link #getTolerance() <em>Tolerance</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTolerance()
+ * @generated
+ * @ordered
+ */
+ protected double tolerance = TOLERANCE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getReferanceDataDir() <em>Referance Data Dir</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getReferanceDataDir()
+ * @generated
+ * @ordered
+ */
+ protected static final String REFERANCE_DATA_DIR_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getReferanceDataDir() <em>Referance Data Dir</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getReferanceDataDir()
+ * @generated
+ * @ordered
+ */
+ protected String referanceDataDir = REFERANCE_DATA_DIR_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getMaximumNumberOfIterations() <em>Maximum Number Of Iterations</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMaximumNumberOfIterations()
+ * @generated
+ * @ordered
+ */
+ protected static final long MAXIMUM_NUMBER_OF_ITERATIONS_EDEFAULT = 0L;
+
+ /**
+ * The cached value of the '{@link #getMaximumNumberOfIterations() <em>Maximum Number Of Iterations</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getMaximumNumberOfIterations()
+ * @generated
+ * @ordered
+ */
+ protected long maximumNumberOfIterations = MAXIMUM_NUMBER_OF_ITERATIONS_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isReInit() <em>Re Init</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isReInit()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean RE_INIT_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isReInit() <em>Re Init</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isReInit()
+ * @generated
+ * @ordered
+ */
+ protected boolean reInit = RE_INIT_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getErrorFunc() <em>Error Func</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getErrorFunc()
+ * @generated
+ * @ordered
+ */
+ protected ErrorFunction errorFunc;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public AutomaticExperimentImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Scenario getBaseScenario() {
+ if (baseScenario != null && baseScenario.eIsProxy()) {
+ InternalEObject oldBaseScenario = (InternalEObject)baseScenario;
+ baseScenario = (Scenario)eResolveProxy(oldBaseScenario);
+ if (baseScenario != oldBaseScenario) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__BASE_SCENARIO, oldBaseScenario, baseScenario));
+ }
+ }
+ return baseScenario;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Scenario basicGetBaseScenario() {
+ return baseScenario;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setBaseScenario(Scenario newBaseScenario) {
+ Scenario oldBaseScenario = baseScenario;
+ baseScenario = newBaseScenario;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__BASE_SCENARIO, oldBaseScenario, baseScenario));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<ModifiableParameter> getParameters() {
+ if (parameters == null) {
+ parameters = new EObjectContainmentEList<ModifiableParameter>(ModifiableParameter.class, this, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__PARAMETERS);
+ }
+ return parameters;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getErrorAnalysisAlgorithm() {
+ return errorAnalysisAlgorithm;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setErrorAnalysisAlgorithm(String newErrorAnalysisAlgorithm) {
+ String oldErrorAnalysisAlgorithm = errorAnalysisAlgorithm;
+ errorAnalysisAlgorithm = newErrorAnalysisAlgorithm;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_ANALYSIS_ALGORITHM, oldErrorAnalysisAlgorithm, errorAnalysisAlgorithm));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getErrorFunction() {
+ return errorFunction;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setErrorFunction(String newErrorFunction) {
+ String oldErrorFunction = errorFunction;
+ errorFunction = newErrorFunction;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNCTION, oldErrorFunction, errorFunction));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public double getTolerance() {
+ return tolerance;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTolerance(double newTolerance) {
+ double oldTolerance = tolerance;
+ tolerance = newTolerance;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__TOLERANCE, oldTolerance, tolerance));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getReferanceDataDir() {
+ return referanceDataDir;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setReferanceDataDir(String newReferanceDataDir) {
+ String oldReferanceDataDir = referanceDataDir;
+ referanceDataDir = newReferanceDataDir;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__REFERANCE_DATA_DIR, oldReferanceDataDir, referanceDataDir));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public long getMaximumNumberOfIterations() {
+ return maximumNumberOfIterations;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setMaximumNumberOfIterations(long newMaximumNumberOfIterations) {
+ long oldMaximumNumberOfIterations = maximumNumberOfIterations;
+ maximumNumberOfIterations = newMaximumNumberOfIterations;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__MAXIMUM_NUMBER_OF_ITERATIONS, oldMaximumNumberOfIterations, maximumNumberOfIterations));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isReInit() {
+ return reInit;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setReInit(boolean newReInit) {
+ boolean oldReInit = reInit;
+ reInit = newReInit;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__RE_INIT, oldReInit, reInit));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ErrorFunction getErrorFunc() {
+ return errorFunc;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public NotificationChain basicSetErrorFunc(ErrorFunction newErrorFunc, NotificationChain msgs) {
+ ErrorFunction oldErrorFunc = errorFunc;
+ errorFunc = newErrorFunc;
+ if (eNotificationRequired()) {
+ ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNC, oldErrorFunc, newErrorFunc);
+ if (msgs == null) msgs = notification; else msgs.add(notification);
+ }
+ return msgs;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setErrorFunc(ErrorFunction newErrorFunc) {
+ if (newErrorFunc != errorFunc) {
+ NotificationChain msgs = null;
+ if (errorFunc != null)
+ msgs = ((InternalEObject)errorFunc).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNC, null, msgs);
+ if (newErrorFunc != null)
+ msgs = ((InternalEObject)newErrorFunc).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNC, null, msgs);
+ msgs = basicSetErrorFunc(newErrorFunc, msgs);
+ if (msgs != null) msgs.dispatch();
+ }
+ else if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNC, newErrorFunc, newErrorFunc));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__PARAMETERS:
+ return ((InternalEList<?>)getParameters()).basicRemove(otherEnd, msgs);
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNC:
+ return basicSetErrorFunc(null, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__BASE_SCENARIO:
+ if (resolve) return getBaseScenario();
+ return basicGetBaseScenario();
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__PARAMETERS:
+ return getParameters();
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_ANALYSIS_ALGORITHM:
+ return getErrorAnalysisAlgorithm();
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNCTION:
+ return getErrorFunction();
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__TOLERANCE:
+ return getTolerance();
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__REFERANCE_DATA_DIR:
+ return getReferanceDataDir();
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__MAXIMUM_NUMBER_OF_ITERATIONS:
+ return getMaximumNumberOfIterations();
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__RE_INIT:
+ return isReInit();
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNC:
+ return getErrorFunc();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__BASE_SCENARIO:
+ setBaseScenario((Scenario)newValue);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__PARAMETERS:
+ getParameters().clear();
+ getParameters().addAll((Collection<? extends ModifiableParameter>)newValue);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_ANALYSIS_ALGORITHM:
+ setErrorAnalysisAlgorithm((String)newValue);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNCTION:
+ setErrorFunction((String)newValue);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__TOLERANCE:
+ setTolerance((Double)newValue);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__REFERANCE_DATA_DIR:
+ setReferanceDataDir((String)newValue);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__MAXIMUM_NUMBER_OF_ITERATIONS:
+ setMaximumNumberOfIterations((Long)newValue);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__RE_INIT:
+ setReInit((Boolean)newValue);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNC:
+ setErrorFunc((ErrorFunction)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__BASE_SCENARIO:
+ setBaseScenario((Scenario)null);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__PARAMETERS:
+ getParameters().clear();
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_ANALYSIS_ALGORITHM:
+ setErrorAnalysisAlgorithm(ERROR_ANALYSIS_ALGORITHM_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNCTION:
+ setErrorFunction(ERROR_FUNCTION_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__TOLERANCE:
+ setTolerance(TOLERANCE_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__REFERANCE_DATA_DIR:
+ setReferanceDataDir(REFERANCE_DATA_DIR_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__MAXIMUM_NUMBER_OF_ITERATIONS:
+ setMaximumNumberOfIterations(MAXIMUM_NUMBER_OF_ITERATIONS_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__RE_INIT:
+ setReInit(RE_INIT_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNC:
+ setErrorFunc((ErrorFunction)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__BASE_SCENARIO:
+ return baseScenario != null;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__PARAMETERS:
+ return parameters != null && !parameters.isEmpty();
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_ANALYSIS_ALGORITHM:
+ return ERROR_ANALYSIS_ALGORITHM_EDEFAULT == null ? errorAnalysisAlgorithm != null : !ERROR_ANALYSIS_ALGORITHM_EDEFAULT.equals(errorAnalysisAlgorithm);
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNCTION:
+ return ERROR_FUNCTION_EDEFAULT == null ? errorFunction != null : !ERROR_FUNCTION_EDEFAULT.equals(errorFunction);
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__TOLERANCE:
+ return tolerance != TOLERANCE_EDEFAULT;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__REFERANCE_DATA_DIR:
+ return REFERANCE_DATA_DIR_EDEFAULT == null ? referanceDataDir != null : !REFERANCE_DATA_DIR_EDEFAULT.equals(referanceDataDir);
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__MAXIMUM_NUMBER_OF_ITERATIONS:
+ return maximumNumberOfIterations != MAXIMUM_NUMBER_OF_ITERATIONS_EDEFAULT;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__RE_INIT:
+ return reInit != RE_INIT_EDEFAULT;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNC:
+ return errorFunc != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (errorAnalysisAlgorithm: ");
+ result.append(errorAnalysisAlgorithm);
+ result.append(", errorFunction: ");
+ result.append(errorFunction);
+ result.append(", tolerance: ");
+ result.append(tolerance);
+ result.append(", referanceDataDir: ");
+ result.append(referanceDataDir);
+ result.append(", maximumNumberOfIterations: ");
+ result.append(maximumNumberOfIterations);
+ result.append(", reInit: ");
+ result.append(reInit);
+ result.append(')');
+ return result.toString();
+ }
+
+} //AutomaticExperimentImpl
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/AutomaticexperimentFactoryImpl.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/AutomaticexperimentFactoryImpl.java
new file mode 100644
index 0000000..69ee2ca
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/AutomaticexperimentFactoryImpl.java
@@ -0,0 +1,128 @@
+package org.eclipse.stem.analysis.automaticexperiment.impl;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentFactory;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+import org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter;
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AutomaticexperimentFactoryImpl extends EFactoryImpl implements AutomaticexperimentFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static AutomaticexperimentFactory init() {
+ try {
+ AutomaticexperimentFactory theAutomaticexperimentFactory = (AutomaticexperimentFactory)EPackage.Registry.INSTANCE.getEFactory("http:///org/eclipse/stem/core/automaticexperiment.ecore");
+ if (theAutomaticexperimentFactory != null) {
+ return theAutomaticexperimentFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new AutomaticexperimentFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperimentFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT: return createAutomaticExperiment();
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER: return createModifiableParameter();
+ case AutomaticexperimentPackage.OPTIMIZER_ALGORITHM: return createOptimizerAlgorithm();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticExperiment createAutomaticExperiment() {
+ AutomaticExperimentImpl automaticExperiment = new AutomaticExperimentImpl();
+ return automaticExperiment;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModifiableParameter createModifiableParameter() {
+ ModifiableParameterImpl modifiableParameter = new ModifiableParameterImpl();
+ return modifiableParameter;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public OptimizerAlgorithm createOptimizerAlgorithm() {
+ OptimizerAlgorithmImpl optimizerAlgorithm = new OptimizerAlgorithmImpl();
+ return optimizerAlgorithm;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperimentPackage getAutomaticexperimentPackage() {
+ return (AutomaticexperimentPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static AutomaticexperimentPackage getPackage() {
+ return AutomaticexperimentPackage.eINSTANCE;
+ }
+
+} //AutomaticexperimentFactoryImpl
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/AutomaticexperimentPackageImpl.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/AutomaticexperimentPackageImpl.java
new file mode 100644
index 0000000..5e89085
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/AutomaticexperimentPackageImpl.java
@@ -0,0 +1,420 @@
+package org.eclipse.stem.analysis.automaticexperiment.impl;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.stem.analysis.AnalysisPackage;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentFactory;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+import org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter;
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+import org.eclipse.stem.core.common.CommonPackage;
+import org.eclipse.stem.core.graph.GraphPackage;
+import org.eclipse.stem.core.model.ModelPackage;
+import org.eclipse.stem.core.modifier.ModifierPackage;
+import org.eclipse.stem.core.scenario.ScenarioPackage;
+import org.eclipse.stem.core.sequencer.SequencerPackage;
+import org.eclipse.stem.core.solver.SolverPackage;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AutomaticexperimentPackageImpl extends EPackageImpl implements AutomaticexperimentPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass automaticExperimentEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass modifiableParameterEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass optimizerAlgorithmEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private AutomaticexperimentPackageImpl() {
+ super(eNS_URI, AutomaticexperimentFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link AutomaticexperimentPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static AutomaticexperimentPackage init() {
+ if (isInited) return (AutomaticexperimentPackage)EPackage.Registry.INSTANCE.getEPackage(AutomaticexperimentPackage.eNS_URI);
+
+ // Obtain or create and register package
+ AutomaticexperimentPackageImpl theAutomaticexperimentPackage = (AutomaticexperimentPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof AutomaticexperimentPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new AutomaticexperimentPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ AnalysisPackage.eINSTANCE.eClass();
+ CommonPackage.eINSTANCE.eClass();
+ GraphPackage.eINSTANCE.eClass();
+ ModelPackage.eINSTANCE.eClass();
+ ModifierPackage.eINSTANCE.eClass();
+ ScenarioPackage.eINSTANCE.eClass();
+ SequencerPackage.eINSTANCE.eClass();
+ SolverPackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theAutomaticexperimentPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theAutomaticexperimentPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theAutomaticexperimentPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(AutomaticexperimentPackage.eNS_URI, theAutomaticexperimentPackage);
+ return theAutomaticexperimentPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getAutomaticExperiment() {
+ return automaticExperimentEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAutomaticExperiment_BaseScenario() {
+ return (EReference)automaticExperimentEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAutomaticExperiment_Parameters() {
+ return (EReference)automaticExperimentEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAutomaticExperiment_ErrorAnalysisAlgorithm() {
+ return (EAttribute)automaticExperimentEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAutomaticExperiment_ErrorFunction() {
+ return (EAttribute)automaticExperimentEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAutomaticExperiment_Tolerance() {
+ return (EAttribute)automaticExperimentEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAutomaticExperiment_ReferanceDataDir() {
+ return (EAttribute)automaticExperimentEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAutomaticExperiment_MaximumNumberOfIterations() {
+ return (EAttribute)automaticExperimentEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAutomaticExperiment_ReInit() {
+ return (EAttribute)automaticExperimentEClass.getEStructuralFeatures().get(7);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAutomaticExperiment_ErrorFunc() {
+ return (EReference)automaticExperimentEClass.getEStructuralFeatures().get(8);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getModifiableParameter() {
+ return modifiableParameterEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getModifiableParameter_InitialValue() {
+ return (EAttribute)modifiableParameterEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getModifiableParameter_Feature() {
+ return (EReference)modifiableParameterEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getModifiableParameter_Step() {
+ return (EAttribute)modifiableParameterEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getModifiableParameter_FeatureName() {
+ return (EAttribute)modifiableParameterEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getModifiableParameter_LowerBound() {
+ return (EAttribute)modifiableParameterEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getModifiableParameter_UpperBound() {
+ return (EAttribute)modifiableParameterEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getModifiableParameter_TargetURI() {
+ return (EAttribute)modifiableParameterEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getOptimizerAlgorithm() {
+ return optimizerAlgorithmEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperimentFactory getAutomaticexperimentFactory() {
+ return (AutomaticexperimentFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ automaticExperimentEClass = createEClass(AUTOMATIC_EXPERIMENT);
+ createEReference(automaticExperimentEClass, AUTOMATIC_EXPERIMENT__BASE_SCENARIO);
+ createEReference(automaticExperimentEClass, AUTOMATIC_EXPERIMENT__PARAMETERS);
+ createEAttribute(automaticExperimentEClass, AUTOMATIC_EXPERIMENT__ERROR_ANALYSIS_ALGORITHM);
+ createEAttribute(automaticExperimentEClass, AUTOMATIC_EXPERIMENT__ERROR_FUNCTION);
+ createEAttribute(automaticExperimentEClass, AUTOMATIC_EXPERIMENT__TOLERANCE);
+ createEAttribute(automaticExperimentEClass, AUTOMATIC_EXPERIMENT__REFERANCE_DATA_DIR);
+ createEAttribute(automaticExperimentEClass, AUTOMATIC_EXPERIMENT__MAXIMUM_NUMBER_OF_ITERATIONS);
+ createEAttribute(automaticExperimentEClass, AUTOMATIC_EXPERIMENT__RE_INIT);
+ createEReference(automaticExperimentEClass, AUTOMATIC_EXPERIMENT__ERROR_FUNC);
+
+ modifiableParameterEClass = createEClass(MODIFIABLE_PARAMETER);
+ createEAttribute(modifiableParameterEClass, MODIFIABLE_PARAMETER__INITIAL_VALUE);
+ createEReference(modifiableParameterEClass, MODIFIABLE_PARAMETER__FEATURE);
+ createEAttribute(modifiableParameterEClass, MODIFIABLE_PARAMETER__STEP);
+ createEAttribute(modifiableParameterEClass, MODIFIABLE_PARAMETER__FEATURE_NAME);
+ createEAttribute(modifiableParameterEClass, MODIFIABLE_PARAMETER__LOWER_BOUND);
+ createEAttribute(modifiableParameterEClass, MODIFIABLE_PARAMETER__UPPER_BOUND);
+ createEAttribute(modifiableParameterEClass, MODIFIABLE_PARAMETER__TARGET_URI);
+
+ optimizerAlgorithmEClass = createEClass(OPTIMIZER_ALGORITHM);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ ScenarioPackage theScenarioPackage = (ScenarioPackage)EPackage.Registry.INSTANCE.getEPackage(ScenarioPackage.eNS_URI);
+ EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
+ AnalysisPackage theAnalysisPackage = (AnalysisPackage)EPackage.Registry.INSTANCE.getEPackage(AnalysisPackage.eNS_URI);
+ CommonPackage theCommonPackage = (CommonPackage)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ automaticExperimentEClass.getESuperTypes().add(this.getOptimizerAlgorithm());
+ optimizerAlgorithmEClass.getESuperTypes().add(theCommonPackage.getIdentifiable());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(automaticExperimentEClass, AutomaticExperiment.class, "AutomaticExperiment", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getAutomaticExperiment_BaseScenario(), theScenarioPackage.getScenario(), null, "baseScenario", null, 1, 1, AutomaticExperiment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAutomaticExperiment_Parameters(), this.getModifiableParameter(), null, "parameters", null, 1, -1, AutomaticExperiment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAutomaticExperiment_ErrorAnalysisAlgorithm(), theEcorePackage.getEString(), "errorAnalysisAlgorithm", null, 1, 1, AutomaticExperiment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAutomaticExperiment_ErrorFunction(), theEcorePackage.getEString(), "errorFunction", null, 1, 1, AutomaticExperiment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAutomaticExperiment_Tolerance(), theEcorePackage.getEDouble(), "tolerance", null, 1, 1, AutomaticExperiment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAutomaticExperiment_ReferanceDataDir(), theEcorePackage.getEString(), "referanceDataDir", null, 1, 1, AutomaticExperiment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAutomaticExperiment_MaximumNumberOfIterations(), theEcorePackage.getELong(), "maximumNumberOfIterations", null, 1, 1, AutomaticExperiment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAutomaticExperiment_ReInit(), theEcorePackage.getEBoolean(), "reInit", null, 1, 1, AutomaticExperiment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAutomaticExperiment_ErrorFunc(), theAnalysisPackage.getErrorFunction(), null, "errorFunc", null, 1, 1, AutomaticExperiment.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(modifiableParameterEClass, ModifiableParameter.class, "ModifiableParameter", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getModifiableParameter_InitialValue(), theEcorePackage.getEDouble(), "initialValue", null, 1, 1, ModifiableParameter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getModifiableParameter_Feature(), theEcorePackage.getEStructuralFeature(), null, "feature", null, 1, 1, ModifiableParameter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getModifiableParameter_Step(), theEcorePackage.getEDouble(), "step", null, 1, 1, ModifiableParameter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getModifiableParameter_FeatureName(), theEcorePackage.getEString(), "featureName", null, 1, 1, ModifiableParameter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getModifiableParameter_LowerBound(), theEcorePackage.getEDouble(), "lowerBound", "-1", 0, 1, ModifiableParameter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getModifiableParameter_UpperBound(), theEcorePackage.getEDouble(), "upperBound", "-1", 0, 1, ModifiableParameter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getModifiableParameter_TargetURI(), theCommonPackage.getURI(), "targetURI", null, 0, 1, ModifiableParameter.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(optimizerAlgorithmEClass, OptimizerAlgorithm.class, "OptimizerAlgorithm", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //AutomaticexperimentPackageImpl
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/ModifiableParameterImpl.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/ModifiableParameterImpl.java
new file mode 100644
index 0000000..4ecb840
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/ModifiableParameterImpl.java
@@ -0,0 +1,503 @@
+package org.eclipse.stem.analysis.automaticexperiment.impl;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+import org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Modifiable Parameter</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl#getInitialValue <em>Initial Value</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl#getFeature <em>Feature</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl#getStep <em>Step</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl#getFeatureName <em>Feature Name</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl#getLowerBound <em>Lower Bound</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl#getUpperBound <em>Upper Bound</em>}</li>
+ * <li>{@link org.eclipse.stem.analysis.automaticexperiment.impl.ModifiableParameterImpl#getTargetURI <em>Target URI</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class ModifiableParameterImpl extends EObjectImpl implements ModifiableParameter {
+ /**
+ * The default value of the '{@link #getInitialValue() <em>Initial Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInitialValue()
+ * @generated
+ * @ordered
+ */
+ protected static final double INITIAL_VALUE_EDEFAULT = 0.0;
+
+ /**
+ * The cached value of the '{@link #getInitialValue() <em>Initial Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getInitialValue()
+ * @generated
+ * @ordered
+ */
+ protected double initialValue = INITIAL_VALUE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getFeature() <em>Feature</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFeature()
+ * @generated
+ * @ordered
+ */
+ protected EStructuralFeature feature;
+
+ /**
+ * The default value of the '{@link #getStep() <em>Step</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStep()
+ * @generated
+ * @ordered
+ */
+ protected static final double STEP_EDEFAULT = 0.0;
+
+ /**
+ * The cached value of the '{@link #getStep() <em>Step</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStep()
+ * @generated
+ * @ordered
+ */
+ protected double step = STEP_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getFeatureName() <em>Feature Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFeatureName()
+ * @generated
+ * @ordered
+ */
+ protected static final String FEATURE_NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getFeatureName() <em>Feature Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFeatureName()
+ * @generated
+ * @ordered
+ */
+ protected String featureName = FEATURE_NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getLowerBound() <em>Lower Bound</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLowerBound()
+ * @generated
+ * @ordered
+ */
+ protected static final double LOWER_BOUND_EDEFAULT = -1.0;
+
+ /**
+ * The cached value of the '{@link #getLowerBound() <em>Lower Bound</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLowerBound()
+ * @generated
+ * @ordered
+ */
+ protected double lowerBound = LOWER_BOUND_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getUpperBound() <em>Upper Bound</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUpperBound()
+ * @generated
+ * @ordered
+ */
+ protected static final double UPPER_BOUND_EDEFAULT = -1.0;
+
+ /**
+ * The cached value of the '{@link #getUpperBound() <em>Upper Bound</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getUpperBound()
+ * @generated
+ * @ordered
+ */
+ protected double upperBound = UPPER_BOUND_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getTargetURI() <em>Target URI</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetURI()
+ * @generated
+ * @ordered
+ */
+ protected static final URI TARGET_URI_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getTargetURI() <em>Target URI</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetURI()
+ * @generated
+ * @ordered
+ */
+ protected URI targetURI = TARGET_URI_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ModifiableParameterImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return AutomaticexperimentPackage.Literals.MODIFIABLE_PARAMETER;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public double getInitialValue() {
+ return initialValue;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setInitialValue(double newInitialValue) {
+ double oldInitialValue = initialValue;
+ initialValue = newInitialValue;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.MODIFIABLE_PARAMETER__INITIAL_VALUE, oldInitialValue, initialValue));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EStructuralFeature getFeature() {
+ if (feature != null && feature.eIsProxy()) {
+ InternalEObject oldFeature = (InternalEObject)feature;
+ feature = (EStructuralFeature)eResolveProxy(oldFeature);
+ if (feature != oldFeature) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE, oldFeature, feature));
+ }
+ }
+ return feature;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EStructuralFeature basicGetFeature() {
+ return feature;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setFeature(EStructuralFeature newFeature) {
+ EStructuralFeature oldFeature = feature;
+ feature = newFeature;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE, oldFeature, feature));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public double getStep() {
+ return step;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setStep(double newStep) {
+ double oldStep = step;
+ step = newStep;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.MODIFIABLE_PARAMETER__STEP, oldStep, step));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getFeatureName() {
+ return featureName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setFeatureName(String newFeatureName) {
+ String oldFeatureName = featureName;
+ featureName = newFeatureName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE_NAME, oldFeatureName, featureName));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public double getLowerBound() {
+ return lowerBound;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLowerBound(double newLowerBound) {
+ double oldLowerBound = lowerBound;
+ lowerBound = newLowerBound;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.MODIFIABLE_PARAMETER__LOWER_BOUND, oldLowerBound, lowerBound));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public double getUpperBound() {
+ return upperBound;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setUpperBound(double newUpperBound) {
+ double oldUpperBound = upperBound;
+ upperBound = newUpperBound;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.MODIFIABLE_PARAMETER__UPPER_BOUND, oldUpperBound, upperBound));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public URI getTargetURI() {
+ return targetURI;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTargetURI(URI newTargetURI) {
+ URI oldTargetURI = targetURI;
+ targetURI = newTargetURI;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, AutomaticexperimentPackage.MODIFIABLE_PARAMETER__TARGET_URI, oldTargetURI, targetURI));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__INITIAL_VALUE:
+ return getInitialValue();
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE:
+ if (resolve) return getFeature();
+ return basicGetFeature();
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__STEP:
+ return getStep();
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE_NAME:
+ return getFeatureName();
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__LOWER_BOUND:
+ return getLowerBound();
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__UPPER_BOUND:
+ return getUpperBound();
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__TARGET_URI:
+ return getTargetURI();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__INITIAL_VALUE:
+ setInitialValue((Double)newValue);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE:
+ setFeature((EStructuralFeature)newValue);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__STEP:
+ setStep((Double)newValue);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE_NAME:
+ setFeatureName((String)newValue);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__LOWER_BOUND:
+ setLowerBound((Double)newValue);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__UPPER_BOUND:
+ setUpperBound((Double)newValue);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__TARGET_URI:
+ setTargetURI((URI)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__INITIAL_VALUE:
+ setInitialValue(INITIAL_VALUE_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE:
+ setFeature((EStructuralFeature)null);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__STEP:
+ setStep(STEP_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE_NAME:
+ setFeatureName(FEATURE_NAME_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__LOWER_BOUND:
+ setLowerBound(LOWER_BOUND_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__UPPER_BOUND:
+ setUpperBound(UPPER_BOUND_EDEFAULT);
+ return;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__TARGET_URI:
+ setTargetURI(TARGET_URI_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__INITIAL_VALUE:
+ return initialValue != INITIAL_VALUE_EDEFAULT;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE:
+ return feature != null;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__STEP:
+ return step != STEP_EDEFAULT;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE_NAME:
+ return FEATURE_NAME_EDEFAULT == null ? featureName != null : !FEATURE_NAME_EDEFAULT.equals(featureName);
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__LOWER_BOUND:
+ return lowerBound != LOWER_BOUND_EDEFAULT;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__UPPER_BOUND:
+ return upperBound != UPPER_BOUND_EDEFAULT;
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__TARGET_URI:
+ return TARGET_URI_EDEFAULT == null ? targetURI != null : !TARGET_URI_EDEFAULT.equals(targetURI);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (initialValue: ");
+ result.append(initialValue);
+ result.append(", step: ");
+ result.append(step);
+ result.append(", featureName: ");
+ result.append(featureName);
+ result.append(", lowerBound: ");
+ result.append(lowerBound);
+ result.append(", upperBound: ");
+ result.append(upperBound);
+ result.append(", targetURI: ");
+ result.append(targetURI);
+ result.append(')');
+ return result.toString();
+ }
+
+} //ModifiableParameterImpl
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/OptimizerAlgorithmImpl.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/OptimizerAlgorithmImpl.java
new file mode 100644
index 0000000..7633da7
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/impl/OptimizerAlgorithmImpl.java
@@ -0,0 +1,47 @@
+package org.eclipse.stem.analysis.automaticexperiment.impl;
+
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+import org.eclipse.stem.core.common.impl.IdentifiableImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Optimizer Algorithm</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * </p>
+ *
+ * @generated
+ */
+public class OptimizerAlgorithmImpl extends IdentifiableImpl implements OptimizerAlgorithm {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected OptimizerAlgorithmImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return AutomaticexperimentPackage.Literals.OPTIMIZER_ALGORITHM;
+ }
+
+} //OptimizerAlgorithmImpl
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/perspectives/AutomaticExperiment.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/perspectives/AutomaticExperiment.java
new file mode 100644
index 0000000..d704e12
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/perspectives/AutomaticExperiment.java
@@ -0,0 +1,70 @@
+// Analysis.java
+package org.eclipse.stem.analysis.automaticexperiment.perspectives;
+
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.stem.analysis.automaticexperiment.views.AutoExpView;
+import org.eclipse.stem.core.Constants;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.navigator.resources.ProjectExplorer;
+
+
+/**
+ * This class implements the "Analysis" perspective of STEM. This perspective is
+ * used to review and compare the results of different runs.
+ */
+public class AutomaticExperiment implements IPerspectiveFactory {
+
+ /**
+ * The identifier of the Designer Perspective
+ */
+ public static final String ID_STEM_AUTOMATIC_EXPERIMENT_PERSPECTIVE = Constants.ID_ROOT
+ + ".analysis.automaticexperiment.perspective"; //$NON-NLS-1$
+
+ /**
+ * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui
+ * .IPageLayout)
+ */
+ public void createInitialLayout(final IPageLayout layout) {
+ final String editorArea = layout.getEditorArea();
+
+ // We don't want to see the editor
+ layout.setEditorAreaVisible(false);
+ // Put the STEM Analysis View by itself on the top
+ layout.addStandaloneView(AutoExpView.ID_AutoExp_VIEW, true, IPageLayout.RIGHT,
+ 0.0f, editorArea);
+
+ // Put the ProjectExplorer view on the left
+ final IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.20f, AutoExpView.ID_AutoExp_VIEW);
+ left.addView(ProjectExplorer.VIEW_ID);
+
+ // Put the Error Log
+ final IFolderLayout bottom = layout.createFolder("right", IPageLayout.BOTTOM, //$NON-NLS-1$
+ 0.60f, AutoExpView.ID_AutoExp_VIEW);
+ // add Error Log view
+ bottom.addView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$
+
+ // add the view to the "Show Views" menu
+ layout.addShowViewShortcut(AutoExpView.ID_AutoExp_VIEW);
+
+ // We don't want to see the editor
+ layout.setEditorAreaVisible(false);
+
+ // Add the Analysis perspective to the "Open Perspective" menu
+ layout.addPerspectiveShortcut(ID_STEM_AUTOMATIC_EXPERIMENT_PERSPECTIVE);
+
+
+ } // createInitialLayout
+
+} // Analysis
\ No newline at end of file
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/presentation/AutomaticexperimentActionBarContributor.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/presentation/AutomaticexperimentActionBarContributor.java
new file mode 100644
index 0000000..72ad3d3
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/presentation/AutomaticexperimentActionBarContributor.java
@@ -0,0 +1,429 @@
+package org.eclipse.stem.analysis.automaticexperiment.presentation;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.edit.ui.action.ControlAction;
+import org.eclipse.emf.edit.ui.action.CreateChildAction;
+import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.emf.edit.ui.action.ValidateAction;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.SubContributionItem;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.stem.analysis.automaticexperiment.provider.AutomaticexperienceEditPlugin;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+
+
+/**
+ * This is the action bar contributor for the Automaticexperiment model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AutomaticexperimentActionBarContributor
+ extends EditingDomainActionBarContributor
+ implements ISelectionChangedListener {
+ /**
+ * This keeps track of the active editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IEditorPart activeEditorPart;
+
+ /**
+ * This keeps track of the current selection provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelectionProvider selectionProvider;
+
+ /**
+ * This action opens the Properties view.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IAction showPropertiesViewAction =
+ new Action(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {
+ @Override
+ public void run() {
+ try {
+ getPage().showView("org.eclipse.ui.views.PropertySheet");
+ }
+ catch (PartInitException exception) {
+ AutomaticexperienceEditPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ /**
+ * This action refreshes the viewer of the current editor if the editor
+ * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IAction refreshViewerAction =
+ new Action(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) {
+ @Override
+ public boolean isEnabled() {
+ return activeEditorPart instanceof IViewerProvider;
+ }
+
+ @Override
+ public void run() {
+ if (activeEditorPart instanceof IViewerProvider) {
+ Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
+ if (viewer != null) {
+ viewer.refresh();
+ }
+ }
+ }
+ };
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
+ * generated for the current selection by the item provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> createChildActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateChild actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createChildMenuManager;
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor
+ * generated for the current selection by the item provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> createSiblingActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateSibling actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IMenuManager createSiblingMenuManager;
+
+ /**
+ * This creates an instance of the contributor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperimentActionBarContributor() {
+ super(ADDITIONS_LAST_STYLE);
+ loadResourceAction = new LoadResourceAction();
+ validateAction = new ValidateAction();
+ controlAction = new ControlAction();
+ }
+
+ /**
+ * This adds Separators for editor additions to the tool bar.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ toolBarManager.add(new Separator("automaticexperiment-settings"));
+ toolBarManager.add(new Separator("automaticexperiment-additions"));
+ }
+
+ /**
+ * This adds to the menu bar a menu and some separators for editor additions,
+ * as well as the sub-menus for object creation items.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void contributeToMenu(IMenuManager menuManager) {
+ super.contributeToMenu(menuManager);
+
+ IMenuManager submenuManager = new MenuManager(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_AutomaticexperimentEditor_menu"), "org.eclipse.stem.analysis.automaticexperimentMenuID");
+ menuManager.insertAfter("additions", submenuManager);
+ submenuManager.add(new Separator("settings"));
+ submenuManager.add(new Separator("actions"));
+ submenuManager.add(new Separator("additions"));
+ submenuManager.add(new Separator("additions-end"));
+
+ // Prepare for CreateChild item addition or removal.
+ //
+ createChildMenuManager = new MenuManager(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ submenuManager.insertBefore("additions", createChildMenuManager);
+
+ // Prepare for CreateSibling item addition or removal.
+ //
+ createSiblingMenuManager = new MenuManager(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ submenuManager.insertBefore("additions", createSiblingMenuManager);
+
+ // Force an update because Eclipse hides empty menus now.
+ //
+ submenuManager.addMenuListener
+ (new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menuManager) {
+ menuManager.updateAll(true);
+ }
+ });
+
+ addGlobalActions(submenuManager);
+ }
+
+ /**
+ * When the active editor changes, this remembers the change and registers with it as a selection provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setActiveEditor(IEditorPart part) {
+ super.setActiveEditor(part);
+ activeEditorPart = part;
+
+ // Switch to the new selection provider.
+ //
+ if (selectionProvider != null) {
+ selectionProvider.removeSelectionChangedListener(this);
+ }
+ if (part == null) {
+ selectionProvider = null;
+ }
+ else {
+ selectionProvider = part.getSite().getSelectionProvider();
+ selectionProvider.addSelectionChangedListener(this);
+
+ // Fake a selection changed event to update the menus.
+ //
+ if (selectionProvider.getSelection() != null) {
+ selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
+ }
+ }
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
+ * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
+ * that can be added to the selected object and updating the menus accordingly.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ // Remove any menu items for old selection.
+ //
+ if (createChildMenuManager != null) {
+ depopulateManager(createChildMenuManager, createChildActions);
+ }
+ if (createSiblingMenuManager != null) {
+ depopulateManager(createSiblingMenuManager, createSiblingActions);
+ }
+
+ // Query the new selection for appropriate new child/sibling descriptors
+ //
+ Collection<?> newChildDescriptors = null;
+ Collection<?> newSiblingDescriptors = null;
+
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+
+ EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
+
+ newChildDescriptors = domain.getNewChildDescriptors(object, null);
+ newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
+ }
+
+ // Generate actions for selection; populate and redraw the menus.
+ //
+ createChildActions = generateCreateChildActions(newChildDescriptors, selection);
+ createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
+
+ if (createChildMenuManager != null) {
+ populateManager(createChildMenuManager, createChildActions, null);
+ createChildMenuManager.update(true);
+ }
+ if (createSiblingMenuManager != null) {
+ populateManager(createSiblingMenuManager, createSiblingActions, null);
+ createSiblingMenuManager.update(true);
+ }
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>,
+ * and returns the collection of these actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if (descriptors != null) {
+ for (Object descriptor : descriptors) {
+ actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>,
+ * and returns the collection of these actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if (descriptors != null) {
+ for (Object descriptor : descriptors) {
+ actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection,
+ * by inserting them before the specified contribution item <code>contributionID</code>.
+ * If <code>contributionID</code> is <code>null</code>, they are simply added.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) {
+ if (actions != null) {
+ for (IAction action : actions) {
+ if (contributionID != null) {
+ manager.insertBefore(contributionID, action);
+ }
+ else {
+ manager.add(action);
+ }
+ }
+ }
+ }
+
+ /**
+ * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) {
+ if (actions != null) {
+ IContributionItem[] items = manager.getItems();
+ for (int i = 0; i < items.length; i++) {
+ // Look into SubContributionItems
+ //
+ IContributionItem contributionItem = items[i];
+ while (contributionItem instanceof SubContributionItem) {
+ contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
+ }
+
+ // Delete the ActionContributionItems with matching action.
+ //
+ if (contributionItem instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem)contributionItem).getAction();
+ if (actions.contains(action)) {
+ manager.remove(contributionItem);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This populates the pop-up menu before it appears.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void menuAboutToShow(IMenuManager menuManager) {
+ super.menuAboutToShow(menuManager);
+ MenuManager submenuManager = null;
+
+ submenuManager = new MenuManager(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ populateManager(submenuManager, createChildActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+
+ submenuManager = new MenuManager(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ populateManager(submenuManager, createSiblingActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+ }
+
+ /**
+ * This inserts global actions before the "additions-end" separator.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void addGlobalActions(IMenuManager menuManager) {
+ menuManager.insertAfter("additions-end", new Separator("ui-actions"));
+ menuManager.insertAfter("ui-actions", showPropertiesViewAction);
+
+ refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ menuManager.insertAfter("ui-actions", refreshViewerAction);
+
+ super.addGlobalActions(menuManager);
+ }
+
+ /**
+ * This ensures that a delete action will clean up all references to deleted objects.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected boolean removeAllReferencesOnDelete() {
+ return true;
+ }
+
+}
\ No newline at end of file
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/presentation/AutomaticexperimentEditor.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/presentation/AutomaticexperimentEditor.java
new file mode 100644
index 0000000..edc95a5
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/presentation/AutomaticexperimentEditor.java
@@ -0,0 +1,1529 @@
+package org.eclipse.stem.analysis.automaticexperiment.presentation;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.ui.MarkerHelper;
+import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
+import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
+import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
+import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider;
+import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;
+import org.eclipse.emf.edit.ui.util.EditUIUtil;
+import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.stem.analysis.automaticexperiment.provider.AutomaticexperienceEditPlugin;
+import org.eclipse.stem.analysis.automaticexperiment.provider.AutomaticexperimentItemProviderAdapterFactory;
+import org.eclipse.stem.analysis.provider.AnalysisItemProviderAdapterFactory;
+import org.eclipse.stem.core.common.provider.CommonItemProviderAdapterFactory;
+import org.eclipse.stem.core.graph.provider.GraphItemProviderAdapterFactory;
+import org.eclipse.stem.core.model.provider.ModelItemProviderAdapterFactory;
+import org.eclipse.stem.core.modifier.provider.ModifierItemProviderAdapterFactory;
+import org.eclipse.stem.core.scenario.provider.ScenarioItemProviderAdapterFactory;
+import org.eclipse.stem.core.sequencer.provider.SequencerItemProviderAdapterFactory;
+import org.eclipse.stem.core.solver.provider.SolverItemProviderAdapterFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.ui.views.contentoutline.ContentOutline;
+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheet;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+
+
+/**
+ * This is an example of a Automaticexperiment model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AutomaticexperimentEditor
+ extends MultiPageEditorPart
+ implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
+ /**
+ * This keeps track of the editing domain that is used to track all changes to the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AdapterFactoryEditingDomain editingDomain;
+
+ /**
+ * This is the one adapter factory used for providing views of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory adapterFactory;
+
+ /**
+ * This is the content outline page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IContentOutlinePage contentOutlinePage;
+
+ /**
+ * This is a kludge...
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IStatusLineManager contentOutlineStatusLineManager;
+
+ /**
+ * This is the content outline page's viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer contentOutlineViewer;
+
+ /**
+ * This is the property sheet page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PropertySheetPage propertySheetPage;
+
+ /**
+ * This is the viewer that shadows the selection in the content outline.
+ * The parent relation must be correctly defined for this to work.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer selectionViewer;
+
+ /**
+ * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Viewer currentViewer;
+
+ /**
+ * This listens to which ever viewer is active.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelectionChangedListener selectionChangedListener;
+
+ /**
+ * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
+
+ /**
+ * This keeps track of the selection of the editor as a whole.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelection editorSelection = StructuredSelection.EMPTY;
+
+ /**
+ * The MarkerHelper is responsible for creating workspace resource markers presented
+ * in Eclipse's Problems View.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected MarkerHelper markerHelper = new EditUIMarkerHelper();
+
+ /**
+ * This listens for when the outline becomes active
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IPartListener partListener =
+ new IPartListener() {
+ public void partActivated(IWorkbenchPart p) {
+ if (p instanceof ContentOutline) {
+ if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
+ getActionBarContributor().setActiveEditor(AutomaticexperimentEditor.this);
+
+ setCurrentViewer(contentOutlineViewer);
+ }
+ }
+ else if (p instanceof PropertySheet) {
+ if (((PropertySheet)p).getCurrentPage() == propertySheetPage) {
+ getActionBarContributor().setActiveEditor(AutomaticexperimentEditor.this);
+ handleActivate();
+ }
+ }
+ else if (p == AutomaticexperimentEditor.this) {
+ handleActivate();
+ }
+ }
+ public void partBroughtToTop(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partClosed(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partDeactivated(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partOpened(IWorkbenchPart p) {
+ // Ignore.
+ }
+ };
+
+ /**
+ * Resources that have been removed since last activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been changed since last activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been saved.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> savedResources = new ArrayList<Resource>();
+
+ /**
+ * Map to store the diagnostic associated with a resource.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>();
+
+ /**
+ * Controls whether the problem indication should be updated.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean updateProblemIndication = true;
+
+ /**
+ * Adapter used to update the problem indication when resources are demanded loaded.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EContentAdapter problemIndicationAdapter =
+ new EContentAdapter() {
+ @Override
+ public void notifyChanged(Notification notification) {
+ if (notification.getNotifier() instanceof Resource) {
+ switch (notification.getFeatureID(Resource.class)) {
+ case Resource.RESOURCE__IS_LOADED:
+ case Resource.RESOURCE__ERRORS:
+ case Resource.RESOURCE__WARNINGS: {
+ Resource resource = (Resource)notification.getNotifier();
+ Diagnostic diagnostic = analyzeResourceProblems(resource, null);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ resourceToDiagnosticMap.put(resource, diagnostic);
+ }
+ else {
+ resourceToDiagnosticMap.remove(resource);
+ }
+
+ if (updateProblemIndication) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+ }
+ break;
+ }
+ }
+ }
+ else {
+ super.notifyChanged(notification);
+ }
+ }
+
+ @Override
+ protected void setTarget(Resource target) {
+ basicSetTarget(target);
+ }
+
+ @Override
+ protected void unsetTarget(Resource target) {
+ basicUnsetTarget(target);
+ }
+ };
+
+ /**
+ * This listens for workspace changes.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IResourceChangeListener resourceChangeListener =
+ new IResourceChangeListener() {
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ try {
+ class ResourceDeltaVisitor implements IResourceDeltaVisitor {
+ protected ResourceSet resourceSet = editingDomain.getResourceSet();
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ public boolean visit(IResourceDelta delta) {
+ if (delta.getResource().getType() == IResource.FILE) {
+ if (delta.getKind() == IResourceDelta.REMOVED ||
+ delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) {
+ Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false);
+ if (resource != null) {
+ if (delta.getKind() == IResourceDelta.REMOVED) {
+ removedResources.add(resource);
+ }
+ else if (!savedResources.remove(resource)) {
+ changedResources.add(resource);
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public Collection<Resource> getChangedResources() {
+ return changedResources;
+ }
+
+ public Collection<Resource> getRemovedResources() {
+ return removedResources;
+ }
+ }
+
+ final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
+ delta.accept(visitor);
+
+ if (!visitor.getRemovedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ removedResources.addAll(visitor.getRemovedResources());
+ if (!isDirty()) {
+ getSite().getPage().closeEditor(AutomaticexperimentEditor.this, false);
+ }
+ }
+ });
+ }
+
+ if (!visitor.getChangedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ changedResources.addAll(visitor.getChangedResources());
+ if (getSite().getPage().getActiveEditor() == AutomaticexperimentEditor.this) {
+ handleActivate();
+ }
+ }
+ });
+ }
+ }
+ catch (CoreException exception) {
+ AutomaticexperienceEditPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ /**
+ * Handles activation of the editor or it's associated views.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void handleActivate() {
+ // Recompute the read only state.
+ //
+ if (editingDomain.getResourceToReadOnlyMap() != null) {
+ editingDomain.getResourceToReadOnlyMap().clear();
+
+ // Refresh any actions that may become enabled or disabled.
+ //
+ setSelection(getSelection());
+ }
+
+ if (!removedResources.isEmpty()) {
+ if (handleDirtyConflict()) {
+ getSite().getPage().closeEditor(AutomaticexperimentEditor.this, false);
+ }
+ else {
+ removedResources.clear();
+ changedResources.clear();
+ savedResources.clear();
+ }
+ }
+ else if (!changedResources.isEmpty()) {
+ changedResources.removeAll(savedResources);
+ handleChangedResources();
+ changedResources.clear();
+ savedResources.clear();
+ }
+ }
+
+ /**
+ * Handles what to do with changed resources on activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void handleChangedResources() {
+ if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
+ if (isDirty()) {
+ changedResources.addAll(editingDomain.getResourceSet().getResources());
+ }
+ editingDomain.getCommandStack().flush();
+
+ updateProblemIndication = false;
+ for (Resource resource : changedResources) {
+ if (resource.isLoaded()) {
+ resource.unload();
+ try {
+ resource.load(Collections.EMPTY_MAP);
+ }
+ catch (IOException exception) {
+ if (!resourceToDiagnosticMap.containsKey(resource)) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ }
+ }
+ }
+
+ if (AdapterFactoryEditingDomain.isStale(editorSelection)) {
+ setSelection(StructuredSelection.EMPTY);
+ }
+
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+ }
+
+ /**
+ * Updates the problems indication with the information described in the specified diagnostic.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void updateProblemIndication() {
+ if (updateProblemIndication) {
+ BasicDiagnostic diagnostic =
+ new BasicDiagnostic
+ (Diagnostic.OK,
+ "org.eclipse.stem.analysis.automaticexperiment",
+ 0,
+ null,
+ new Object [] { editingDomain.getResourceSet() });
+ for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
+ if (childDiagnostic.getSeverity() != Diagnostic.OK) {
+ diagnostic.add(childDiagnostic);
+ }
+ }
+
+ int lastEditorPage = getPageCount() - 1;
+ if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
+ ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ setActivePage(lastEditorPage);
+ }
+ }
+ else if (diagnostic.getSeverity() != Diagnostic.OK) {
+ ProblemEditorPart problemEditorPart = new ProblemEditorPart();
+ problemEditorPart.setDiagnostic(diagnostic);
+ problemEditorPart.setMarkerHelper(markerHelper);
+ try {
+ addPage(++lastEditorPage, problemEditorPart, getEditorInput());
+ setPageText(lastEditorPage, problemEditorPart.getPartName());
+ setActivePage(lastEditorPage);
+ showTabs();
+ }
+ catch (PartInitException exception) {
+ AutomaticexperienceEditPlugin.INSTANCE.log(exception);
+ }
+ }
+
+ if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
+ markerHelper.deleteMarkers(editingDomain.getResourceSet());
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ try {
+ markerHelper.createMarkers(diagnostic);
+ }
+ catch (CoreException exception) {
+ AutomaticexperienceEditPlugin.INSTANCE.log(exception);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Shows a dialog that asks if conflicting changes should be discarded.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean handleDirtyConflict() {
+ return
+ MessageDialog.openQuestion
+ (getSite().getShell(),
+ getString("_UI_FileConflict_label"),
+ getString("_WARN_FileConflict"));
+ }
+
+ /**
+ * This creates a model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperimentEditor() {
+ super();
+ initializeEditingDomain();
+ }
+
+ /**
+ * This sets up the editing domain for the model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void initializeEditingDomain() {
+ // Create an adapter factory that yields item providers.
+ //
+ adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+
+ adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new AutomaticexperimentItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new AnalysisItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new CommonItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new GraphItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ModelItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ModifierItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ScenarioItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new SequencerItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new SolverItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+
+ // Create the command stack that will notify this editor as commands are executed.
+ //
+ BasicCommandStack commandStack = new BasicCommandStack();
+
+ // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
+ //
+ commandStack.addCommandStackListener
+ (new CommandStackListener() {
+ public void commandStackChanged(final EventObject event) {
+ getContainer().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+
+ // Try to select the affected objects.
+ //
+ Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null) {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+ if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
+ propertySheetPage.refresh();
+ }
+ }
+ });
+ }
+ });
+
+ // Create the editing domain with a special command stack.
+ //
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
+ }
+
+ /**
+ * This is here for the listener to be able to call it.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void firePropertyChange(int action) {
+ super.firePropertyChange(action);
+ }
+
+ /**
+ * This sets the selection into whichever viewer is active.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSelectionToViewer(Collection<?> collection) {
+ final Collection<?> theSelection = collection;
+ // Make sure it's okay.
+ //
+ if (theSelection != null && !theSelection.isEmpty()) {
+ Runnable runnable =
+ new Runnable() {
+ public void run() {
+ // Try to select the items in the current content viewer of the editor.
+ //
+ if (currentViewer != null) {
+ currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true);
+ }
+ }
+ };
+ getSite().getShell().getDisplay().asyncExec(runnable);
+ }
+ }
+
+ /**
+ * This returns the editing domain as required by the {@link IEditingDomainProvider} interface.
+ * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain}
+ * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EditingDomain getEditingDomain() {
+ return editingDomain;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object [] getElements(Object object) {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object [] getChildren(Object object) {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ Object parent = super.getParent(object);
+ return parent != null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getParent(Object object) {
+ return null;
+ }
+ }
+
+ /**
+ * This makes sure that one content viewer, either for the current page or the outline view, if it has focus,
+ * is the current one.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCurrentViewer(Viewer viewer) {
+ // If it is changing...
+ //
+ if (currentViewer != viewer) {
+ if (selectionChangedListener == null) {
+ // Create the listener on demand.
+ //
+ selectionChangedListener =
+ new ISelectionChangedListener() {
+ // This just notifies those things that are affected by the section.
+ //
+ public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
+ setSelection(selectionChangedEvent.getSelection());
+ }
+ };
+ }
+
+ // Stop listening to the old one.
+ //
+ if (currentViewer != null) {
+ currentViewer.removeSelectionChangedListener(selectionChangedListener);
+ }
+
+ // Start listening to the new one.
+ //
+ if (viewer != null) {
+ viewer.addSelectionChangedListener(selectionChangedListener);
+ }
+
+ // Remember it.
+ //
+ currentViewer = viewer;
+
+ // Set the editors selection based on the current viewer's selection.
+ //
+ setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
+ }
+ }
+
+ /**
+ * This returns the viewer as required by the {@link IViewerProvider} interface.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Viewer getViewer() {
+ return currentViewer;
+ }
+
+ /**
+ * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void createContextMenuFor(StructuredViewer viewer) {
+ MenuManager contextMenu = new MenuManager("#PopUp");
+ contextMenu.add(new Separator("additions"));
+ contextMenu.setRemoveAllWhenShown(true);
+ contextMenu.addMenuListener(this);
+ Menu menu= contextMenu.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
+
+ int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
+ Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
+ viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
+ viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
+ }
+
+ /**
+ * This is the method called to load a resource into the editing domain's resource set based on the editor's input.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createModel() {
+ URI resourceURI = EditUIUtil.getURI(getEditorInput());
+ Exception exception = null;
+ Resource resource = null;
+ try {
+ // Load the resource through the editing domain.
+ //
+ resource = editingDomain.getResourceSet().getResource(resourceURI, true);
+ }
+ catch (Exception e) {
+ exception = e;
+ resource = editingDomain.getResourceSet().getResource(resourceURI, false);
+ }
+
+ Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
+ }
+
+ /**
+ * Returns a diagnostic describing the errors and warnings listed in the resource
+ * and the specified exception (if any).
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
+ if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
+ BasicDiagnostic basicDiagnostic =
+ new BasicDiagnostic
+ (Diagnostic.ERROR,
+ "org.eclipse.stem.analysis.automaticexperiment",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object [] { exception == null ? (Object)resource : exception });
+ basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
+ return basicDiagnostic;
+ }
+ else if (exception != null) {
+ return
+ new BasicDiagnostic
+ (Diagnostic.ERROR,
+ "org.eclipse.stem.analysis.automaticexperiment",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object[] { exception });
+ }
+ else {
+ return Diagnostic.OK_INSTANCE;
+ }
+ }
+
+ /**
+ * This is the method used by the framework to install your own controls.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public void createPages() {
+ // Creates the model from the editor input
+ //
+ createModel();
+
+ // Only creates the other pages if there is something that can be edited
+ //
+ if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
+ // Create a page for the selection tree view.
+ //
+ Tree tree = new Tree(getContainer(), SWT.MULTI);
+ selectionViewer = new TreeViewer(tree);
+ setCurrentViewer(selectionViewer);
+
+ selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+// selectionViewer.setInput(editingDomain.getResourceSet());
+ selectionViewer.setInput(editingDomain.getResourceSet().getResources().get(0));
+ selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
+
+ new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
+
+ createContextMenuFor(selectionViewer);
+ int pageIndex = addPage(tree);
+ setPageText(pageIndex, getString("_UI_SelectionPage_label"));
+
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ setActivePage(0);
+ }
+ });
+ }
+
+ // Ensures that this editor will only display the page's tab
+ // area if there are more than one page
+ //
+ getContainer().addControlListener
+ (new ControlAdapter() {
+ boolean guard = false;
+ @Override
+ public void controlResized(ControlEvent event) {
+ if (!guard) {
+ guard = true;
+ hideTabs();
+ guard = false;
+ }
+ }
+ });
+
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+ }
+
+ /**
+ * If there is just one page in the multi-page editor part,
+ * this hides the single tab at the bottom.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void hideTabs() {
+ if (getPageCount() <= 1) {
+ setPageText(0, "");
+ if (getContainer() instanceof CTabFolder) {
+ ((CTabFolder)getContainer()).setTabHeight(1);
+ Point point = getContainer().getSize();
+ getContainer().setSize(point.x, point.y + 6);
+ }
+ }
+ }
+
+ /**
+ * If there is more than one page in the multi-page editor part,
+ * this shows the tabs at the bottom.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void showTabs() {
+ if (getPageCount() > 1) {
+ setPageText(0, getString("_UI_SelectionPage_label"));
+ if (getContainer() instanceof CTabFolder) {
+ ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
+ Point point = getContainer().getSize();
+ getContainer().setSize(point.x, point.y - 6);
+ }
+ }
+ }
+
+ /**
+ * This is used to track the active viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void pageChange(int pageIndex) {
+ super.pageChange(pageIndex);
+
+ if (contentOutlinePage != null) {
+ handleContentOutlineSelection(contentOutlinePage.getSelection());
+ }
+ }
+
+ /**
+ * This is how the framework determines which interfaces we implement.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object getAdapter(Class key) {
+ if (key.equals(IContentOutlinePage.class)) {
+ return showOutlineView() ? getContentOutlinePage() : null;
+ }
+ else if (key.equals(IPropertySheetPage.class)) {
+ return getPropertySheetPage();
+ }
+ else if (key.equals(IGotoMarker.class)) {
+ return this;
+ }
+ else {
+ return super.getAdapter(key);
+ }
+ }
+
+ /**
+ * This accesses a cached version of the content outliner.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IContentOutlinePage getContentOutlinePage() {
+ if (contentOutlinePage == null) {
+ // The content outline is just a tree.
+ //
+ class MyContentOutlinePage extends ContentOutlinePage {
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ contentOutlineViewer = getTreeViewer();
+ contentOutlineViewer.addSelectionChangedListener(this);
+
+ // Set up the tree viewer.
+ //
+ contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ contentOutlineViewer.setInput(editingDomain.getResourceSet());
+
+ // Make sure our popups work.
+ //
+ createContextMenuFor(contentOutlineViewer);
+
+ if (!editingDomain.getResourceSet().getResources().isEmpty()) {
+ // Select the root object in the view.
+ //
+ contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
+ }
+ }
+
+ @Override
+ public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
+ super.makeContributions(menuManager, toolBarManager, statusLineManager);
+ contentOutlineStatusLineManager = statusLineManager;
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ }
+
+ contentOutlinePage = new MyContentOutlinePage();
+
+ // Listen to selection so that we can handle it is a special way.
+ //
+ contentOutlinePage.addSelectionChangedListener
+ (new ISelectionChangedListener() {
+ // This ensures that we handle selections correctly.
+ //
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleContentOutlineSelection(event.getSelection());
+ }
+ });
+ }
+
+ return contentOutlinePage;
+ }
+
+ /**
+ * This accesses a cached version of the property sheet.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IPropertySheetPage getPropertySheetPage() {
+ if (propertySheetPage == null) {
+ propertySheetPage =
+ new ExtendedPropertySheetPage(editingDomain) {
+ @Override
+ public void setSelectionToViewer(List<?> selection) {
+ AutomaticexperimentEditor.this.setSelectionToViewer(selection);
+ AutomaticexperimentEditor.this.setFocus();
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ };
+ propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+ }
+
+ return propertySheetPage;
+ }
+
+ /**
+ * This deals with how we want selection in the outliner to affect the other views.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void handleContentOutlineSelection(ISelection selection) {
+ if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
+ if (selectedElements.hasNext()) {
+ // Get the first selected element.
+ //
+ Object selectedElement = selectedElements.next();
+
+ ArrayList<Object> selectionList = new ArrayList<Object>();
+ selectionList.add(selectedElement);
+ while (selectedElements.hasNext()) {
+ selectionList.add(selectedElements.next());
+ }
+
+ // Set the selection to the widget.
+ //
+ selectionViewer.setSelection(new StructuredSelection(selectionList));
+ }
+ }
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply tests the command stack.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isDirty() {
+ return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded();
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply saves the model file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ // Save only resources that have actually changed.
+ //
+ final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+
+ // Do the work within an operation because this is a long running activity that modifies the workbench.
+ //
+ WorkspaceModifyOperation operation =
+ new WorkspaceModifyOperation() {
+ // This is the method that gets invoked when the operation runs.
+ //
+ @Override
+ public void execute(IProgressMonitor monitor) {
+ // Save the resources to the file system.
+ //
+ boolean first = true;
+ for (Resource resource : editingDomain.getResourceSet().getResources()) {
+ if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
+ try {
+ long timeStamp = resource.getTimeStamp();
+ resource.save(saveOptions);
+ if (resource.getTimeStamp() != timeStamp) {
+ savedResources.add(resource);
+ }
+ }
+ catch (Exception exception) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ first = false;
+ }
+ }
+ }
+ };
+
+ updateProblemIndication = false;
+ try {
+ // This runs the options, and shows progress.
+ //
+ new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
+
+ // Refresh the necessary state.
+ //
+ ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ catch (Exception exception) {
+ // Something went wrong that shouldn't.
+ //
+ AutomaticexperienceEditPlugin.INSTANCE.log(exception);
+ }
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+
+ /**
+ * This returns whether something has been persisted to the URI of the specified resource.
+ * The implementation uses the URI converter from the editor's resource set to try to open an input stream.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean isPersisted(Resource resource) {
+ boolean result = false;
+ try {
+ InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
+ if (stream != null) {
+ result = true;
+ stream.close();
+ }
+ }
+ catch (IOException e) {
+ // Ignore
+ }
+ return result;
+ }
+
+ /**
+ * This always returns true because it is not currently supported.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * This also changes the editor's input.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void doSaveAs() {
+ SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
+ saveAsDialog.open();
+ IPath path = saveAsDialog.getResult();
+ if (path != null) {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if (file != null) {
+ doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
+ }
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void doSaveAs(URI uri, IEditorInput editorInput) {
+ (editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ IProgressMonitor progressMonitor =
+ getActionBars().getStatusLineManager() != null ?
+ getActionBars().getStatusLineManager().getProgressMonitor() :
+ new NullProgressMonitor();
+ doSave(progressMonitor);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void gotoMarker(IMarker marker) {
+ try {
+ if (marker.getType().equals(EValidator.MARKER)) {
+ String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
+ if (uriAttribute != null) {
+ URI uri = URI.createURI(uriAttribute);
+ EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
+ if (eObject != null) {
+ setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
+ }
+ }
+ }
+ }
+ catch (CoreException exception) {
+ AutomaticexperienceEditPlugin.INSTANCE.log(exception);
+ }
+ }
+
+ /**
+ * This is called during startup.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput editorInput) {
+ setSite(site);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ site.setSelectionProvider(this);
+ site.getPage().addPartListener(partListener);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setFocus() {
+ getControl(getActivePage()).setFocus();
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionChangedListeners.add(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionChangedListeners.remove(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ISelection getSelection() {
+ return editorSelection;
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
+ * Calling this result will notify the listeners.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSelection(ISelection selection) {
+ editorSelection = selection;
+
+ for (ISelectionChangedListener listener : selectionChangedListeners) {
+ listener.selectionChanged(new SelectionChangedEvent(this, selection));
+ }
+ setStatusLineManager(selection);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setStatusLineManager(ISelection selection) {
+ IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ?
+ contentOutlineStatusLineManager : getActionBars().getStatusLineManager();
+
+ if (statusLineManager != null) {
+ if (selection instanceof IStructuredSelection) {
+ Collection<?> collection = ((IStructuredSelection)selection).toList();
+ switch (collection.size()) {
+ case 0: {
+ statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
+ break;
+ }
+ case 1: {
+ String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
+ statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
+ break;
+ }
+ default: {
+ statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
+ break;
+ }
+ }
+ }
+ else {
+ statusLineManager.setMessage("");
+ }
+ }
+ }
+
+ /**
+ * This looks up a string in the plugin's plugin.properties file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static String getString(String key) {
+ return AutomaticexperienceEditPlugin.INSTANCE.getString(key);
+ }
+
+ /**
+ * This looks up a string in plugin.properties, making a substitution.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static String getString(String key, Object s1) {
+ return AutomaticexperienceEditPlugin.INSTANCE.getString(key, new Object [] { s1 });
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void menuAboutToShow(IMenuManager menuManager) {
+ ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EditingDomainActionBarContributor getActionBarContributor() {
+ return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IActionBars getActionBars() {
+ return getActionBarContributor().getActionBars();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AdapterFactory getAdapterFactory() {
+ return adapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void dispose() {
+ updateProblemIndication = false;
+
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
+
+ getSite().getPage().removePartListener(partListener);
+
+ adapterFactory.dispose();
+
+ if (getActionBarContributor().getActiveEditor() == this) {
+ getActionBarContributor().setActiveEditor(null);
+ }
+
+ if (propertySheetPage != null) {
+ propertySheetPage.dispose();
+ }
+
+ if (contentOutlinePage != null) {
+ contentOutlinePage.dispose();
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * Returns whether the outline view should be presented to the user.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean showOutlineView() {
+ return false;
+ }
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/presentation/AutomaticexperimentModelWizard.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/presentation/AutomaticexperimentModelWizard.java
new file mode 100644
index 0000000..e581619
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/presentation/AutomaticexperimentModelWizard.java
@@ -0,0 +1,612 @@
+package org.eclipse.stem.analysis.automaticexperiment.presentation;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.CommonPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentFactory;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+import org.eclipse.stem.analysis.automaticexperiment.provider.AutomaticexperienceEditPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ISetSelectionTarget;
+
+
+
+/**
+ * This is a simple wizard for creating a new model file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AutomaticexperimentModelWizard extends Wizard implements INewWizard {
+ /**
+ * The supported extensions for created files.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<String> FILE_EXTENSIONS =
+ Collections.unmodifiableList(Arrays.asList(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_AutomaticexperimentEditorFilenameExtensions").split("\\s*,\\s*")));
+
+ /**
+ * A formatted list of supported file extensions, suitable for display.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String FORMATTED_FILE_EXTENSIONS =
+ AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_AutomaticexperimentEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
+
+ /**
+ * This caches an instance of the model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AutomaticexperimentPackage automaticexperimentPackage = AutomaticexperimentPackage.eINSTANCE;
+
+ /**
+ * This caches an instance of the model factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AutomaticexperimentFactory automaticexperimentFactory = automaticexperimentPackage.getAutomaticexperimentFactory();
+
+ /**
+ * This is the file creation page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AutomaticexperimentModelWizardNewFileCreationPage newFileCreationPage;
+
+ /**
+ * This is the initial object creation page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AutomaticexperimentModelWizardInitialObjectCreationPage initialObjectCreationPage;
+
+ /**
+ * Remember the selection during initialization for populating the default container.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * Remember the workbench during initialization.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IWorkbench workbench;
+
+ /**
+ * Caches the names of the types that can be created as the root object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected List<String> initialObjectNames;
+
+ /**
+ * This just records the information.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_Wizard_label"));
+ setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(AutomaticexperienceEditPlugin.INSTANCE.getImage("full/wizban/NewAutomaticexperiment")));
+ }
+
+ /**
+ * Returns the names of the types that can be created as the root object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<String> getInitialObjectNames() {
+ if (initialObjectNames == null) {
+ initialObjectNames = new ArrayList<String>();
+ for (EClassifier eClassifier : automaticexperimentPackage.getEClassifiers()) {
+ if (eClassifier instanceof EClass) {
+ EClass eClass = (EClass)eClassifier;
+ if (!eClass.isAbstract()) {
+ initialObjectNames.add(eClass.getName());
+ }
+ }
+ }
+ Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
+ }
+ return initialObjectNames;
+ }
+
+ /**
+ * Create a new model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EObject createInitialModel() {
+ EClass eClass = (EClass)automaticexperimentPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName());
+ EObject rootObject = automaticexperimentFactory.create(eClass);
+ return rootObject;
+ }
+
+ /**
+ * Do the work after everything is specified.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean performFinish() {
+ try {
+ // Remember the file.
+ //
+ final IFile modelFile = getModelFile();
+
+ // Do the work within an operation.
+ //
+ WorkspaceModifyOperation operation =
+ new WorkspaceModifyOperation() {
+ @Override
+ protected void execute(IProgressMonitor progressMonitor) {
+ try {
+ // Create a resource set
+ //
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Get the URI of the model file.
+ //
+ URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
+
+ // Create a resource for this file.
+ //
+ Resource resource = resourceSet.createResource(fileURI);
+
+ // Add the initial model object to the contents.
+ //
+ EObject rootObject = createInitialModel();
+ if (rootObject != null) {
+ resource.getContents().add(rootObject);
+ }
+
+ // Save the contents of the resource to the file system.
+ //
+ Map<Object, Object> options = new HashMap<Object, Object>();
+ options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
+ resource.save(options);
+ }
+ catch (Exception exception) {
+ AutomaticexperienceEditPlugin.INSTANCE.log(exception);
+ }
+ finally {
+ progressMonitor.done();
+ }
+ }
+ };
+
+ getContainer().run(false, false, operation);
+
+ // Select the new file resource in the current view.
+ //
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage page = workbenchWindow.getActivePage();
+ final IWorkbenchPart activePart = page.getActivePart();
+ if (activePart instanceof ISetSelectionTarget) {
+ final ISelection targetSelection = new StructuredSelection(modelFile);
+ getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
+ }
+ });
+ }
+
+ // Open an editor on the new file.
+ //
+ try {
+ page.openEditor
+ (new FileEditorInput(modelFile),
+ workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
+ }
+ catch (PartInitException exception) {
+ MessageDialog.openError(workbenchWindow.getShell(), AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
+ return false;
+ }
+
+ return true;
+ }
+ catch (Exception exception) {
+ AutomaticexperienceEditPlugin.INSTANCE.log(exception);
+ return false;
+ }
+ }
+
+ /**
+ * This is the one page of the wizard.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public class AutomaticexperimentModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
+ /**
+ * Pass in the selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperimentModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) {
+ super(pageId, selection);
+ }
+
+ /**
+ * The framework calls this to see if the file is correct.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected boolean validatePage() {
+ if (super.validatePage()) {
+ String extension = new Path(getFileName()).getFileExtension();
+ if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
+ String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
+ setErrorMessage(AutomaticexperienceEditPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IFile getModelFile() {
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));
+ }
+ }
+
+ /**
+ * This is the page where the type of object to create is selected.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public class AutomaticexperimentModelWizardInitialObjectCreationPage extends WizardPage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Combo initialObjectField;
+
+ /**
+ * @generated
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ */
+ protected List<String> encodings;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Combo encodingField;
+
+ /**
+ * Pass in the selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperimentModelWizardInitialObjectCreationPage(String pageId) {
+ super(pageId);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE); {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.verticalSpacing = 12;
+ composite.setLayout(layout);
+
+ GridData data = new GridData();
+ data.verticalAlignment = GridData.FILL;
+ data.grabExcessVerticalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ composite.setLayoutData(data);
+ }
+
+ Label containerLabel = new Label(composite, SWT.LEFT);
+ {
+ containerLabel.setText(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_ModelObject"));
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ containerLabel.setLayoutData(data);
+ }
+
+ initialObjectField = new Combo(composite, SWT.BORDER);
+ {
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ initialObjectField.setLayoutData(data);
+ }
+
+ for (String objectName : getInitialObjectNames()) {
+ initialObjectField.add(getLabel(objectName));
+ }
+
+ if (initialObjectField.getItemCount() == 1) {
+ initialObjectField.select(0);
+ }
+ initialObjectField.addModifyListener(validator);
+
+ Label encodingLabel = new Label(composite, SWT.LEFT);
+ {
+ encodingLabel.setText(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_XMLEncoding"));
+
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ encodingLabel.setLayoutData(data);
+ }
+ encodingField = new Combo(composite, SWT.BORDER);
+ {
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ encodingField.setLayoutData(data);
+ }
+
+ for (String encoding : getEncodings()) {
+ encodingField.add(encoding);
+ }
+
+ encodingField.select(0);
+ encodingField.addModifyListener(validator);
+
+ setPageComplete(validatePage());
+ setControl(composite);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ModifyListener validator =
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ setPageComplete(validatePage());
+ }
+ };
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean validatePage() {
+ return getInitialObjectName() != null && getEncodings().contains(encodingField.getText());
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (visible) {
+ if (initialObjectField.getItemCount() == 1) {
+ initialObjectField.clearSelection();
+ encodingField.setFocus();
+ }
+ else {
+ encodingField.clearSelection();
+ initialObjectField.setFocus();
+ }
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getInitialObjectName() {
+ String label = initialObjectField.getText();
+
+ for (String name : getInitialObjectNames()) {
+ if (getLabel(name).equals(label)) {
+ return name;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getEncoding() {
+ return encodingField.getText();
+ }
+
+ /**
+ * Returns the label for the specified type name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected String getLabel(String typeName) {
+ try {
+ return AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type");
+ }
+ catch(MissingResourceException mre) {
+ AutomaticexperienceEditPlugin.INSTANCE.log(mre);
+ }
+ return typeName;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<String> getEncodings() {
+ if (encodings == null) {
+ encodings = new ArrayList<String>();
+ for (StringTokenizer stringTokenizer = new StringTokenizer(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) {
+ encodings.add(stringTokenizer.nextToken());
+ }
+ }
+ return encodings;
+ }
+ }
+
+ /**
+ * The framework calls this to create the contents of the wizard.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void addPages() {
+ // Create a page, set the title, and the initial model file name.
+ //
+ newFileCreationPage = new AutomaticexperimentModelWizardNewFileCreationPage("Whatever", selection);
+ newFileCreationPage.setTitle(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_AutomaticexperimentModelWizard_label"));
+ newFileCreationPage.setDescription(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_AutomaticexperimentModelWizard_description"));
+ newFileCreationPage.setFileName(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_AutomaticexperimentEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
+ addPage(newFileCreationPage);
+
+ // Try and get the resource selection to determine a current directory for the file dialog.
+ //
+ if (selection != null && !selection.isEmpty()) {
+ // Get the resource...
+ //
+ Object selectedElement = selection.iterator().next();
+ if (selectedElement instanceof IResource) {
+ // Get the resource parent, if its a file.
+ //
+ IResource selectedResource = (IResource)selectedElement;
+ if (selectedResource.getType() == IResource.FILE) {
+ selectedResource = selectedResource.getParent();
+ }
+
+ // This gives us a directory...
+ //
+ if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
+ // Set this for the container.
+ //
+ newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
+
+ // Make up a unique new name here.
+ //
+ String defaultModelBaseFilename = AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_AutomaticexperimentEditorFilenameDefaultBase");
+ String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
+ String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
+ for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
+ modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
+ }
+ newFileCreationPage.setFileName(modelFilename);
+ }
+ }
+ }
+ initialObjectCreationPage = new AutomaticexperimentModelWizardInitialObjectCreationPage("Whatever2");
+ initialObjectCreationPage.setTitle(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_AutomaticexperimentModelWizard_label"));
+ initialObjectCreationPage.setDescription(AutomaticexperienceEditPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
+ addPage(initialObjectCreationPage);
+ }
+
+ /**
+ * Get the file from the page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IFile getModelFile() {
+ return newFileCreationPage.getModelFile();
+ }
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/AutomaticExperimentItemProvider.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/AutomaticExperimentItemProvider.java
new file mode 100644
index 0000000..1f996f0
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/AutomaticExperimentItemProvider.java
@@ -0,0 +1,385 @@
+package org.eclipse.stem.analysis.automaticexperiment.provider;
+
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.stem.analysis.AnalysisFactory;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AutomaticExperimentItemProvider
+ extends OptimizerAlgorithmItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticExperimentItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addBaseScenarioPropertyDescriptor(object);
+ addParametersPropertyDescriptor(object);
+ addErrorAnalysisAlgorithmPropertyDescriptor(object);
+ addErrorFunctionPropertyDescriptor(object);
+ addTolerancePropertyDescriptor(object);
+ addReferanceDataDirPropertyDescriptor(object);
+ addMaximumNumberOfIterationsPropertyDescriptor(object);
+ addReInitPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Base Scenario feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addBaseScenarioPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AutomaticExperiment_baseScenario_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AutomaticExperiment_baseScenario_feature", "_UI_AutomaticExperiment_type"),
+ AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__BASE_SCENARIO,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Parameters feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addParametersPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AutomaticExperiment_parameters_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AutomaticExperiment_parameters_feature", "_UI_AutomaticExperiment_type"),
+ AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__PARAMETERS,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Error Analysis Algorithm feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addErrorAnalysisAlgorithmPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AutomaticExperiment_errorAnalysisAlgorithm_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AutomaticExperiment_errorAnalysisAlgorithm_feature", "_UI_AutomaticExperiment_type"),
+ AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__ERROR_ANALYSIS_ALGORITHM,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Error Function feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addErrorFunctionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AutomaticExperiment_errorFunction_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AutomaticExperiment_errorFunction_feature", "_UI_AutomaticExperiment_type"),
+ AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__ERROR_FUNCTION,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Tolerance feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addTolerancePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AutomaticExperiment_tolerance_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AutomaticExperiment_tolerance_feature", "_UI_AutomaticExperiment_type"),
+ AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__TOLERANCE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.REAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Referance Data Dir feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addReferanceDataDirPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AutomaticExperiment_referanceDataDir_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AutomaticExperiment_referanceDataDir_feature", "_UI_AutomaticExperiment_type"),
+ AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__REFERANCE_DATA_DIR,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Maximum Number Of Iterations feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addMaximumNumberOfIterationsPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AutomaticExperiment_maximumNumberOfIterations_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AutomaticExperiment_maximumNumberOfIterations_feature", "_UI_AutomaticExperiment_type"),
+ AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__MAXIMUM_NUMBER_OF_ITERATIONS,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Re Init feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addReInitPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AutomaticExperiment_reInit_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AutomaticExperiment_reInit_feature", "_UI_AutomaticExperiment_type"),
+ AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__RE_INIT,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__BASE_SCENARIO);
+ childrenFeatures.add(AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__PARAMETERS);
+ childrenFeatures.add(AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__ERROR_FUNC);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns AutomaticExperiment.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/customobj16/AutomaticExperiment"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated NOT
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((AutomaticExperiment)object).getURI().lastSegment();
+ return label == null || label.length() == 0 ?
+ getString("_UI_AutomaticExperiment_type") :
+ label;
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getTextGen(Object object) {
+ URI labelValue = ((AutomaticExperiment)object).getURI();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ?
+ getString("_UI_AutomaticExperiment_type") :
+ getString("_UI_AutomaticExperiment_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(AutomaticExperiment.class)) {
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_ANALYSIS_ALGORITHM:
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNCTION:
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__TOLERANCE:
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__REFERANCE_DATA_DIR:
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__MAXIMUM_NUMBER_OF_ITERATIONS:
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__RE_INIT:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT__ERROR_FUNC:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__ERROR_FUNC,
+ AnalysisFactory.eINSTANCE.createErrorFunction()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__ERROR_FUNC,
+ AnalysisFactory.eINSTANCE.createThresholdErrorFunction()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (AutomaticexperimentPackage.Literals.AUTOMATIC_EXPERIMENT__ERROR_FUNC,
+ AnalysisFactory.eINSTANCE.createSimpleErrorFunction()));
+ }
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/AutomaticexperienceEditPlugin.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/AutomaticexperienceEditPlugin.java
new file mode 100644
index 0000000..01a44ef
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/AutomaticexperienceEditPlugin.java
@@ -0,0 +1,104 @@
+package org.eclipse.stem.analysis.automaticexperiment.provider;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.ui.EclipseUIPlugin;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
+import org.eclipse.stem.analysis.provider.AnalysisEditPlugin;
+import org.eclipse.stem.core.common.provider.CoreEditPlugin;
+
+/**
+ * This is the central singleton for the Automaticexperience editor plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class AutomaticexperienceEditPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final AutomaticexperienceEditPlugin INSTANCE = new AutomaticexperienceEditPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperienceEditPlugin() {
+ super
+ (new ResourceLocator [] {
+ AnalysisEditPlugin.INSTANCE,
+ CoreEditPlugin.INSTANCE,
+ EcoreEditPlugin.INSTANCE,
+ });
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipseUIPlugin {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/AutomaticexperimentItemProviderAdapterFactory.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/AutomaticexperimentItemProviderAdapterFactory.java
new file mode 100644
index 0000000..56f0df4
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/AutomaticexperimentItemProviderAdapterFactory.java
@@ -0,0 +1,255 @@
+package org.eclipse.stem.analysis.automaticexperiment.provider;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.stem.analysis.automaticexperiment.util.AutomaticexperimentAdapterFactory;
+
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers.
+ * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
+ * The adapters also support Eclipse property sheets.
+ * Note that most of the adapters are shared among multiple instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AutomaticexperimentItemProviderAdapterFactory extends AutomaticexperimentAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Object> supportedTypes = new ArrayList<Object>();
+
+ /**
+ * This constructs an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperimentItemProviderAdapterFactory() {
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AutomaticExperimentItemProvider automaticExperimentItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createAutomaticExperimentAdapter() {
+ if (automaticExperimentItemProvider == null) {
+ automaticExperimentItemProvider = new AutomaticExperimentItemProvider(this);
+ }
+
+ return automaticExperimentItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ModifiableParameterItemProvider modifiableParameterItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createModifiableParameterAdapter() {
+ if (modifiableParameterItemProvider == null) {
+ modifiableParameterItemProvider = new ModifiableParameterItemProvider(this);
+ }
+
+ return modifiableParameterItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected OptimizerAlgorithmItemProvider optimizerAlgorithmItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createOptimizerAlgorithmAdapter() {
+ if (optimizerAlgorithmItemProvider == null) {
+ optimizerAlgorithmItemProvider = new OptimizerAlgorithmItemProvider(this);
+ }
+
+ return optimizerAlgorithmItemProvider;
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This adds a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This disposes all of the item providers created by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void dispose() {
+ if (automaticExperimentItemProvider != null) automaticExperimentItemProvider.dispose();
+ if (modifiableParameterItemProvider != null) modifiableParameterItemProvider.dispose();
+ if (optimizerAlgorithmItemProvider != null) optimizerAlgorithmItemProvider.dispose();
+ }
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/ModifiableParameterItemProvider.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/ModifiableParameterItemProvider.java
new file mode 100644
index 0000000..da62384
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/ModifiableParameterItemProvider.java
@@ -0,0 +1,307 @@
+package org.eclipse.stem.analysis.automaticexperiment.provider;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+import org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter;
+
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ModifiableParameterItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModifiableParameterItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addInitialValuePropertyDescriptor(object);
+ addFeaturePropertyDescriptor(object);
+ addStepPropertyDescriptor(object);
+ addFeatureNamePropertyDescriptor(object);
+ addLowerBoundPropertyDescriptor(object);
+ addUpperBoundPropertyDescriptor(object);
+ addTargetURIPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Initial Value feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addInitialValuePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ModifiableParameter_initialValue_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ModifiableParameter_initialValue_feature", "_UI_ModifiableParameter_type"),
+ AutomaticexperimentPackage.Literals.MODIFIABLE_PARAMETER__INITIAL_VALUE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.REAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Feature feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addFeaturePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ModifiableParameter_feature_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ModifiableParameter_feature_feature", "_UI_ModifiableParameter_type"),
+ AutomaticexperimentPackage.Literals.MODIFIABLE_PARAMETER__FEATURE,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Step feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addStepPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ModifiableParameter_step_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ModifiableParameter_step_feature", "_UI_ModifiableParameter_type"),
+ AutomaticexperimentPackage.Literals.MODIFIABLE_PARAMETER__STEP,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.REAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Feature Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addFeatureNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ModifiableParameter_featureName_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ModifiableParameter_featureName_feature", "_UI_ModifiableParameter_type"),
+ AutomaticexperimentPackage.Literals.MODIFIABLE_PARAMETER__FEATURE_NAME,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Lower Bound feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addLowerBoundPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ModifiableParameter_lowerBound_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ModifiableParameter_lowerBound_feature", "_UI_ModifiableParameter_type"),
+ AutomaticexperimentPackage.Literals.MODIFIABLE_PARAMETER__LOWER_BOUND,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.REAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Upper Bound feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addUpperBoundPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ModifiableParameter_upperBound_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ModifiableParameter_upperBound_feature", "_UI_ModifiableParameter_type"),
+ AutomaticexperimentPackage.Literals.MODIFIABLE_PARAMETER__UPPER_BOUND,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.REAL_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Target URI feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addTargetURIPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ModifiableParameter_targetURI_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ModifiableParameter_targetURI_feature", "_UI_ModifiableParameter_type"),
+ AutomaticexperimentPackage.Literals.MODIFIABLE_PARAMETER__TARGET_URI,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns ModifiableParameter.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/ModifiableParameter"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((ModifiableParameter)object).getFeatureName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_ModifiableParameter_type") :
+ getString("_UI_ModifiableParameter_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(ModifiableParameter.class)) {
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__INITIAL_VALUE:
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__STEP:
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__FEATURE_NAME:
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__LOWER_BOUND:
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__UPPER_BOUND:
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER__TARGET_URI:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return AutomaticexperienceEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/OptimizerAlgorithmItemProvider.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/OptimizerAlgorithmItemProvider.java
new file mode 100644
index 0000000..651bfc4
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/provider/OptimizerAlgorithmItemProvider.java
@@ -0,0 +1,130 @@
+package org.eclipse.stem.analysis.automaticexperiment.provider;
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+import org.eclipse.stem.core.common.provider.IdentifiableItemProvider;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class OptimizerAlgorithmItemProvider
+ extends IdentifiableItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public OptimizerAlgorithmItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This returns OptimizerAlgorithm.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/OptimizerAlgorithm"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ URI labelValue = ((OptimizerAlgorithm)object).getURI();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ?
+ getString("_UI_OptimizerAlgorithm_type") :
+ getString("_UI_OptimizerAlgorithm_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return AutomaticexperienceEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmCompositeEditor.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmCompositeEditor.java
new file mode 100644
index 0000000..5da9a8a
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmCompositeEditor.java
@@ -0,0 +1,17 @@
+package org.eclipse.stem.analysis.automaticexperiment.ui;
+
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+import org.eclipse.swt.widgets.Composite;
+
+public abstract class AlgorithmCompositeEditor extends Composite {
+
+ AlgorithmCompositeEditor(final Composite parent, final int style) {
+ super(parent, style);
+ }
+
+ public abstract boolean validate();
+
+ public abstract String getErrorMessage();
+
+ public abstract OptimizerAlgorithm createAlgorithm();
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmCompositeEditorAdapter.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmCompositeEditorAdapter.java
new file mode 100644
index 0000000..577e877
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmCompositeEditorAdapter.java
@@ -0,0 +1,14 @@
+package org.eclipse.stem.analysis.automaticexperiment.ui;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.swt.events.ModifyListener;
+
+public abstract class AlgorithmCompositeEditorAdapter extends AdapterImpl implements
+ Adapter {
+
+ abstract public AlgorithmCompositeEditor createCompositeEditor(
+ AlgorithmControl algControl,
+ int style, ModifyListener projectValidator, IProject project);
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmCompositeEditorAdapterFactory.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmCompositeEditorAdapterFactory.java
new file mode 100644
index 0000000..7413594
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmCompositeEditorAdapterFactory.java
@@ -0,0 +1,22 @@
+package org.eclipse.stem.analysis.automaticexperiment.ui;
+
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+
+/**
+ * This class represents
+ */
+public interface AlgorithmCompositeEditorAdapterFactory {
+
+ AlgorithmCompositeEditorAdapterFactoryImpl INSTANCE = new AlgorithmCompositeEditorAdapterFactoryImpl();
+
+ public class AlgorithmCompositeEditorAdapterFactoryImpl extends
+ ComposedAdapterFactory implements
+ AlgorithmCompositeEditorAdapterFactory {
+
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return type == AlgorithmCompositeEditorAdapter.class;
+ }
+
+ }
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmControl.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmControl.java
new file mode 100644
index 0000000..12a316d
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AlgorithmControl.java
@@ -0,0 +1,125 @@
+package org.eclipse.stem.analysis.automaticexperiment.ui;
+
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+import org.eclipse.stem.analysis.automaticexperiment.views.Messages;
+import org.eclipse.stem.ui.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * This class represents the SWT control for defining a disease.
+ */
+public class AlgorithmControl extends Composite {
+
+ private static OptimizerAlgorithm[] algorithms = null;
+
+ StackLayout stackLayout;
+
+
+ private Map<OptimizerAlgorithm, AlgorithmCompositeEditor>compositeMap = new HashMap<OptimizerAlgorithm, AlgorithmCompositeEditor>();
+
+ /**
+ * Create the composite
+ *
+ * @param parent
+ * @param style
+ * @param projectValidator
+ */
+ public AlgorithmControl(final Composite parent, final int style,
+ ModifyListener projectValidator, IProject project, OptimizerAlgorithm[]algorithms) {
+ super(parent, style);
+ stackLayout = new StackLayout();
+ setLayout(stackLayout);
+
+ AlgorithmCompositeEditor firstOne = null;
+ if (algorithms != null) {
+ // Yes
+ for (int i = 0; i < algorithms.length; i++) {
+
+ AlgorithmCompositeEditorAdapter acea = (AlgorithmCompositeEditorAdapter) AlgorithmCompositeEditorAdapterFactory.INSTANCE
+ .adapt(algorithms[i],
+ AlgorithmCompositeEditorAdapter.class);
+
+ final AlgorithmCompositeEditor ace = acea
+ .createCompositeEditor(this, SWT.NONE,projectValidator, project);
+
+ compositeMap.put(algorithms[i], ace);
+ if (firstOne == null) {
+ // Yes
+ firstOne = ace;
+ } // if
+ } // for i
+ } // if any disease models?
+
+ stackLayout.topControl = firstOne;
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.eclipse.stem.doc.newautoexp_contextid");
+ }//
+
+
+
+ void displayAlgorithm(final OptimizerAlgorithm algorithm) {
+ final AlgorithmCompositeEditor ace = compositeMap.get(algorithm);
+ // Did we find it?
+ if (ace != null) {
+ // Yes
+ stackLayout.topControl = ace;
+ layout();
+ } // if
+ else {
+ Activator.logError(Messages.getString("DMPC2") //$NON-NLS-1$
+ + algorithm.getClass().getName() + "\"", null); //$NON-NLS-1$
+ }
+ } //
+
+
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ protected void checkSubclass() {
+ // Disable the check that prevents sub-classing of SWT components
+ }
+
+ /**
+ * @return <code>true</code> if the contents of the control are valid,
+ * <code>false</code> otherwise.
+ */
+ public boolean validate() {
+ return ((AlgorithmCompositeEditor) (stackLayout.topControl))
+ .validate();
+ } // validate
+
+ /**
+ * @return the error message set by {@link #validate()}
+ */
+ public String getErrorMessage() {
+ return ((AlgorithmCompositeEditor) (stackLayout.topControl))
+ .getErrorMessage();
+ }
+
+ public OptimizerAlgorithm createAutomaticExperiment() {
+ return( ((AlgorithmCompositeEditor)(stackLayout.topControl)).createAlgorithm());
+ }
+} //
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AutomaticExperimentCompositeEditor.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AutomaticExperimentCompositeEditor.java
new file mode 100644
index 0000000..645cad9
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AutomaticExperimentCompositeEditor.java
@@ -0,0 +1,665 @@
+package org.eclipse.stem.analysis.automaticexperiment.ui;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.stem.analysis.ErrorFunction;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentFactory;
+import org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter;
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+import org.eclipse.stem.analysis.automaticexperiment.views.Messages;
+import org.eclipse.stem.core.common.Identifiable;
+import org.eclipse.stem.core.common.impl.IdentifiableImpl;
+import org.eclipse.stem.core.scenario.Scenario;
+import org.eclipse.stem.core.scenario.impl.ScenarioImpl;
+import org.eclipse.stem.ui.Activator;
+import org.eclipse.stem.ui.widgets.IdentifiablePickerDialog;
+import org.eclipse.stem.ui.widgets.ParameterPickerDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+
+public class AutomaticExperimentCompositeEditor extends AlgorithmCompositeEditor {
+
+ Text maxItersText;
+ Text referenceDataText;
+ Text baseScenarioText;
+ Combo errorFunctionCombo;
+ Text startValText;
+ Text stepValText;
+ Text minValText;
+ Text maxValText;
+ Text toleranceText;
+ Table table;
+
+ boolean reInit = true;
+ ArrayList<Identifiable> identifiableList = new ArrayList<Identifiable>();
+ ArrayList<EAttribute> attributeList = new ArrayList<EAttribute>();
+ ArrayList<Double>minList = new ArrayList<Double>();
+ ArrayList<Double>maxList = new ArrayList<Double>();
+ ArrayList<Double>startList = new ArrayList<Double>();
+ ArrayList<Double>stepList = new ArrayList<Double>();
+ int currentTableIndex;
+ Scenario baseScenario;
+
+ String errorMessage;
+
+
+ public AutomaticExperimentCompositeEditor(Composite parent, int style, final ModifyListener projectValidator, final IProject project) {
+ super(parent, style);
+ // Fill in the rest here
+
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 3;
+ setLayout(gridLayout);
+
+ Label maxItersLabel = new Label(this, SWT.NONE);
+ maxItersLabel.setText(Messages.getString("NM.MAXITERS"));
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 1;
+ maxItersLabel.setLayoutData(gridData);
+
+ maxItersText = new Text(this, SWT.NONE);
+ maxItersText.setText("-1");
+ GridData gridData2 = new GridData();
+ gridData2.horizontalSpan = 2;
+ gridData2.grabExcessHorizontalSpace = true;
+ gridData2.horizontalAlignment = SWT.FILL;
+ maxItersText.setLayoutData(gridData2);
+ maxItersText.addModifyListener(projectValidator);
+
+ Label refDataLabel = new Label(this, SWT.NONE);
+ refDataLabel.setText(Messages.getString("NM.REFERENCE"));
+ GridData gridData3 = new GridData();
+ gridData3.horizontalSpan = 1;
+ refDataLabel.setLayoutData(gridData3);
+
+ referenceDataText = new Text(this, SWT.NONE);
+ referenceDataText.setText("");
+ GridData gridData4 = new GridData();
+ gridData4.horizontalSpan = 1;
+ gridData4.grabExcessHorizontalSpace = true;
+ gridData4.horizontalAlignment = SWT.FILL;
+ referenceDataText.setLayoutData(gridData4);
+ referenceDataText.addModifyListener(projectValidator);
+
+ Button pickRefereceButton = new Button(this, SWT.NONE);
+ pickRefereceButton.setText(Messages.getString("NM.REFPICKFOLDER"));
+ GridData gridData5 = new GridData();
+ gridData5.horizontalSpan = 1;
+ pickRefereceButton.setLayoutData(gridData5);
+ final Shell shell = this.getShell();
+ pickRefereceButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ final DirectoryDialog dd = new DirectoryDialog(shell,
+ SWT.OPEN | SWT.SINGLE);
+ dd.setText(Messages.getString("NM.REFFOLDERTITLE")); //$NON-NLS-1$
+
+ String selected = dd.open();
+ if(selected != null) referenceDataText.setText(selected);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ Label baseScenarioLabel = new Label(this, SWT.NONE);
+ baseScenarioLabel.setText(Messages.getString("NM.BASESCENARIO"));
+ GridData gridData6 = new GridData();
+ gridData6.horizontalSpan = 1;
+ baseScenarioLabel.setLayoutData(gridData6);
+
+ baseScenarioText = new Text(this, SWT.NONE);
+ baseScenarioText.setText("");
+ GridData gridData7 = new GridData();
+ gridData7.horizontalSpan = 1;
+ gridData7.grabExcessHorizontalSpace = true;
+ gridData7.horizontalAlignment = SWT.FILL;
+ baseScenarioText.setLayoutData(gridData7);
+ baseScenarioText.setEditable(false);
+ baseScenarioText.addModifyListener(projectValidator);
+
+ Button pickScenarioButton = new Button(this, SWT.NONE);
+ pickScenarioButton.setText(Messages.getString("NM.SELECTSCENARIO"));
+ GridData gridData8 = new GridData();
+ gridData8.horizontalSpan = 1;
+ pickScenarioButton.setLayoutData(gridData8);
+ pickScenarioButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+
+ IdentifiablePickerDialog ppDialog = new IdentifiablePickerDialog(AutomaticExperimentCompositeEditor.this.getShell(), SWT.NONE, Messages.getString("NM.PICKSCENARIO"), project, ScenarioImpl.class);
+ Object ret = ppDialog.open();
+ if(ret != null) {
+ baseScenario = (Scenario)ret;
+ baseScenarioText.setText(baseScenario.getURI().toString());
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+
+ Label errorFunctionLabel = new Label(this, SWT.NONE);
+ errorFunctionLabel.setText(Messages.getString("NM.ERRORFUNCTION"));
+ GridData gridData9 = new GridData();
+ gridData9.horizontalSpan = 1;
+ baseScenarioLabel.setLayoutData(gridData9);
+
+ errorFunctionCombo = new Combo(this, SWT.NONE);
+ initializeErrorFunctionCombo();
+ GridData gridData10 = new GridData();
+ gridData10.horizontalSpan = 2;
+ gridData10.grabExcessHorizontalSpace = true;
+ gridData10.horizontalAlignment = SWT.FILL;
+ errorFunctionCombo.setLayoutData(gridData10);
+
+ Label reInitLabel = new Label(this, SWT.NONE);
+ reInitLabel.setText(Messages.getString("NM.REINITLABEL"));
+ GridData gridDataRI = new GridData();
+ gridDataRI.horizontalSpan = 1;
+ reInitLabel.setLayoutData(gridDataRI);
+
+ Composite radioComposite = new Composite(this, SWT.BORDER);
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.type = SWT.HORIZONTAL;
+ radioComposite.setLayout(fillLayout);
+
+ final Button falseButton = new Button(radioComposite, SWT.RADIO);
+ falseButton.setText(Messages.getString("NM.NO"));//$NON-NLS-1$
+
+ Button trueButton = new Button(radioComposite, SWT.RADIO);
+ trueButton.setText(Messages.getString("NM.YES"));//$NON-NLS-1$
+
+ trueButton.setSelection(true);
+ falseButton.setSelection(false);
+
+ Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ if (event.widget == falseButton) {
+ reInit = !falseButton.getSelection();
+ }
+ }
+ };
+ // these are radio buttons so we only need to add the listener to one of them.
+ falseButton.addListener(SWT.Selection, listener);
+ final GridData cGD = new GridData();
+ cGD.grabExcessHorizontalSpace = true;
+ cGD.horizontalAlignment = SWT.FILL;
+ cGD.horizontalSpan = 2;
+ radioComposite.setLayoutData(cGD);
+
+ Label toleranceTabel = new Label(this, SWT.NONE);
+ toleranceTabel.setText(Messages.getString("NM.TOLERANCE"));
+ GridData tolGD = new GridData();
+ tolGD.horizontalSpan = 1;
+ toleranceTabel.setLayoutData(tolGD);
+
+ toleranceText = new Text(this, SWT.NONE);
+ toleranceText.setText("1E-9");
+ GridData tol2GD = new GridData();
+ tol2GD.horizontalSpan = 2;
+ tol2GD.grabExcessHorizontalSpace = true;
+ tol2GD.horizontalAlignment = SWT.FILL;
+ toleranceText.setLayoutData(tol2GD);
+
+ table = new Table(this, SWT.BORDER | SWT.SINGLE);
+ GridData gridData11 = new GridData();
+ gridData11.horizontalSpan = 1;
+ gridData11.grabExcessHorizontalSpace = true;
+ gridData11.horizontalAlignment = SWT.FILL;
+ gridData11.grabExcessVerticalSpace = false;
+ table.setLayoutData(gridData11);
+
+ Composite startStepComp = new Composite(this, SWT.NONE);
+ GridLayout startLayout = new GridLayout();
+ startLayout.numColumns = 2;
+ startStepComp.setLayout(startLayout);
+
+ Label startLabel = new Label(startStepComp, SWT.NONE);
+ startLabel.setText(Messages.getString("NM.INITIAL"));
+ GridData gridData12 = new GridData();
+ gridData12.horizontalSpan=1;
+ startLabel.setLayoutData(gridData12);
+ Label stepLabel = new Label(startStepComp, SWT.NONE);
+ stepLabel.setText(Messages.getString("NM.STEP"));
+ GridData gridData13 = new GridData();
+ gridData13.horizontalSpan=1;
+ stepLabel.setLayoutData(gridData13);
+ startValText = new Text(startStepComp, SWT.NONE);
+ GridData gridData14 = new GridData();
+ gridData13.horizontalSpan = 1;
+ startValText.setLayoutData(gridData14);
+ startValText.addModifyListener(projectValidator);
+ startValText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if(currentTableIndex == -1) return;
+ String txt = startValText.getText();
+ double d = 0.0;
+ try {
+ d = Double.parseDouble(txt);
+ } catch(NumberFormatException nfe) {
+ // Ignore, the validator will report the error
+ }
+ startList.set(currentTableIndex, d);
+ }
+ });
+ stepValText = new Text(startStepComp, SWT.NONE);
+ GridData gridData15 = new GridData();
+ gridData15.horizontalSpan = 1;
+ stepValText.setLayoutData(gridData15);
+ stepValText.addModifyListener(projectValidator);
+ stepValText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ if(currentTableIndex == -1) return;
+ String txt = stepValText.getText();
+ double d = 0.0;
+ try {
+ d = Double.parseDouble(txt);
+ } catch(NumberFormatException nfe) {
+ // Ignore, the validator will report the error
+ }
+ stepList.set(currentTableIndex, d);
+ }
+ });
+
+ Composite minMaxComp = new Composite(this, SWT.NONE);
+ GridLayout minMaxLayout = new GridLayout();
+ minMaxLayout.numColumns = 2;
+ minMaxComp.setLayout(startLayout);
+
+ Label minLabel = new Label(minMaxComp, SWT.NONE);
+ minLabel.setText(Messages.getString("NM.MIN"));
+ GridData gridData16 = new GridData();
+ gridData16.horizontalSpan=1;
+ minLabel.setLayoutData(gridData12);
+ Label maxLabel = new Label(minMaxComp, SWT.NONE);
+ maxLabel.setText(Messages.getString("NM.MAX"));
+ GridData gridData17 = new GridData();
+ gridData17.horizontalSpan=1;
+ maxLabel.setLayoutData(gridData17);
+ minValText = new Text(minMaxComp, SWT.NONE);
+ GridData gridData18 = new GridData();
+ gridData18.horizontalSpan = 1;
+ minValText.setLayoutData(gridData18);
+ minValText.addModifyListener(projectValidator);
+ minValText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if(currentTableIndex == -1) return;
+ String txt = minValText.getText();
+ double d = 0.0;
+ try {
+ d = Double.parseDouble(txt);
+ } catch(NumberFormatException nfe) {
+ // Ignore, the validator will report the error
+ }
+ minList.set(currentTableIndex, d);
+ }
+ });
+ maxValText = new Text(minMaxComp, SWT.NONE);
+ GridData gridData19 = new GridData();
+ gridData19.horizontalSpan = 1;
+ maxValText.setLayoutData(gridData19);
+ maxValText.addModifyListener(projectValidator);
+ maxValText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ if(currentTableIndex == -1) return;
+ String txt = maxValText.getText();
+ double d = 0.0;
+ try {
+ d = Double.parseDouble(txt);
+ } catch(NumberFormatException nfe) {
+ // Ignore, the validator will report the error
+ }
+ maxList.set(currentTableIndex, d);
+ }
+ });
+ minValText.setEnabled(false);
+ maxValText.setEnabled(false);
+ startValText.setEnabled(false);
+ stepValText.setEnabled(false);
+
+
+
+ Composite plusminusbuttons = new Composite(this, SWT.NONE);
+ GridLayout gridLayout2 = new GridLayout();
+ gridLayout2.numColumns = 2;
+ plusminusbuttons.setLayout(gridLayout2);
+
+ GridData gridData20 = new GridData();
+ gridData20.horizontalSpan = 1;
+ gridData20.grabExcessHorizontalSpace = true;
+ gridData20.horizontalAlignment = SWT.FILL;
+ plusminusbuttons.setLayoutData(gridData20);
+
+ Button plusButton = new Button(plusminusbuttons, SWT.NONE);
+ plusButton.setText(Messages.getString("NM.PLUS"));
+ GridData gridData21 = new GridData();
+ gridData21.horizontalSpan = 1;
+ plusButton.setLayoutData(gridData21);
+
+ final Button minusButton = new Button(plusminusbuttons, SWT.NONE);
+ minusButton.setText(Messages.getString("NM.MINUS"));
+ GridData gridData22 = new GridData();
+ gridData21.horizontalSpan = 1;
+ minusButton.setLayoutData(gridData22);
+ minusButton.setEnabled(false);
+
+ table.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ currentTableIndex = table.getSelectionIndex();
+ if(currentTableIndex > -1) {
+ minValText.setText(minList.get(currentTableIndex)+"");
+ maxValText.setText(maxList.get(currentTableIndex)+"");
+ startValText.setText(startList.get(currentTableIndex)+"");
+ stepValText.setText(stepList.get(currentTableIndex)+"");
+ minValText.setEnabled(true);
+ maxValText.setEnabled(true);
+ startValText.setEnabled(true);
+ stepValText.setEnabled(true);
+ minusButton.setEnabled(true);
+ } else {
+ minValText.setText("");
+ maxValText.setText("");
+ startValText.setText("");
+ stepValText.setText("");
+
+ minValText.setEnabled(false);
+ maxValText.setEnabled(false);
+ startValText.setEnabled(false);
+ stepValText.setEnabled(false);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+
+ plusButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+
+ ParameterPickerDialog ppDialog = new ParameterPickerDialog(AutomaticExperimentCompositeEditor.this.getShell(), SWT.NONE, Messages.getString("NM.PICKPARAM"), project, IdentifiableImpl.class);
+ Object [] ret = ppDialog.open();
+ if(ret != null) {
+ Identifiable id = (Identifiable)ret[0];
+ EAttribute attr = (EAttribute)ret[1];
+ identifiableList.add(id);
+ attributeList.add(attr);
+ TableItem newRow= new TableItem(table, SWT.NONE);
+ newRow.setText(attr.getName()+" ("+id.getURI().lastSegment()+")");
+ minList.add(0.0);
+ maxList.add(1.0);
+ startList.add(0.5);
+ stepList.add(0.1);
+ projectValidator.modifyText(null);//
+
+ }
+
+
+
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ minusButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+
+ if(currentTableIndex > -1) {
+ table.remove(currentTableIndex);
+ minList.remove(currentTableIndex);
+ maxList.remove(currentTableIndex);
+ startList.remove(currentTableIndex);
+ stepList.remove(currentTableIndex);
+
+ currentTableIndex = table.getSelectionIndex();
+
+ minValText.setText("");
+ maxValText.setText("");
+ startValText.setText("");
+ stepValText.setText("");
+ if(minList.size() == 0) {
+ minusButton.setEnabled(false);
+ minValText.setEnabled(false);
+ maxValText.setEnabled(false);
+ startValText.setEnabled(false);
+ stepValText.setEnabled(false);
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ }
+
+ private ErrorFunction[] errorFunctions;
+
+ private void initializeErrorFunctionCombo() {
+
+ final IExtensionRegistry registry = Platform.getExtensionRegistry();
+ final IConfigurationElement[] errorFunctionsConfigElements = registry
+ .getConfigurationElementsFor(org.eclipse.stem.analysis.Constants.ID_ERRORFUNCTION_EXTENSION_POINT);
+
+ final java.util.List<ErrorFunction> temp = new ArrayList<ErrorFunction>();
+
+ errorFunctions = new ErrorFunction[errorFunctionsConfigElements.length];
+
+ for (int i = 0; i < errorFunctionsConfigElements.length; i++) {
+ final IConfigurationElement element = errorFunctionsConfigElements[i];
+
+ if (element.getName().equals(org.eclipse.stem.analysis.Constants.ERRORFUNCTION_ELEMENT)) {
+ // Yes
+ try {
+ temp.add((ErrorFunction) element
+ .createExecutableExtension("class")); //$NON-NLS-1$
+ } catch (final CoreException e) {
+ Activator.logError(
+ Messages.getString("Unable to instantiate extension point "+element), e); //$NON-NLS-1$
+ }
+ } // if
+ } // for each configuration element
+
+ errorFunctions = temp.toArray(new ErrorFunction[] {});
+
+ for(int i=0;i<errorFunctions.length;++i)
+ errorFunctionCombo.add(errorFunctions[i].eClass().getName());
+ errorFunctionCombo.select(0);
+ }
+
+ @Override
+ public boolean validate() {
+ boolean retValue = true;
+ double minVal=0, maxVal=1, startVal=0.5, stepVal=0.1; // valid set of values, just in case the text boxes aren't enabled yet.
+ errorMessage = "";
+ if(retValue) {
+ if(startValText.isEnabled()) {
+ String val = startValText.getText();
+ retValue = checkDouble(val);
+ if(!retValue) errorMessage = Messages.getString("NM.BADSTART");
+ else startVal = Double.parseDouble(val);
+ }
+ }
+
+ if(retValue) {
+ if(stepValText.isEnabled()) {
+ String val = stepValText.getText();
+ retValue = checkDoubleNonZero(val);
+ if(!retValue) errorMessage = Messages.getString("NM.BADSTEP");
+ else stepVal = Double.parseDouble(val);
+ }
+ }
+
+ if(retValue) {
+ if(minValText.isEnabled()) {
+ String val = minValText.getText();
+ retValue = checkDouble(val);
+ if(!retValue) errorMessage = Messages.getString("NM.BADMIN");
+ else minVal = Double.parseDouble(val);
+ }
+ }
+
+ if(retValue) {
+ if(maxValText.isEnabled()) {
+ String val = maxValText.getText();
+ retValue = checkDouble(val);
+ if(!retValue) errorMessage = Messages.getString("NM.BADMAX");
+ else maxVal = Double.parseDouble(val);
+ }
+ }
+
+ if(retValue)
+ if(minVal >maxVal) {
+ errorMessage = Messages.getString("NM.BADMINMAX");
+ retValue = false;
+ }
+
+ if(retValue)
+ if(maxItersText.isEnabled()) {
+ String val = maxItersText.getText();
+ retValue = checkIntegerMinValue(val, -1);
+ if(!retValue) errorMessage = Messages.getString("NM.BADMAXITERS");
+ }
+ if(retValue)
+ if(referenceDataText.getText() == null || referenceDataText.getText().trim().equals("")) {
+ errorMessage = Messages.getString("NM.BADREFERENCE");
+ retValue = false;
+ }
+
+ if(retValue)
+ if(baseScenario == null) {
+ errorMessage = Messages.getString("NM.BADBASESCENARIO");
+ retValue = false;
+ }
+
+ if(retValue)
+ if(table.getItemCount() == 0) {
+ errorMessage = Messages.getString("NM.ATLEASTONEPARAM");
+ retValue = false;
+ }
+
+ if(retValue)
+ if(toleranceText.isEnabled()) {
+ retValue = checkDoublePositiveNonZero(toleranceText.getText());
+ }
+ return retValue;
+ }
+
+ @Override
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ private boolean checkDouble(String d) {
+ boolean retValue = true;
+ try {
+ Double.parseDouble(d);
+ } catch(Exception e) {
+ retValue = false;
+ }
+ return retValue;
+ }
+
+ @SuppressWarnings("unused")
+ private boolean checkDoubleNonZero(String d) {
+ boolean retValue = true;
+ try {
+ double _d = Double.parseDouble(d);
+ if(_d == 0.0) retValue = false;
+ } catch(Exception e) {
+ retValue = false;
+ }
+ return retValue;
+ }
+
+ private boolean checkIntegerMinValue(String i, int min) {
+ boolean retValue = true;
+ try {
+ int _i = Integer.parseInt(i);
+ if(_i < min) retValue = false;
+ } catch(Exception e) {
+ retValue = false;
+ }
+ return retValue;
+ }
+
+
+ private boolean checkDoublePositiveNonZero(String d) {
+ boolean retValue = true;
+ try {
+ double _d = Double.parseDouble(d);
+ if(_d < 0.0) retValue = false;
+ } catch(Exception e) {
+ retValue = false;
+ }
+ return retValue;
+ }
+
+ @Override
+ public OptimizerAlgorithm createAlgorithm() {
+ AutomaticExperiment autoExperiment = AutomaticexperimentFactory.eINSTANCE.createAutomaticExperiment();
+
+ autoExperiment.setBaseScenario(baseScenario);
+ int ind = errorFunctionCombo.getSelectionIndex();
+ if(ind == -1) ind = 0; // grab first one
+ autoExperiment.setErrorFunc(errorFunctions[ind]);
+ autoExperiment.setMaximumNumberOfIterations(Integer.parseInt(maxItersText.getText()));
+ autoExperiment.setReferanceDataDir(referenceDataText.getText()); // ToDO: Use platform independent method
+ autoExperiment.setReInit(reInit);
+ autoExperiment.setTolerance(Double.parseDouble(toleranceText.getText()));
+
+ int n=0;
+ for(Identifiable ident :identifiableList) {
+ ModifiableParameter param = AutomaticexperimentFactory.eINSTANCE.createModifiableParameter();
+ param.setTargetURI(ident.getURI());
+ param.setFeatureName(attributeList.get(n).getName());
+ param.setInitialValue(startList.get(n));
+ param.setStep(stepList.get(n));
+ param.setLowerBound(minList.get(n));
+ param.setUpperBound(maxList.get(n));
+
+ autoExperiment.getParameters().add(param);
+ ++n;
+ }
+ return autoExperiment;
+ }
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AutomaticExperimentCompositeEditorAdapter.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AutomaticExperimentCompositeEditorAdapter.java
new file mode 100644
index 0000000..4de0fdd
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AutomaticExperimentCompositeEditorAdapter.java
@@ -0,0 +1,17 @@
+package org.eclipse.stem.analysis.automaticexperiment.ui;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.swt.events.ModifyListener;
+
+public class AutomaticExperimentCompositeEditorAdapter extends
+ AlgorithmCompositeEditorAdapter {
+
+ @Override
+ public AlgorithmCompositeEditor createCompositeEditor(
+ AlgorithmControl algControl, int style,
+ ModifyListener projectValidator, IProject project) {
+ // TODO Auto-generated method stub
+ return new AutomaticExperimentCompositeEditor(algControl, style, projectValidator, project);
+ }
+
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AutomaticExperimentCompositeEditorAdapterFactory.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AutomaticExperimentCompositeEditorAdapterFactory.java
new file mode 100644
index 0000000..956109b
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/AutomaticExperimentCompositeEditorAdapterFactory.java
@@ -0,0 +1,34 @@
+package org.eclipse.stem.analysis.automaticexperiment.ui;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.stem.analysis.automaticexperiment.util.AutomaticexperimentAdapterFactory;
+
+public class AutomaticExperimentCompositeEditorAdapterFactory extends
+ AutomaticexperimentAdapterFactory implements
+ AlgorithmCompositeEditorAdapterFactory {
+
+ /**
+ *
+ */
+ public AutomaticExperimentCompositeEditorAdapterFactory() {
+ super();
+ AlgorithmCompositeEditorAdapterFactoryImpl.INSTANCE
+ .addAdapterFactory(this);
+ }
+
+ /**
+ *
+ */
+ @Override
+ public Adapter createAutomaticExperimentAdapter() {
+ return new AutomaticExperimentCompositeEditorAdapter();
+ }
+
+ /**
+ *
+ */
+ public boolean isFactoryForType(Object type) {
+ return type == AlgorithmCompositeEditorAdapter.class
+ || super.isFactoryForType(type);
+ }
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/NewAutomaticExperimentWizard.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/NewAutomaticExperimentWizard.java
new file mode 100644
index 0000000..9bd8cc9
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/ui/NewAutomaticExperimentWizard.java
@@ -0,0 +1,342 @@
+package org.eclipse.stem.analysis.automaticexperiment.ui;
+
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+import org.eclipse.stem.analysis.automaticexperiment.views.Messages;
+import org.eclipse.stem.core.STEMURI;
+import org.eclipse.stem.core.STEMXMIResourceFactoryImpl;
+import org.eclipse.stem.core.common.Identifiable;
+import org.eclipse.stem.core.experiment.ExperimentPackage;
+import org.eclipse.stem.core.scenario.Scenario;
+import org.eclipse.stem.ui.Activator;
+import org.eclipse.stem.ui.wizards.DublinCorePage;
+import org.eclipse.stem.ui.wizards.NewIdentifiablePage;
+import org.eclipse.stem.ui.wizards.NewIdentifiableWizard;
+import org.eclipse.stem.ui.wizards.NewSTEMProjectWizard;
+import org.eclipse.stem.ui.wizards.STEMWizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class NewAutomaticExperimentWizard
+ extends NewIdentifiableWizard {
+
+
+ public NewAutomaticExperimentWizard() {
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @see org.eclipse.stem.ui.wizards.NewIdentifiableWizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ setForcePreviousAndNextButtons(false);
+ newIdentifiablePage = createNewIdentifiablePage();
+ // Were we successful in creating the page?
+ if (newIdentifiablePage == null) {
+ // No
+ return;
+ }
+ newDublinCorePage = createDublinCorePage();
+ // Were we successful in creating the page?
+ if (newDublinCorePage == null) {
+ // No
+ return;
+ }
+ addPage(newIdentifiablePage);
+ addPage(newDublinCorePage);
+ }
+
+ /**
+ * @see org.eclipse.stem.ui.wizards.NewIdentifiableWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
+ */
+ @Override
+ public IWizardPage getNextPage(IWizardPage page) {
+ final IWizardPage nextPage = super.getNextPage(page);
+ return nextPage;
+ }
+
+ @Override
+ protected DublinCorePage createDublinCorePage() {
+ return new DublinCorePage() {
+ /**
+ * @see org.eclipse.stem.ui.wizards.NewIdentifiableWizard.DublinCorePage#initializeDCFields()
+ */
+ @SuppressWarnings("nls")
+ @Override
+ protected void initializeDCAttributes() {
+ super.initializeDCAttributes();
+ format.setText(ExperimentPackage.eNS_URI);
+ format.setEnabled(false);
+ type.setText(STEMURI.EXPERIMENT_TYPE_URI.toString());
+ type.setEnabled(false);
+
+
+ titleTextField.setText(Messages.getString("dc_title_a_exp"));
+ source.setText(Messages.getString("dc_source_a_exp"));
+ descriptionTextField.setText(Messages.getString("dc_desc_a_exp"));
+
+ }
+ };
+ }
+
+ @Override
+ protected Identifiable createIdentifiable() {
+ return createAutomaticExperiment();
+ }
+ NewAutomaticExperimentPage page;
+
+ @Override
+ protected NewIdentifiablePage createNewIdentifiablePage() {
+ this.setHelpContextId("org.eclipse.stem.doc.newautomaticexp_contextid");
+ page = new NewAutomaticExperimentPage(getShell(), "New Automatic Experiment Wizard"); //$NON-NLS-1$
+ page.setTitle(""); //$NON-NLS-1$
+ return page;
+ }
+
+
+ @Override
+ protected String getSerializationFileNameExtension() {
+ return AutomaticexperimentPackage.eNAME;
+ }
+
+ @Override
+ protected String getSerializationFolderName() {
+ return NewSTEMProjectWizard.EXPERIMENTS_FOLDER_NAME;
+ }
+
+ @Override
+ protected String getWizardTitle() {
+ // TODO Externalise this string
+ return "Automatic Experiment Wizard";
+ }
+
+ protected OptimizerAlgorithm createAutomaticExperiment() {
+ OptimizerAlgorithm ret = page.algControl.createAutomaticExperiment();
+ ret.setDublinCore(newDublinCorePage.createDublinCore());
+ return ret;
+ }
+
+ protected Scenario createScenario(final String scenarioFile) {
+ final ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*",
+ STEMXMIResourceFactoryImpl.INSTANCE);
+
+ resourceSet.getResourceFactoryRegistry().getProtocolToFactoryMap().put("platform",
+ STEMXMIResourceFactoryImpl.INSTANCE);
+ final Resource resource = resourceSet.getResource(URI.createFileURI(scenarioFile),
+ true);
+ try {
+ resource.load(null);
+ } catch (FileNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Scenario loadedScenario = (Scenario)resource.getContents().get(0);
+ loadedScenario.initialize();
+ return loadedScenario;
+ //return ScenarioTest.createFixture();
+ }
+
+ protected static class NewAutomaticExperimentPage extends NewIdentifiablePage {
+
+ public List parametersList = null;
+ public Combo algorithmCombo = null;
+ public Combo errorFunctionCombo = null;
+ public Spinner numOfIterationsSpinner = null;
+ public Text refDirText = null;
+ public Text scenarioText = null;
+ protected Shell shell = null;
+// public NewAutomaticExperimentPage2 page2 = null;
+
+ AlgorithmControl algControl;
+
+ /**
+ * @param pageName
+ * the name of the page
+ */
+ protected NewAutomaticExperimentPage(final Shell shell, final String pageName) {
+ super(pageName);
+ this.shell = shell;
+// page2 = new NewAutomaticExperimentPage2("Page 2");
+// page2.setPreviousPage(this);
+ }
+
+ protected ModifyListener projectValidator = new ModifyListener() {
+ public void modifyText(@SuppressWarnings("unused") final ModifyEvent e) {
+ setPageComplete(validatePage());
+ }
+ };
+ /**
+ * @see org.eclipse.stem.ui.wizards.NewIdentifiablePage#createSpecificComposite(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Composite createSpecificComposite(Composite parent) {
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "org.eclipse.stem.doc.newautomaticexp_contextid");
+
+ final Composite composite = new Composite(parent, SWT.NONE);
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ composite.setLayout(gridLayout);
+
+ final Label label21 = new Label(composite, SWT.NONE);
+ label21.setText((Messages.getString("WIZ.ALGORITHM")));
+ algorithmCombo = new Combo(composite, SWT.READ_ONLY);
+ initializeAlgorithmsCombo();
+ GridData gridData21 = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gridData21.horizontalSpan = 1;
+ algorithmCombo.setLayoutData(gridData21);
+
+ GridData gridDataCombo = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
+ gridDataCombo.horizontalSpan = 1;
+ algorithmCombo.setLayoutData(gridDataCombo);
+
+ Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData sepData = new GridData(SWT.FILL, SWT.TOP, true, false);
+ sepData.horizontalSpan = 2;
+ separator.setLayoutData(sepData);
+
+ algControl = new AlgorithmControl(composite, SWT.NONE, projectValidator, this.getSelectedProject(), algorithms);
+
+ GridData gridDataAControl = new GridData(SWT.FILL,SWT.CENTER, true, false, 2, 1);
+// gridDataAControl.horizontalAlignment = 2;
+ algControl.setLayoutData(gridDataAControl);
+
+ return composite;
+ }
+
+ private OptimizerAlgorithm[] algorithms;
+
+ private void initializeAlgorithmsCombo() {
+
+ final IExtensionRegistry registry = Platform.getExtensionRegistry();
+ final IConfigurationElement[] algorithmsConfigElements = registry
+ .getConfigurationElementsFor(org.eclipse.stem.analysis.automaticexperiment.Constants.ID_ALGORITHM_EXTENSION_POINT);
+
+ final java.util.List<Identifiable> temp = new ArrayList<Identifiable>();
+
+ algorithms = new OptimizerAlgorithm[algorithmsConfigElements.length];
+
+ for (int i = 0; i < algorithmsConfigElements.length; i++) {
+ final IConfigurationElement element = algorithmsConfigElements[i];
+ // Does the element specify the class of the disease model?
+ if (element.getName().equals(org.eclipse.stem.analysis.automaticexperiment.Constants.ALGORITHM_ELEMENT)) {
+ // Yes
+ try {
+ temp.add((OptimizerAlgorithm) element
+ .createExecutableExtension(Messages.getString("ALG.1"))); //$NON-NLS-1$
+ } catch (final CoreException e) {
+ Activator.logError(
+ Messages.getString("ALG.3"), e); //$NON-NLS-1$
+ }
+ } // if
+ } // for each configuration element
+
+ algorithms = temp.toArray(new OptimizerAlgorithm[] {});
+
+
+ for(int i=0;i<algorithms.length;++i)
+ algorithmCombo.add(algorithms[i].eClass().getName());
+ algorithmCombo.select(0);
+ }
+
+
+
+ /**
+ * @see org.eclipse.stem.ui.wizards.NewIdentifiablePage#validatePage()
+ */
+ @Override
+ protected boolean validatePage() {
+ boolean retValue = super.validatePage();
+ if(retValue) {
+ setErrorMessage(null);
+ retValue = algControl.validate();
+ // Error?
+ if (!retValue) {
+ // Yes
+ setErrorMessage(algControl.getErrorMessage());
+ } // if
+
+ }
+ return retValue;
+ }
+
+ @Override
+ protected String getDCDescription() {
+ return "Some description goes here";
+ }
+
+ }
+
+
+ /**
+ * This class is a {@link IHandler} for the command that creates a
+ * {@link NewAutomaticExperimentWizard}
+ */
+ public static class NewAutomaticExperimentWizardCommandHandler extends AbstractHandler
+ implements IHandler {
+
+ /**
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ public Object execute(final ExecutionEvent executionEvent)
+ throws ExecutionException {
+ final IWorkbenchWindow window = HandlerUtil
+ .getActiveWorkbenchWindowChecked(executionEvent);
+ final NewAutomaticExperimentWizard wizard = new NewAutomaticExperimentWizard();
+ wizard.init(window.getWorkbench(), StructuredSelection.EMPTY);
+ final WizardDialog wizardDialog = new STEMWizardDialog(window
+ .getShell(), wizard);
+ wizardDialog.open();
+ return null;
+ } // execute
+ }
+}
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/util/AutomaticexperimentAdapterFactory.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/util/AutomaticexperimentAdapterFactory.java
new file mode 100644
index 0000000..3166978
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/util/AutomaticexperimentAdapterFactory.java
@@ -0,0 +1,203 @@
+package org.eclipse.stem.analysis.automaticexperiment.util;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+import org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter;
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+import org.eclipse.stem.core.common.Identifiable;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage
+ * @generated
+ */
+public class AutomaticexperimentAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static AutomaticexperimentPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperimentAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = AutomaticexperimentPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AutomaticexperimentSwitch<Adapter> modelSwitch =
+ new AutomaticexperimentSwitch<Adapter>() {
+ @Override
+ public Adapter caseAutomaticExperiment(AutomaticExperiment object) {
+ return createAutomaticExperimentAdapter();
+ }
+ @Override
+ public Adapter caseModifiableParameter(ModifiableParameter object) {
+ return createModifiableParameterAdapter();
+ }
+ @Override
+ public Adapter caseOptimizerAlgorithm(OptimizerAlgorithm object) {
+ return createOptimizerAlgorithmAdapter();
+ }
+ @Override
+ public <T> Adapter caseComparable(Comparable<T> object) {
+ return createComparableAdapter();
+ }
+ @Override
+ public Adapter caseIdentifiable(Identifiable object) {
+ return createIdentifiableAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment <em>Automatic Experiment</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment
+ * @generated
+ */
+ public Adapter createAutomaticExperimentAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter <em>Modifiable Parameter</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter
+ * @generated
+ */
+ public Adapter createModifiableParameterAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm <em>Optimizer Algorithm</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm
+ * @generated
+ */
+ public Adapter createOptimizerAlgorithmAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link java.lang.Comparable <em>Comparable</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see java.lang.Comparable
+ * @generated
+ */
+ public Adapter createComparableAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.stem.core.common.Identifiable <em>Identifiable</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.stem.core.common.Identifiable
+ * @generated
+ */
+ public Adapter createIdentifiableAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //AutomaticexperimentAdapterFactory
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/util/AutomaticexperimentSwitch.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/util/AutomaticexperimentSwitch.java
new file mode 100644
index 0000000..c3c2e47
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/util/AutomaticexperimentSwitch.java
@@ -0,0 +1,216 @@
+package org.eclipse.stem.analysis.automaticexperiment.util;
+
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperiment;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage;
+import org.eclipse.stem.analysis.automaticexperiment.ModifiableParameter;
+import org.eclipse.stem.analysis.automaticexperiment.OptimizerAlgorithm;
+import org.eclipse.stem.core.common.Identifiable;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.stem.analysis.automaticexperiment.AutomaticexperimentPackage
+ * @generated
+ */
+public class AutomaticexperimentSwitch<T1> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static AutomaticexperimentPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AutomaticexperimentSwitch() {
+ if (modelPackage == null) {
+ modelPackage = AutomaticexperimentPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T1 doSwitch(EObject theEObject) {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T1 doSwitch(EClass theEClass, EObject theEObject) {
+ if (theEClass.eContainer() == modelPackage) {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T1 doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case AutomaticexperimentPackage.AUTOMATIC_EXPERIMENT: {
+ AutomaticExperiment automaticExperiment = (AutomaticExperiment)theEObject;
+ T1 result = caseAutomaticExperiment(automaticExperiment);
+ if (result == null) result = caseOptimizerAlgorithm(automaticExperiment);
+ if (result == null) result = caseIdentifiable(automaticExperiment);
+ if (result == null) result = caseComparable(automaticExperiment);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case AutomaticexperimentPackage.MODIFIABLE_PARAMETER: {
+ ModifiableParameter modifiableParameter = (ModifiableParameter)theEObject;
+ T1 result = caseModifiableParameter(modifiableParameter);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case AutomaticexperimentPackage.OPTIMIZER_ALGORITHM: {
+ OptimizerAlgorithm optimizerAlgorithm = (OptimizerAlgorithm)theEObject;
+ T1 result = caseOptimizerAlgorithm(optimizerAlgorithm);
+ if (result == null) result = caseIdentifiable(optimizerAlgorithm);
+ if (result == null) result = caseComparable(optimizerAlgorithm);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Automatic Experiment</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Automatic Experiment</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T1 caseAutomaticExperiment(AutomaticExperiment object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Modifiable Parameter</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Modifiable Parameter</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T1 caseModifiableParameter(ModifiableParameter object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Optimizer Algorithm</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Optimizer Algorithm</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T1 caseOptimizerAlgorithm(OptimizerAlgorithm object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Comparable</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Comparable</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public <T> T1 caseComparable(Comparable<T> object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Identifiable</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Identifiable</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T1 caseIdentifiable(Identifiable object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T1 defaultCase(EObject object) {
+ return null;
+ }
+
+} //AutomaticexperimentSwitch
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AggregateTimeSeriesCanvas.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AggregateTimeSeriesCanvas.java
new file mode 100644
index 0000000..8ec255d
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AggregateTimeSeriesCanvas.java
@@ -0,0 +1,1247 @@
+package org.eclipse.stem.analysis.automaticexperiment.views;
+
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.birt.chart.device.IDeviceRenderer;
+import org.eclipse.birt.chart.exception.ChartException;
+import org.eclipse.birt.chart.factory.Generator;
+import org.eclipse.birt.chart.model.Chart;
+import org.eclipse.birt.chart.model.ChartWithAxes;
+import org.eclipse.birt.chart.model.attribute.Anchor;
+import org.eclipse.birt.chart.model.attribute.AxisType;
+import org.eclipse.birt.chart.model.attribute.Bounds;
+import org.eclipse.birt.chart.model.attribute.ColorDefinition;
+import org.eclipse.birt.chart.model.attribute.IntersectionType;
+import org.eclipse.birt.chart.model.attribute.LineAttributes;
+import org.eclipse.birt.chart.model.attribute.LineStyle;
+import org.eclipse.birt.chart.model.attribute.Position;
+import org.eclipse.birt.chart.model.attribute.TickStyle;
+import org.eclipse.birt.chart.model.attribute.impl.BoundsImpl;
+import org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionImpl;
+import org.eclipse.birt.chart.model.component.Axis;
+import org.eclipse.birt.chart.model.component.Series;
+import org.eclipse.birt.chart.model.component.impl.SeriesImpl;
+import org.eclipse.birt.chart.model.data.NumberDataSet;
+import org.eclipse.birt.chart.model.data.SeriesDefinition;
+import org.eclipse.birt.chart.model.data.impl.NumberDataElementImpl;
+import org.eclipse.birt.chart.model.data.impl.NumberDataSetImpl;
+import org.eclipse.birt.chart.model.data.impl.SeriesDefinitionImpl;
+import org.eclipse.birt.chart.model.impl.ChartWithAxesImpl;
+import org.eclipse.birt.chart.model.layout.Legend;
+import org.eclipse.birt.chart.model.layout.Plot;
+import org.eclipse.birt.chart.model.type.LineSeries;
+import org.eclipse.birt.chart.model.type.impl.ScatterSeriesImpl;
+import org.eclipse.birt.chart.util.PluginSettings;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.stem.analysis.automaticexperiment.Activator;
+import org.eclipse.stem.ui.preferences.VisualizationPreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IWorkbenchActionConstants;
+
+/**
+ * AggregateTimeSeriesCanvas is a subclass of {@link Canvas} suitable for chart drawings.
+ */
+public class AggregateTimeSeriesCanvas extends Canvas {
+
+ protected IDeviceRenderer idr = null;
+
+ /**
+ * This is the {@link Chart} that plots the relative values.
+ */
+ protected Chart cm = null;
+
+ /**
+ * The provider of relative values.
+ */
+ //private RelativeValueHistoryProvider rvhp;
+
+ private AnalysisControl control = null;
+
+ /**
+ * the index of this Chart
+ */
+ private int chartIndex = 0;
+
+
+ /**
+ * some extra colors
+ */
+ protected static final ColorDefinition[] colorDefault = {
+ ColorDefinitionImpl.RED(),
+ ColorDefinitionImpl.GREEN(),
+ ColorDefinitionImpl.BLUE(),
+ ColorDefinitionImpl.BLACK(),
+ ColorDefinitionImpl.GREY(),
+ ColorDefinitionImpl.CYAN(),
+ ColorDefinitionImpl.ORANGE()
+ };
+ /**
+ * used if we need to overlay traces in different colors
+ */
+ private boolean overlayMode = false;
+
+
+
+ /**
+ * A context menu for this view
+ */
+ Menu popUpMenu = null;
+
+ /**
+ * set y axis to a linear scale
+ */
+ private LinearScaleAction linearTimeAction;
+ /**
+ * set y axis to a log scale
+ */
+ private LogScaleAction logTimeAction;
+ protected boolean useLinearTimeScale = true;
+
+
+ /**
+ * show the legend (true by default)
+ */
+ private LegendViewAction viewLegend;
+
+ /**
+ * hide the legend
+ */
+ private LegendHideAction hideLegend;
+ protected boolean showLegend = true;
+
+ protected Legend legend = null;
+
+
+ /**
+ * this is a map of the DataSeries object (keyed by property name)
+ */
+ protected final Map<String,DataSeries> dataSeriesMap = new HashMap<String,DataSeries>();
+
+ /**
+ * Keep track of which timeseries are visible
+ */
+
+ protected Map<String, Boolean>visibleMap = new HashMap<String,Boolean>();
+
+
+ /**
+ * These are the cycle numbers that match the relative values that will be
+ * plotted
+ *
+ * @see #relativeValues
+ */
+ private final List<Integer> cycleNumbers = new ArrayList<Integer>();
+
+ /**
+ * Chart generator instance (reference to a singleton)
+ */
+ Generator gr;
+
+ Axis yAxisPrimary;
+ Axis xAxisPrimary;
+ /**
+ * the maxY value for scaling
+ */
+ double maxY = -1.0;
+
+ /**
+ * Log of zero is negative infinity so for each location we will cut off the minimum
+ * at the min NONZERO Y value
+ */
+ private double minYscale = 1.0;
+
+
+ /**
+ * Label for line series LEGEND
+ */
+ public String Ordinate_LEGEND = "Y";
+
+ /**
+ * Label for line series Y axis label
+ **/
+ public String Ordinate_AXIS = "Y";
+
+
+ /**
+ * Label for line series X axis label
+ **/
+ public String X_AXIS = "X";
+
+ /**
+ * customizable color definitions
+ */
+ private ColorDefinition foreGround = ColorDefinitionImpl.WHITE();
+ private ColorDefinition backgroundGround = ColorDefinitionImpl.BLACK();
+ private ColorDefinition frameColor = ColorDefinitionImpl.create(180, 180, 200);
+
+ Image imgChart = null;
+
+ /**
+ * This Constructor is used when we want to place the time series in a container
+ * which is a sub component of the actual AnalysisControl
+ * @param analysisControl
+ *
+ * @param parent the SWT parent of the {@link Widget}
+ * @param ordinateString
+ * @param yAxisLabel
+ * @param xAxisLabel
+ * @param foreground
+ * @param background
+ * @param framecolor
+ * @param chartIndex the index of this chart (0 if only one)
+ * @param overlayMode used if we need to overlay traces in different colors
+ */
+ public AggregateTimeSeriesCanvas(final AnalysisControl analysisControl, final Composite parent,
+ final String ordinateString,
+ final String yAxisLabel,
+ final String xAxisLabel,
+ final String firstProperty,
+ ColorDefinition foreground,
+ ColorDefinition background,
+ ColorDefinition framecolor,
+ int chartIndex,
+ boolean overlayMode ) {
+ super(parent, SWT.DOUBLE_BUFFERED | SWT.BORDER);
+ Ordinate_LEGEND = ordinateString;
+ Ordinate_AXIS = yAxisLabel;
+ X_AXIS = xAxisLabel;
+ foreGround = foreground;
+ backgroundGround = background;
+ frameColor = framecolor;
+ this.chartIndex = chartIndex;
+ this.overlayMode = overlayMode;
+
+ gr = Generator.instance();
+
+ try {
+ idr = PluginSettings.instance().getDevice("dv.SWT"); //$NON-NLS-1$
+ } catch (final ChartException pex) {
+ Activator.logError("Problem initializing chart", pex); //$NON-NLS-1$
+ return;
+ }
+
+ control = analysisControl;
+
+
+ cm = createSimpleLineChart(firstProperty, dataSeriesMap, cycleNumbers, Messages
+ .getString("CC.title")); //$NON-NLS-1$
+
+ resetData();
+ addPaintListener(new PaintListener() {
+ public void paintControl(final PaintEvent pe) {
+
+ final Composite source = (Composite) pe.getSource();
+ final org.eclipse.swt.graphics.Rectangle d = source
+ .getClientArea();
+
+ if(imgChart != null) imgChart.dispose();
+ imgChart = new Image(source.getDisplay(), d);
+
+ idr.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT, new GC(
+ imgChart));
+ final Bounds bounds = BoundsImpl.create(d.x, d.y, d.width,
+ d.height);
+ bounds.scale(72d / idr.getDisplayServer().getDpiResolution());
+ // BOUNDS MUST BE SPECIFIED IN POINTS
+
+ try {
+ gr.render(idr, gr.build(idr.getDisplayServer(), cm, bounds,
+ null, null, null));
+ pe.gc.drawImage(imgChart, d.x, d.y);
+ } catch (final ChartException ce) {
+ Activator.logError("Problem rendering chart", ce); //$NON-NLS-1$
+ }
+ } // paintControl
+ } // PaintListener
+ );
+
+ //Create a context menu for the canvas
+ createContextMenu(this);
+
+
+ } // AggregateTimeSeriesCanvas
+ /**
+ * Constructor.
+ *
+ * @param parent the SWT parent of the {@link Widget}
+ * @param ordinateString
+ * @param yAxisLabel
+ * @param xAxisLabel
+ * @param foreground
+ * @param background
+ * @param framecolor
+ * @param chartIndex the index of this chart (0 if only one)
+ *
+ */
+ public AggregateTimeSeriesCanvas(final Composite parent,
+ final String ordinateString,
+ final String yAxisLabel,
+ final String xAxisLabel,
+ final String firstProperty,
+ ColorDefinition foreground,
+ ColorDefinition background,
+ ColorDefinition framecolor,
+ int chartIndex) {
+ super(parent, SWT.DOUBLE_BUFFERED | SWT.BORDER);
+ Ordinate_LEGEND = ordinateString;
+ Ordinate_AXIS = yAxisLabel;
+ X_AXIS = xAxisLabel;
+ foreGround = foreground;
+ backgroundGround = background;
+ frameColor = framecolor;
+ this.chartIndex = chartIndex;
+
+ gr = Generator.instance();
+
+ try {
+ idr = PluginSettings.instance().getDevice("dv.SWT"); //$NON-NLS-1$
+ } catch (final ChartException pex) {
+ Activator.logError("Problem initializing chart", pex); //$NON-NLS-1$
+ return;
+ }
+
+ control = (AnalysisControl) parent;
+
+
+ cm = createSimpleLineChart(firstProperty, dataSeriesMap, cycleNumbers, Messages
+ .getString("CC.title")); //$NON-NLS-1$
+
+ resetData();
+
+ addPaintListener(new PaintListener() {
+ public void paintControl(final PaintEvent pe) {
+
+ final Composite source = (Composite) pe.getSource();
+ final org.eclipse.swt.graphics.Rectangle d = source
+ .getClientArea();
+
+ if(imgChart != null) imgChart.dispose();
+ imgChart = new Image(source.getDisplay(), d);
+ idr.setProperty(IDeviceRenderer.GRAPHICS_CONTEXT, new GC(
+ imgChart));
+ final Bounds bounds = BoundsImpl.create(d.x, d.y, d.width,
+ d.height);
+ bounds.scale(72d / idr.getDisplayServer().getDpiResolution());
+ // BOUNDS MUST BE SPECIFIED IN POINTS
+
+ try {
+ gr.render(idr, gr.build(idr.getDisplayServer(), cm, bounds,
+ null, null, null));
+ pe.gc.drawImage(imgChart, d.x, d.y);
+ } catch (final ChartException ce) {
+ Activator.logError("Problem rendering chart", ce); //$NON-NLS-1$
+ }
+ } // paintControl
+ } // PaintListener
+ );
+
+ //Create a context menu for the canvas
+ createContextMenu(this);
+
+
+ } // AggregateTimeSeriesCanvas
+
+
+
+ /**
+ * The method which gets the {@link AggregateTimeSeriesCanvas}' reports list, and
+ * draws it on the {@link AggregateTimeSeriesCanvas}.
+ * @return integratedDifference for each line series
+ *
+ */
+ public void draw() {
+
+ //clearData();
+ resetData();
+ yAxisPrimary.getSeriesDefinitions().clear();
+
+ // get the number of lines to plot for this type of chart
+ int maxLines = control.getNumProperties(chartIndex);
+
+ // add all the rest of the line series now
+ for (int i = 0; i < maxLines; i ++) {
+ String property = control.getProperty(chartIndex,i);
+
+ if(!dataSeriesMap.containsKey(property)) {
+ // new property
+ DataSeries series = new DataSeries(property, i, overlayMode);
+ if(visibleMap.containsKey(property))
+ series.setVisible(visibleMap.get(property));
+ else {
+ series.setVisible(true);
+ visibleMap.put(property, true);
+ }
+
+ dataSeriesMap.put(property, series);
+ }
+ DataSeries series = dataSeriesMap.get(property);
+ series.show();
+
+ }
+
+ // update the context menu with the new properties to plot
+ //updateContextMenu(this);
+
+ maxY = -1.0;
+
+ boolean setCycles = false;
+ // Get the values for the property to be plotted
+ int maxPoints = 0;
+
+ for (int i = 0; i < maxLines; i++) {
+ String property = control.getProperty(chartIndex,i);
+ double[] doubleValues = control.getValues(chartIndex,i);
+ if(doubleValues==null) {
+ doubleValues = new double[0];
+ //doubleValues[0] = 0;
+ }
+ DataSeries series = dataSeriesMap.get(property);
+
+ if(dataSeriesMap.get(property).isVisible() == true) {
+ for (int j = 0; j < doubleValues.length; j++) {
+
+
+ if(doubleValues[j] <= minYscale) {
+ if(doubleValues[j] > 0.0) minYscale = doubleValues[j];
+ }
+
+ if(doubleValues[j] >= maxY) {
+ maxY = doubleValues[j];
+ double log = Math.floor(Math.log10(maxY));
+ double adjustedMax = (Math.ceil(maxY/Math.pow(10, log)))*Math.pow(10, log);
+ if(adjustedMax <= 1.0) adjustedMax = 1.0;
+ //adjustedMax = maxY*100.0;
+ //adjustedMax += 1.0;
+ //int mx = (int)adjustedMax;
+ //adjustedMax = ((double)mx)/100.0;
+ if (useLinearTimeScale) {
+ yAxisPrimary.getScale().setMax(NumberDataElementImpl.create(adjustedMax));
+ double step = adjustedMax / 10.0;
+ yAxisPrimary.getScale().setStep(step);
+ } else {
+ // keep 2 significant figures on scale axis
+ double ymax = Math.log(adjustedMax);
+ if(adjustedMax > 1.0) {
+ ymax += 0.499;
+ long imax = Math.round(ymax);
+ ymax = imax;
+ }
+ yAxisPrimary.getScale().setMax(NumberDataElementImpl.create(ymax));
+ double step = ymax/10.0;
+ yAxisPrimary.getScale().setStep(step);
+ }
+
+
+ }
+ }
+ } // is visible
+
+ // Any values?
+ if (doubleValues.length > 0) {
+ if (maxPoints < doubleValues.length) {
+ maxPoints = doubleValues.length;
+ }
+
+ for (int cycleNumber = 0; cycleNumber < doubleValues.length; cycleNumber++) {
+
+ Double value;
+ double displayValue = doubleValues[cycleNumber];
+ if (displayValue <= minYscale) {
+ // Log(0.0) is negative infinity so for display purposes only
+ // we set the minimum axis value at 0.1/POPULATION
+ displayValue = minYscale;
+ }
+ if (useLinearTimeScale) {
+ value = new Double(displayValue);
+ } else {
+ value = new Double(Math.log(displayValue));
+ }
+
+
+ series.addValue(value);
+
+ // only do once for first line series
+ if (!setCycles) {
+ cycleNumbers.add(Integer.valueOf(cycleNumber));
+ }
+ } // for cycleNumber
+
+ if(xAxisPrimary.getSeriesDefinitions().get(0).getSeries().size() != cycleNumbers.size()) {
+ // The number of data points have changed, create a new series for the x axis
+ xAxisPrimary.getSeriesDefinitions().clear();
+ final Series xAxisSeries = SeriesImpl.create();
+
+ final NumberDataSet xValues = NumberDataSetImpl.create(cycleNumbers);
+ xAxisSeries.setDataSet(xValues);
+ final SeriesDefinition sdX = SeriesDefinitionImpl.create();
+
+ xAxisPrimary.getSeriesDefinitions().add(sdX);
+ sdX.getSeries().add(xAxisSeries);
+ }
+
+
+ setCycles = true; // we set them only once
+
+ } else {
+ //resetData();
+ }
+ } // for i properties
+
+
+ if (!this.isDisposed()) {
+ redraw();
+ }
+
+
+ // control.updateMessage(ScenarioAnalysisSuite.WORKING_MSG);
+
+ } // paintControl
+
+ /**
+ * @param dataSeriesMap
+ * the {@link List} that will contain the relative values
+ * (0.0-1.0) to plot
+ * @param cycleNumbers
+ * the {@link List} of simulation cycle numbers that match the
+ * relative values
+ * @param seriesIdentifier
+ * the title of the chart
+ * @return a <code>Chart</code>
+ */
+ public final Chart createSimpleLineChart(
+ final String firstProperty,
+ final Map<String, DataSeries> dataSeriesMap,
+ final List<Integer> cycleNumbers, final String seriesIdentifier) {
+
+ final ChartWithAxes retValue = ChartWithAxesImpl.create();
+
+
+ // Plot
+ retValue.getBlock().setBackground(frameColor);
+ final Plot p = retValue.getPlot();
+ p.getClientArea().setBackground(backgroundGround);
+
+ // Title
+ // cwaLine.getTitle( ).getLabel( ).getCaption( ).setValue( "Line Chart"
+ // );//$NON-NLS-1$
+ retValue.getTitle().setVisible(false);
+
+ // Legend
+ legend = retValue.getLegend();
+ final LineAttributes lia = legend.getOutline();
+ legend.getText().getFont().setSize(8);
+ lia.setStyle(LineStyle.SOLID_LITERAL);
+ legend.getInsets().set(10, 5, 0, 0);
+ legend.getOutline().setVisible(false);
+ legend.setAnchor(Anchor.NORTH_LITERAL);
+ legend.setPosition(Position.BELOW_LITERAL);
+ legend.getText().setColor(foreGround);
+ legend.getOutline().setColor(foreGround);
+
+ // cwaLine.getLegend( ).getText().getFont().setSize(16);;
+ // cwaLine.getLegend( ).setVisible( true );
+
+ // /////////
+ // X-Axis
+ xAxisPrimary = retValue.getPrimaryBaseAxes()[0];
+ xAxisPrimary.setType(AxisType.TEXT_LITERAL);
+ xAxisPrimary.getMajorGrid().setTickStyle(TickStyle.BELOW_LITERAL);
+ xAxisPrimary.getOrigin().setType(IntersectionType.VALUE_LITERAL);
+ xAxisPrimary.getTitle().setVisible(false);
+ xAxisPrimary.getTitle().getCaption().getFont().setSize(9);
+ xAxisPrimary.getTitle().getCaption().setColor(foreGround);
+ xAxisPrimary.getLabel().getCaption().setColor(foreGround);
+
+ final Series xAxisSeries = SeriesImpl.create();
+
+ // new colors
+ xAxisSeries.getLabel().getCaption().setColor(foreGround);
+ xAxisSeries.getLabel().getOutline().setColor(foreGround);
+ //
+
+ final NumberDataSet xValues = NumberDataSetImpl.create(cycleNumbers);
+ xAxisSeries.setDataSet(xValues);
+ final SeriesDefinition sdX = SeriesDefinitionImpl.create();
+
+ xAxisPrimary.getSeriesDefinitions().add(sdX);
+ sdX.getSeries().add(xAxisSeries);
+
+ // ////////
+ // Y-Axis
+ yAxisPrimary = retValue.getPrimaryOrthogonalAxis(xAxisPrimary);
+ yAxisPrimary.getMajorGrid().setTickStyle(TickStyle.LEFT_LITERAL);
+
+ // NumberDataSet[] orthoValues = new NumberDataSet[MAX_LINES];
+ // SeriesDefinition[] sdY = new SeriesDefinition[MAX_LINES];
+
+ // end Y-Series
+
+ xAxisPrimary.getScale().setMin(NumberDataElementImpl.create(0.0));
+ // xAxisPrimary.getScale( ).setMax( NumberDataElementImpl.create( 10.0 )
+ // );
+ // xAxisPrimary.getScale( ).setStep( 1 );
+ xAxisPrimary.getLabel().getCaption().getFont().setSize(9);
+ xAxisPrimary.getLabel().getCaption().setColor(foreGround);
+ xAxisPrimary.getTitle().setVisible(true);
+ xAxisPrimary.getTitle().getCaption().setValue(X_AXIS);
+
+ yAxisPrimary.getScale().setMin(NumberDataElementImpl.create(0.0));
+ yAxisPrimary.getScale().setMax(NumberDataElementImpl.create(1.0));
+ yAxisPrimary.getScale().setStep(0.25);
+ yAxisPrimary.getLabel().getCaption().getFont().setSize(9);
+ yAxisPrimary.getLabel().getCaption().setColor(foreGround);
+ yAxisPrimary.getTitle( ).getCaption( ).setValue( Ordinate_AXIS );
+ yAxisPrimary.getTitle( ).setVisible(true);
+ // yAxisPrimary.getMajorGrid().getLineAttributes().setColor(foreGround);
+
+ // for now get ready to create only one line - we have no data yet.
+ // we will add more lines as we need them
+ // handle null
+ if(!dataSeriesMap.containsKey(firstProperty)) {
+ DataSeries series = new DataSeries(Messages.getString("AUTO.TITLE4"), 0, overlayMode);
+ dataSeriesMap.put(firstProperty, series);
+ }
+
+ return retValue;
+ } // createSimpleLineChart
+
+
+ /**
+ * Create the view's context menu and add the action handlers to it.
+ */
+ protected void createContextMenu(final Composite parent) {
+
+ // Init a Context Menu Manager
+ final MenuManager contextMenuManager = new MenuManager();
+
+ // ---------------------------------------------------------------------
+
+ linearTimeAction = new LinearScaleAction();
+ logTimeAction = new LogScaleAction();
+ contextMenuManager.add(linearTimeAction);
+ contextMenuManager.add(logTimeAction);
+
+
+
+ // Place Holder for Menu Additions
+ contextMenuManager.add(new Separator(
+ IWorkbenchActionConstants.MB_ADDITIONS));
+
+ // ---------------------------------------------------------------------
+
+ viewLegend = new LegendViewAction();
+ hideLegend = new LegendHideAction();
+ contextMenuManager.add(viewLegend);
+ contextMenuManager.add(hideLegend);
+
+ // ---------------------------------------------------------------------
+
+
+ // Place Holder for Menu Additions
+ contextMenuManager.add(new Separator(
+ IWorkbenchActionConstants.MB_ADDITIONS));
+
+ popUpMenu = contextMenuManager.createContextMenu(parent);
+
+ // Set the context menu for the viewer
+ parent.setMenu(popUpMenu);
+
+ } // createContextMenu
+
+ /**
+ * Update the view's context menu and add the action handlers to it.
+ */
+ private void updateContextMenu(final Composite parent) {
+
+ popUpMenu.dispose();
+
+ // Init a Context Menu Manager
+ final MenuManager contextMenuManager = new MenuManager();
+
+ // ---------------------------------------------------------------------
+
+ linearTimeAction = new LinearScaleAction();
+ logTimeAction = new LogScaleAction();
+ contextMenuManager.add(linearTimeAction);
+ contextMenuManager.add(logTimeAction);
+
+ // ---------------------------------------------------------------------
+
+
+ // Place Holder for Menu Additions
+ contextMenuManager.add(new Separator(
+ IWorkbenchActionConstants.MB_ADDITIONS));
+
+ // ---------------------------------------------------------------------
+
+ viewLegend = new LegendViewAction();
+ hideLegend = new LegendHideAction();
+ contextMenuManager.add(viewLegend);
+ contextMenuManager.add(hideLegend);
+
+ // ---------------------------------------------------------------------
+
+
+ // Place Holder for Menu Additions
+ contextMenuManager.add(new Separator(
+ IWorkbenchActionConstants.MB_ADDITIONS));
+
+
+ // ---------------------------------------------------------------------
+ // add the displayable properties
+ for (int i = 0; i < control.getNumProperties(chartIndex); i ++) {
+
+ String nextProp = control.getProperty(chartIndex,i);
+ DataSeries series = dataSeriesMap.get(nextProp);
+ DisplayableProperty property = new DisplayableProperty(nextProp, series.isVisible());
+ contextMenuManager.add(property);
+ }
+
+ // ---------------------------------------------------------------------
+
+ // Place Holder for Menu Additions
+ contextMenuManager.add(new Separator(
+ IWorkbenchActionConstants.MB_ADDITIONS));
+
+ // ---------------------------------------------------------------------
+
+ final Menu popUpMenu = contextMenuManager.createContextMenu(parent);
+
+ // Set the context menu for the viewer
+ parent.setMenu(popUpMenu);
+
+
+ } // updateContextMenu
+
+
+
+ /**
+ * Sets the colors for a n array of LineSeries given the property to Plot
+ * for each. Try to set color from the preferences (if specified for that
+ * property) otherwise sets line color to blue.
+ *
+ * @param propertiesToPlot
+ * @param lsList
+ */
+ public static void setColorDefs(
+ final List<String> propertiesToPlot,
+ final List<LineSeries> lsList) {
+ // the default line color
+
+ // if possible get color from preferences
+ final Map<String, Color> colorMap = VisualizationPreferencePage
+ .getColorMapping();
+ for (int i = 0; i < lsList.size(); i++) {
+ ColorDefinition color = ColorDefinitionImpl.BLUE();
+
+ if ((propertiesToPlot != null) && (propertiesToPlot.size() > i)) {
+ final String key = propertiesToPlot.get(i);
+ // look or the preference color by name
+ if (colorMap.containsKey(key)) {
+ final Color c = colorMap.get(key);
+ color = ColorDefinitionImpl.create(c.getRed(),
+ c.getGreen(), c.getBlue());
+ }
+ lsList.get(i).setSeriesIdentifier(key);
+ lsList.get(i).getLineAttributes().setColor(color);
+ } else {
+
+ if (lsList.get(i) != null) {
+ lsList.get(i).setSeriesIdentifier(" ");
+ lsList.get(i).getLineAttributes().setColor(color);
+ }
+ }
+ }
+ return;
+ }// getColorDef
+
+
+
+
+ /**
+ * Disposes the Color objects
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ /**
+ * reset
+ */
+ public void reset() {
+ resetData();
+ redraw();
+ }
+
+ protected void resetData() {
+ clearData();
+
+ cycleNumbers.add(Integer.valueOf(0));
+ }
+
+ protected void clearData() {
+
+ dataSeriesMap.clear();
+ cycleNumbers.clear();
+ }
+
+
+ /**
+ * toggle the scale from logarithmic to linear
+ */
+ void toggleAxisScale() {
+ if (useLinearTimeScale) { //Switch to logarithmic scale
+ logTimeAction.setChecked(true);
+ linearTimeAction.setChecked(false);
+ //Just using the following axis type, to move to log scale, didn't work
+ //yAxisPrimary.setType(AxisType.LOGARITHMIC_LITERAL);
+ yAxisPrimary.getScale().setMin(null);
+ yAxisPrimary.getScale().setMax(null);
+ yAxisPrimary.getScale().unsetStep();
+ yAxisPrimary.getScale().unsetStepNumber();
+ }
+ else { //Switch to linear scale
+ logTimeAction.setChecked(false);
+ linearTimeAction.setChecked(true);
+ //yAxisPrimary.setType(AxisType.LINEAR_LITERAL);
+ yAxisPrimary.getScale().setMin(NumberDataElementImpl.create(0.0));
+ yAxisPrimary.getScale().setMax(NumberDataElementImpl.create(1.0));
+ yAxisPrimary.getScale().setStep(0.25);
+ }
+ useLinearTimeScale = !useLinearTimeScale;
+ draw();
+ }
+
+
+ /**
+ * toggle the scale from logarithmic to linear
+ */
+ void toggleLegend() {
+ if (showLegend) { //Switch to hide
+ viewLegend.setChecked(false);
+ hideLegend.setChecked(true);
+ legend.setVisible(false);
+ }
+ else { //Switch to view
+ viewLegend.setChecked(true);
+ hideLegend.setChecked(false);
+ legend.setVisible(true);
+ }
+ showLegend = !showLegend;
+ draw();
+ }
+
+
+ /**
+ * Action to show the legend
+ */
+ protected class LegendViewAction extends Action {
+ public LegendViewAction()
+ {
+ super(Messages.getString("ContextMenu.ShowLegend"), IAction.AS_CHECK_BOX);
+ setChecked(showLegend);
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#getText()
+ */
+ @Override
+ public String getText() {
+ return Messages.getString("ContextMenu.ShowLegend");
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ if (showLegend) {
+ setChecked(true);
+ //Nothing to do. It's already linear-time.
+ }
+ else {
+ toggleLegend();
+ }
+ draw();
+ }
+ } //LegendViewAction
+
+ /**
+ * Action to hide the legend
+ */
+ class LegendHideAction extends Action {
+ public LegendHideAction()
+ {
+ super(Messages.getString("ContextMenu.HideLegend"), IAction.AS_CHECK_BOX);
+ setChecked(!showLegend);
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#getText()
+ */
+ @Override
+ public String getText() {
+ return Messages.getString("ContextMenu.HideLegend");
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ if (!showLegend) {
+ setChecked(true);
+ //Nothing to do. It's already log-time.
+ }
+ else {
+ toggleLegend();
+ }
+ draw();
+ }
+ }//LegendHideAction
+
+
+ /**
+ * switch to linear plot
+ *
+ */
+ protected class LinearScaleAction extends Action {
+ public LinearScaleAction()
+ {
+ super(Messages.getString("ContextMenu.LinearTimeScale"), IAction.AS_CHECK_BOX);
+ setChecked(useLinearTimeScale);
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#getText()
+ */
+ @Override
+ public String getText() {
+ return Messages.getString("ContextMenu.LinearTimeScale");
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ if (useLinearTimeScale) {
+ setChecked(true);
+ //Nothing to do. It's already linear-time.
+ }
+ else {
+ toggleAxisScale();
+ }
+ draw();
+ }
+ } //LinearScaleAction
+
+ /**
+ * switch to semi-log plot (log scale on y axis)
+ *
+ */
+ class LogScaleAction extends Action {
+ public LogScaleAction()
+ {
+ super(Messages.getString("ContextMenu.LogTimeScale"), IAction.AS_CHECK_BOX);
+ setChecked(!useLinearTimeScale);
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#getText()
+ */
+ @Override
+ public String getText() {
+ return Messages.getString("ContextMenu.LogTimeScale");
+ }
+
+ /**
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ if (!useLinearTimeScale) {
+ setChecked(true);
+ //Nothing to do. It's already log-time.
+ }
+ else {
+ toggleAxisScale();
+ }
+ draw();
+ }
+ }//LogScaleAction
+
+ /**
+ * DisplayableProperty
+ *
+ */
+ protected class DisplayableProperty extends Action
+ {
+ String property = null;
+ public DisplayableProperty(String property, boolean visibility)
+ {
+ super(property, IAction.AS_CHECK_BOX);
+ this.property = property;
+ setChecked(visibility);
+ }
+
+
+
+ /**
+ * @see org.eclipse.jface.action.Action#getText()
+ */
+ @Override
+ public String getText() {
+ return property;
+ }
+
+ /**
+ * Toggle the state
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ DataSeries series = dataSeriesMap.get(property);
+ series.toggleVisible();
+ dataSeriesMap.put(property,series);
+ setChecked(series.isVisible());
+ visibleMap.put(property, series.isVisible());
+ draw();
+ }
+ }// DisplayableProperty
+
+
+ /**
+ * Inner class DataSeries
+ * all the data objects for a plot
+ *
+ */
+ protected class DataSeries
+ {
+ public String propertyName = "";
+
+ public List<Double> relativeValues = new ArrayList<Double>();
+ public Series lineSeries = null;
+ private boolean visible = true;
+ private SeriesDefinition sdY = null;
+ private int seriesIndex = 0;
+ private boolean overlayMode = false;
+
+
+ public boolean isVisible() {
+ return visible;
+ }
+ public void setVisible(boolean state) {
+ visible = state;
+ }
+
+ public void toggleVisible() {
+ visible = !visible;
+ }
+
+ /**
+ *
+ * @param propertyName
+ * @param index
+ * @param overlay
+ */
+ public DataSeries(String propertyName, int index, boolean overlay) {
+ this.propertyName = propertyName;
+ this.seriesIndex = index;
+ this.overlayMode = overlay;
+ relativeValues = new ArrayList<Double>();
+ relativeValues.add(new Double(0.0));
+ addLineSeries(propertyName);
+ }
+
+ public void addValue(Double val) {
+ if(relativeValues==null) relativeValues = new ArrayList<Double>();
+ relativeValues.add(val);
+ }
+
+ /**
+ * @param propertyName
+ *
+ */
+ @SuppressWarnings("deprecation")
+ public void addLineSeries(final String propertyName) {
+
+ final NumberDataSet orthoValues = NumberDataSetImpl
+ .create(relativeValues);
+ if(lineSeries == null) {
+ lineSeries = ScatterSeriesImpl.create();
+ /*
+ *
+ * Bar chart style is too slow for generation of a fill
+ * if we want a fill we can try using the difference plot
+ * to a straight line at y=0
+ *
+
+ if(propertyName.indexOf("*")>=1) {
+ // barseries methods
+ lineSeries = (BarSeries) BarSeriesImpl.create();
+ } else {
+ lineSeries = (ScatterSeries) ScatterSeriesImpl.create();
+ }
+
+ *
+ */
+ } // if lineSeries==null
+ lineSeries.setDataSet(orthoValues);
+ ((LineSeries) lineSeries).getLineAttributes().setVisible(true);
+ ((LineSeries) lineSeries).getLineAttributes().setThickness(3);
+ ((LineSeries) lineSeries).getMarkers().clear();
+
+ // Assign the line color
+ // based on selected property. Default is Blue
+ setColorDefs(seriesIndex);
+ // If this is the "selected" region of a graph set the marker type
+
+ // the series def
+ sdY = SeriesDefinitionImpl.create();
+ sdY.getSeriesPalette().update(-2);
+ sdY.getSeries().add(lineSeries);
+ yAxisPrimary.getSeriesDefinitions().add(sdY);
+
+ return;
+ }// addLineSeries
+
+ /**
+ * in response to user action temporarily remove the line series from the graph
+ */
+ public void hide() {
+ lineSeries.setVisible(false);
+ visible = false;
+ }// hide
+
+ /**
+ * in response to user action add back the line series to the graph
+ */
+ public void show() {
+ lineSeries.setVisible(true);
+ visible = true;
+ }// show
+
+
+ /**
+ * Overloaded and simple method to set the colors
+ * does not use the preferences
+ *
+ * Sets the colors for a n array of LineSeries given the property to Plot
+ * for each. Try to set color from the preferences (if specified for that
+ * property) otherwise sets line color to blue.
+ * @param propertyName
+ *
+ */
+ public void setColorDefs(int index) {
+ // the default line color
+ if(index >= colorDefault.length) index = 0; // should never happen
+ ColorDefinition color = colorDefault[index];
+
+ this.lineSeries.setSeriesIdentifier(propertyName);
+ if (overlayMode) {
+ ((LineSeries)this.lineSeries).getLineAttributes().setColor(color);
+ ((LineSeries)this.lineSeries).getLineAttributes().setStyle(LineStyle.DOTTED_LITERAL);
+ } else {
+ ((LineSeries)this.lineSeries).getLineAttributes().setColor(color);
+ }
+
+
+ }// getColorDefs
+
+ /**
+ * Sets the colors for a n array of LineSeries given the property to Plot
+ * for each. Try to set color from the preferences (if specified for that
+ * property) otherwise sets line color to blue.
+ * @param propertyName
+ *
+ */
+ public void setColorDefs(String propertyName) {
+ // the default line color
+
+ // if possible get color from preferences
+ final Map<String, Color> colorMap = VisualizationPreferencePage.getColorMapping();
+
+ // default color
+ int colorIndex = seriesIndex % colorDefault.length;
+ ColorDefinition color = colorDefault[colorIndex];
+
+ // preferred color by name
+ String key = propertyName.substring(0,1);
+
+ if (colorMap.containsKey(key)) {
+ final Color c = colorMap.get(key);
+ color = ColorDefinitionImpl.create(c.getRed(), c.getGreen(), c.getBlue());
+ }
+
+ this.lineSeries.setSeriesIdentifier(propertyName);
+ if (overlayMode) {
+ ((LineSeries)this.lineSeries).getLineAttributes().setColor(ColorDefinitionImpl.GREY());
+ ((LineSeries)this.lineSeries).getLineAttributes().setStyle(LineStyle.DOTTED_LITERAL);
+ } else {
+ ((LineSeries)this.lineSeries).getLineAttributes().setColor(color);
+ }
+
+
+ }// getColorDefs
+
+ /**
+ * length of the series
+ * @return number of data points
+ */
+ public int getDataSize() {
+ return relativeValues.size();
+ }
+ // Accessors
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ public void setPropertyName(String propertyName) {
+ this.propertyName = propertyName;
+ }
+
+ public List<Double> getRelativeValues() {
+ return relativeValues;
+ }
+
+ public void setRelativeValues(List<Double> relativeValues) {
+ this.relativeValues = relativeValues;
+ }
+
+
+
+ public void setLineSeries(LineSeries lineSeries) {
+ this.lineSeries = lineSeries;
+ }
+ }// DataSeries
+ ////////////////////////////////////////////////////////
+
+} // AggregateTimeSeriesCanvas
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AnalysisControl.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AnalysisControl.java
new file mode 100644
index 0000000..3289b0c
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AnalysisControl.java
@@ -0,0 +1,183 @@
+// AnalysisControl
+package org.eclipse.stem.analysis.automaticexperiment.views;
+
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * AnalysisControl is a subclass of Canvas suitable for chart drawings.
+ */
+abstract public class AnalysisControl extends Composite {
+
+
+ protected static final String CLEAR_TEXT = "clear monitors";
+
+ protected Label simulationNameLabel;
+
+ /**
+ * Status text
+ */
+ public static final String STATUS_TEXT = "status";
+
+ protected static Map<String,Object> controlParametersMap = new HashMap<String,Object>();
+
+ /**
+ * a string for setting user feedback messages
+ */
+ protected String userMessage = "";
+
+ /**
+ * a label to display messages
+ */
+ protected Label userMessageLabel = null;
+
+
+
+ /**
+ * The collection of ISelectionChangedListener waiting to be told about
+ * selections.
+ */
+ protected final List<ISelectionChangedListener> listeners = new CopyOnWriteArrayList<ISelectionChangedListener>();
+
+ protected Label identifiableTitle;
+
+ /**
+ * The width of the layout margin.
+ */
+ protected static final int MARGIN_WIDTH = 5;
+
+ /**
+ * The height of the layout margin.
+ */
+ protected static final int MARGIN_HEIGHT = 5;
+
+ /**
+ * @param parent
+ * @param style
+ */
+ public AnalysisControl(final Composite parent, final int style) {
+ super(parent, style);
+
+ this.addDisposeListener(new DisposeListener() {
+ /**
+ * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
+ */
+ public void widgetDisposed(@SuppressWarnings("unused")
+ final DisposeEvent e) {
+ dispose();
+ }
+ });
+
+ final FormLayout layout = new FormLayout();
+ layout.marginHeight = MARGIN_HEIGHT;
+ layout.marginWidth = MARGIN_WIDTH;
+ setLayout(layout);
+
+ } // AnalysisControl
+
+ /**
+ * @param parent
+ * the parent SWT control that this composite will be a child of
+ * @return the SWT Composite to be displayed above the MapCanvas in the
+ * control
+ */
+ protected Composite createTopComposite(final Composite parent) {
+ final Composite topComposite = new Composite(parent, SWT.NONE);
+
+ final FillLayout topCompositeLayout = new FillLayout(SWT.VERTICAL);
+ topComposite.setLayout(topCompositeLayout);
+
+ simulationNameLabel = new Label(topComposite, SWT.CENTER);
+ simulationNameLabel.setText("");
+
+ return topComposite;
+ } // createTopComposite
+
+
+
+
+ /**
+ *
+ * @param folderName
+ */
+ protected abstract void initializeHeader(String folderName);
+
+
+ /**
+ * All controllers must implement this
+ * to remove the control e.g. by a remove button event
+ */
+ public abstract void remove() ;
+
+
+
+
+
+
+ /**
+ * get values for graphs as double array
+ * @param chartIndex allows multiple charts in a view. Default is index=0 (one chart)
+ * @param state
+ * @return value array
+ */
+ public abstract double[] getValues(int chartIndex, int state);
+
+ /**
+ * update the message text
+ */
+ public void updateMessage() {
+ if(userMessageLabel!=null) userMessageLabel.setText(userMessage);
+ }
+
+ /**
+ * update the message text
+ * @param message
+ */
+ public void updateMessage(String message) {
+ userMessage = message;
+ if(userMessageLabel!=null) userMessageLabel.setText(userMessage);
+ }
+
+ /**
+ * get the name of the time series for a given state
+ * @param chartIndex allows multiple charts in a view. Default is index=0 (one chart)
+ * @param state
+ * @return property name
+ */
+ public abstract String getProperty(int chartIndex, int state);
+
+
+ /**
+ *
+ * @param chartIndex allows multiple charts in a view. Default is index=0 (one chart)
+ * @return number of properties to plot
+ */
+ public abstract int getNumProperties(int chartIndex);
+
+
+
+
+
+} // AnalysisControl
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AnalysisControlFactory.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AnalysisControlFactory.java
new file mode 100644
index 0000000..92987c9
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AnalysisControlFactory.java
@@ -0,0 +1,35 @@
+// AnalysisControlFactory.java
+package org.eclipse.stem.analysis.automaticexperiment.views;
+
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * This interface is implemented by factories that create instances of
+ * {@link AnalysisControl}.
+ */
+public interface AnalysisControlFactory {
+
+ /**
+ *
+ * @param parent
+ * @return the AnalysisControl
+ */
+ AnalysisControl create(final Composite parent);
+
+ /**
+ * @return TODO JFK
+ */
+ public String getControlType();
+
+} // AnalysisControlFactory
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AnalysisViewer.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AnalysisViewer.java
new file mode 100644
index 0000000..a85dc1e
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AnalysisViewer.java
@@ -0,0 +1,219 @@
+// AnalysisViewer.java
+package org.eclipse.stem.analysis.automaticexperiment.views;
+
+/*******************************************************************************
+ * Copyright (c) 2007,2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.stem.ui.views.geographic.map.MapControl;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * This class presents "views" of the running simulations.
+ */
+public class AnalysisViewer extends Viewer {
+
+
+
+ private static final String URI_PREFIX = "/resources/data/scenario/disease/";
+
+
+
+ /**
+ * This is the top-level control of the viewer. It contains the
+ * {@link MapControl}s that display the current state of the
+ * {@link org.eclipse.stem.jobs.simulation.Simulation}s.
+ */
+ final Composite composite;
+
+
+
+
+
+
+
+
+ // get the path
+ //private static final IPath PATH = Activator.getDefault().getStateLocation();
+
+ //private static final String sep = File.separator;
+
+ //private static final String pathSuffix = "analysis"+sep;
+
+
+
+ /**
+ * This factory is used to create instances of {@link AnalysisControl} in the
+ * method {@link #populateView()}
+ */
+ private final AnalysisControlFactory acf;
+
+ /**
+ * @param parent
+ * the SWT parent of the control that makes up the viewer
+ * @param acf
+ * the factory that creates instance of {@link AnalysisControl}
+ */
+ public AnalysisViewer(final Composite parent, final AnalysisControlFactory acf) {
+
+ composite = new Composite(parent, SWT.NONE);
+ final FillLayout compositeLayout = new FillLayout(SWT.HORIZONTAL);
+ composite.setLayout(compositeLayout);
+
+ // Remember the factory that we'll use to create instances of
+ // AnalysisControl
+ this.acf = acf;
+ refresh();
+ composite.pack();
+
+ } // AnalysisViewer
+
+ /**
+ * @see org.eclipse.jface.viewers.Viewer#getControl()
+ */
+ @Override
+ public Control getControl() {
+ return composite;
+ } // getControl
+
+
+
+ /**
+ * @see org.eclipse.jface.viewers.Viewer#refresh()
+ */
+ @Override
+ public void refresh() {
+ populateView();
+ } // refresh
+
+
+
+
+ /**
+ * Create and dispose of MapControls as necessary to display the selected
+ * Simulations.
+ */
+ private void populateView() {
+
+
+ // problem here when we start up
+ // Are we done?
+ if (composite.isDisposed()) {
+ // Yes
+ return;
+ } // if
+
+
+ final AnalysisControl analysisControl = acf.create(composite);
+
+ analysisControl.addDisposeListener(new DisposeListener() {
+ /**
+ * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
+ */
+ public void widgetDisposed(@SuppressWarnings("unused")
+ final DisposeEvent e) {
+ composite.layout(true, true);
+ composite.redraw();
+ }
+ });
+
+ composite.layout(true, true);
+ composite.redraw();
+ } // populateView
+
+
+
+
+
+
+
+
+
+ /**
+ * Removes whitespace, ',', '.', etc.
+ * @param s
+ * @return a filtered string
+ */
+ public static String nameFilter (String s) {
+ String s1 = s.trim();
+ s1 = s1.replace('"',' ');
+ s1 = s1.replaceAll(" ","");
+ s1 = s1.replace(',','_');
+ s1 = s1.replace('.','_');
+ s1 = s1.replaceAll("_","");
+ s = s1;
+
+ return s;
+ }
+
+
+
+
+
+ /**
+ * filters the location id prefix from the beginning of
+ * a nodes ID for generation of a file name
+ * @param unfiltered
+ * @return the filtered file name using location id.
+ */
+ public static String filterFilename(String unfiltered) {
+ int last = unfiltered.indexOf(URI_PREFIX);
+ if (last >=0) {
+ last += URI_PREFIX.length();
+ return unfiltered.substring(last, unfiltered.length());
+ }
+ return unfiltered;
+
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.Viewer#getInput()
+ */
+ @Override
+ public Object getInput() {
+ // not used
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object)
+ */
+ @Override
+ public void setInput(@SuppressWarnings("unused") Object input) {
+ // not used
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers.ISelection, boolean)
+ */
+ @Override
+ public void setSelection(@SuppressWarnings("unused") ISelection selection, @SuppressWarnings("unused") boolean reveal) {
+ // not used
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.Viewer#getSelection()
+ */
+ @Override
+ public ISelection getSelection() {
+ // not used
+ return null;
+ }
+
+
+} // AnalysisViewer
diff --git a/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AutoExpControl.java b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AutoExpControl.java
new file mode 100644
index 0000000..f805cc9
--- /dev/null
+++ b/analysis/org.eclipse.stem.analysis.automaticexperiment/src/org/eclipse/stem/analysis/automaticexperiment/views/AutoExpControl.java
@@ -0,0 +1,1191 @@
+// AutoExpControl.java
+package org.eclipse.stem.analysis.automaticexperiment.views;
+
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.birt.chart.model.attribute.ColorDefinition;
+import org.eclipse.birt.chart.model.attribute.impl.ColorDefinitionImpl;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.stem.analysis.ErrorResult;
+import org.eclipse.stem.analysis.automaticexperiment.ALGORITHM_STATUS;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperimentManager;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperimentManagerEvent;
+import org.eclipse.stem.analysis.automaticexperiment.AutomaticExperimentManagerListener;
+import org.eclipse.stem.analysis.automaticexperiment.ErrorAnalysisAlgorithm;
+import org.eclipse.stem.analysis.automaticexperiment.ErrorAnalysisAlgorithmEvent;
+import org.eclipse.stem.analysis.automaticexperiment.ErrorAnalysisAlgorithmListener;
+import org.eclipse.stem.analysis.automaticexperiment.MANAGER_STATUS;
+import org.eclipse.stem.core.common.Identifiable;
+import org.eclipse.stem.ui.ISharedImages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * This class is a SWT GUI component that uses BIRT to plot
+ */
+public class AutoExpControl extends AnalysisControl {
+
+
+ private static Display display = null;
+
+ private ImageRegistry imageRegistry = null;
+
+ private static AutomaticExperimentManager manager = null;
+
+ /**
+ * Folder to contain the data
+ *
+ */
+ static CTabFolder tabFolder;
+
+ static boolean pauseTrigger = false;
+
+ static double[] referenceIncidence;
+ static double[] modelIncidence;
+
+
+ /**
+ * A label to report status (not yet used)
+ */
+ //static Label statusLabel;
+
+ /**
+ * stop button
+ */
+ Button stopButton = null;
+
+ /**
+ * restart button
+ */
+ Button restartButton = null;
+ /**
+ * Colors for the time series chart
+ */
+ static final ColorDefinition foreGround = ColorDefinitionImpl.create(180, 0, 0);
+ static final ColorDefinition backgroundGround = ColorDefinitionImpl.create(255, 255, 225);
+ static final ColorDefinition frameColor = ColorDefinitionImpl.WHITE();
+
+ // some colors
+ private static Color cyan;
+ private static Color cyanDark;
+ private static Color darkRed;
+ private static Color white;
+ private static Color lightGreen;
+ private static Color lightBlue;
+
+
+
+ protected static RunHistoryCanvas errorConvergenceByRun = null;
+ static final int ERROR_CONVERGENCE_BY_RUN_ID = 0;
+
+ protected static ErrorTimeSeriesCanvas currentErrorByTime = null;
+ static final int CURRENT_ERROR_BY_TIME_ID = 1;
+
+ protected static AggregateTimeSeriesCanvas aggregateErrorByTime = null;
+ static final int AGGREGATE_BY_TIME_ID = 2;
+
+
+ private static final int NUMROWS = 10;
+
+ //protected static Composite chartComposite;
+ protected static Composite errorTimeSeriesComposite;
+ protected static Composite aggregateTimeSeriesComposite;
+ protected static Composite runHistoryComposite;
+ protected static Composite valuesComposite;
+ protected static Composite controlsComposite;
+ protected static Composite controlsActionComposite;
+ protected static Composite controlsValuesComposite;
+ protected static Composite settingsComposite;
+
+ private static List<Double> errorHistoryList = new ArrayList<Double>();
+ private static double[] errorHistory;
+ private static double[] bestSeries;
+ private static double bestError = Double.MAX_VALUE;
+ private static double bestVError = Double.MAX_VALUE;
+ private static double[] newErrorTimeSeries;
+
+ protected static String[] runParamNames;
+ protected static double[] bestParamValues;
+
+ protected static double[][] recentParamValues;
+ protected static double[] restartParamValues;
+ protected static double[] recentErrors;
+ protected static double[] recentVErrors;
+
+ protected static CLabel[] attributeLabels;
+ protected static CLabel[] controlLabels;
+ protected static Text[] bestValueLabels;
+
+ protected static Text[][] recentValueLabels;
+ protected static Text[] restartValues;
+
+ protected static short row = 0; // which row are we updating
+
+ protected static short numColumns = 0;
+
+ /**
+ * restart sim uses latest vals or best
+ */
+ protected static boolean restartWithLatest= true;
+
+ /**
+ * The dialog for the wizard
+ */
+ //static WizardDialog wizardDialog;
+
+ //PropertySelector propertySelector;
+ //List<ItemPropertyDescriptor> selectedProperties;
+
+ /**
+ *
+ * @param parent
+ */
+ public AutoExpControl(final Composite parent) {
+ super(parent, SWT.None);
+ createContents();
+ } // AutoExpControl
+
+
+
+ /**
+ * Create the contents of the plotter
+ */
+ void createContents() {
+
+ // Set the image registry
+ if (imageRegistry == null) {
+ org.eclipse.stem.ui.Activator activator = org.eclipse.stem.ui.Activator.getDefault();
+ imageRegistry = activator.getImageRegistry();
+ }
+ // Use form layout
+ setLayout(new FormLayout());
+ if(display==null) display = this.getDisplay();
+ cyan = display.getSystemColor(SWT.COLOR_CYAN);
+ cyanDark = new Color(display, 60, 220, 220);
+ darkRed = display.getSystemColor(SWT.COLOR_DARK_RED);
+ white = display.getSystemColor(SWT.COLOR_WHITE);
+ lightGreen = new Color(display, 128, 255, 128);
+ lightBlue = new Color(display, 128, 128, 255);
+
+
+ identifiableTitle = new Label(this, SWT.NONE);
+ identifiableTitle.setText(Messages.getString("AUTO.TITLELABEL"));
+
+
+ int bottom = 5;
+ final FormData titleFormData = new FormData();
+ identifiableTitle.setLayoutData(titleFormData);
+ titleFormData.top = new FormAttachment(0, 0);
+ titleFormData.bottom = new FormAttachment(bottom, 0);
+ titleFormData.left = new FormAttachment(0, 0);
+ titleFormData.right = new FormAttachment(100, 0);
+
+ bottom += 1;
+
+ tabFolder = new CTabFolder(this, SWT.BORDER);
+ // set up the values composite
+ valuesComposite = new Composite(tabFolder, SWT.BORDER);
+
+ final FormData tabFormData = new FormData();
+ tabFormData.top = new FormAttachment(bottom, 0);
+ tabFormData.bottom = new FormAttachment(100, 0);
+ tabFormData.left = new FormAttachment(0, 0);
+ tabFormData.right = new FormAttachment(100, 0);
+ tabFolder.setLayoutData(tabFormData);
+ tabFolder.setSimple(false);
+
+
+ tabFolder.setSelectionBackground(new Color[]{
+ cyan,
+ white,
+ lightBlue,
+ lightBlue},
+ new int[] {25, 50, 100});
+
+
+ tabFolder.setSelectionForeground(display.getSystemColor(SWT.COLOR_BLACK));
+
+ tabFolder.setBackground(cyanDark);
+ tabFolder.setForeground(darkRed);
+ tabFolder.setBorderVisible(true);
+
+ /////////////
+ // RUN HISTORY
+ CTabItem item0 = new CTabItem(tabFolder, SWT.BORDER);
+ item0.setText (" "+Messages.getString("AUTO.HISTORY")+" ");
+ runHistoryComposite = new Composite(tabFolder, SWT.BORDER);
+ runHistoryComposite.setLayout(new FormLayout());
+ item0.setControl(runHistoryComposite);
+ // set up the four data time series inside the chartComposite
+ getRunHistoryChart(runHistoryComposite);
+
+ /////////////
+ // AGGREGATE TIME SERIES
+ CTabItem item1 = new CTabItem(tabFolder, SWT.BORDER);
+ item1.setText (" "+Messages.getString("AUTO.AGGREGATESERIES")+" ");
+ aggregateTimeSeriesComposite = new Composite(tabFolder, SWT.BORDER);
+ aggregateTimeSeriesComposite.setLayout(new FormLayout());
+ item1.setControl(aggregateTimeSeriesComposite);
+ // set up the four data time series inside the chartComposite
+ getAggregateTimeSeriesChart(aggregateTimeSeriesComposite);
+
+ /////////////
+ // ERROR TIME SERIES
+ CTabItem item2 = new CTabItem(tabFolder, SWT.BORDER);
+ item2.setText (" "+Messages.getString("AUTO.ERRORSERIES")+" ");
+ errorTimeSeriesComposite = new Composite(tabFolder, SWT.BORDER);
+ errorTimeSeriesComposite.setLayout(new FormLayout());
+ item2.setControl(errorTimeSeriesComposite);
+ // set up the four data time series inside the chartComposite
+ getErrorTimeSeriesChart(errorTimeSeriesComposite);
+
+ //////////////
+ // VALUES
+ CTabItem item3 = new CTabItem(tabFolder, SWT.BORDER);
+ item3.setText(Messages.getString("AUTO.VALUES"));
+ item3.setControl(valuesComposite);
+
+ //////////////
+ // Controls
+ controlsComposite = new Composite(tabFolder, SWT.BORDER);
+ getControls();
+ CTabItem item4 = new CTabItem(tabFolder, SWT.BORDER);
+ item4.setText(Messages.getString("AUTO.CONTROLS"));
+ item4.setControl(controlsComposite);
+
+ //////////////
+ // Settings
+// settingsComposite = new Composite(tabFolder, SWT.BORDER);
+// getSettings();
+// CTabItem item4 = new CTabItem(tabFolder, SWT.BORDER);
+// item4.setText(Messages.getString("AUTO.SETTINGS"));
+// item4.setControl(settingsComposite);
+
+
+
+ tabFolder.setSelection(item0);
+ if(manager==null) {
+ manager = AutomaticExperimentManager.getInstance();
+ manager.addListener(new AutomaticExperimentManagerListener() {
+
+ public void eventReceived(AutomaticExperimentManagerEvent evt) {
+ if(evt.status == MANAGER_STATUS.SCHEDULED) {
+ ErrorAnalysisAlgorithm alg = evt.algorithm;
+ display.syncExec(new Runnable() {
+ public void run() {
+ AutoExpControl.this.reset();
+ AutoExpControl.this.stopButton.setEnabled(true);
+ restartButton.setEnabled(false);
+ }
+ });
+ alg.addListener(new ErrorAnalysisAlgorithmListener() {
+ public void eventReceived(ErrorAnalysisAlgorithmEvent evt) {
+
+ if(evt.status == ALGORITHM_STATUS.STARTING_SIMULATION) {
+ // set the label info
+ runParamNames = evt.parameterNames;
+ if(recentParamValues == null) {
+ numColumns = (short)runParamNames.length;
+ recentParamValues = new double[NUMROWS][runParamNames.length+1];
+ restartParamValues = new double[runParamNames.length];
+
+ recentErrors = new double[NUMROWS];
+ recentVErrors = new double[NUMROWS];
+ }
+
+ if(row < NUMROWS) {
+ recentParamValues[row] = copyDoubleArray(evt.parameterValues);
+ recentErrors[row] = -1; // not known yet
+ recentVErrors[row++] = -1; // not known yet
+ } else {
+ // We need to shift up
+ for(int i=0;i<NUMROWS-1;++i) {
+ for(int j=0;j<runParamNames.length;++j) recentParamValues[i][j] = recentParamValues[i+1][j];
+ recentErrors[i]=recentErrors[i+1];
+ recentVErrors[i]=recentVErrors[i+1];
+
+ }
+ recentParamValues[row-1] = copyDoubleArray(evt.parameterValues);
+ recentErrors[row-1] = -1; // not known yet
+ recentVErrors[row-1] = -1; // not known yet
+ }
+
+ // copy all but the error - it is not a parameter
+ for(int i = 0; i < (restartParamValues.length); i ++) {
+ if(restartWithLatest) {
+ if(recentParamValues!=null) restartParamValues[i] = recentParamValues[row-1][i];
+ } else {
+ if(bestParamValues!=null) restartParamValues[i] = bestParamValues[i];
+ }
+
+ }
+
+ // Add a Runnable to the UI thread's execution queue
+ final Display display = Display.getDefault();
+ if (!display.isDisposed()) {
+ // Yes
+ try {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ if(!valuesInitialized) {
+ initializeValueLabels(runParamNames);
+ initializeControlLabels(runParamNames);
+ }
+ updateValueLabels();
+ } // run
+ }); // display.asyncExec
+ } // try
+ catch (final Exception e) {
+ // Ignore there could be a race condition with the display being disposed
+ } // catch Exception
+ } // if (!display.isDisposed())
+ //////////////////////////////////////
+ } else if(evt.status == ALGORITHM_STATUS.FINISHED_ALGORITHM) {
+ // The algorithm has finished. Smallest value in
+ //evt.result
+ /////////////////
+ display.asyncExec(new Runnable() {
+ public void run() {
+ restartButton.setEnabled(true);
+ stopButton.setEnabled(false);
+ }
+ });
+ } else if(evt.status == ALGORITHM_STATUS.FINISHED_SIMULATION) {
+ // One simulation is done. The result is READY and stored in evt.result
+ ErrorResult result = evt.result;
+ final double plottableError = plottableError(result.getError());
+ recentErrors[row-1] = evt.result.getError();
+ recentVErrors[row-1] = evt.result.getValidationError();
+
+ if(result != null) {
+ // Plot 1 from result.getError() (keep appending)
+ appendLatestErrorData(plottableError);
+ // Plot 2 from result.getErrorByTimestep() (same as we show in scenario comparison view)
+ setRecentTimeSeries(result.getError(), result.getValidationError(), result.getErrorByTimeStep(), result.getReferenceByTime(), result.getModelByTime() );
+
+ if(bestParamValues == null) {
+ bestParamValues = copyDoubleArray(recentParamValues[row-1]);
+ bestError = result.getError();
+ bestVError = result.getValidationError();
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // Add a Runnable to the UI thread's execution queue
+ final Display display = Display.getDefault();
+ if (!display.isDisposed()) {
+ // Yes
+ try {
+ display.asyncExec(new Runnable() {
+ public void run() {
+ updateCharts();
+ updateValueLabels();
+ } // run
+ }); // display.asyncExec
+ } // try
+ catch (final Exception e) {
+ // Ignore there could be a race condition with the display being disposed
+ } // catch Exception
+ } // if (!display.isDisposed())
+ }// if(result != null)
+ } else if(evt.status == ALGORITHM_STATUS.RESTARTED_ALGORITHM) {
+ // The algorithm has restarted. Smallest value in
+ // evt.result
+ }
+ }
+ });
+ }
+ }
+ });
+
+ }// if(manager null)
+
+
+ updateCharts();
+
+ } // createContents
+
+ /**
+ * filter +ve, -ve infinity, etc
+ * @param error
+ * @return
+ */
+ static double plottableError(double error) {
+ if((error==Double.POSITIVE_INFINITY)
+ ||(error==Double.NEGATIVE_INFINITY)
+ ||Double.isNaN(error)
+ ||(error==Double.MAX_VALUE)) {
+ return 100.0;
+ } else {
+ return error;
+ }
+
+
+ }
+
+ private void reset() {
+ // Reset everything at the beginning of an automated experiment
+ errorHistory = new double[1];
+ errorHistory[0] = 0;
+
+ newErrorTimeSeries = new double[1];
+ newErrorTimeSeries[0] = 0;
+
+ referenceIncidence = new double[1];
+ referenceIncidence[0] = 0;
+
+ modelIncidence = new double[1];
+ modelIncidence[0] = 0;
+
+ errorConvergenceByRun.resetData();
+ currentErrorByTime.resetData();
+ aggregateErrorByTime.resetData();
+ //errorConvergenceByRun.clearData();
+ //currentErrorByTime.clearData();
+ errorHistoryList = new ArrayList<Double>();
+
+ bestSeries = null;
+ bestError = Double.MAX_VALUE;
+ bestVError = Double.MAX_VALUE;
+
+ runParamNames = null;
+ bestParamValues = null;
+ restartParamValues = null;
+ recentParamValues = null;
+ recentErrors = null;
+ recentVErrors = null;
+
+ if(attributeLabels != null)
+ for(int i=0;i<attributeLabels.length;++i) {
+ attributeLabels[i].dispose();
+ attributeLabels[i] = null;
+ }
+ attributeLabels = null;
+ if(bestValueLabels != null)
+ for(int i=0;i<bestValueLabels.length;++i) {
+ bestValueLabels[i].dispose();
+ bestValueLabels[i] = null;
+ }
+ bestValueLabels = null;
+
+ if(recentValueLabels != null)
+ for(int i=0;i<recentValueLabels.length;++i)
+ for(int j=0;j<recentValueLabels[i].length;++j) {
+ recentValueLabels[i][j].dispose();
+ recentValueLabels[i][j] = null;
+ }
+ recentValueLabels = null;
+
+ if(controlLabels != null)
+ for(CLabel lab:controlLabels) lab.dispose();
+
+ controlLabels = null;
+
+
+ if(restartValues!=null)
+ for(Text t:restartValues) t.dispose();
+
+ row = 0;
+ numColumns = 0;
+ valuesInitialized = false;
+ }
+
+ /**
+ * update the graphs
+ */
+ public static void updateCharts() {
+ errorConvergenceByRun.draw();
+ currentErrorByTime.draw();
+ aggregateErrorByTime.draw();
+ }
+
+ /**
+ * redraw the graphs
+ */
+ public static void redrawCharts() {
+ errorConvergenceByRun.redraw();
+ currentErrorByTime.redraw();
+ aggregateErrorByTime.redraw();
+ }
+
+
+
+ /**
+ * set up the time series chart
+ * @param dataComposite
+ */
+ private void getErrorTimeSeriesChart(Composite dataComposite) {
+
+ // currentErrorByTime
+ currentErrorByTime = new ErrorTimeSeriesCanvas(this,dataComposite,
+ Messages.getString("AUTO.TITLE2"),
+ Messages.getString("AUTO.ERROR"),// y axis
+ Messages.getString("AUTO.TIME"),// x axis
+ Messages.getString("AUTO.TITLE2"), //first property (line series name)
+ foreGround,
+ backgroundGround,
+ frameColor, CURRENT_ERROR_BY_TIME_ID, true);
+ final FormData timeSeriesFormData = new FormData();
+ currentErrorByTime.setLayoutData(timeSeriesFormData);
+ timeSeriesFormData.top = new FormAttachment(dataComposite, 0);
+ timeSeriesFormData.bottom = new FormAttachment(100, 0);
+ timeSeriesFormData.left = new FormAttachment(0, 0);
+ timeSeriesFormData.right = new FormAttachment(100, 0);
+
+ currentErrorByTime.redraw();
+
+ }// getErrorTimeSeries
+
+ /**
+ * set up the time series chart
+ * @param dataComposite
+ */
+ private void getAggregateTimeSeriesChart(Composite dataComposite) {
+
+ // currentErrorByTime
+ aggregateErrorByTime = new AggregateTimeSeriesCanvas(this,dataComposite,
+ Messages.getString("AUTO.TITLE4"),
+ Messages.getString(&