当前位置: 首页>>代码示例>>C#>>正文


C# EcellObject.Clone方法代码示例

本文整理汇总了C#中Ecell.Objects.EcellObject.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# EcellObject.Clone方法的具体用法?C# EcellObject.Clone怎么用?C# EcellObject.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Ecell.Objects.EcellObject的用法示例。


在下文中一共展示了EcellObject.Clone方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DataChangeAction

 /// <summary>
 /// The constructor for DataChangeAction with initial parameters.
 /// </summary>
 /// <param name="paramID">A parameter ID.</param>
 /// <param name="oldObj">An object before changing.</param>
 /// <param name="newObj">An object after changing.</param>
 public DataChangeAction(string paramID, EcellObject oldObj, EcellObject newObj)
 {
     m_paramID = paramID;
     m_oldObj = oldObj.Clone();
     m_newObj = newObj.Clone();
 }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:12,代码来源:DataChangeAction.cs

示例2: DataChanged4System

        /// <summary>
        /// Changes the "System".
        /// </summary>
        /// <param name="modelID">The model ID</param>
        /// <param name="key">The key</param>
        /// <param name="type">The type</param>
        /// <param name="ecellObject">The changed "System"</param>
        /// <param name="isRecorded">Whether this action is recorded or not</param>
        /// <param name="isAnchor">Whether this action is an anchor or not</param>
        private void DataChanged4System(string modelID, string key, string type, EcellObject ecellObject, bool isRecorded, bool isAnchor)
        {
            m_currentProject.SortSystems();
            List<EcellObject> systemList = m_currentProject.SystemDic[modelID];

            string paramId = m_currentProject.Info.SimulationParam;
            if (Constants.defaultSimParam.Equals(paramId))
                paramId = null;

            // When system path is not modified.
            if (modelID.Equals(ecellObject.ModelID) && key.Equals(ecellObject.Key))
            {
                // Changes some properties.
                for (int i = 0; i < systemList.Count; i++)
                {
                    if (!systemList[i].Key.Equals(key))
                        continue;

                    CheckDifferences(systemList[i], ecellObject, paramId);

                    if (m_currentProject.Info.SimulationParam.Equals(Constants.defaultSimParam))
                    {
                        systemList[i] = ecellObject.Clone();
                    }
                    else
                    {
                        m_currentProject.DeleteInitialCondition(systemList[i]);
                        m_currentProject.SetInitialCondition(ecellObject);
                    }

                    m_env.PluginManager.DataChanged(modelID, key, type, ecellObject);
                    return;
                }
            }

            // Check Root
            if (key == Constants.delimiterPath)
                throw new EcellException(MessageResources.ErrChangeRoot);

            // Changes the object.
            Dictionary<string, string> variableKeyDic = new Dictionary<string, string>();
            Dictionary<string, string> oldKeyDic = new Dictionary<string, string>();
            List<EcellObject> tempList = new List<EcellObject>();
            tempList.AddRange(systemList);
            foreach (EcellObject system in tempList)
            {
                if (!system.Key.Equals(key) && !system.Key.StartsWith(key + Constants.delimiterPath))
                    continue;

                // Adds the new "System" object.
                string newKey = ecellObject.Key + system.Key.Substring(key.Length);
            //                oldKeyDic.Add(newKey, system.Key);
                EcellSystem newSystem
                    = (EcellSystem)EcellObject.CreateObject(modelID, newKey, system.Type, system.Classname, system.Value);
                if (newSystem.Key == ecellObject.Key)
                    newSystem.SetPosition(ecellObject);
                else
                    newSystem.SetPosition(system);
                CheckEntityPath(newSystem);
                CheckDifferences(system, newSystem, paramId);
                CheckParameterObservedData(system, newSystem.Key);
                m_currentProject.AddSystem(newSystem);
                m_currentProject.DeleteSystem(system);

                // Change Child
                foreach (EcellObject child in system.Children)
                {
                    EcellObject copy = child.Clone();
                    copy.ParentSystemID = newKey;
                    CheckEntityPath(copy);
                    m_currentProject.AddEntity(copy);
                    CheckParameterObservedData(child, copy.Key);
                    CheckLogger(child, copy.Key);

            //                    oldKeyDic.Add(copy.Key, child.Key);
                    if (copy.Type.Equals(Constants.xpathVariable))
                        variableKeyDic.Add(child.Key, copy.Key);
                }
            }

            ecellObject = m_currentProject.GetEcellObject(modelID, Constants.xpathSystem, ecellObject.Key, false);
            m_env.PluginManager.DataChanged(modelID, key, ecellObject.Type, ecellObject);
            // Checks all processes.
            m_currentProject.SortSystems();
            List<EcellObject> processList = CheckVariableReferenceChanges(variableKeyDic);
            DataChanged(processList, true, false);
        }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:96,代码来源:DataManager.cs

示例3: DataChanged4Entity

        /// <summary>
        /// Changes the "Variable" or the "Process".
        /// </summary>
        /// <param name="modelID">The model ID</param>
        /// <param name="key">The key</param>
        /// <param name="type">The type</param>
        /// <param name="ecellObject">The changed "Variable" or the "Process"</param>
        /// <param name="isRecorded">Whether this action is recorded or not</param>
        /// <param name="isAnchor">Whether this action is an anchor or not</param>
        private void DataChanged4Entity(
            string modelID, string key, string type, EcellObject ecellObject, bool isRecorded, bool isAnchor)
        {
            // Get changed node.
            EcellObject oldNode = m_currentProject.GetEcellObject(modelID, type, key, false);
            Debug.Assert(oldNode != null);

            string paramId = m_currentProject.Info.SimulationParam;
            if (Constants.defaultSimParam.Equals(paramId))
                paramId = null;

            CheckDifferences(oldNode, ecellObject, paramId);
            if (key.Equals(ecellObject.Key))
            {
                if (m_currentProject.Info.SimulationParam.Equals(Constants.defaultSimParam) ||
                    !oldNode.Classname.Equals(ecellObject.Classname) || oldNode.Value.Count != ecellObject.Value.Count)
                {
                    EcellObject oldSystem = m_currentProject.GetEcellObject(modelID, Constants.xpathSystem, Util.GetSuperSystemPath(key), true);
                    Debug.Assert(oldSystem != null);
                    oldSystem.Children.Remove(oldNode);
                    oldSystem.Children.Add(ecellObject);
                }
                else
                {
                    m_currentProject.DeleteInitialCondition(oldNode);
                    m_currentProject.SetInitialCondition(ecellObject);
                }
                m_env.PluginManager.DataChanged(modelID, key, type, ecellObject);
                return;
            }

            // Get parent system.
            // Add new object.
            DataAdd4Entity(ecellObject.Clone(), false);
            m_currentProject.UpdateInitialCondition(oldNode, ecellObject);
            m_env.PluginManager.DataChanged(modelID, key, type, ecellObject);
            if (type.Equals(Constants.xpathVariable))
            {
                List<EcellObject> list = CheckVariableReferenceChanges(key, ecellObject.Key);
                DataChanged(list, false, false);
            }
            // Deletes the old object.
            DataDelete4Node(modelID, key, type, false, true, false);
            return;
        }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:54,代码来源:DataManager.cs

示例4: DataAdd4Entity

        /// <summary>
        /// Adds the "Process" or the "Variable".
        /// </summary>
        /// <param name="entity">The "Variable"</param>
        /// <param name="messageFlag">The flag of the messages</param>
        private void DataAdd4Entity(EcellObject entity, bool messageFlag)
        {
            string modelID = entity.ModelID;
            string key = entity.Key;
            string type = entity.Type;
            string systemKey = entity.ParentSystemID;

            Dictionary<string, List<EcellObject>> sysDic = m_currentProject.SystemDic;

            // Check Stepper
            if (entity is EcellProcess)
            {
                EcellProcess process = (EcellProcess)entity;
                string stepperID = process.StepperID;
                EcellObject stepper = null;
                foreach (EcellObject s in GetStepper(modelID))
                {
                    if (s.Key.Equals(stepperID))
                        stepper = s;
                }
                if (stepper == null)
                    process.StepperID = GetStepper(entity.ModelID)[0].Key;
            }

            // Add object.
            bool findFlag = false;
            foreach (EcellObject system in sysDic[modelID])
            {
                if (!system.ModelID.Equals(modelID) || !system.Key.Equals(systemKey))
                    continue;
                // Check duplicated object.
                foreach (EcellObject child in system.Children)
                {
                    if (!child.Key.Equals(key) || !child.Type.Equals(type))
                        continue;
                    throw new EcellException(
                        string.Format(
                            MessageResources.ErrExistObj,
                            new object[] { key }
                        )
                    );
                }
                // Set object.
                CheckEntityPath(entity);
                system.Children.Add(entity.Clone());
                SetLogger(entity);

                findFlag = true;
                break;
            }

            if (messageFlag)
            {
                MessageCreateEntity(type, string.Format(MessageResources.InfoAdd,
                    new object[] { type, entity.Key }));
            }
            Debug.Assert(findFlag);
        }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:63,代码来源:DataManager.cs

示例5: DataDeleteAction

 /// <summary>
 /// The constructor for DataDeleteAction with initial parameters.
 /// </summary>
 /// <param name="obj">deleted object.</param>
 public DataDeleteAction(EcellObject obj)
 {
     m_obj = obj.Clone();
 }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:8,代码来源:DataDeleteAction.cs

示例6: DataAddAction

 /// <summary>
 /// The constructor for DataAddAction with initial parameters.
 /// </summary>
 /// <param name="obj">the added object</param>
 /// <param name="isUndoable">The flag the action is undoable.</param>
 public DataAddAction(EcellObject obj, bool isUndoable)
 {
     m_obj = obj.Clone();
     m_obj.IsLayouted = true;
     m_isUndoable = isUndoable;
 }
开发者ID:ecell,项目名称:ecell3-ide,代码行数:11,代码来源:DataAddAction.cs


注:本文中的Ecell.Objects.EcellObject.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。