本文整理汇总了C#中SortedDictionary.EntrySet方法的典型用法代码示例。如果您正苦于以下问题:C# SortedDictionary.EntrySet方法的具体用法?C# SortedDictionary.EntrySet怎么用?C# SortedDictionary.EntrySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortedDictionary
的用法示例。
在下文中一共展示了SortedDictionary.EntrySet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: SimpleTVTermsEnum
internal SimpleTVTermsEnum(SortedDictionary<BytesRef, SimpleTVPostings> terms)
{
_terms = terms;
_iterator = terms.EntrySet().GetEnumerator();
}
示例3: SeekCeil
public override SeekStatus SeekCeil(BytesRef text)
{
var newTerms = new SortedDictionary<BytesRef, SimpleTVPostings>();
foreach (var p in _terms.Where(p => p.Key.CompareTo(text) >= 0))
newTerms.Add(p.Key, p.Value);
_iterator = newTerms.EntrySet().GetEnumerator();
try
{
_iterator.MoveNext();
return _iterator.Current.Key.Equals(text) ? SeekStatus.FOUND : SeekStatus.NOT_FOUND;
}
catch
{
return SeekStatus.END;
}
}
示例4: Authorize
/// <exception cref="System.IO.IOException"></exception>
private void Authorize(HttpURLConnection c)
{
IDictionary<string, IList<string>> reqHdr = c.GetRequestProperties();
SortedDictionary<string, string> sigHdr = new SortedDictionary<string, string>();
foreach (KeyValuePair<string, IList<string>> entry in reqHdr.EntrySet())
{
string hdr = entry.Key;
if (IsSignedHeader(hdr))
{
sigHdr.Put(StringUtils.ToLowerCase(hdr), ToCleanString(entry.Value));
}
}
StringBuilder s = new StringBuilder();
s.Append(c.GetRequestMethod());
s.Append('\n');
s.Append(Remove(sigHdr, "content-md5"));
s.Append('\n');
s.Append(Remove(sigHdr, "content-type"));
s.Append('\n');
s.Append(Remove(sigHdr, "date"));
s.Append('\n');
foreach (KeyValuePair<string, string> e in sigHdr.EntrySet())
{
s.Append(e.Key);
s.Append(':');
s.Append(e.Value);
s.Append('\n');
}
string host = c.GetURL().GetHost();
s.Append('/');
s.Append(Sharpen.Runtime.Substring(host, 0, host.Length - DOMAIN.Length - 1));
s.Append(c.GetURL().AbsolutePath);
string sec;
try
{
Mac m = Mac.GetInstance(HMAC);
m.Init(privateKey);
sec = Base64.EncodeBytes(m.DoFinal(Sharpen.Runtime.GetBytesForString(s.ToString()
, "UTF-8")));
}
catch (NoSuchAlgorithmException e_1)
{
throw new IOException(MessageFormat.Format(JGitText.Get().noHMACsupport, HMAC, e_1
.Message));
}
catch (InvalidKeyException e_1)
{
throw new IOException(MessageFormat.Format(JGitText.Get().invalidKey, e_1.Message
));
}
c.SetRequestProperty("Authorization", "AWS " + publicKey + ":" + sec);
}