예제 #1
0
        public void TestConstructor()
        {
            EcellObservedData data = new EcellObservedData();
            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, data.Min, "Min is unexpected value.");
            Assert.AreEqual(100.0, data.Differ, "Differ is unexpected value.");
            Assert.AreEqual(0.5, data.Rate, "Rate is unexpected value.");
            Assert.AreEqual("Ecell.Objects.EcellObservedData", 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.Differ = 9;
            data.Rate = 0.8;

            Assert.AreEqual("Variable:/S0:Value:MolarConc", data.Key, "Key is unexpected value.");
            Assert.AreEqual(10, data.Max, "Max is unexpected value.");
            Assert.AreEqual(1.0, data.Min, "Min is unexpected value.");
            Assert.AreEqual(9.0, data.Differ, "Differ is unexpected value.");
            Assert.AreEqual(0.8, data.Rate, "Rate is unexpected value.");
            Assert.IsNotNull(data.GetHashCode(), "ToString method returned unexpected value.");
        }
예제 #2
0
        public void TestCopy()
        {
            EcellObservedData data = new EcellObservedData();
            Assert.IsNotNull(data, "Constructor of type, EcellObservedData failed to create instance.");

            EcellObservedData newData = data.Copy();
            Assert.IsNotNull(newData, "Constructor of type, EcellObservedData failed to create instance.");
            Assert.AreEqual("", newData.Key, "Key is unexpected value.");
            Assert.AreEqual(100.0, newData.Max, "Max is unexpected value.");
            Assert.AreEqual(0, newData.Min, "Min is unexpected value.");
            Assert.AreEqual(100.0, newData.Differ, "Differ is unexpected value.");
            Assert.AreEqual(0.5, newData.Rate, "Rate is unexpected value.");
            Assert.AreEqual("Ecell.Objects.EcellObservedData", newData.GetType().ToString(), "GetType method returned unexpected value.");
            Assert.IsNotNull(newData.ToString(), "ToString method returned unexpected value.");

            data = new EcellObservedData("Variable:/S0:Value:MolarConc", 0.75, 0.25, 0.5, 0.5);
            Assert.IsNotNull(data, "Constructor of type, EcellObservedData failed to create instance.");

            newData = data.Copy();
            Assert.IsNotNull(newData, "Constructor of type, EcellObservedData failed to create instance.");
            Assert.AreEqual("Variable:/S0:Value:MolarConc", newData.Key, "Key is unexpected value.");
            Assert.AreEqual(0.75d, newData.Max, "Max is unexpected value.");
            Assert.AreEqual(0.25d, newData.Min, "Min is unexpected value.");
            Assert.AreEqual(0.5d, newData.Differ, "Differ is unexpected value.");
            Assert.AreEqual(0.5d, newData.Rate, "Rate is unexpected value.");
            Assert.AreEqual("Ecell.Objects.EcellObservedData", newData.GetType().ToString(), "GetType method returned unexpected value.");
            Assert.IsNotNull(newData.ToString(), "ToString method returned unexpected value.");
        }
예제 #3
0
 /// <summary>
 /// Set the observed data.
 /// </summary>
 /// <param name="fullPN">the FullPN of observed data.</param>
 /// <param name="max">the max of observed data.</param>
 /// <param name="min">the min of observed data.</param>
 /// <param name="differ">the differ of observed data.</param>
 /// <param name="rate">the rate of observed data.</param>
 public void SetObservedData(string fullPN, double max, double min, 
     double differ, double rate)
 {
     EcellObservedData d = new EcellObservedData(fullPN, max, min, differ, rate);
     DataManager.SetObservedData(d);
 }
예제 #4
0
 /// <summary>
 /// Remove the observed data.
 /// </summary>
 /// <param name="fullPN">the FullPN.</param>
 public void RemoveObservedData(string fullPN)
 {
     EcellObservedData d = new EcellObservedData(fullPN, 0.0);
     DataManager.RemoveObservedData(d);
 }
예제 #5
0
 /// <summary>
 /// The event sequence when the user set and change the observed data.
 /// </summary>
 /// <param name="data">The observed data.</param>
 public void SetObservedData(EcellObservedData data)
 {
     if (m_observedList.ContainsKey(data.Key))
     {
         m_observedList[data.Key] = data;
     }
     else
         m_observedList.Add(data.Key, data);
     m_env.PluginManager.SetObservedData(data);
 }
예제 #6
0
 /// <summary>
 /// The event sequence when the user remove the data from the list of observed data.
 /// </summary>
 /// <param name="data">The removed observed data.</param>
 public void RemoveObservedData(EcellObservedData data)
 {
     if (m_observedList.ContainsKey(data.Key))
         m_observedList.Remove(data.Key);
     m_env.PluginManager.RemoveObservedData(data);
 }
예제 #7
0
 /// <summary>
 /// The event sequence when the user set and change the observed data.
 /// </summary>
 /// <param name="data">The observed data.</param>
 public void SetObservedData(EcellObservedData data)
 {
     foreach (IAnalysis p in m_analysisList)
     {
         p.SetObservedData(data);
     }
 }
예제 #8
0
 public void TearDown()
 {
     _unitUnderTest = null;
 }
예제 #9
0
 /// <summary>
 /// Notify to change the observed data to DataManager.
 /// </summary>
 /// <param name="data">the changed observed data.</param>
 public void NotifyObservedDataChanged(EcellObservedData data)
 {
     DataManager.SetObservedData(data);
 }
예제 #10
0
        /// <summary>
        /// Enter the drag object on DataGridView of the observed data.
        /// </summary>
        /// <param name="sender">DataGridView.</param>
        /// <param name="e">DragEventArgs</param>
        private void ObservedDragDrop(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.Logable && d.Value.IsDouble)
                    {
                        EcellObservedData data =
                            new EcellObservedData(d.EntityPath, Double.Parse(d.Value.ToString()));
                        m_owner.Environment.DataManager.SetObservedData(data);
                        break;
                    }
                }
            }
        }
예제 #11
0
        /// <summary>
        /// Set the observed data.
        /// </summary>
        /// <param name="data">the set observed data.</param>
        public void SetObservedData(EcellObservedData data)
        {
            foreach (DataGridViewRow r1 in bifurcationObservedDataGrid.Rows)
            {
                string fullPN = r1.Cells[observedFullPNColumn.Index].Value.ToString();
                if (fullPN.Equals(data.Key))
                {
                    // max
                    int index = dataGridViewTextBoxColumn6.Index;
                    r1.Cells[index].Value = data.Max;

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

                    // differ
                    index = dataGridViewTextBoxColumn8.Index;
                    r1.Cells[index].Value = data.Differ;

                    // rate
                    index = dataGridViewTextBoxColumn9.Index;
                    r1.Cells[index].Value = data.Rate;

                    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);

            DataGridViewTextBoxCell c4 = new DataGridViewTextBoxCell();
            c4.Value = data.Differ;
            r.Cells.Add(c4);

            DataGridViewTextBoxCell c5 = new DataGridViewTextBoxCell();
            c5.Value = data.Rate;
            r.Cells.Add(c5);

            r.Tag = data.Copy();
            bifurcationObservedDataGrid.Rows.Add(r);
        }
예제 #12
0
 /// <summary>
 /// Remove the observed data.
 /// </summary>
 /// <param name="data">the removed observed data.</param>
 public void RemoveObservedData(EcellObservedData data)
 {
     foreach (DataGridViewRow r in bifurcationObservedDataGrid.Rows)
     {
         string fullPN = r.Cells[observedFullPNColumn.Index].Value.ToString();
         if (fullPN.Equals(data.Key))
         {
             bifurcationObservedDataGrid.Rows.Remove(r);
             return;
         }
     }
 }
예제 #13
0
        public void TestObservedData()
        {
            _env.DataManager.LoadProject(TestConstant.Project_Drosophila);
            string path = "Variable:/CELL:SIZE:Value";

            EcellObservedData data = new EcellObservedData(path, 0.1);
            _unitUnderTest.SetObservedData(data);
            _unitUnderTest.RemoveObservedData(data);
        }
예제 #14
0
        public void TestSetObservedData()
        {
            _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);
            _unitUnderTest.SetObservedData(observedData);
            Assert.IsTrue(_unitUnderTest.IsContainsObservedData(fullPN));

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

            _unitUnderTest.RemoveObservedData(observedData);
        }
예제 #15
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);
        }
예제 #16
0
        public void TestEquals()
        {
            EcellObservedData data1 = new EcellObservedData("Variable:/S0:Value:MolarConc", 0.75, 0.25, 0.5, 0.5);
            EcellObservedData data2 = new EcellObservedData("Variable:/S0:Value1:MolarConc", 0.75, 0.25, 0.5, 0.5);
            EcellObservedData data3 = new EcellObservedData("Variable:/S0:Value:MolarConc", 20, 0, 20, 0.8);
            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.");
        }
예제 #17
0
 public void SetUp()
 {
     _unitUnderTest = new EcellObservedData();
 }
예제 #18
0
 /// <summary>
 /// The event sequence when the user remove the data from the list of observed data.
 /// </summary>
 /// <param name="data">The removed observed data.</param>
 public void RemoveObservedData(EcellObservedData data)
 {
     m_observedList.Remove(data.Key);
     m_bifurcationDialog.RemoveObservedData(data);
     m_robustDialog.RemoveObservedData(data);
 }
예제 #19
0
 /// <summary>
 /// The event sequence when the user set and change the observed data.
 /// </summary>
 /// <param name="data">The observed data.</param>
 public void SetObservedData(EcellObservedData data)
 {
     if (!m_observedList.ContainsKey(data.Key))
         m_observedList.Add(data.Key, null);
     m_bifurcationDialog.SetObservedData(data);
     m_robustDialog.SetObservedData(data);
 }
예제 #20
0
        /// <summary>
        /// Set the observed data properties in the analysis parameter file.
        /// </summary>
        /// <param name="observers">thec current node.</param>
        private void SetObservedData(XmlNode observers)
        {
            foreach (XmlNode node in observers.ChildNodes)
            {
                if (!node.Name.Equals(AnalysisParameterConstants.xObservedData))
                    continue;

                string fullPN = GetElementString(node, AnalysisParameterConstants.xFullPN);
                double max = Double.Parse(GetElementString(node, AnalysisParameterConstants.xMax));
                double min = Double.Parse(GetElementString(node, AnalysisParameterConstants.xMin));
                double differ = Double.Parse(GetElementString(node, AnalysisParameterConstants.xDiffer));
                double rate = Double.Parse(GetElementString(node, AnalysisParameterConstants.xRate));

                EcellObservedData o = new EcellObservedData(fullPN, max, min, differ, rate);
                m_analysis.ObservedDataList.Add(o);
            }
        }