本文整理汇总了C#中DataStore.GetData方法的典型用法代码示例。如果您正苦于以下问题:C# DataStore.GetData方法的具体用法?C# DataStore.GetData怎么用?C# DataStore.GetData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataStore
的用法示例。
在下文中一共展示了DataStore.GetData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
/// <summary>
/// The main run method called to fill tables in the specified DataStore.
/// </summary>
/// <param name="dataStore">The DataStore to work with</param>
public void Run(DataStore dataStore)
{
dataStore.DeleteTable(this.Name);
DataTable statsData = new DataTable();
statsData.Columns.Add("SimulationName", typeof(string));
statsData.Columns.Add("VariableName", typeof(string));
statsData.Columns.Add("n", typeof(string));
statsData.Columns.Add("residual", typeof(double));
statsData.Columns.Add("R^2", typeof(double));
statsData.Columns.Add("RMSD", typeof(double));
statsData.Columns.Add("%", typeof(double));
statsData.Columns.Add("MSD", typeof(double));
statsData.Columns.Add("SB", typeof(double));
statsData.Columns.Add("SDSD", typeof(double));
statsData.Columns.Add("LCS", typeof(double));
DataTable simulationData = dataStore.GetData("*", this.TableName);
if (simulationData != null)
{
DataView view = new DataView(simulationData);
string[] columnNames = DataTableUtilities.GetColumnNames(simulationData);
foreach (string observedColumnName in columnNames)
{
if (observedColumnName.StartsWith("Observed."))
{
string predictedColumnName = observedColumnName.Replace("Observed.", "Predicted.");
if (simulationData.Columns.Contains(predictedColumnName))
{
DataColumn predictedColumn = simulationData.Columns[predictedColumnName];
DataColumn observedColumn = simulationData.Columns[observedColumnName];
if (predictedColumn.DataType == typeof(double) &&
observedColumn.DataType == typeof(double))
{
// Calculate stats for each simulation and store them in a rows in our stats table.
string[] simulationNames = dataStore.SimulationNames;
foreach (string simulationName in simulationNames)
{
string seriesName = simulationName;
view.RowFilter = "SimName = '" + simulationName + "'";
CalcStatsRow(view, observedColumnName, predictedColumnName, seriesName, statsData);
}
// Calculate stats for all simulations and store in a row of the stats table.
string overallSeriesName = "Combined " + observedColumnName.Replace("Observed.", "");
view.RowFilter = null;
CalcStatsRow(view, observedColumnName, predictedColumnName, overallSeriesName, statsData);
}
}
}
}
// Write the stats data to the DataStore
dataStore.WriteTable(null, this.Name, statsData);
}
}
示例2: Run
/// <summary>
/// The main run method called to fill tables in the specified DataStore.
/// </summary>
/// <param name="dataStore">The DataStore to work with</param>
public void Run(DataStore dataStore)
{
dataStore.DeleteTable(this.Name);
DataTable simulationData = dataStore.GetData("*", this.TableName);
if (simulationData != null)
{
// Add all the necessary columns to our data table.
DataTable probabilityData = new DataTable();
probabilityData.Columns.Add("Probability", typeof(double));
foreach (DataColumn column in simulationData.Columns)
{
if (column.DataType == typeof(double))
probabilityData.Columns.Add(column.ColumnName, typeof(double));
}
string[] simulationNames = dataStore.SimulationNames;
DataView view = new DataView(simulationData);
foreach (string simulationName in simulationNames)
{
view.RowFilter = "SimName = '" + simulationName + "'";
int startRow = probabilityData.Rows.Count;
// Add in a simulation column.
string[] simulationNameColumnValues = StringUtilities.CreateStringArray(simulationName, view.Count);
DataTableUtilities.AddColumn(probabilityData, "SimulationName", simulationNameColumnValues, startRow, simulationNameColumnValues.Length);
// Add in the probability column
double[] probabilityValues = MathUtilities.ProbabilityDistribution(view.Count, this.Exceedence);
DataTableUtilities.AddColumn(probabilityData, "Probability", probabilityValues, startRow, view.Count);
// Add in all other numeric columns.
foreach (DataColumn column in simulationData.Columns)
{
if (column.DataType == typeof(double))
{
double[] values = DataTableUtilities.GetColumnAsDoubles(view, column.ColumnName);
Array.Sort<double>(values);
DataTableUtilities.AddColumn(probabilityData, column.ColumnName, values, startRow, values.Length);
}
}
}
// Write the stats data to the DataStore
dataStore.WriteTable(null, this.Name, probabilityData);
}
}