public void TestConstructor()
        {
            EcellParameterData data = new EcellParameterData();
            Assert.IsNotNull(data, "Constructor of type, EcellObservedData failed to create instance.");
            Assert.AreEqual("", data.Key, "Key is unexpected value.");
            Assert.AreEqual(100.0, data.Max, "Max is unexpected value.");
            Assert.AreEqual(0.0d, data.Min, "Min is unexpected value.");
            Assert.AreEqual(0.0d, data.Step, "Step is unexpected value.");
            Assert.AreEqual("Ecell.Objects.EcellParameterData", data.GetType().ToString(), "GetType method returned unexpected value.");
            Assert.IsNotNull(data.ToString(), "ToString method returned unexpected value.");
            Assert.IsNotNull(data.GetHashCode(), "ToString method returned unexpected value.");

            data.Key = "Variable:/S0:Value:MolarConc";
            data.Max = 10;
            data.Min = 1;
            data.Step = 1;

            Assert.AreEqual("Variable:/S0:Value:MolarConc", data.Key, "Key is unexpected value.");
            Assert.AreEqual(10, data.Max, "Max is unexpected value.");
            Assert.AreEqual(1.0d, data.Min, "Min is unexpected value.");
            Assert.AreEqual(1.0d, data.Step, "Step is unexpected value.");
        }
Example #2
0
 /// <summary>
 /// The event sequence when the user remove the data from the list of parameter data.
 /// </summary>
 /// <param name="data">The removed observed data.</param>
 public void RemoveParameterData(EcellParameterData data)
 {
     if (m_parameterList.ContainsKey(data.Key))
         m_parameterList.Remove(data.Key);
     m_env.PluginManager.RemoveParameterData(data);
 }
Example #3
0
 /// <summary>
 /// The event sequence when the user add and change the parameter data.
 /// </summary>
 /// <param name="data">The parameter data.</param>
 public void SetParameterData(EcellParameterData data)
 {
     if (!m_paramList.ContainsKey(data.Key))
         m_paramList.Add(data.Key, null);
     m_bifurcationDialog.SetParameterData(data);
     m_robustDialog.SetParameterData(data);
     m_estimationDialog.SetParameterData(data);
 }
Example #4
0
 /// <summary>
 /// The event sequence when the user remove the data from the list of parameter data.
 /// </summary>
 /// <param name="data">The removed parameter data.</param>
 public void RemoveParameterData(EcellParameterData data)
 {
     m_paramList.Remove(data.Key);
     m_bifurcationDialog.RemoveParameterData(data);
     m_robustDialog.RemoveParameterData(data);
     m_estimationDialog.RemoveParameterData(data);
 }
Example #5
0
 /// <summary>
 /// Notify to change the parameter data to DataManager.
 /// </summary>
 /// <param name="data">the changed parameter data.</param>
 public void NotifyParameterDataChanged(EcellParameterData data)
 {
     DataManager.SetParameterData(data);
 }
Example #6
0
 /// <summary>
 /// The event sequence when the user add and change the parameter data.
 /// </summary>
 /// <param name="data">The parameter data.</param>
 public void SetParameterData(EcellParameterData data)
 {
     foreach (IAnalysis p in m_analysisList)
     {
         p.SetParameterData(data);
     }
 }
        /// <summary>
        /// Set the parameter data.
        /// </summary>
        /// <param name="data">the set parameter data.</param>
        public void SetParameterData(EcellParameterData data)
        {
            foreach (DataGridViewRow r1 in parameterEstimationParameterDataGrid.Rows)
            {
                string fullPN = r1.Cells[paramFullPNColumn.Index].Value.ToString();
                if (fullPN.Equals(data.Key))
                {
                    // max
                    int index = dataGridViewTextBoxColumn2.Index;
                    r1.Cells[index].Value = data.Max;

                    // min
                    index = dataGridViewTextBoxColumn3.Index;
                    r1.Cells[index].Value = data.Min;

                    r1.Tag = data.Copy();
                    return;
                }
            }
            DataGridViewRow r = new DataGridViewRow();
            DataGridViewTextBoxCell c1 = new DataGridViewTextBoxCell();
            c1.Value = data.Key;
            r.Cells.Add(c1);

            DataGridViewTextBoxCell c2 = new DataGridViewTextBoxCell();
            c2.Value = data.Max;
            r.Cells.Add(c2);

            DataGridViewTextBoxCell c3 = new DataGridViewTextBoxCell();
            c3.Value = data.Min;
            r.Cells.Add(c3);

            r.Tag = data.Copy();

            parameterEstimationParameterDataGrid.Rows.Add(r);
        }
Example #8
0
 /// <summary>
 /// Set the parameter data.
 /// </summary>
 /// <param name="fullPN">the FullPN of parameter data.</param>
 /// <param name="max">the max of parameter data.</param>
 /// <param name="min">the min of parameter data.</param>
 /// <param name="step">the step of parameter data.</param>
 public void SetParameterData(string fullPN, double max, double min, double step)
 {
     EcellParameterData d = new EcellParameterData(fullPN, max, min, step);
     DataManager.SetParameterData(d);
 }
 public void TearDown()
 {
     _unitUnderTest = null;
 }
        public void TestEquals()
        {
            EcellParameterData data1 = new EcellParameterData("Variable:/S0:Value:MolarConc", 0.75, 0.25, 0.05);
            EcellParameterData data2 = new EcellParameterData("Variable:/S0:Value1:MolarConc", 0.75, 0.25, 0.05);
            EcellParameterData data3 = new EcellParameterData("Variable:/S0:Value:MolarConc", 20, 0, 0);
            object obj = new object();

            Assert.AreEqual(false, data1.Equals(data2), "Equals method returned unexpected value.");
            Assert.AreEqual(false, data1.Equals(obj), "Equals method returned unexpected value.");
            Assert.AreEqual(true, data1.Equals(data3), "Equals method returned unexpected value.");
        }
 public void SetUp()
 {
     _unitUnderTest = new EcellParameterData();
 }
        public void TestCopy()
        {
            EcellParameterData data = new EcellParameterData();
            EcellParameterData newData = data.Copy();
            Assert.AreEqual(data, newData, "Key is unexpected value.");
            Assert.AreEqual("", newData.Key, "Key is unexpected value.");
            Assert.AreEqual(100.0, newData.Max, "Max is unexpected value.");
            Assert.AreEqual(0.0d, newData.Min, "Min is unexpected value.");
            Assert.AreEqual(0.0d, newData.Step, "Step is unexpected value.");
            Assert.AreEqual("Ecell.Objects.EcellParameterData", newData.GetType().ToString(), "GetType method returned unexpected value.");

            data = new EcellParameterData("Variable:/S0:Value:MolarConc", 10);
            newData = data.Copy();
            Assert.AreEqual(data, newData, "Key is unexpected value.");
            Assert.AreEqual("Variable:/S0:Value:MolarConc", newData.Key, "Key is unexpected value.");
            Assert.AreEqual(15.0, newData.Max, "Max is unexpected value.");
            Assert.AreEqual(5.0d, newData.Min, "Min is unexpected value.");
            Assert.AreEqual(0.0d, newData.Step, "Step is unexpected value.");
            Assert.AreEqual("Ecell.Objects.EcellParameterData", newData.GetType().ToString(), "GetType method returned unexpected value.");
        }
Example #13
0
        public void TestSetParameterData()
        {
            _unitUnderTest.LoadProject(TestConstant.Project_Drosophila);

            string fullPN = "Variable:/CELL/CYTOPLASM:M:Value";
            Assert.IsFalse(_unitUnderTest.IsContainsParameterData(fullPN));

            EcellParameterData parameterData = new EcellParameterData(fullPN, 0.2);
            _unitUnderTest.SetParameterData(parameterData);
            _unitUnderTest.SetParameterData(parameterData);
            Assert.IsTrue(_unitUnderTest.IsContainsParameterData(fullPN));

            Assert.AreEqual(_unitUnderTest.GetParameterData()[0], _unitUnderTest.GetParameterData(fullPN));

            _unitUnderTest.RemoveParameterData(parameterData);
        }
Example #14
0
        public void TestCheckParameterData()
        {
            _unitUnderTest.LoadProject(TestConstant.Project_Drosophila);

            string fullPN = "Variable:/CELL/CYTOPLASM:M:Value";
            Assert.IsFalse(_unitUnderTest.IsContainsObservedData(fullPN));

            EcellObservedData observedData = new EcellObservedData(fullPN, 0.2);
            _unitUnderTest.SetObservedData(observedData);
            EcellParameterData parameterData = new EcellParameterData(fullPN, 0.2);
            _unitUnderTest.SetParameterData(parameterData);

            EcellObject variable = _unitUnderTest.GetEcellObject("Drosophila", "/CELL/CYTOPLASM:M", "Variable");
            variable.Key = "/CELL:M";

            _unitUnderTest.DataChanged("Drosophila", "/CELL/CYTOPLASM:M", "Variable", variable);
        }
Example #15
0
 /// <summary>
 /// The event sequence when the user set and change the prameter data.
 /// </summary>
 /// <param name="data">The observed data.</param>
 public void SetParameterData(EcellParameterData data)
 {
     if (m_parameterList.ContainsKey(data.Key))
     {
         m_parameterList[data.Key] = data;
     }
     else
         m_parameterList.Add(data.Key, data);
     m_env.PluginManager.SetParameterData(data);
 }
Example #16
0
        public void TestParameterData()
        {
            _env.DataManager.LoadProject(TestConstant.Project_Drosophila);
            string path = "Variable:/CELL:SIZE:Value";

            EcellParameterData data = new EcellParameterData(path, 0.1);
            _unitUnderTest.SetParameterData(data);
            _unitUnderTest.RemoveParameterData(data);
        }
Example #17
0
 /// <summary>
 /// Remove the parameter data.
 /// </summary>
 /// <param name="fullPN">the FullPN.</param>
 public void RemoveParameterData(string fullPN)
 {
     EcellParameterData d = new EcellParameterData(fullPN, 0.0);
     DataManager.RemoveParameterData(d);
 }
        /// <summary>
        /// Set the parameter data.
        /// </summary>
        /// <param name="data">the set parameter data.</param>
        public void SetParameterData(EcellParameterData data)
        {
            foreach (DataGridViewRow r1 in robustAnalysisParameterDataGrid.Rows)
            {
                string fullPN = r1.Cells[paramFullPNColumn.Index].Value.ToString();
                if (fullPN.Equals(data.Key))
                {
                    // max
                    int index = dataGridViewTextBoxColumn2.Index;
                    r1.Cells[index].Value = data.Max;

                    // min
                    index = dataGridViewTextBoxColumn3.Index;
                    r1.Cells[index].Value = data.Min;

                    // step
                    index = dataGridViewTextBoxColumn4.Index;
                    r1.Cells[index].Value = data.Step;
                    r1.Tag = data.Copy();

                    return;
                }
            }
            DataGridViewRow r = new DataGridViewRow();
            DataGridViewTextBoxCell c1 = new DataGridViewTextBoxCell();
            c1.Value = data.Key;
            r.Cells.Add(c1);

            DataGridViewTextBoxCell c2 = new DataGridViewTextBoxCell();
            c2.Value = data.Max;
            r.Cells.Add(c2);

            DataGridViewTextBoxCell c3 = new DataGridViewTextBoxCell();
            c3.Value = data.Min;
            r.Cells.Add(c3);

            if (robustAnalysisParameterDataGrid.ColumnCount >= 4)
            {
                DataGridViewTextBoxCell c4 = new DataGridViewTextBoxCell();
                c4.Value = data.Step;
                r.Cells.Add(c4);
            }

            r.Tag = data.Copy();

            robustAnalysisParameterDataGrid.Rows.Add(r);
        }
 /// <summary>
 /// Remove the parameter data.
 /// </summary>
 /// <param name="data">the removed parameter data.</param>
 public void RemoveParameterData(EcellParameterData data)
 {
     foreach (DataGridViewRow r in parameterEstimationParameterDataGrid.Rows)
     {
         string fullPN = r.Cells[paramFullPNColumn.Index].Value.ToString();
         if (fullPN.Equals(data.Key))
         {
             parameterEstimationParameterDataGrid.Rows.Remove(r);
             return;
         }
     }
 }
        /// <summary>
        /// Drop the parameter data on DataGridView of the parameter data.
        /// </summary>
        /// <param name="sender">DataGridView</param>
        /// <param name="e">DragEventArgs</param>
        private void ParamDataDragDrop(object sender, DragEventArgs e)
        {
            object obj = e.Data.GetData("Ecell.Objects.EcellDragObject");
            if (obj == null) return;
            EcellDragObject dobj = obj as EcellDragObject;

            foreach (EcellDragEntry ent in dobj.Entries)
            {
                EcellObject t = m_owner.DataManager.GetEcellObject(dobj.ModelID, ent.Key, ent.Type);
                foreach (EcellData d in t.Value)
                {
                    if (d.EntityPath.Equals(ent.Path))
                    {
                        if (d.Name.Equals(Constants.xpathSize))
                        {
                            EcellSystem sys = t as EcellSystem;
                            string fullID = Constants.xpathVariable + ":" + ent.Key + ":SIZE:Value";
                            EcellParameterData data =
                                new EcellParameterData(fullID, sys.SizeInVolume);
                            m_owner.Environment.DataManager.SetParameterData(data);
                        }
                        else if (d.Settable && d.Value.IsDouble)
                        {
                            EcellParameterData data =
                                new EcellParameterData(d.EntityPath, Double.Parse(d.Value.ToString()));
                            m_owner.Environment.DataManager.SetParameterData(data);
                        }
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Drop the parameter data on DataGridView of the parameter data.
        /// </summary>
        /// <param name="sender">DataGridView</param>
        /// <param name="e">DragEventArgs</param>
        private void ParamDataDragDrop(object sender, DragEventArgs e)
        {
            object obj = e.Data.GetData("Ecell.Objects.EcellDragObject");
            if (obj == null) return;
            EcellDragObject dobj = obj as EcellDragObject;

            foreach (EcellDragEntry ent in dobj.Entries)
            {
                EcellObject t = m_owner.DataManager.GetEcellObject(dobj.ModelID, ent.Key, ent.Type);
                foreach (EcellData d in t.Value)
                {
                    if (d.EntityPath.Equals(ent.Path) && d.Settable && d.Value.IsDouble)
                    {
                        EcellParameterData data =
                            new EcellParameterData(d.EntityPath, Double.Parse(d.Value.ToString()));
                        m_owner.Environment.DataManager.SetParameterData(data);
                        break;
                    }
                }
            }
        }
Example #22
0
        /// <summary>
        /// Set the parameter data properties in the analysis parameter file.
        /// </summary>
        /// <param name="unknowns">the current node</param>
        private void SetUnknownData(XmlNode unknowns)
        {
            foreach (XmlNode node in unknowns.ChildNodes)
            {
                if (!node.Name.Equals(AnalysisParameterConstants.xUnknownData))
                    continue;

                string fullPN = GetElementString(node, AnalysisParameterConstants.xFullPN);
                double max = Double.Parse(GetElementString(node, AnalysisParameterConstants.xMax));
                double min = Double.Parse(GetElementString(node, AnalysisParameterConstants.xMin));
                double step = Double.Parse(GetElementString(node, AnalysisParameterConstants.xStep));

                EcellParameterData p = new EcellParameterData(fullPN, max, min, step);
                m_analysis.ParameterDataList.Add(p);
            }
        }