本文整理汇总了C#中IOrderedEnumerable类的典型用法代码示例。如果您正苦于以下问题:C# IOrderedEnumerable类的具体用法?C# IOrderedEnumerable怎么用?C# IOrderedEnumerable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IOrderedEnumerable类属于命名空间,在下文中一共展示了IOrderedEnumerable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ColorGraphAndGetColorCount
/// <summary>
/// Colors the graph and returns the number of colors needed
/// </summary>
private static int ColorGraphAndGetColorCount(IOrderedEnumerable<Node> sortedRepeaters )
{
int maxColor = 0;
foreach(Node node in sortedRepeaters)
{
int minColorNotUsed = 0;
List<int> colorsUsed = new List<int>();
foreach (Node adjacentNode in node.AdjacentNodes)
{
if (adjacentNode.Color != -1)
colorsUsed.Add(adjacentNode.Color);
}
//its a planar graph so no more than 4 colors needed
for (int i = 0; i <=3; i ++)
{
if (!colorsUsed.Contains(i))
{
minColorNotUsed = i;
break;
}
}
//now we have the minimum color not used by adjacent nodes, color the node
node.Color = minColorNotUsed;
if (minColorNotUsed > maxColor)
maxColor = minColorNotUsed;
}
return maxColor+1;
}
开发者ID:RodH257,项目名称:Advanced-Algorithm-Problems,代码行数:35,代码来源:ChannelAllocation.cs
示例2: ProtocolReport
public ProtocolReport(ReportModel model)
: base(model, "ProtocolTemplate.docx")
{
this.modelItems = ReportModel.ReportParameters["ProtocolResults"] as IOrderedEnumerable<ProtocolResult>;
this.hasMKB = this.modelItems.Any(pr => pr.ProductTest.Test.TestType.ShortName == TestTypes.MKB);
this.hasFZH = this.modelItems.Any(pr => pr.ProductTest.Test.TestType.ShortName == TestTypes.FZH);
}
开发者ID:astian92,项目名称:rvselectronicdiary,代码行数:7,代码来源:ProtocolReport.cs
示例3: CreateSuitesXElementWithParameters
public XElement CreateSuitesXElementWithParameters(
IOrderedEnumerable<ITestSuite> suites,
IOrderedEnumerable<ITestScenario> scenarios,
IOrderedEnumerable<ITestResult> testResults,
IXMLElementsStruct xmlStruct)
{
var suitesElement =
new XElement(xmlStruct.SuitesNode,
from suite in suites
select new XElement(xmlStruct.SuiteNode,
new XAttribute("uniqueId", suite.UniqueId),
new XAttribute("id", suite.Id),
new XAttribute("name", suite.Name),
new XAttribute("status", suite.Status),
createXattribute(xmlStruct.TimeSpentAttribute, Convert.ToInt32(suite.Statistics.TimeSpent)),
new XAttribute("all", suite.Statistics.All.ToString()),
new XAttribute("passed", suite.Statistics.Passed.ToString()),
createXattribute(xmlStruct.FailedAttribute, suite.Statistics.Failed.ToString()),
new XAttribute("notTested", suite.Statistics.NotTested.ToString()),
new XAttribute("knownIssue", suite.Statistics.PassedButWithBadSmell.ToString()),
createXattribute("description", suite.Description),
createXattribute("platformId", suite.PlatformId),
createXattribute("platformUniqueId", suite.PlatformUniqueId),
CreateScenariosXElementCommon(
suite,
// 20141122
// scenarios.Where(scenario => scenario.SuiteId == suite.Id).OrderBy(scenario => scenario.Id),
// testResults.Where(testResult => testResult.SuiteId == suite.Id).OrderBy(testResult => testResult.Id),
scenarios.Where(scenario => scenario.SuiteId == suite.Id && scenario.SuiteUniqueId == suite.UniqueId).OrderBy(scenario => scenario.Id),
testResults.Where(testResult => testResult.SuiteId == suite.Id && testResult.SuiteUniqueId == suite.UniqueId).OrderBy(testResult => testResult.Id),
xmlStruct)
)
);
return suitesElement;
}
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:35,代码来源:TestResultsExporter.cs
示例4: Print
static void Print(IOrderedEnumerable<List<int>> sortedResults)
{
foreach (var item in sortedResults)
{
Console.WriteLine("{0} = {1}", string.Join(" + ", item), endResult);
}
}
开发者ID:KrasiNedew,项目名称:SoftUni,代码行数:7,代码来源:RecursiveSubsetSumsWithSort.cs
示例5: Percentile
private double Percentile(IOrderedEnumerable<double> sortedData, double p)
{
int count = sortedData.Count();
if (count == 0) return 0;
if (count == 1) return sortedData.Last();
if (p >= 100.0d) return sortedData.Last();
double position = (count + 1) * p / 100d;
double leftNumber, rightNumber;
double n = p / 100d * (count - 1) + 1d;
if (position >= 1)
{
leftNumber = sortedData.ElementAt((int)Math.Floor(n) - 1);
rightNumber = sortedData.ElementAt((int)Math.Floor(n));
}
else
{
leftNumber = sortedData.First();
rightNumber = sortedData.ElementAt(1);
}
if (Math.Abs(leftNumber - rightNumber) < Double.Epsilon)
return leftNumber;
else
{
double part = n - Math.Floor(n);
return leftNumber + part*(rightNumber - leftNumber);
}
}
开发者ID:demonix,项目名称:iPoint.ServiceStatistics,代码行数:31,代码来源:PercentileAggregationOperation.cs
示例6: GetMatchedRecords
protected virtual bool GetMatchedRecords(
IOrderedEnumerable<IRecord> recordsFilteredByDate,
IModelInput modelInput,
out IDictionary<string, IList<IRecord>> matchedRecords
)
{
matchedRecords = new Dictionary<string, IList<IRecord>>();
if (!recordsFilteredByDate.AnySave())
{
return false;
}
foreach (var record in recordsFilteredByDate)
{
foreach (var term in modelInput.FilterTerms)
{
var distinctMatchedDescription = GetMatchedDistinctDescription(record.Description, term);
record.DistinctDescription = distinctMatchedDescription;
if (string.IsNullOrEmpty(distinctMatchedDescription))
{
continue;
}
if (matchedRecords.ContainsKey(distinctMatchedDescription))
{
matchedRecords[distinctMatchedDescription].Add(record);
}
else
{
matchedRecords.Add(distinctMatchedDescription, new List<IRecord>() { record });
}
break;
}
}
return matchedRecords.Any();
}
开发者ID:CrankSoftware,项目名称:MoolaBsa,代码行数:35,代码来源:BaseModel.cs
示例7: ReplaceForbbidenWords
public static StringBuilder ReplaceForbbidenWords(string text, IOrderedEnumerable<KeyValuePair<string, List<int>>> sortedLocations)
{
const char STAR_SYMBOL = '*';
StringBuilder result = new StringBuilder();
int index = 0;
foreach (var forbiddenWord in sortedLocations)
{
foreach (var location in forbiddenWord.Value)
{
for (; index < text.Length; index++)
{
if (index >= location && index < location + forbiddenWord.Key.Length)
{
result.Append(STAR_SYMBOL);
}
else
{
result.Append(text[index]);
}
if (index == location + forbiddenWord.Key.Length)
{
break;
}
}
}
}
return result;
}
开发者ID:vaster,项目名称:Telerik.vasko,代码行数:31,代码来源:Program.cs
示例8: DisplayPackageViewModel
public DisplayPackageViewModel(Package package, IOrderedEnumerable<Package> packageHistory, bool isVersionHistory)
: base(package)
{
Copyright = package.Copyright;
if (!isVersionHistory)
{
Dependencies = new DependencySetsViewModel(package.Dependencies);
PackageVersions = packageHistory.Select(p => new DisplayPackageViewModel(p, packageHistory, isVersionHistory: true));
}
DownloadCount = package.DownloadCount;
LastEdited = package.LastEdited;
if (!isVersionHistory && packageHistory.Any())
{
// calculate the number of days since the package registration was created
// round to the nearest integer, with a min value of 1
// divide the total download count by this number
TotalDaysSinceCreated = Convert.ToInt32(Math.Max(1, Math.Round((DateTime.UtcNow - packageHistory.Last().Created).TotalDays)));
DownloadsPerDay = TotalDownloadCount / TotalDaysSinceCreated; // for the package
}
else
{
TotalDaysSinceCreated = 0;
DownloadsPerDay = 0;
}
}
开发者ID:ZhiYuanHuang,项目名称:NuGetGallery,代码行数:28,代码来源:DisplayPackageViewModel.cs
示例9: GetTotalInventory
/// <summary>
/// Get Total list of items in the inventory
/// </summary>
/// <param name="lstTotalInventoryMl"></param>
/// <param name="lstInventoryMl"></param>
private List<InventoryModel> GetTotalInventory(IOrderedEnumerable<InventoryModel> lstTotalInventoryMl, string logicalDeviceId, string searchText)
{
List<InventoryModel> lstInventoryMl = new List<InventoryModel>();
var lstInventoryInMl =
lstTotalInventoryMl.Where(x => x.CurrentState.Equals(Enums.CurrentState.Add.ToString())).ToList();
var lstInventoryOutMl =
lstTotalInventoryMl.Where(x => x.CurrentState.Equals(Enums.CurrentState.Remove.ToString())).ToList();
foreach (var inventoryInMl in lstInventoryInMl)
{
var inventoryOutMl =
lstInventoryOutMl.Where(
x => x.LogicalDeviceId == inventoryInMl.LogicalDeviceId && x.TagEPC == inventoryInMl.TagEPC)
.ToList();
if (inventoryOutMl.Count == 0)
{
lstInventoryMl.Add(inventoryInMl);
}
else
{
lstInventoryOutMl.Remove(inventoryOutMl.FirstOrDefault());
}
}
lstInventoryMl.ToList().ForEach(x =>
{
x.Batch = (from u in ObjTersoDataContext.items
where u.EPC == x.TagEPC
select u.Batch).FirstOrDefault();
x.ItemId = (from u in ObjTersoDataContext.items
where u.EPC == x.TagEPC
select u.ItemId).FirstOrDefault();
x.Material = (from u in ObjTersoDataContext.items
where u.EPC == x.TagEPC
select u.Material).FirstOrDefault();
x.ExpirationDate = (from u in ObjTersoDataContext.items
where u.EPC == x.TagEPC
select u.ExpirationDate).FirstOrDefault();
x.ExpirationDateString = x.ExpirationDate != null ? String.Format("{0:MM/dd/yyyy}", x.ExpirationDate.Value) : string.Empty;
x.DeviceId = (from u in ObjTersoDataContext.devices
where u.LogicalDeviceId == x.LogicalDeviceId
select u.DeviceId).FirstOrDefault();
});
lstInventoryMl = lstInventoryMl.Where(x => (string.IsNullOrEmpty(logicalDeviceId) || x.LogicalDeviceId.Equals(logicalDeviceId))
&& (string.IsNullOrEmpty(searchText) ||
(!string.IsNullOrEmpty(x.Material) && x.Material.Contains(searchText)) ||
(!string.IsNullOrEmpty(x.Batch) && x.Batch.Contains(searchText)) ||
x.TagEPC.Contains(searchText) || x.LogicalDeviceId.Equals(searchText)
)).ToList();
lstInventoryMl.ToList().ForEach(x =>
{
x.TotalRows = lstInventoryMl.Count;
});
return lstInventoryMl.ToList();
}
开发者ID:tersosolutions,项目名称:JetstreamSDK-.NET_Launchpad,代码行数:64,代码来源:DBInventory.cs
示例10: BurrowsWheelerTransform
internal BurrowsWheelerTransform(IOrderedEnumerable<int[]> transform)
{
var y = transform.Select(v => new { F = v[0], L = v[2], S = v[1] }).ToArray();
sorted = y.Select(v => v.F).ToArray();
bwt = y.Select(v => v.L).ToArray();
suffix = y.Select(v => v.S).ToArray();
index = suffix.Select((s, i) => new { S = s, I = i }).OrderBy(v => v.S).Select(v => v.I).ToArray();
}
开发者ID:dialectsoftware,项目名称:DialectSoftware.Text,代码行数:8,代码来源:BurrowsWheelerTransform.cs
示例11: Print
private static void Print(IOrderedEnumerable<A> result)
{
var output = result.Select(a =>
{
Console.WriteLine(a.S);
return a.S;
});
}
开发者ID:fr4nky80,项目名称:LearnCSharp,代码行数:9,代码来源:Sorting.cs
示例12: PrintList
private static void PrintList(IOrderedEnumerable<Worker> list)
{
foreach (var human in list)
{
Console.WriteLine(human);
}
Console.WriteLine();
}
开发者ID:hkostadinov,项目名称:SoftUni,代码行数:9,代码来源:Test.cs
示例13: MeansOfTransportAsString
public string MeansOfTransportAsString(IOrderedEnumerable<TransportMethod> meansOfTransport)
{
if (meansOfTransport == null || !meansOfTransport.Any())
{
return string.Empty;
}
return string.Join("-", meansOfTransport.Select(m => EnumHelper.GetShortName(m)));
}
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:9,代码来源:MeansOfTransportFormatter.cs
示例14: ShowProcesses
private void ShowProcesses(IOrderedEnumerable<Process> lstOfProcesses)
{
foreach (var proc in lstOfProcesses)
{
lv_Processes.Items.Add(String.Format("{0}.exe", proc.ProcessName)).SubItems.AddRange(new string[]
{proc.Id.ToString(),(proc.PagedMemorySize64/(1024*1024)).ToString()+"M",
proc.Threads.Count.ToString()});
}
}
开发者ID:JohnKarnel,项目名称:ProcessManager,代码行数:9,代码来源:FormMain.cs
示例15: AdicionarTodasAsDespesasOrdenadasPorMesEmConta
private void AdicionarTodasAsDespesasOrdenadasPorMesEmConta(ContaDTO contaDTO, IOrderedEnumerable<DespesaDeViagem> despesasOrdenadasPorMes)
{
foreach (var despesa in despesasOrdenadasPorMes)
{
var despesaDTO = TransformarDespesaEmDespesaDTO(despesa);
contaDTO.Despesas.Add(despesaDTO);
}
}
开发者ID:Workker,项目名称:Orcamento2014,代码行数:9,代码来源:ServicoDesnormalizarContas.cs
示例16: SampleConsecutiveDataPointObservationsCollection
public SampleConsecutiveDataPointObservationsCollection(
IOrderedEnumerable<DataPointObservation> observations,
Action<IEnumerable<AggregatedDataPoint>> aggregationReceiver,
bool isPartial)
: base(observations)
{
this.aggregationReceiver = aggregationReceiver;
this.isPartial = isPartial;
}
开发者ID:djnicholson,项目名称:DataAggregationAndVisualizationEngine,代码行数:9,代码来源:SampleConsecutiveDataPointObservationsCollection.cs
示例17: PrintList
private static void PrintList(IOrderedEnumerable<Worker> sortedWorkers)
{
foreach (var worker in sortedWorkers)
{
Console.WriteLine(worker);
}
Console.WriteLine();
}
开发者ID:asenAce,项目名称:Software_University_Bulgaria,代码行数:9,代码来源:Start.cs
示例18: AddSimpleSentence
public FromComprenoModel AddSimpleSentence(IOrderedEnumerable<Compreno.SentenceElement> words)
{
var simpleSentece = new SimpleSentence();
simpleSentece.Words.AddRange(words.Select(_toSentenceWord));
_comparisonSentence.SimpleSentences.Add(simpleSentece);
return this;
}
开发者ID:Ogonik,项目名称:LWS,代码行数:10,代码来源:ComparisonModelBuilder.cs
示例19: AddLinkedChain
public FromComprenoModel AddLinkedChain(Compreno.SentenceElement master, IOrderedEnumerable<Compreno.SentenceElement> dependantWords)
{
var linkedChain = new LinkedChain();
linkedChain.Master.Words.Add(_toSentenceWord(master));
linkedChain.Dependent.Words.AddRange(dependantWords.Select(_toSentenceWord));
_comparisonSentence.LinkedChains.Add(linkedChain);
return this;
}
开发者ID:Ogonik,项目名称:LWS,代码行数:10,代码来源:ComparisonModelBuilder.cs
示例20: GatherCollections
public void GatherCollections(ISearchCmdletBaseDataObject searchCriteria, List<ITestSuite> suitesForSearch)
{
var testResultsSearcher = new TestResultsSearcher();
TestSuites = testResultsSearcher.SearchForSuites(searchCriteria, suitesForSearch);
TestScenarios = testResultsSearcher.SearchForScenarios(searchCriteria, suitesForSearch);
TestResults = testResultsSearcher.SearchForTestResults(searchCriteria, suitesForSearch);
}
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:7,代码来源:GatherTestResultsCollections.cs
注:本文中的IOrderedEnumerable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论