本文整理汇总了C#中System.Environment.TimeoutD方法的典型用法代码示例。如果您正苦于以下问题:C# Environment.TimeoutD方法的具体用法?C# Environment.TimeoutD怎么用?C# Environment.TimeoutD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Environment
的用法示例。
在下文中一共展示了Environment.TimeoutD方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Cast
private IEnumerable<Event> Cast(Environment env, Resource crane, string name, IEnumerable<Slab> castQueue)
{
foreach (var slab in castQueue) {
yield return env.TimeoutD(slab.CastTime);
env.Log("Caster {0} finished at {1}", name, env.Now);
var token = crane.Request();
yield return token;
env.Process(Transport(env, crane, token, name));
}
}
示例2: TestRunResumeDApi
public void TestRunResumeDApi()
{
/* Stopped simulation can be resumed. */
var env = new Environment(defaultStep: TimeSpan.FromMinutes(1));
var events = new List<Event>() {
env.TimeoutD(5),
env.TimeoutD(10),
env.TimeoutD(15),
env.TimeoutD(20)
};
Assert.AreEqual(env.NowD, 0);
Assert.AreEqual(env.PeekD(), 5);
Assert.IsFalse(events.Any(x => x.IsProcessed));
env.RunD(10);
Assert.AreEqual(env.NowD, 10);
Assert.AreEqual(env.PeekD(), 10);
Assert.IsTrue(events[0].IsProcessed);
Assert.IsFalse(events[1].IsProcessed);
Assert.IsFalse(events[2].IsProcessed);
env.RunD(5);
Assert.AreEqual(env.NowD, 15);
Assert.AreEqual(env.PeekD(), 15);
Assert.IsTrue(events[0].IsProcessed);
Assert.IsTrue(events[1].IsProcessed);
Assert.IsFalse(events[2].IsProcessed);
env.RunD(1);
Assert.AreEqual(env.NowD, 16);
Assert.AreEqual(env.PeekD(), 20);
Assert.IsTrue(events[0].IsProcessed);
Assert.IsTrue(events[1].IsProcessed);
Assert.IsTrue(events[2].IsProcessed);
env.RunD();
Assert.AreEqual(env.NowD, 20);
Assert.AreEqual(env.PeekD(), double.MaxValue);
}
示例3: AProcess
private static IEnumerable<Event> AProcess(Environment env, List<string> log)
{
while (env.NowD < 2) {
log.Add(env.NowD.ToString("00", CultureInfo.InvariantCulture.NumberFormat));
yield return env.TimeoutD(1);
}
}
示例4: Transport
private IEnumerable<Event> Transport(Environment env, Resource crane, Request token, string caster)
{
env.Log("Crane transporting from caster {0} at {1}", caster, env.Now);
yield return env.TimeoutD(4);
crane.Release(token);
}
示例5: TestOperatorAndBlockedProcess
private IEnumerable<Event> TestOperatorAndBlockedProcess(Environment env)
{
var timeout = env.TimeoutD(1);
var @event = new Event(env);
yield return env.TimeoutD(1);
var condition = timeout & @event;
Assert.IsFalse(condition.IsTriggered);
}
示例6: TestAndConditionBlockedProcess
private IEnumerable<Event> TestAndConditionBlockedProcess(Environment env)
{
var t1 = env.TimeoutD(1);
var e = new Event(env);
yield return t1;
yield return t1 & e;
Assert.Fail("Process should not recover");
}