本文整理汇总了C#中SortedDictionary.LastKey方法的典型用法代码示例。如果您正苦于以下问题:C# SortedDictionary.LastKey方法的具体用法?C# SortedDictionary.LastKey怎么用?C# SortedDictionary.LastKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortedDictionary
的用法示例。
在下文中一共展示了SortedDictionary.LastKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parseTypes
// parses a list of MappingCharFilter style rules into a custom byte[] type table
private sbyte[] parseTypes(IList<string> rules)
{
SortedMap<char?, sbyte?> typeMap = new SortedDictionary<char?, sbyte?>();
foreach (string rule in rules)
{
Matcher m = typePattern.matcher(rule);
if (!m.find())
{
throw new System.ArgumentException("Invalid Mapping Rule : [" + rule + "]");
}
string lhs = parseString(m.group(1).Trim());
sbyte? rhs = parseType(m.group(2).Trim());
if (lhs.Length != 1)
{
throw new System.ArgumentException("Invalid Mapping Rule : [" + rule + "]. Only a single character is allowed.");
}
if (rhs == null)
{
throw new System.ArgumentException("Invalid Mapping Rule : [" + rule + "]. Illegal type.");
}
typeMap.put(lhs[0], rhs);
}
// ensure the table is always at least as big as DEFAULT_WORD_DELIM_TABLE for performance
sbyte[] types = new sbyte[Math.Max(typeMap.LastKey() + 1, WordDelimiterIterator.DEFAULT_WORD_DELIM_TABLE.Length)];
for (int i = 0; i < types.Length; i++)
{
types[i] = WordDelimiterIterator.getType(i);
}
foreach (KeyValuePair<char?, sbyte?> mapping in typeMap.EntrySet())
{
types[mapping.Key] = mapping.Value;
}
return types;
}