本文整理汇总了C#中AnalysisData类的典型用法代码示例。如果您正苦于以下问题:C# AnalysisData类的具体用法?C# AnalysisData怎么用?C# AnalysisData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnalysisData类属于命名空间,在下文中一共展示了AnalysisData类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetResults
public IEnumerable<AnalysisResult> GetResults(AnalysisData data)
{
return this.heuristics
.GroupBy(h => h.Language)
.Select(group => new { language = group.Key, matches = Run(group, data), groupCount = group.Count() })
.Select(x => new AnalysisResult(x.language, x.matches, CalculateScore(this.heuristics.Count, x.groupCount, x.matches.Count())));
}
示例2: FilterDiagnostics
protected override void FilterDiagnostics(AnalysisData analysisData, Func<DiagnosticData, bool> predicateOpt)
{
if (predicateOpt == null)
{
AppendDiagnostics(analysisData.Items.Where(d => this.DiagnosticIds == null || this.DiagnosticIds.Contains(d.Id)));
return;
}
AppendDiagnostics(analysisData.Items.Where(d => this.DiagnosticIds == null || this.DiagnosticIds.Contains(d.Id)).Where(predicateOpt));
}
示例3: GetExistingDiagnostics
private static ImmutableArray<DiagnosticData> GetExistingDiagnostics(AnalysisData analysisData)
{
if (analysisData == null)
{
return ImmutableArray<DiagnosticData>.Empty;
}
return analysisData.Items;
}
示例4: UpdateDocumentDiagnostics
private ImmutableArray<DiagnosticData> UpdateDocumentDiagnostics(
AnalysisData existingData, ImmutableArray<TextSpan> range, ImmutableArray<DiagnosticData> memberDiagnostics,
SyntaxTree tree, SyntaxNode member, int memberId)
{
// get old span
var oldSpan = range[memberId];
// get old diagnostics
var diagnostics = existingData.Items;
// check quick exit cases
if (diagnostics.Length == 0 && memberDiagnostics.Length == 0)
{
return diagnostics;
}
// simple case
if (diagnostics.Length == 0 && memberDiagnostics.Length > 0)
{
return memberDiagnostics;
}
// regular case
var result = new List<DiagnosticData>();
// update member location
Contract.Requires(member.FullSpan.Start == oldSpan.Start);
var delta = member.FullSpan.End - oldSpan.End;
var replaced = false;
foreach (var diagnostic in diagnostics)
{
if (diagnostic.TextSpan.Start < oldSpan.Start)
{
result.Add(diagnostic);
continue;
}
if (!replaced)
{
result.AddRange(memberDiagnostics);
replaced = true;
}
if (oldSpan.End <= diagnostic.TextSpan.Start)
{
result.Add(UpdatePosition(diagnostic, tree, delta));
continue;
}
}
// if it haven't replaced, replace it now
if (!replaced)
{
result.AddRange(memberDiagnostics);
replaced = true;
}
return result.ToImmutableArray();
}
示例5: CheckSemanticVersions
private static bool CheckSemanticVersions(Project project, AnalysisData existingData, VersionArgument versions)
{
if (existingData == null)
{
return false;
}
return VersionStamp.CanReusePersistedVersion(versions.TextVersion, existingData.TextVersion) &&
project.CanReusePersistedDependentSemanticVersion(versions.ProjectVersion, versions.DataVersion, existingData.DataVersion);
}
示例6: CheckSyntaxVersions
private static bool CheckSyntaxVersions(Document document, AnalysisData existingData, VersionArgument versions)
{
if (existingData == null)
{
return false;
}
return document.CanReusePersistedTextVersion(versions.TextVersion, existingData.TextVersion) &&
document.CanReusePersistedSyntaxTreeVersion(versions.DataVersion, existingData.DataVersion);
}
示例7: PersistProjectData
private static async Task PersistProjectData(Project project, DiagnosticState state, AnalysisData data)
{
// TODO: Cancellation is not allowed here to prevent data inconsistency. But there is still a possibility of data inconsistency due to
// things like exception. For now, I am letting it go and let v2 engine take care of it properly. If v2 doesnt come online soon enough
// more refactoring is required on project state.
// clear all existing data
state.Remove(project.Id);
foreach (var document in project.Documents)
{
state.Remove(document.Id);
}
// quick bail out
if (data.Items.Length == 0)
{
return;
}
// save new data
var group = data.Items.GroupBy(d => d.DocumentId);
foreach (var kv in group)
{
if (kv.Key == null)
{
// save project scope diagnostics
await state.PersistAsync(project, new AnalysisData(data.TextVersion, data.DataVersion, kv.ToImmutableArrayOrEmpty()), CancellationToken.None).ConfigureAwait(false);
continue;
}
// save document scope diagnostics
var document = project.GetDocument(kv.Key);
if (document == null)
{
continue;
}
await state.PersistAsync(document, new AnalysisData(data.TextVersion, data.DataVersion, kv.ToImmutableArrayOrEmpty()), CancellationToken.None).ConfigureAwait(false);
}
}
示例8: FilterDiagnostics
protected override void FilterDiagnostics(AnalysisData analysisData, Func<DiagnosticData, bool> predicateOpt = null)
{
// we don't care about result
return;
}
示例9: GetResult
public bool GetResult(AnalysisData data) => this.analysisFunc(data);
示例10: getTests
public List<Test> getTests(Int32 numTests, PatientObject patient)
{
if (Authenticated_AorC())
{
try
{
List<Test> tests = new List<Test>();
Test filler = new Test();
filler.anal = new List<AnalysisData>();
Movement.Database.Patient p1 = new Movement.Database.Patient(patient.ID);
ReadOnlyCollection<Movement.Database.Test> testList;
testList = p1.GetAllTests();
AnalysisData d1 = new AnalysisData();
if (numTests == 0)
{
for (int i = 0; i < testList.Count; i++)
{
filler.anal = new List<AnalysisData>();
filler.hand = testList[i].Hand;
filler.mode = testList[i].Mode;
filler.ID = testList[i].TestID;
filler.script.scriptID = testList[i].TestScript.ScriptID;
filler.timestamp = testList[i].Timestamp;
filler.rotation = testList[i].Rotation;
filler.script.type = testList[i].TestScript.ScriptType.Name;
foreach (KeyValuePair<Movement.Analysis.AnalysisMetric, Movement.Database.TestAnalysisComponent> data in testList[i].Analysis.Components)
{
d1.metric = data.Key;
d1.max = data.Value.Max;
d1.min = data.Value.Min;
d1.mean = data.Value.Mean;
d1.stdDev = data.Value.StdDev;
filler.anal.Add(d1);
}
tests.Add(filler);
}
}
else if (numTests < testList.Count)
{
for (int j = 0; j < numTests; j++)
{
filler.anal = new List<AnalysisData>();
filler.hand = testList[j].Hand;
filler.mode = testList[j].Mode;
filler.ID = testList[j].TestID;
filler.script.scriptID = testList[j].TestScript.ScriptID;
filler.timestamp = testList[j].Timestamp;
filler.rotation = testList[j].Rotation;
filler.script.type = testList[j].TestScript.ScriptType.Name;
filler.isNormal = testList[j].AnalysisIsNormal;
foreach (KeyValuePair<Movement.Analysis.AnalysisMetric, Movement.Database.TestAnalysisComponent> data in testList[j].Analysis.Components)
{
d1.metric = data.Key;
d1.max = data.Value.Max;
d1.min = data.Value.Min;
d1.mean = data.Value.Mean;
d1.stdDev = data.Value.StdDev;
filler.anal.Add(d1);
}
tests.Add(filler);
}
}
else if (numTests > testList.Count)
{
for (int i = 0; i < testList.Count; i++)
{
filler.anal = new List<AnalysisData>();
filler.hand = testList[i].Hand;
filler.mode = testList[i].Mode;
filler.ID = testList[i].TestID;
filler.script.scriptID = testList[i].TestScript.ScriptID;
filler.timestamp = testList[i].Timestamp;
filler.rotation = testList[i].Rotation;
filler.script.type = testList[i].TestScript.ScriptType.Name;
foreach (KeyValuePair<Movement.Analysis.AnalysisMetric, Movement.Database.TestAnalysisComponent> data in testList[i].Analysis.Components)
{
d1.metric = data.Key;
d1.max = data.Value.Max;
d1.min = data.Value.Min;
d1.mean = data.Value.Mean;
d1.stdDev = data.Value.StdDev;
filler.anal.Add(d1);
}
tests.Add(filler);
}
}
//.........这里部分代码省略.........
示例11: CanUseDocumentState
private bool CanUseDocumentState(AnalysisData existingData, VersionStamp textVersion, VersionStamp dataVersion)
{
if (existingData == null)
{
return false;
}
// make sure data stored in the cache is one from its previous text update
return existingData.DataVersion.Equals(dataVersion) && existingData.TextVersion.Equals(textVersion);
}
示例12: Run
private static IEnumerable<string> Run(IEnumerable<IHeuristic> heuristics, AnalysisData data)
=> heuristics
.Where(x => x.GetResult(data) == true)
.Select(x => x.Name);
示例13: FilterDiagnostics
protected override void FilterDiagnostics(AnalysisData analysisData)
{
AppendDiagnostics(analysisData.Items.Where(d => this.DiagnosticIds == null || this.DiagnosticIds.Contains(d.Id)));
}