本文整理汇总了C#中Tnum.AddState方法的典型用法代码示例。如果您正苦于以下问题:C# Tnum.AddState方法的具体用法?C# Tnum.AddState怎么用?C# Tnum.AddState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tnum
的用法示例。
在下文中一共展示了Tnum.AddState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Misc_TemporalRecursion4
public void Misc_TemporalRecursion4()
{
Tnum x = new Tnum();
x.AddState(Time.DawnOf, 10);
x.AddState(new DateTime(2000,1,1), 1);
Assert.AreEqual("{Dawn: 89; 1/1/2000: 1}", TemporalFibonacci(x).Out);
}
示例2: HasUndefinedIntervals1
public void HasUndefinedIntervals1()
{
Tnum r = new Tnum(new Hval(null,Hstate.Null));
r.AddState(Date(2000,1,1), new Hval(null,Hstate.Unstated));
r.AddState(Date(2001,1,1), 2);
Assert.AreEqual(true, Util.HasUndefinedIntervals(r));
}
示例3: RunningSummedIntervals_1
public void RunningSummedIntervals_1()
{
Tnum t = new Tnum(0);
t.AddState(Date(2012, 1, 1), 1000);
t.AddState(Date(2012, 3, 1), 0);
Tnum r = t.RunningSummedIntervals(TheMonth);
Assert.AreEqual("{Dawn: 0; 2/1/2012: 1000; 3/1/2012: 2000}", r.Out);
}
示例4: TnumSwitch11_lazy
public void TnumSwitch11_lazy()
{
Tnum x = new Tnum(10);
x.AddState(Date(2000,1,1), 1);
Tnum result = Switch<Tnum>(()=> x >= 5, ()=> new Tnum(1),
()=> 2);
Assert.AreEqual("{Dawn: 1; 1/1/2000: 2}", result.Out);
}
示例5: MergeTvars2
public void MergeTvars2()
{
Hval unst = new Hval(null,Hstate.Null);
Tnum tn1 = new Tnum(unst);
Tnum tn2 = new Tnum(0);
tn2.AddState(Date(2000,1,1), unst);
tn2.AddState(Date(2001,1,1), 2);
tn2.AddState(Date(2002,1,1), unst);
Assert.AreEqual(tn2.Out, Util.MergeTvars<Tnum>(tn1,tn2).Out);
}
示例6: MergeTvars1
public void MergeTvars1()
{
Hval unst = new Hval(null,Hstate.Null);
Tnum tn1 = new Tnum(unst);
tn1.AddState(Date(2000,1,1), 1);
tn1.AddState(Date(2001,1,1), unst);
tn1.AddState(Date(2002,1,1), 3);
tn1.AddState(Date(2003,1,1), unst);
Tnum tn2 = new Tnum(0);
tn2.AddState(Date(2000,1,1), unst);
tn2.AddState(Date(2001,1,1), 2);
tn2.AddState(Date(2002,1,1), unst);
tn2.AddState(Date(2003,1,1), unst);
Tnum result = Util.MergeTvars<Tnum>(tn1,tn2);
Assert.AreEqual("{Dawn: 0; 1/1/2000: 1; 1/1/2001: 2; 1/1/2002: 3; 1/1/2003: Null}", result.Out);
}
示例7: FT_AsOf_5
public void FT_AsOf_5()
{
Tnum t = new Tnum(4);
t.AddState(Time.DawnOf.AddYears(5), 44);
Tnum res = t.AsOf(Time.DawnOf.AddYears(12));
Assert.AreEqual(44, res.Out);
}
示例8: SlidingSummedIntervals_7
public void SlidingSummedIntervals_7()
{
Tnum t = new Tnum(Hstate.Unstated);
t.AddState(Date(2013, 1, 1), 2000);
Tnum r = t.SlidingSummedIntervals(TheYear, 2);
Assert.AreEqual("Unstated", r.Out);
}
示例9: TemporalMath2
public void TemporalMath2()
{
Tnum x = new Tnum(10);
x.AddState(new DateTime(2000,1,1), 1);
Assert.AreEqual("{Dawn: 9; 1/1/2000: 0}", (x-1).Out );
}
示例10: Test39b
public void Test39b()
{
Tnum t = new Tnum(0);
t.AddState(new DateTime(2000,1,1), 7);
Tnum res = t / 7;
Assert.AreEqual("{Dawn: 0; 1/1/2000: 1}", res.Out);
}
示例11: tnv
private static Tnum tnv()
{
Tnum result = new Tnum(Hstate.Stub);
result.AddState(Date(2001,1,1), Hstate.Uncertain);
result.AddState(Date(2002,1,1), Hstate.Unstated);
return result;
}
示例12: FT_ToInt_3
public void FT_ToInt_3()
{
Tnum t = new Tnum(42);
t.AddState(Date(1912,5,3), 43);
Assert.AreEqual(null, t.ToInt);
}
示例13: FT_ToDecimal_3
public void FT_ToDecimal_3()
{
Tnum t = new Tnum(42.13);
t.AddState(Date(1912,5,3), 43.13);
Assert.AreEqual(null, t.ToDecimal);
}
示例14: FT_Shift_3
public void FT_Shift_3()
{
Tnum t = new Tnum(0);
t.AddState(Date(2010,1,1), 100);
t.AddState(Date(2011,1,1), 200);
Tnum actual = t.Shift(2, TheYear);
Assert.AreEqual("{Dawn: 0; 1/1/2008: 100; 1/1/2009: 200}", actual.Out);
}
示例15: HasUndefinedIntervals3
public void HasUndefinedIntervals3()
{
Tnum r = new Tnum(7);
r.AddState(Date(2000,1,1), 6);
r.AddState(Date(2001,1,1), 2);
Assert.AreEqual(false, Util.HasUndefinedIntervals(r));
}