本文整理汇总了C#中ICollection.AddItem方法的典型用法代码示例。如果您正苦于以下问题:C# ICollection.AddItem方法的具体用法?C# ICollection.AddItem怎么用?C# ICollection.AddItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICollection
的用法示例。
在下文中一共展示了ICollection.AddItem方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DocumentTitleMatchClassifier
public DocumentTitleMatchClassifier(string title)
{
if (title == null)
{
this.potentialTitles = null;
}
else
{
title = title.Trim();
if (title.Length == 0)
{
this.potentialTitles = null;
}
else
{
this.potentialTitles = new HashSet<string>();
potentialTitles.AddItem(title);
string p;
p = GetLongestPart(title, "[ ]*[\\|»|:][ ]*");
if (p != null)
{
potentialTitles.AddItem(p);
}
p = GetLongestPart(title, "[ ]*[\\|»|:\\(\\)][ ]*");
if (p != null)
{
potentialTitles.AddItem(p);
}
p = GetLongestPart(title, "[ ]*[\\|»|:\\(\\)\\-][ ]*");
if (p != null)
{
potentialTitles.AddItem(p);
}
p = GetLongestPart(title, "[ ]*[\\|»|,|:\\(\\)\\-][ ]*");
if (p != null)
{
potentialTitles.AddItem(p);
}
}
}
}
示例2: GetDesignDocFunction
private String GetDesignDocFunction(String fnName, String key, ICollection<String> outLanguageList)
{
var path = fnName.Split('/');
if (path.Length != 2)
{
return null;
}
var docId = string.Format("_design/{0}", path[0]);
var rev = GetDocumentWithIDAndRev(docId, null, DocumentContentOptions.None);
if (rev == null)
{
return null;
}
var outLanguage = (string)rev.GetPropertyForKey("language");
if (outLanguage != null)
{
outLanguageList.AddItem(outLanguage);
}
else
{
outLanguageList.AddItem("javascript");
}
var container = (IDictionary<String, Object>)rev.GetPropertyForKey(key);
return (string)container.Get(path[1]);
}
示例3: Service
/// <exception cref="System.IO.IOException"></exception>
private void Service()
{
if (biDirectionalPipe)
{
SendAdvertisedRefs(new RefAdvertiser.PacketLineOutRefAdvertiser(pckOut));
}
else
{
if (requestPolicy == UploadPack.RequestPolicy.ANY)
{
advertised = Sharpen.Collections.EmptySet<ObjectId>();
}
else
{
advertised = new HashSet<ObjectId>();
foreach (Ref @ref in GetAdvertisedOrDefaultRefs().Values)
{
if (@ref.GetObjectId() != null)
{
advertised.AddItem(@ref.GetObjectId());
}
}
}
}
bool sendPack;
try
{
RecvWants();
if (wantIds.IsEmpty())
{
preUploadHook.OnBeginNegotiateRound(this, wantIds, 0);
preUploadHook.OnEndNegotiateRound(this, wantIds, 0, 0, false);
return;
}
if (options.Contains(OPTION_MULTI_ACK_DETAILED))
{
multiAck = BasePackFetchConnection.MultiAck.DETAILED;
noDone = options.Contains(OPTION_NO_DONE);
}
else
{
if (options.Contains(OPTION_MULTI_ACK))
{
multiAck = BasePackFetchConnection.MultiAck.CONTINUE;
}
else
{
multiAck = BasePackFetchConnection.MultiAck.OFF;
}
}
if (depth != 0)
{
ProcessShallow();
}
sendPack = Negotiate();
}
catch (PackProtocolException err)
{
ReportErrorDuringNegotiate(err.Message);
throw;
}
catch (ServiceMayNotContinueException err)
{
if (!err.IsOutput() && err.Message != null)
{
try
{
pckOut.WriteString("ERR " + err.Message + "\n");
err.SetOutput();
}
catch
{
}
}
// Ignore this secondary failure (and not mark output).
throw;
}
catch (IOException err)
{
ReportErrorDuringNegotiate(JGitText.Get().internalServerError);
throw;
}
catch (RuntimeException err)
{
ReportErrorDuringNegotiate(JGitText.Get().internalServerError);
throw;
}
catch (Error err)
{
ReportErrorDuringNegotiate(JGitText.Get().internalServerError);
throw;
}
if (sendPack)
{
SendPack();
}
}
示例4: Resolve
/// <exception cref="System.IO.IOException"></exception>
public override void Resolve(ICollection<ObjectId> matches, AbbreviatedObjectId id
, int matchLimit)
{
int[] data = names[id.FirstByte];
int max = (int)(((uint)offset32[id.FirstByte].Length) >> 2);
int high = max;
if (high == 0)
{
return;
}
int low = 0;
do
{
int p = (int)(((uint)(low + high)) >> 1);
int cmp = id.PrefixCompare(data, IdOffset(p));
if (cmp < 0)
{
high = p;
}
else
{
if (cmp == 0)
{
// We may have landed in the middle of the matches. Move
// backwards to the start of matches, then walk forwards.
//
while (0 < p && id.PrefixCompare(data, IdOffset(p - 1)) == 0)
{
p--;
}
for (; p < max && id.PrefixCompare(data, IdOffset(p)) == 0; p++)
{
matches.AddItem(ObjectId.FromRaw(data, IdOffset(p)));
if (matches.Count > matchLimit)
{
break;
}
}
return;
}
else
{
low = p + 1;
}
}
}
while (low < high);
}
示例5: Database
static Database()
{
// Default value for maxRevTreeDepth, the max rev depth to preserve in a prune operation
KnownSpecialKeys = new HashSet<string>();
KnownSpecialKeys.AddItem("_id");
KnownSpecialKeys.AddItem("_rev");
KnownSpecialKeys.AddItem("_attachments");
KnownSpecialKeys.AddItem("_deleted");
KnownSpecialKeys.AddItem("_revisions");
KnownSpecialKeys.AddItem("_revs_info");
KnownSpecialKeys.AddItem("_conflicts");
KnownSpecialKeys.AddItem("_deleted_conflicts");
}
示例6: Resolve
/// <exception cref="System.IO.IOException"></exception>
internal override void Resolve(ICollection<ObjectId> matches, AbbreviatedObjectId
id)
{
// Go through the packs once. If we didn't find any resolutions
// scan for new packs and check once more.
//
int oldSize = matches.Count;
ObjectDirectory.PackList pList = packList.Get();
for (; ; )
{
foreach (PackFile p in pList.packs)
{
try
{
p.Resolve(matches, id, RESOLVE_ABBREV_LIMIT);
}
catch (IOException)
{
// Assume the pack is corrupted.
//
RemovePack(p);
}
if (matches.Count > RESOLVE_ABBREV_LIMIT)
{
return;
}
}
if (matches.Count == oldSize)
{
ObjectDirectory.PackList nList = ScanPacks(pList);
if (nList == pList || nList.packs.Length == 0)
{
break;
}
pList = nList;
continue;
}
break;
}
string fanOut = Sharpen.Runtime.Substring(id.Name, 0, 2);
string[] entries = new FilePath(GetDirectory(), fanOut).List();
if (entries != null)
{
foreach (string e in entries)
{
if (e.Length != Constants.OBJECT_ID_STRING_LENGTH - 2)
{
continue;
}
try
{
ObjectId entId = ObjectId.FromString(fanOut + e);
if (id.PrefixCompare(entId) == 0)
{
matches.AddItem(entId);
}
}
catch (ArgumentException)
{
continue;
}
if (matches.Count > RESOLVE_ABBREV_LIMIT)
{
return;
}
}
}
foreach (FileObjectDatabase.AlternateHandle alt in MyAlternates())
{
alt.db.Resolve(matches, id);
if (matches.Count > RESOLVE_ABBREV_LIMIT)
{
return;
}
}
}
示例7: Service
/// <exception cref="System.IO.IOException"></exception>
private void Service()
{
if (biDirectionalPipe)
{
SendAdvertisedRefs(new RefAdvertiser.PacketLineOutRefAdvertiser(pckOut));
}
else
{
advertised = new HashSet<ObjectId>();
refs = refFilter.Filter(db.GetAllRefs());
foreach (Ref @ref in refs.Values)
{
if (@ref.GetObjectId() != null)
{
advertised.AddItem(@ref.GetObjectId());
}
}
}
RecvWants();
if (wantAll.IsEmpty())
{
return;
}
if (options.Contains(OPTION_MULTI_ACK_DETAILED))
{
multiAck = BasePackFetchConnection.MultiAck.DETAILED;
}
else
{
if (options.Contains(OPTION_MULTI_ACK))
{
multiAck = BasePackFetchConnection.MultiAck.CONTINUE;
}
else
{
multiAck = BasePackFetchConnection.MultiAck.OFF;
}
}
if (Negotiate())
{
SendPack();
}
}
示例8: ExpandWildcard
/// <exception cref="NGit.Errors.TransportException"></exception>
private void ExpandWildcard(RefSpec spec, ICollection<Ref> matched)
{
foreach (Ref src in conn.GetRefs())
{
if (spec.MatchSource(src) && matched.AddItem(src))
{
Want(src, spec.ExpandFromSource(src));
}
}
}
示例9: ExpandSingle
/// <exception cref="NGit.Errors.TransportException"></exception>
private void ExpandSingle(RefSpec spec, ICollection<Ref> matched)
{
Ref src = conn.GetRef(spec.GetSource());
if (src == null)
{
throw new TransportException(MessageFormat.Format(JGitText.Get().remoteDoesNotHaveSpec
, spec.GetSource()));
}
if (matched.AddItem(src))
{
Want(src, spec);
}
}
示例10: AmazonS3
static AmazonS3()
{
SIGNED_HEADERS = new HashSet<string>();
SIGNED_HEADERS.AddItem("content-type");
SIGNED_HEADERS.AddItem("content-md5");
SIGNED_HEADERS.AddItem("date");
}
示例11: Service
/// <exception cref="System.IO.IOException"></exception>
private void Service()
{
if (biDirectionalPipe)
{
SendAdvertisedRefs(new RefAdvertiser.PacketLineOutRefAdvertiser(pckOut));
}
else
{
advertised = new HashSet<ObjectId>();
foreach (Ref @ref in GetAdvertisedRefs().Values)
{
if (@ref.GetObjectId() != null)
{
advertised.AddItem(@ref.GetObjectId());
}
}
}
RecvWants();
if (wantIds.IsEmpty())
{
preUploadHook.OnBeginNegotiateRound(this, wantIds, 0);
preUploadHook.OnEndNegotiateRound(this, wantIds, 0, 0, false);
return;
}
if (options.Contains(OPTION_MULTI_ACK_DETAILED))
{
multiAck = BasePackFetchConnection.MultiAck.DETAILED;
noDone = options.Contains(OPTION_NO_DONE);
}
else
{
if (options.Contains(OPTION_MULTI_ACK))
{
multiAck = BasePackFetchConnection.MultiAck.CONTINUE;
}
else
{
multiAck = BasePackFetchConnection.MultiAck.OFF;
}
}
if (Negotiate())
{
SendPack();
}
}