本文整理汇总了C#中Ecell.Objects.EcellObject.SetEcellDatas方法的典型用法代码示例。如果您正苦于以下问题:C# EcellObject.SetEcellDatas方法的具体用法?C# EcellObject.SetEcellDatas怎么用?C# EcellObject.SetEcellDatas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ecell.Objects.EcellObject
的用法示例。
在下文中一共展示了EcellObject.SetEcellDatas方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataStored4Variable
/// <summary>
/// Stores the "EcellObject" 4 the "Variable".
/// </summary>
/// <param name="simulator">The simulator</param>
/// <param name="ecellObject">The stored "Variable"</param>
/// <param name="initialCondition">The initial condition.</param>
internal static void DataStored4Variable(
WrappedSimulator simulator,
EcellObject ecellObject,
Dictionary<string, double> initialCondition)
{
string fullID = ecellObject.FullID;
IList<string> wrappedPolymorph = simulator.GetEntityPropertyList(fullID);
//
// Checks the stored "EcellData"
//
List<EcellData> variableEcellDataList = 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;
variableEcellDataList.Add(storedEcellData);
}
}
foreach (string name in wrappedPolymorph)
{
string entityPath = fullID + Constants.delimiterColon + name;
PropertyAttributes flag = simulator.GetEntityPropertyAttributes(entityPath);
if (!flag.Gettable)
{
continue;
}
EcellValue value = GetVariableValue(simulator, name, entityPath);
EcellData ecellData = CreateEcellData(name, value, entityPath, flag);
if (ecellData.Value != null)
{
ecellData.Logable = ecellData.Value.IsDouble;
}
if (storedEcellDataDic.ContainsKey(name))
{
ecellData.Logged = storedEcellDataDic[name].Logged;
variableEcellDataList.Remove(storedEcellDataDic[name]);
}
variableEcellDataList.Add(ecellData);
}
ecellObject.SetEcellDatas(variableEcellDataList);
}
示例2: DataStored4Stepper
/// <summary>
/// Stores the "EcellObject" 4 the "Stepper".
/// </summary>
/// <param name="simulator">The simulator</param>
/// <param name="dmm">The "DynamicModuleManager"</param>
/// <param name="ecellObject">The stored "Stepper"</param>
internal static void DataStored4Stepper(
WrappedSimulator simulator,
DMDescriptorKeeper dmm,
EcellObject ecellObject)
{
string key = Constants.xpathStepper + Constants.delimiterColon + Constants.delimiterColon + ecellObject.Key;
List<EcellData> stepperEcellDataList = new List<EcellData>();
IList<string> wrappedPolymorph = null;
//
// Property List
//
try
{
wrappedPolymorph = simulator.GetStepperPropertyList(ecellObject.Key);
}
catch (Exception ex)
{
Trace.WriteLine(ex.StackTrace);
return;
}
//
// Sets the class name.
//
if (string.IsNullOrEmpty(ecellObject.Classname))
{
ecellObject.Classname = simulator.GetStepperClassName(ecellObject.Key);
}
//
// Checks the stored "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;
stepperEcellDataList.Add(storedEcellData);
}
}
//
// Stores the "EcellData"
//
foreach (string name in wrappedPolymorph)
{
string entityPath = key + Constants.delimiterColon + name;
PropertyAttributes flag = simulator.GetStepperPropertyAttributes(ecellObject.Key, name);
if (!flag.Gettable)
{
continue;
}
EcellValue value = null;
try
{
object property = simulator.GetStepperProperty(ecellObject.Key, name);
value = new EcellValue(property);
}
catch (Exception ex)
{
Trace.WriteLine(ex);
value = GetValueFromDMM(dmm, ecellObject.Type, ecellObject.Classname, name);
}
EcellData ecellData = CreateEcellData(name, value, entityPath, flag);
if (storedEcellDataDic.ContainsKey(name))
{
if (value.IsString && value.ToString().Equals(""))
{
continue;
}
else
{
stepperEcellDataList.Remove(storedEcellDataDic[name]);
}
}
stepperEcellDataList.Add(ecellData);
}
ecellObject.SetEcellDatas(stepperEcellDataList);
}
示例3: 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);
}
示例4: DataStored4Process
//.........这里部分代码省略.........
/// <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]);
}
processEcellDataList.Add(ecellData);
}
ecellObject.SetEcellDatas(processEcellDataList);
}