本文整理汇总了C#中RowSet类的典型用法代码示例。如果您正苦于以下问题:C# RowSet类的具体用法?C# RowSet怎么用?C# RowSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RowSet类属于命名空间,在下文中一共展示了RowSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
/// <summary>
/// Main processing script.
/// </summary>
/// <param name="input">The input row.</param>
/// <param name="outputRow">The output row.</param>
/// <param name="args">The arguments.</param>
/// <returns>The IEnumerable output row.</returns>
public override IEnumerable<Row> Process(RowSet input, Row outputRow, string[] args)
{
string frameShift = args[0];
string frameLength = args[1];
Directory.CreateDirectory("relatedFeatures");
foreach (var row in input.Rows)
{
outputRow["WaveID"].Set(row["WaveID"].String);
outputRow["WaveBinary"].Set(row["WaveBinary"].Binary);
outputRow["WaveAlignments"].Set(row["WaveAlignments"].String);
outputRow["RawF0"].Set(row["RawF0"].String);
outputRow["LPCC"].Set(row["LPCC"].Binary);
outputRow["OF0"].Set(row["OF0"].String);
outputRow["LSP"].Set(row["LSP"].Binary);
outputRow["Pow"].Set(row["Pow"].String);
outputRow["MBE"].Set(row["MBE"].String);
outputRow["NCCF"].Set(row["NCCF"].String);
string waveId = row["WaveID"].String;
string wave = JobBase.GenerateLocalFile(waveId, row["WaveBinary"].Binary, FileExtensions.Waveform);
string relatedFeatureFile = Path.Combine("relatedFeatures", waveId + "." + FileExtensions.Text);
string[] argument = { wave, relatedFeatureFile, frameShift, frameLength };
F0ExtractorCOSMOS.ExtractRelatedFeaturesOneFile(argument, null);
outputRow["RF"].Set(File.ReadAllText(relatedFeatureFile));
yield return outputRow;
}
}
示例2: valueComparator
internal static void valueComparator(RowSet rawrowset, List<object[]> insertedRows)
{
List<Row> rowset = rawrowset.GetRows().ToList();
Assert.True(rowset.Count == insertedRows.Count,
string.Format(
"Returned rows count is not equal with the count of rows that were inserted! \n Returned: {0} \n Expected: {1} \n",
rowset.Count, insertedRows.Count));
int i = 0;
foreach (Row row in rowset)
{
if (row.Any(col => col.GetType() == typeof (byte[])))
for (int j = 0; j < row.Length; j++)
{
Assert.AreEqual(insertedRows[i][j], row[j]);
}
else
{
for (int m = 0; m < row.Length; m++)
{
if (!row[m].Equals(insertedRows[i][m]))
{
insertedRows.Reverse(); // To check if needed and why
if (!row[m].Equals(insertedRows[i][m]))
insertedRows.Reverse();
}
Assert.AreEqual(insertedRows[i][m], row[m], "Inserted data does not match with returned data.");
}
}
i++;
}
}
示例3: CreateStringsRowset
/// <summary>
/// Creates a rowset.
/// The columns are named: col_0, ..., col_n
/// The rows values are: row_0_col_0, ..., row_m_col_n
/// </summary>
public RowSet CreateStringsRowset(int columnLength, int rowLength, string valueModifier = null)
{
var columns = new List<CqlColumn>();
var columnIndexes = new Dictionary<string, int>();
for (var i = 0; i < columnLength; i++)
{
var c = new CqlColumn()
{
Index = i,
Name = "col_" + i,
TypeCode = ColumnTypeCode.Text,
Type = typeof(string)
};
columns.Add(c);
columnIndexes.Add(c.Name, c.Index);
}
var rs = new RowSet();
for (var j = 0; j < rowLength; j++)
{
var rowValues = new List<byte[]>();
foreach (var c in columns)
{
var value = valueModifier + "row_" + j + "_col_" + c.Index;
rowValues.Add(Encoding.UTF8.GetBytes(value));
}
rs.AddRow(new Row(1, rowValues.ToArray(), columns.ToArray(), columnIndexes));
}
return rs;
}
示例4: Process
/// <summary>
/// Main processing script.
/// </summary>
/// <param name="input">The input row.</param>
/// <param name="outputRow">The output row.</param>
/// <param name="args">The arguments.</param>
/// <returns>The IEnumerable output row.</returns>
public override IEnumerable<Row> Process(RowSet input, Row outputRow, string[] args)
{
string svmDir = "svm";
string scaledSVMDir = "scaledSVM";
Directory.CreateDirectory(svmDir);
Directory.CreateDirectory(scaledSVMDir);
foreach (var row in input.Rows)
{
outputRow["WaveID"].Set(row["WaveID"].String);
outputRow["WaveBinary"].Set(row["WaveBinary"].Binary);
outputRow["WaveAlignments"].Set(row["WaveAlignments"].String);
outputRow["RawF0"].Set(row["RawF0"].String);
outputRow["LPCC"].Set(row["LPCC"].Binary);
outputRow["OF0"].Set(row["OF0"].String);
outputRow["LSP"].Set(row["LSP"].Binary);
outputRow["Pow"].Set(row["Pow"].String);
outputRow["MBE"].Set(row["MBE"].String);
string waveId = row["WaveID"].String;
string svmFile = JobBase.GenerateLocalFile(waveId, row["SVM"].String, FileExtensions.Text, false, svmDir);
string scaledSVMFile = Path.Combine(scaledSVMDir, waveId + "." + FileExtensions.Text);
string svmRangeFile = Path.GetFileName(this.Job.ReplaceVariable["SVMRANGE"]);
// File.WriteAllText(svmRangeFile, TmocFile.NormalizeOutput(svmRangeFile)).
string argument = Helper.NeutralFormat(" -r \"{0}\" \"{1}\"", svmRangeFile, svmFile);
DelayedLogger logger = new DelayedLogger(new TextLogger(scaledSVMFile));
CommandLine.RunCommand(Path.GetFileName(this.Job.ReplaceVariable["SVMSCALETOOL"]),
argument, Environment.CurrentDirectory, logger.Writer, logger.Writer, null);
logger.Dispose();
outputRow["SSVM"].Set(File.ReadAllText(scaledSVMFile));
yield return outputRow;
}
}
示例5: Reduce
public override IEnumerable<Row> Reduce(RowSet input, Row output, string[] args)
{
DateTime lastLogin = default(DateTime);
int sessionId = 1;
foreach (Row row in input.Rows)
{
DateTime currentLoginTime = (DateTime)row["logintime"].Value;
if (lastLogin == default(DateTime))
{
lastLogin = currentLoginTime;
}
else
{
if (lastLogin.AddMinutes(30) < currentLoginTime)
sessionId++;
lastLogin = currentLoginTime;
}
row.CopyTo(output);
output["sessionId"].Set(sessionId);
yield return output;
}
}
示例6: Process
/// <summary>
/// Main processing script.
/// </summary>
/// <param name="input">The input row.</param>
/// <param name="outputRow">The output row.</param>
/// <param name="args">The arguments.</param>
/// <returns>The IEnumerable output row.</returns>
public override IEnumerable<Row> Process(RowSet input, Row outputRow, string[] args)
{
string uvDir = "uv";
string scaledSVMDir = "scaledSVM";
Directory.CreateDirectory(uvDir);
Directory.CreateDirectory(scaledSVMDir);
foreach (var row in input.Rows)
{
outputRow["WaveID"].Set(row["WaveID"].String);
outputRow["WaveBinary"].Set(row["WaveBinary"].Binary);
outputRow["WaveAlignments"].Set(row["WaveAlignments"].String);
outputRow["RawF0"].Set(row["RawF0"].String);
outputRow["LPCC"].Set(row["LPCC"].Binary);
outputRow["OF0"].Set(row["OF0"].String);
outputRow["LSP"].Set(row["LSP"].Binary);
outputRow["Pow"].Set(row["Pow"].String);
outputRow["MBE"].Set(row["MBE"].String);
string waveId = row["WaveID"].String;
string scaledSVMFile = JobBase.GenerateLocalFile(waveId, row["SSVM"].String, FileExtensions.Text, false, scaledSVMDir);
string uvFile = Path.Combine(uvDir, waveId + "." + FileExtensions.Text);
string argument = Helper.NeutralFormat(" \"{0}\" \"{1}\" \"{2}\"", scaledSVMFile, Path.GetFileName(this.Job.ReplaceVariable["UVMODELFILE"]), uvFile);
CommandLine.RunCommand(Path.GetFileName(this.Job.ReplaceVariable["SVMPREDICTTOOL"]),
argument, "./");
outputRow["UV"].Set(JobBase.GetTextFile(uvFile));
yield return outputRow;
}
}
示例7: Process
/// <summary>
/// Main processing script.
/// </summary>
/// <param name="input">The input row.</param>
/// <param name="outputRow">The output row.</param>
/// <param name="args">The arguments.</param>
/// <returns>The IEnumerable output row.</returns>
public override IEnumerable<Row> Process(RowSet input, Row outputRow, string[] args)
{
string f0Dir = "f0";
string expandDir = "expand";
string svmDir = "svm";
Directory.CreateDirectory(f0Dir);
Directory.CreateDirectory(expandDir);
Directory.CreateDirectory(svmDir);
foreach (var row in input.Rows)
{
outputRow["WaveID"].Set(row["WaveID"].String);
outputRow["WaveBinary"].Set(row["WaveBinary"].Binary);
outputRow["WaveAlignments"].Set(row["WaveAlignments"].String);
outputRow["RawF0"].Set(row["RawF0"].String);
outputRow["LPCC"].Set(row["LPCC"].Binary);
outputRow["OF0"].Set(row["OF0"].String);
outputRow["LSP"].Set(row["LSP"].Binary);
outputRow["Pow"].Set(row["Pow"].String);
outputRow["MBE"].Set(row["MBE"].String);
string waveId = row["WaveID"].String;
string f0File = JobBase.GenerateLocalFile(waveId, row["RawF0"].String, FileExtensions.F0File, true, f0Dir);
string expandFeatureFile = JobBase.GenerateLocalFile(waveId, row["EXP"].String, FileExtensions.Text, false, expandDir);
string svmFile = Path.Combine(svmDir, waveId + "." + FileExtensions.Text);
string[] argument = { f0File, expandFeatureFile, svmFile };
F0ExtractorCOSMOS.FormatFeaturesOneFile(argument, null);
outputRow["SVM"].Set(File.ReadAllText(svmFile));
yield return outputRow;
}
}
示例8: Process
/// <summary>
/// Main processing script.
/// </summary>
/// <param name="input">The input row.</param>
/// <param name="outputRow">The output row.</param>
/// <param name="args">The arguments.</param>
/// <returns>The IEnumerable output row.</returns>
public override IEnumerable<Row> Process(RowSet input, Row outputRow, string[] args)
{
float minF0Value = float.Parse(args[0]);
float maxF0Value = float.Parse(args[1]);
string uvDir = "uv";
string fZeroDir = "f0";
string smoothedFZeroDir = "smoothedF0";
Directory.CreateDirectory(uvDir);
Directory.CreateDirectory(fZeroDir);
Directory.CreateDirectory(smoothedFZeroDir);
foreach (var row in input.Rows)
{
outputRow["WaveID"].Set(row["WaveID"].String);
outputRow["WaveBinary"].Set(row["WaveBinary"].Binary);
outputRow["WaveAlignments"].Set(row["WaveAlignments"].String);
outputRow["RawF0"].Set(row["RawF0"].String);
outputRow["LPCC"].Set(row["LPCC"].Binary);
outputRow["OF0"].Set(row["OF0"].String);
outputRow["LSP"].Set(row["LSP"].Binary);
outputRow["Pow"].Set(row["Pow"].String);
outputRow["MBE"].Set(row["MBE"].String);
string waveId = row["WaveID"].String;
string f0File = JobBase.GenerateLocalFile(waveId, row["RawF0"].String, FileExtensions.F0File, true, fZeroDir);
string uvFile = JobBase.GenerateLocalFile(waveId, row["UV"].String, FileExtensions.Text, true, uvDir);
string smoothedF0File = Path.Combine(smoothedFZeroDir, waveId + "." + FileExtensions.F0File);
string[] argument = { f0File, uvFile, smoothedF0File, minF0Value.ToString(), maxF0Value.ToString() };
F0ExtractorCOSMOS.SmoothOneF0File(argument, null);
outputRow["SF0"].Set(JobBase.GetTextFile(smoothedF0File));
yield return outputRow;
}
}
示例9: CqlReader
internal CqlReader(RowSet rows)
{
popul = rows;
for (int idx = 0; idx < popul.Columns.Length; idx++)
colidx.Add(popul.Columns[idx].Name, idx);
enumRows = popul.GetRows();
enumerRows = enumRows.GetEnumerator();
}
示例10: AddDataToWorksheet
private void AddDataToWorksheet(RowSet resultset, Excel.Range target, bool useFormula)
{
var rgTitles = target.Resize[1, resultset.ColLen];
Utils.AddTitlesToRange(rgTitles, resultset.Titles);
var rgData = ((Excel.Range)target.Cells[2, 1]).Resize[resultset.RowLen, resultset.ColLen];
Utils.AddDataToRange(rgData, resultset.Data, useFormula);
Utils.AddTagsToRange(rgData, resultset.Diff, ctrlInteriorColor.SelectedColor, ctrlFontColor.SelectedColor);
}
示例11: FetchAsync_Pocos_WithCql_Empty
public void FetchAsync_Pocos_WithCql_Empty()
{
var rowset = new RowSet();
var mappingClient = GetMappingClient(rowset);
var userTask = mappingClient.FetchAsync<PlainUser>("SELECT * FROM users");
var users = userTask.Result;
Assert.NotNull(users);
Assert.AreEqual(0, users.Count());
}
示例12: Process
/// <summary>
/// Main processing script.
/// </summary>
/// <param name="input">The input row.</param>
/// <param name="outputRow">The output row.</param>
/// <param name="args">The arguments.</param>
/// <returns>The IEnumerable output row.</returns>
public override IEnumerable<Row> Process(RowSet input, Row outputRow, string[] args)
{
foreach (var row in input.Rows)
{
outputRow["WaveID"].Set(row["WaveID"].String);
outputRow["SVM"].Set(row["SVM"].String);
yield return outputRow;
}
}
示例13: GetSession
private ISession GetSession(RowSet result)
{
var sessionMock = new Mock<ISession>(MockBehavior.Strict);
sessionMock
.Setup(s => s.ExecuteAsync(It.IsAny<IStatement>()))
.Returns(TestHelper.DelayedTask(result, 200))
.Verifiable();
sessionMock.Setup(s => s.PrepareAsync(It.IsAny<string>())).Returns(TaskHelper.ToTask(GetPrepared("Mock query")));
sessionMock.Setup(s => s.BinaryProtocolVersion).Returns(2);
return sessionMock.Object;
}
示例14: CommandExecuteReaderUsesSyncExecute
public void CommandExecuteReaderUsesSyncExecute()
{
var connection = new CqlConnection();
var sessionMock = new Mock<ISession>();
var rowset = new RowSet();
sessionMock
.Setup(s => s.Execute(It.IsAny<string>(), It.IsAny<ConsistencyLevel>()))
.Returns(rowset)
.Verifiable();
connection.ManagedConnection = sessionMock.Object;
var cmd = (CqlCommand) connection.CreateCommand();
cmd.CommandText = "INSERT INTO dummy_cf (a,b) VALUES (1,2)";
var reader = cmd.ExecuteReader();
reader.Dispose();
sessionMock.Verify();
}
示例15: AddColumnInfoToWorksheet
private void AddColumnInfoToWorksheet(RowSet resultset, Excel.Range target)
{
object[,] info = ExcelArray<object>.Create(resultset.RowLen, 1);
var rgTitles = (Excel.Range)target.Rows[0];
var rgInfo = (Excel.Range)target.Columns[0];
for (int ri = 1; ri <= resultset.RowLen; ri++) {
switch (resultset.Match[ri]) {
case XlRowMatch.MatchWithDiff: info[ri, 1] = "'!="; break;
case XlRowMatch.NoMatch: info[ri, 1] = "'+"; break;
}
}
Utils.SetCellStyle(rgInfo, 0xFF);
rgTitles.Value = resultset.Titles;
rgTitles.Font.Bold = true;
rgInfo.Value = info;
rgInfo.HorizontalAlignment = Excel.Constants.xlCenter;
rgInfo.ColumnWidth = 2.5;
}