本文整理汇总了C#中Bag.PopInd方法的典型用法代码示例。如果您正苦于以下问题:C# Bag.PopInd方法的具体用法?C# Bag.PopInd怎么用?C# Bag.PopInd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bag
的用法示例。
在下文中一共展示了Bag.PopInd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestItvVsCh
public void TestItvVsCh()
{
// HC mechanism
var gen = new Gerador();
var dado = new Dice();
var saco = new Bag<CStamp>();
var seed = new CStamp();
seed.Seed(gen.Seed());
saco.Push(seed);
// ITC mechanism
var bag = new Bag<Stamp>();
var seedb = new Stamp();
bag.Push(seedb);
var forks = 0;
var joins = 0;
var events = 0;
int i;
var counter = 0;
for (i = 0;
i < 1500;
i++)
{
Debug.WriteLine(i + 1 + ": bugs->" + counter);
var tipo = dado.Iroll(1, 100);
if (tipo <= 34
|| saco.GetSize() == 1)
{
// fork
Debug.WriteLine("Fork __________________________");
forks++;
var ind = saco.GetValidIndice();
// mecanismo hc
var outStamp = saco.PopInd(ind);
CStamp novo = outStamp.Fork();
saco.Push(outStamp);
saco.Push(novo);
// mecanismo itc in place
var sout = bag.PopInd(ind);
var sin = sout.Fork();
bag.Push(sout);
bag.Push(sin);
// // mecanismo itc funcional
// Stamp outb = (Stamp) bag.popInd(ind);
// Stamp[] p = Stamp.fork(outb);
// Stamp in1 = p[0];
// Stamp in2 = p[1];
//
// bag.push(in1);
// bag.push(in2);
}
else if (tipo <= 66)
{
// join
Debug.WriteLine("Join __________________________");
joins++;
var inda = saco.GetValidIndice();
var outa = saco.PopInd(inda);
var souta = bag.PopInd(inda);
var indb = saco.GetValidIndice();
var outb = saco.PopInd(indb);
var soutb = bag.PopInd(indb);
var novo = new CStamp();
novo.Join(outa, outb);
saco.Push(novo);
// Stamp novob = Stamp.join(souta, soutb);
// bag.push(novob);
souta.Join(soutb);
bag.Push(souta);
}
else
{
// event
Debug.WriteLine("Event _________________________");
events++;
var ind = saco.GetValidIndice();
var outStamp = saco.PopInd(ind);
outStamp.Event(gen.Gera());
saco.Push(outStamp);
var outb = bag.PopInd(ind);
// System.out.println("ANTES:"+outb.toString());
outb.MakeEvent();
// System.out.println("DPS:"+outb.toString());
//.........这里部分代码省略.........