本文整理汇总了C#中Ecell.Objects.EcellObject类的典型用法代码示例。如果您正苦于以下问题:C# EcellObject类的具体用法?C# EcellObject怎么用?C# EcellObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EcellObject类属于Ecell.Objects命名空间,在下文中一共展示了EcellObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeStepperAction
/// <summary>
/// The constructor for UpdateStepperAction with initial parameters.
/// </summary>
/// <param name="newID">The updated stepper ID.</param>
/// <param name="orgID">The original stepper ID.</param>
/// <param name="newStepper">The updated stepper.</param>
/// <param name="oldStepper">The old stepper.</param>
public ChangeStepperAction(string newID, string orgID, EcellObject newStepper, EcellObject oldStepper)
{
m_newID = newID;
m_orgID = orgID;
m_newStepper = newStepper;
m_oldStepper = oldStepper;
}
示例2: DataStored
/// <summary>
/// Stores the "EcellObject"
/// </summary>
/// <param name="simulator">The "simulator"</param>
/// <param name="dmm">The "DMDescriptorKeeper"</param>
/// <param name="ecellObject">The stored "EcellObject"</param>
/// <param name="initialCondition">The initial condition.</param>
internal static void DataStored(
WrappedSimulator simulator,
DMDescriptorKeeper dmm,
EcellObject ecellObject,
Dictionary<string, double> initialCondition)
{
if (ecellObject.Type.Equals(Constants.xpathStepper))
{
DataStored4Stepper(simulator, dmm, ecellObject);
}
else if (ecellObject.Type.Equals(Constants.xpathSystem))
{
DataStored4System(
simulator,
ecellObject,
initialCondition);
}
else if (ecellObject.Type.Equals(Constants.xpathProcess))
{
DataStored4Process(
simulator,
dmm,
ecellObject,
initialCondition);
}
else if (ecellObject.Type.Equals(Constants.xpathVariable))
{
DataStored4Variable(
simulator,
ecellObject,
initialCondition);
}
//
// 4 children
//
if (ecellObject.Children != null)
{
foreach (EcellObject childEcellObject in ecellObject.Children)
DataStored(simulator, dmm, childEcellObject, initialCondition);
}
}
示例3: AddSystem
/// <summary>
/// Add System to this project.
/// </summary>
/// <param name="system">the system object.</param>
public void AddSystem(EcellObject system)
{
m_systemDic[system.ModelID].Add(system);
}
示例4: DataStored4System
/// <summary>
/// Stores the "EcellObject" 4 the "System".
/// </summary>
/// <param name="simulator">The simulator</param>
/// <param name="ecellObject">The stored "System"</param>
/// <param name="initialCondition">The initial condition.</param>
internal static void DataStored4System(
WrappedSimulator simulator,
EcellObject ecellObject,
Dictionary<string, double> initialCondition)
{
// Creates an entityPath.
string parentPath = ecellObject.ParentSystemID;
string childPath = ecellObject.LocalID;
string key = Constants.xpathSystem + Constants.delimiterColon +
parentPath + Constants.delimiterColon +
childPath;
// Property List
IList<string> wrappedPolymorph = simulator.GetEntityPropertyList(key);
//
// Checks the stored "EcellData"
//
List<EcellData> systemEcellDataList = new List<EcellData>();
Dictionary<string, EcellData> storedEcellDataDic
= new Dictionary<string, EcellData>();
if (ecellObject.Value != null && ecellObject.Value.Count > 0)
{
foreach (EcellData storedEcellData in ecellObject.Value)
{
storedEcellDataDic[storedEcellData.Name] = storedEcellData;
systemEcellDataList.Add(storedEcellData);
}
}
foreach (string name in wrappedPolymorph)
{
string entityPath = key + Constants.delimiterColon + name;
PropertyAttributes flag = simulator.GetEntityPropertyAttributes(entityPath);
if (!flag.Gettable)
{
continue;
}
object value = null;
if (name.Equals(Constants.xpathSize))
{
value = new EcellValue(EcellSystem.DefaultSize);
}
else
{
try
{
value = new EcellValue(simulator.GetEntityProperty(entityPath));
}
catch (WrappedException ex)
{
Trace.WriteLine(ex);
if (storedEcellDataDic.ContainsKey(name))
{
IEnumerable val = storedEcellDataDic[name].Value as IEnumerable;
object firstItem = null;
{
IEnumerator i = val.GetEnumerator();
if (i.MoveNext())
firstItem = i.Current;
}
if (firstItem is IEnumerable)
{
value = val;
}
else
{
value = firstItem;
}
}
else
{
value = "";
}
}
}
EcellData ecellData = CreateEcellData(name, new EcellValue(value), entityPath, flag);
if (ecellData.Value != null)
{
ecellData.Logable = ecellData.Value.IsDouble;
}
if (storedEcellDataDic.ContainsKey(name))
{
ecellData.Logged = storedEcellDataDic[name].Logged;
systemEcellDataList.Remove(storedEcellDataDic[name]);
}
systemEcellDataList.Add(ecellData);
}
ecellObject.SetEcellDatas(systemEcellDataList);
}
示例5: DataStored4Process
/// <summary>
/// Stores the "EcellObject" 4 the "Process".
/// </summary>
/// <param name="simulator">The simulator</param>
/// <param name="dmm">The "DMDescriptorKeeper"</param>
/// <param name="ecellObject">The stored "Process"</param>
/// <param name="initialCondition">The initial condition.</param>
internal static void DataStored4Process(
WrappedSimulator simulator,
DMDescriptorKeeper dmm,
EcellObject ecellObject,
Dictionary<string, double> initialCondition)
{
string key = ecellObject.FullID;
IList<string> wrappedPolymorph = null;
try
{
wrappedPolymorph = simulator.GetEntityPropertyList(key);
}
catch (Exception ex)
{
Trace.WriteLine(ex);
return;
}
//
// Checks the stored "EcellData"
//
List<EcellData> processEcellDataList = new List<EcellData>();
Dictionary<string, EcellData> storedEcellDataDic = new Dictionary<string, EcellData>();
if (ecellObject.Value != null && ecellObject.Value.Count > 0)
{
foreach (EcellData storedEcellData in ecellObject.Value)
{
storedEcellDataDic[storedEcellData.Name] = storedEcellData;
processEcellDataList.Add(storedEcellData);
}
}
//
// Stores the "EcellData"
//
foreach (string name in wrappedPolymorph)
{
string entityPath = Util.BuildFullPN(key, name);
PropertyAttributes flag = simulator.GetEntityPropertyAttributes(entityPath);
if (!flag.Gettable)
{
continue;
}
EcellValue value = null;
if (name == Constants.xpathVRL)
{
// Won't restore the variable reference list from the simulator's corresponding
// object.
if (storedEcellDataDic.ContainsKey(name))
value = storedEcellDataDic[name].Value;
else
value = new EcellValue(new List<object>());
}
else if (name == Constants.xpathActivity || name == Constants.xpathMolarActivity)
{
value = new EcellValue(0.0);
}
else
{
try
{
value = new EcellValue(simulator.GetEntityProperty(entityPath));
if (dmm.ContainsDescriptor(ecellObject.Type, ecellObject.Classname))
{
DMDescriptor desc = dmm.GetDMDescriptor(ecellObject.Type, ecellObject.Classname);
if (desc.ContainsProperty(name))
{
PropertyDescriptor prop = desc[name];
if (prop.DefaultValue.Type == EcellValueType.List && !value.IsList)
value = new EcellValue(new List<EcellValue>());
}
}
}
catch (Exception ex)
{
Trace.WriteLine(ex);
value = GetValueFromDMM(dmm, ecellObject.Type, ecellObject.Classname, name);
}
}
EcellData ecellData = CreateEcellData(name, value, entityPath, flag);
if (ecellData.Value != null)
{
ecellData.Logable = ecellData.Value.IsDouble &&
(ecellData.Settable == false || ecellData.Saveable == false);
}
if (storedEcellDataDic.ContainsKey(name))
{
ecellData.Logged = storedEcellDataDic[name].Logged;
processEcellDataList.Remove(storedEcellDataDic[name]);
//.........这里部分代码省略.........
示例6: DataChanged
/// <summary>
/// The event sequence on changing value of data at other plugin.
/// </summary>
/// <param name="modelID">The model ID before value change.</param>
/// <param name="key">The ID before value change.</param>
/// <param name="type">The data type before value change.</param>
/// <param name="data">Changed value of object.</param>
public void DataChanged(string modelID, string key, string type, EcellObject data)
{
if (m_current == null)
return;
if (m_isChanging)
{
if (m_current.Key == key)
{
m_current = data;
UpdateProperties();
}
return;
}
if (m_current.ModelID == modelID && m_current.Key == key && m_current.Type == type)
{
m_current = data;
ReloadProperties();
}
}
示例7: ChangeStatus
/// <summary>
/// When change system status, change menu enable/disable.
/// </summary>
/// <param name="type">System status.</param>
public void ChangeStatus(ProjectStatus type)
{
if (type == ProjectStatus.Running)
{
m_dgv.ReadOnly = true;
// m_dgv.Enabled = false;
m_time.Enabled = true;
m_time.Start();
}
else if (type == ProjectStatus.Suspended)
{
m_dgv.ReadOnly = false;
// m_dgv.Enabled = true;
m_time.Enabled = false;
m_time.Stop();
try
{
UpdatePropForSimulation();
ResetReadOnly();
}
catch (Exception)
{
// ���̃v���O�C���Ńf�[�^��ҏW������
// �V�~�����[�V�������ُ�I���������f�[�^��擾�ł��Ȃ��������߁B
// ���̃v���O�C���ŃG���[���b�Z�[�W���\�������̂�
// �����ł͏o���Ȃ��悤�ɂ���B
}
}
else if (type == ProjectStatus.Loaded)
{
// m_dgv.Enabled = true;
m_dgv.ReadOnly = false;
if (m_status == ProjectStatus.Running || m_status == ProjectStatus.Suspended || m_status == ProjectStatus.Stepping)
{
m_time.Enabled = false;
m_time.Stop();
if (m_current != null)
m_current = m_env.DataManager.GetEcellObject(m_current.ModelID, m_current.Key, m_current.Type);
ResetProperty();
ResetReadOnly();
}
}
else if (type == ProjectStatus.Uninitialized)
{
m_dgv.ReadOnly = true;
// m_dgv.Enabled = false;
}
else if (type == ProjectStatus.Stepping)
{
m_dgv.ReadOnly = false;
// m_dgv.Enabled = true;
try
{
UpdatePropForSimulation();
ResetReadOnly();
}
catch (Exception)
{
// ���̃v���O�C���Ńf�[�^��ҏW������
// �V�~�����[�V�������ُ�I���������f�[�^��擾�ł��Ȃ��������߁B
// ���̃v���O�C���ŃG���[���b�Z�[�W���\�������̂�
// �����ł͏o���Ȃ��悤�ɂ���B
}
}
m_status = type;
m_dgv.ReadOnly = false;
}
示例8: 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();
}
示例9: DataAdd
/// <summary>
/// Add the object.
/// </summary>
/// <param name="data">the added object.</param>
public override void DataAdd(EcellObject data)
{
m_editCount++;
}
示例10: ObjectPropertyReport
/// <summary>
/// Constructor with the initial parameters.
/// </summary>
/// <param name="type">the type of message.</param>
/// <param name="message">the message string.</param>
/// <param name="group">the group string.</param>
/// <param name="obj">the object of message.</param>
/// <param name="propertyName">the proerty name.</param>
public ObjectPropertyReport(MessageType type, string message,
string group, EcellObject obj, string propertyName)
: base(type, message, group, obj)
{
m_propName = propertyName;
}
示例11: AddIntoDictionary
private void AddIntoDictionary(SortedDictionary<float, List<EcellObject>> dict,
float posValue,
EcellObject node)
{
if (dict == null)
return;
if (dict.ContainsKey(posValue))
dict[posValue].Add(node);
else
{
List<EcellObject> newDict = new List<EcellObject>();
newDict.Add(node);
dict.Add(posValue, newDict);
}
}
示例12: SetInitialCondition
/// <summary>
/// Set initial condition of new object.
/// </summary>
/// <param name="newobj">the new object.</param>
public void SetInitialCondition(EcellObject newobj)
{
EcellObject defaultObj = GetEcellObject(newobj.ModelID,
newobj.Type, newobj.Key, true);
foreach (EcellData newData in newobj.Value)
{
EcellData defaultData = defaultObj.GetEcellData(newData.Name);
if (defaultData == null)
continue;
defaultData.Logged = newData.Logged;
if (!newData.Settable || (newData.Value == null || (!newData.Value.IsDouble && !newData.Value.IsInt)))
{
defaultObj.RemoveEcellValue(newData.Name);
defaultObj.Value.Add(newData);
continue;
}
double newProp = Convert.ToDouble(newData.Value.Value.ToString());
double defaultProp = Convert.ToDouble(defaultData.Value.Value.ToString());
if (newProp != defaultProp)
{
InitialCondition[Info.SimulationParam][newobj.ModelID][newData.EntityPath] = newProp;
}
else
{
InitialCondition[Info.SimulationParam][newobj.ModelID].Remove(newData.EntityPath);
}
}
defaultObj.Layout = newobj.Layout.Clone();
}
示例13: DeleteSystem
/// <summary>
/// Delete System.
/// </summary>
/// <param name="system">the system object.</param>
public void DeleteSystem(EcellObject system)
{
string type, ekey, param;
m_systemDic[system.ModelID].Remove(system);
// Delete Simulation parameter.
foreach (string keyParamID in m_initialCondition.Keys)
{
foreach (string delModel in m_initialCondition[keyParamID].Keys)
{
Debug.Assert(system.Type == Constants.xpathSystem);
string delKey = system.Key;
List<String> delKeyList = new List<string>();
foreach (string entKey in m_initialCondition[keyParamID][delModel].Keys)
{
Util.ParseFullPN(entKey, out type, out ekey, out param);
if (ekey.Equals(delKey) || ekey.StartsWith(delKey + "/") || ekey.StartsWith(delKey + ":"))
delKeyList.Add(entKey);
}
foreach (string entKey in delKeyList)
{
m_initialCondition[keyParamID][delModel].Remove(entKey);
}
}
}
}
示例14: DeleteInitialCondition
/// <summary>
/// Delete the initial condition of object.
/// </summary>
/// <param name="obj">the deleted object.</param>
public void DeleteInitialCondition(EcellObject obj)
{
string modelID = obj.ModelID;
foreach (String simParam in InitialCondition.Keys)
{
foreach (EcellData d in obj.Value)
{
if (InitialCondition[simParam][modelID].ContainsKey(d.EntityPath))
InitialCondition[simParam][modelID].Remove(d.EntityPath);
}
}
}
示例15: DeleteEntity
/// <summary>
/// Delete Entity.
/// </summary>
/// <param name="entity">the entity object.</param>
public void DeleteEntity(EcellObject entity)
{
// set param
string model = entity.ModelID;
string key = entity.Key;
string sysKey = entity.ParentSystemID;
string type = entity.Type;
// delete entity
foreach (EcellObject system in m_systemDic[entity.ModelID])
{
if (!system.Key.Equals(sysKey))
continue;
foreach (EcellObject child in system.Children)
{
if (!child.Key.Equals(key) || !child.Type.Equals(type))
continue;
system.Children.Remove(child);
break;
}
}
// Delete Simulation parameter.
foreach (string keyParameterID in m_initialCondition.Keys)
{
Dictionary<string, double> condition = m_initialCondition[keyParameterID][model];
foreach (EcellData data in entity.Value)
{
if (!data.Settable)
continue;
if (!condition.ContainsKey(data.EntityPath))
continue;
condition.Remove(data.EntityPath);
}
}
}