本文整理汇总了C#中BlockList.IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# BlockList.IsEmpty方法的具体用法?C# BlockList.IsEmpty怎么用?C# BlockList.IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockList
的用法示例。
在下文中一共展示了BlockList.IsEmpty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEmptyList
public virtual void TestEmptyList()
{
BlockList<string> empty;
empty = new BlockList<string>();
NUnit.Framework.Assert.AreEqual(0, empty.Count);
NUnit.Framework.Assert.IsTrue(empty.IsEmpty());
NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext());
empty = new BlockList<string>(0);
NUnit.Framework.Assert.AreEqual(0, empty.Count);
NUnit.Framework.Assert.IsTrue(empty.IsEmpty());
NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext());
empty = new BlockList<string>(1);
NUnit.Framework.Assert.AreEqual(0, empty.Count);
NUnit.Framework.Assert.IsTrue(empty.IsEmpty());
NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext());
empty = new BlockList<string>(64);
NUnit.Framework.Assert.AreEqual(0, empty.Count);
NUnit.Framework.Assert.IsTrue(empty.IsEmpty());
NUnit.Framework.Assert.IsFalse(empty.Iterator().HasNext());
}
示例2: Parse
/// <summary>Parse the pack stream.</summary>
/// <remarks>Parse the pack stream.</remarks>
/// <param name="receiving">
/// receives progress feedback during the initial receiving
/// objects phase. If null,
/// <see cref="NGit.NullProgressMonitor">NGit.NullProgressMonitor</see>
/// will be
/// used.
/// </param>
/// <param name="resolving">receives progress feedback during the resolving objects phase.
/// </param>
/// <returns>
/// the pack lock, if one was requested by setting
/// <see cref="SetLockMessage(string)">SetLockMessage(string)</see>
/// .
/// </returns>
/// <exception cref="System.IO.IOException">the stream is malformed, or contains corrupt objects.
/// </exception>
public virtual PackLock Parse(ProgressMonitor receiving, ProgressMonitor resolving
)
{
if (receiving == null)
{
receiving = NullProgressMonitor.INSTANCE;
}
if (resolving == null)
{
resolving = NullProgressMonitor.INSTANCE;
}
if (receiving == resolving)
{
receiving.Start(2);
}
try
{
ReadPackHeader();
entries = new PackedObjectInfo[(int)objectCount];
baseById = new ObjectIdOwnerMap<PackParser.DeltaChain>();
baseByPos = new LongMap<PackParser.UnresolvedDelta>();
deferredCheckBlobs = new BlockList<PackedObjectInfo>();
receiving.BeginTask(JGitText.Get().receivingObjects, (int)objectCount);
try
{
for (int done = 0; done < objectCount; done++)
{
IndexOneObject();
receiving.Update(1);
if (receiving.IsCancelled())
{
throw new IOException(JGitText.Get().downloadCancelled);
}
}
ReadPackFooter();
EndInput();
}
finally
{
receiving.EndTask();
}
if (!deferredCheckBlobs.IsEmpty())
{
DoDeferredCheckBlobs();
}
if (deltaCount > 0)
{
if (resolving is BatchingProgressMonitor)
{
((BatchingProgressMonitor)resolving).SetDelayStart(1000, TimeUnit.MILLISECONDS);
}
resolving.BeginTask(JGitText.Get().resolvingDeltas, deltaCount);
ResolveDeltas(resolving);
if (entryCount < objectCount)
{
if (!IsAllowThin())
{
throw new IOException(MessageFormat.Format(JGitText.Get().packHasUnresolvedDeltas
, Sharpen.Extensions.ValueOf(objectCount - entryCount)));
}
ResolveDeltasWithExternalBases(resolving);
if (entryCount < objectCount)
{
throw new IOException(MessageFormat.Format(JGitText.Get().packHasUnresolvedDeltas
, Sharpen.Extensions.ValueOf(objectCount - entryCount)));
}
}
resolving.EndTask();
}
packDigest = null;
baseById = null;
baseByPos = null;
}
finally
{
try
{
if (readCurs != null)
{
readCurs.Release();
}
}
//.........这里部分代码省略.........
示例3: TestAddToEnd
public virtual void TestAddToEnd()
{
BlockList<int> list = new BlockList<int>(4);
int cnt = BlockList<int>.BLOCK_SIZE * 3;
for (int i = 0; i < cnt; i++)
{
list.AddItem(Sharpen.Extensions.ValueOf(42 + i));
}
NUnit.Framework.Assert.AreEqual(cnt, list.Count);
for (int i_1 = 0; i_1 < cnt; i_1++)
{
NUnit.Framework.Assert.AreEqual(Sharpen.Extensions.ValueOf(42 + i_1), list[i_1]);
}
list.Clear();
NUnit.Framework.Assert.AreEqual(0, list.Count);
NUnit.Framework.Assert.IsTrue(list.IsEmpty());
for (int i_2 = 0; i_2 < cnt; i_2++)
{
list.Add(i_2, Sharpen.Extensions.ValueOf(42 + i_2));
}
NUnit.Framework.Assert.AreEqual(cnt, list.Count);
for (int i_3 = 0; i_3 < cnt; i_3++)
{
NUnit.Framework.Assert.AreEqual(Sharpen.Extensions.ValueOf(42 + i_3), list[i_3]);
}
}