本文整理汇总了C#中SortedSet.Max方法的典型用法代码示例。如果您正苦于以下问题:C# SortedSet.Max方法的具体用法?C# SortedSet.Max怎么用?C# SortedSet.Max使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortedSet
的用法示例。
在下文中一共展示了SortedSet.Max方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeSqlTokens
static private void InitializeSqlTokens()
{
SqlKeywords = new SortedSet<string>();
SqlKeywords.Add("*");
SqlKeywords.Add("ACTION");
SqlKeywords.Add("ALTER");
SqlKeywords.Add("AS");
SqlKeywords.Add("ASC");
SqlKeywords.Add("BY");
SqlKeywords.Add("CLUSTERED");
SqlKeywords.Add("COLUMN");
SqlKeywords.Add("CONSTRAINT");
SqlKeywords.Add("CREATE");
SqlKeywords.Add("DEFAULT");
SqlKeywords.Add("DELETE");
SqlKeywords.Add("DESC");
SqlKeywords.Add("DROP");
SqlKeywords.Add("EXEC");
SqlKeywords.Add("EXECUTE");
SqlKeywords.Add("FROM");
SqlKeywords.Add("FUNCTION");
SqlKeywords.Add("GROUP");
SqlKeywords.Add("INSERT");
SqlKeywords.Add("INTO");
SqlKeywords.Add("INDEX");
SqlKeywords.Add("KEY");
SqlKeywords.Add("LEVEL");
SqlKeywords.Add("NONCLUSTERED");
SqlKeywords.Add("OCT");
SqlKeywords.Add("ORDER");
SqlKeywords.Add("PRIMARY");
SqlKeywords.Add("PROC");
SqlKeywords.Add("PROCEDURE");
SqlKeywords.Add("RULE");
SqlKeywords.Add("SCHEMA");
SqlKeywords.Add("SELECT");
SqlKeywords.Add("STATISTICS");
SqlKeywords.Add("STATUS");
SqlKeywords.Add("TABLE");
SqlKeywords.Add("TRIGGER");
SqlKeywords.Add("UPDATE");
SqlKeywords.Add("USER");
SqlKeywords.Add("VALUES");
SqlKeywords.Add("VIEW");
SqlKeywords.Add("WHERE");
MaxKeywordLength = SqlKeywords.Max(s => s.Length);
}
示例2: FeatureSummary
public static string FeatureSummary(Task feature)
{
IEnumerable<Task> allTasks;
try
{
allTasks = LinkedTasks(feature);
}
catch (UnlinkedException)
{
if (feature.GetCustomColumnValue("Planned sprint").ToString() != string.Empty)
feature.SetCustomColumnValue("Planned sprint", string.Empty);
return string.Empty;
}
var projects = allTasks.Select(t => t.Project.Name).Distinct();
var allPlannedSprints = new SortedSet<string>();
var plannedIPSprint = false;
var summary_builder = new StringBuilder();
summary_builder.Append(string.Format(FEATURE_SUMMARY_LINE_FORMAT, FEATURE_SUMMARY_HEADINGS));
summary_builder.Append(FEATURE_SUMMARY_HEADER_SEPARATOR);
foreach (var project in projects)
{
var team = project.Substring(TEAM_PROJECT_PREFIX.Length);
var teamShort = team.Substring(0, (team.Length > 14) ? 13 : team.Length) + ((team.Length > 14) ? "…" : "");
var tasks = allTasks.Where(t => t.Project.Name == project);
var status = CalcAggregatedStatus(tasks);
var completedPoints = tasks.Where(t => LeafCompleted(t)).Sum(t => t.Points);
var totalPoints = tasks.Sum(t => t.Points);
var completedStories = tasks.Where(t => LeafCompleted(t)).Count();
var totalStories = tasks.Count();
var plannedSprints = tasks
.Where(t => !LeafCompleted(t))
.Select(t => t.GetCustomColumnValue("Planned sprint"))
.Where(sprintColumn => sprintColumn != null)
.Select(sprintColumn => sprintColumn.ToString())
.Where(sprint => sprint.Length != 0)
.Distinct()
.OrderBy(sprint => sprint);
var plannedSprintsString = plannedSprints.Aggregate(
new StringBuilder(),
(sb, sprint) => sb.Append(sprint).Append(", "),
sb => sb.Length > 0 ? sb.ToString(0, sb.Length-2) : "");
var productOwner = ProductOwnerConfig.GetProductOwner(team, "unknown");
var productOwnerShort = productOwner.Substring(0, (productOwner.Length > 14) ? 13 : productOwner.Length) + ((productOwner.Length > 14) ? "…" : "");
summary_builder.AppendFormat(FEATURE_SUMMARY_LINE_FORMAT,
teamShort, status, completedPoints + "/" + totalPoints, completedStories + "/" + totalStories, productOwnerShort, plannedSprintsString);
if (plannedSprintsString.Length > 0)
{
if (!plannedIPSprint && plannedSprints.Where(t => t == "IP").Any())
plannedIPSprint = true;
var maxPlannedSprint = plannedSprints.Where(t => t.StartsWith("S")).Max();
allPlannedSprints.Add(maxPlannedSprint);
}
}
if (plannedIPSprint)
feature.SetCustomColumnValue("Planned sprint", "IP");
else if (allPlannedSprints.Count() > 0)
feature.SetCustomColumnValue("Planned sprint", allPlannedSprints.Max());
return summary_builder.ToString();
}
示例3: LB_ABOD
/// <summary>
/// LB-ABOD algorithm implement
/// </summary>
/// <param name="kNN"></param>
/// <param name="topK"></param>
public static void LB_ABOD(int kNN, int topK, string fpath, DateTime timeStart)
{
DStatusPacket tmpPacket;
List<DStatus> D = new List<DStatus>(LENGTH);
for (int i = 0; i < LENGTH; i++)
{
tmpPacket = data.getDataByID(i);
D.Add(addIndexToPacket(i, tmpPacket));
}
/*
* (step 2) Compute LB-ABOF for each point A ∈ D.
* (step 3) Organize the database objects in a candidate list ordered ascending
* w.r.t. their assigned LB-ABOF.
*/
DStatusPacket A;
double LB_ABOF_A;
List<DPoint> candidateList = new List<DPoint>();
DPoint tmp;
double ABOF_A;
for (int i = 0; i < LENGTH; i++)
{
A = data.getDataByID(i);
LB_ABOF_A = calcLBABOF(A, i, kNN);
// debug
//ABOF_A = ABOF(D, A, i);
//if (ABOF_A - LB_ABOF_A <= 0)
//{
// Console.WriteLine("ABOF(A) <= LB-ABOF(A)");
// Console.WriteLine("ABOF: {0}\tLB-ABOF: {1}", ABOF_A, LB_ABOF_A);
//}
tmp = new DPoint(i, LB_ABOF_A);
candidateList.Add(tmp);
}
candidateList.Sort(); // sort ascending
saveDPoint(candidateList, fpath);
/*
* (step 4) Determine the exact ABOF for the first @topK objects in the candidate
* list, Remove them from the candidate list and insert into the current
* result list.
*/
int indexB;
DStatusPacket B;
double ABOF_B;
int Counter = 0; // The Counter of Comparable
SortedSet<DPoint> resultList = new SortedSet<DPoint>();
for (int i = 0; i < topK; i++)
{
indexB = (int)candidateList[i].ID;
B = data.getDataByID(indexB);
ABOF_B = ABOF(D, B, indexB);
tmp = new DPoint(B.ID, ABOF_B);
resultList.Add(tmp);
candidateList.RemoveAt(i);
Counter++;
}
/*
* (step 6) if the largest ABOF in the result list < the smallest approximated
* ABOF in the candidate list, terminate; else, proceed with step 5.
* (step 5) Remove and examine the next best candidate C from the candidate list
* and determine the exact ABOF, if the ABOF of C < the largest ABOF
* of an object A in the result list, remove A from the result list and
* insert C into the result list.
*/
int indexC;
DStatusPacket C; // next best candidate C in the candidate list
DPoint CC; // point that need to be insert into result list
double ABOF_C;
double Min_LBABOF = candidateList[0].Value;
double Max_ABOF = resultList.Max().Value;
while (Max_ABOF > Min_LBABOF && candidateList.Count() != 0)
{
indexC = (int)candidateList[0].ID; // next best candidate
C = data.getDataByID(indexC);
ABOF_C = ABOF(D, C, indexC);
candidateList.RemoveAt(0);
if (ABOF_C < Max_ABOF)
{
CC = new DPoint(C.ID, ABOF_C);
resultList.Remove(resultList.Max());
//.........这里部分代码省略.........