本文整理汇总了C#中System.Collections.ArrayList.FindAll方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.FindAll方法的具体用法?C# ArrayList.FindAll怎么用?C# ArrayList.FindAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ArrayList
的用法示例。
在下文中一共展示了ArrayList.FindAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtractUniqueQueryTokensBasedOnOccurance
private static void ExtractUniqueQueryTokensBasedOnOccurance(ArrayList<ArrayList<QueryToken>> disjuncts,
ArrayList<ArrayList<QueryToken>> finalQueryList,
double twitterProfilerFrequencyThreshold,
ArrayList<ArrayList<QueryToken>> subsetsGrouped,
ArrayList<int> subsetsGroupedOccurance,
int maxOccurance)
{
var subsetsWithMaxOccurance = subsetsGrouped
.Where((x, idx) => subsetsGroupedOccurance[idx] == maxOccurance)
.OrderBy(x => x.Count)
.ToList();
// remove subsets which are contained in other ones
ArrayList<int> subsetsToRemove = new ArrayList<int>();
for (int i = 0; i < subsetsWithMaxOccurance.Count(); ++i)
{
for (int j = i + 1; j < subsetsWithMaxOccurance.Count(); ++j)
{
if (ContainsTokenSubset(subsetsWithMaxOccurance[i], subsetsWithMaxOccurance[j]))
{
subsetsToRemove.Add(i);
break;
}
}
}
subsetsToRemove.Sort();
subsetsToRemove.Reverse();
foreach (var toRemove in subsetsToRemove.Distinct())
{
subsetsWithMaxOccurance.RemoveAt(toRemove);
}
subsetsToRemove.Clear();
if (maxOccurance > 1) // perform twitter profiling
{
for (int i = 0; i < subsetsWithMaxOccurance.Count(); ++i)
{
//twitter profiling
string searchQuery = TwitterProfiler.QueryTokensToStringConverter(subsetsWithMaxOccurance[i]);
double twitterProfilerFrequency = TwitterProfiler.ProfileFrequency(searchQuery);
if (Math.Round(twitterProfilerFrequency) == Convert.ToInt32(TwitterProfiler.InvalidReturns.Exception))
{
Console.WriteLine("\nError during twitter profiling: {0}!", TwitterProfiler.GetExceptionError());
System.Environment.Exit(1);
}
if (twitterProfilerFrequency < twitterProfilerFrequencyThreshold)
{
int disjunctsCountBeforeRemoval = disjuncts.Count();
// remove disjuncts from the original list that contain the selected subset
QueryConverterUtils.RemoveDisjunctsContainingSubsets(disjuncts, subsetsWithMaxOccurance[i]);
if (disjuncts.Count() < disjunctsCountBeforeRemoval)
finalQueryList.Add(subsetsWithMaxOccurance[i]);
if (disjuncts.Count() == 0)
return;
else
{
if (i >= (subsetsWithMaxOccurance.Count() - 1))
{
// find new possible subsets
QueryConverterUtils.ExtractUniqueQueryTokens(disjuncts, finalQueryList, twitterProfilerFrequencyThreshold);
return;
}
}
}
else
{
if (i >= (subsetsWithMaxOccurance.Count() - 1))
{
// select subsets with the first lower occurance
ArrayList<int> lowerOccurances = subsetsGroupedOccurance.FindAll(x => x < maxOccurance);
if (lowerOccurances.Count > 0)
maxOccurance = lowerOccurances.Max();
else
maxOccurance = 0;
if (maxOccurance < 1)
return;
QueryConverterUtils.ExtractUniqueQueryTokensBasedOnOccurance(disjuncts, finalQueryList, twitterProfilerFrequencyThreshold, subsetsGrouped, subsetsGroupedOccurance, maxOccurance);
if (disjuncts.Count() == 0)
return;
}
}
}
}
else // if occurrence is 1 -> profiling not needed
{
foreach (var item in subsetsWithMaxOccurance)
{
int disjunctsCountBeforeRemoval = disjuncts.Count();
// remove disjuncts from the original list that contain the selected subset
QueryConverterUtils.RemoveDisjunctsContainingSubsets(disjuncts, item);
//.........这里部分代码省略.........