本文整理汇总了C#中SortedDictionary.put方法的典型用法代码示例。如果您正苦于以下问题:C# SortedDictionary.put方法的具体用法?C# SortedDictionary.put怎么用?C# SortedDictionary.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SortedDictionary
的用法示例。
在下文中一共展示了SortedDictionary.put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: fieldsProducer
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public codecs.FieldsProducer fieldsProducer(index.SegmentReadState state) throws java.io.IOException
public override FieldsProducer fieldsProducer(SegmentReadState state)
{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String fileName = index.IndexFileNames.SegmentFileName(state.segmentInfo.name, state.segmentSuffix, EXTENSION);
string fileName = IndexFileNames.SegmentFileName(state.segmentInfo.name, state.segmentSuffix, EXTENSION);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final store.ChecksumIndexInput in = state.directory.openChecksumInput(fileName, store.IOContext.READONCE);
ChecksumIndexInput @in = state.directory.openChecksumInput(fileName, IOContext.READONCE);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.SortedMap<String,TermsReader> fields = new java.util.TreeMap<>();
SortedMap<string, TermsReader> fields = new SortedDictionary<string, TermsReader>();
try
{
CodecUtil.CheckHeader(@in, CODEC_NAME, VERSION_START, VERSION_CURRENT);
while (true)
{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int termCount = in.readVInt();
int termCount = @in.readVInt();
if (termCount == 0)
{
break;
}
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final TermsReader termsReader = new TermsReader(state.fieldInfos, in, termCount);
TermsReader termsReader = new TermsReader(state.fieldInfos, @in, termCount);
// System.out.println("load field=" + termsReader.field.name);
fields.put(termsReader.field.name, termsReader);
}
CodecUtil.CheckFooter(@in);
}
finally
{
@in.close();
}
return new FieldsProducerAnonymousInnerClassHelper(this, fields);
}
示例2: 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;
}
示例3: ReadAdvertisedImpl
private static IDictionary<string, Ref> ReadAdvertisedImpl(TextReader br)
{
var avail = new SortedDictionary<string, Ref>();
while (true)
{
string line = br.ReadLine();
if (line == null) break;
int tab = line.IndexOf('\t');
if (tab < 0)
{
throw InvalidAdvertisement(line);
}
string name = line.Substring(tab + 1);
ObjectId id = ObjectId.FromString(line.Slice(0, tab));
if (name.EndsWith("^{}"))
{
name = name.Slice(0, name.Length - 3);
Ref prior = avail.get(name);
if (prior == null)
{
throw OutOfOrderAdvertisement(name);
}
if (prior.PeeledObjectId != null)
{
throw DuplicateAdvertisement(name + "^{}");
}
avail.put(name, new PeeledTag(Storage.Network, name, prior.ObjectId, id));
}
else
{
Ref prior = avail.put(name, new PeeledNonTag(Storage.Network, name, id));
if (prior != null)
{
throw DuplicateAdvertisement(name);
}
}
}
return avail;
}