public void TestGetIndex() { var dt1 = DateTime.Parse("2000/01/01 12:30:00"); var dt2 = DateTime.Parse("2000/01/01 12:31:00"); var dt3 = DateTime.Parse("2000/01/01 12:32:00"); var dt4 = DateTime.Parse("2000/01/01 12:33:00"); var dt5 = DateTime.Parse("2000/01/01 12:34:00"); var ts = new MemorySeries(); ts.Add(new DataObject() {DateTime = dt1}); ts.Add(new DataObject() { DateTime = dt2 }); ts.Add(new DataObject() { DateTime = dt3 }); ts.Add(new DataObject() { DateTime = dt4 }); ts.Add(new DataObject() { DateTime = dt5 }); Assert.Equal(1, ts.GetIndex(dt2, SearchOption.ExactFirst)); Assert.Equal(1, ts.GetIndex(dt2, SearchOption.Next)); Assert.Equal(1, ts.GetIndex(dt2, SearchOption.Prev)); var dtBeforeFirstDt = DateTime.Parse("2000/01/01 12:29:11"); var dtAfterFirstDt = DateTime.Parse("2000/01/01 12:35:23"); var dtMiddle = DateTime.Parse("2000/01/01 12:33:54"); Assert.Equal(-1, ts.GetIndex(dtBeforeFirstDt, SearchOption.ExactFirst)); Assert.Equal(0, ts.GetIndex(dtBeforeFirstDt, SearchOption.Next)); Assert.Equal(-1, ts.GetIndex(dtBeforeFirstDt, SearchOption.Prev)); Assert.Equal(-1, ts.GetIndex(dtAfterFirstDt, SearchOption.ExactFirst)); Assert.Equal(-1, ts.GetIndex(dtAfterFirstDt, SearchOption.Next)); Assert.Equal(ts.Count - 1, ts.GetIndex(dtAfterFirstDt, SearchOption.Prev)); Assert.Equal(-1, ts.GetIndex(dtMiddle, SearchOption.ExactFirst)); Assert.Equal(3, ts.GetIndex(dtMiddle, SearchOption.Prev)); Assert.Equal(4, ts.GetIndex(dtMiddle, SearchOption.Next)); }
public void Transform() { MemorySeries s = new MemorySeries("PrivateBytes", 6); Assert.AreEqual(12.345678d, s.Transform("12345678")); // 12 MB. Assert.AreEqual(0f, s.Transform("0")); Assert.AreEqual(0f, s.Transform(null)); }
public Simulator() { this.Intervals = new IntervalList(); this.InputSeries = new DataSeriesList(); this.simulationMode = SimulationMode.MaxSpeed; this.speedMultiplier = 1.0; this.SmCegm8IIv = false; this.paused = false; this.step = 0; this.StepEnabled = false; this.ObjectsInInterval = 0; this.CurrentState = SimulatorState.Stopped; this.XyXefUib4X = new MemorySeries <SimpleDataObject>("what"); this.UseReversedArray = false; }
public void TestGetIndex() { var dt1 = DateTime.Parse("2000/01/01 12:30:00"); var dt2 = DateTime.Parse("2000/01/01 12:31:00"); var dt3 = DateTime.Parse("2000/01/01 12:32:00"); var dt4 = DateTime.Parse("2000/01/01 12:33:00"); var dt5 = DateTime.Parse("2000/01/01 12:34:00"); var ts = new MemorySeries(); ts.Add(new DataObject() { DateTime = dt1 }); ts.Add(new DataObject() { DateTime = dt2 }); ts.Add(new DataObject() { DateTime = dt3 }); ts.Add(new DataObject() { DateTime = dt4 }); ts.Add(new DataObject() { DateTime = dt5 }); Assert.Equal(1, ts.GetIndex(dt2, SearchOption.ExactFirst)); Assert.Equal(1, ts.GetIndex(dt2, SearchOption.Next)); Assert.Equal(1, ts.GetIndex(dt2, SearchOption.Prev)); var dtBeforeFirstDt = DateTime.Parse("2000/01/01 12:29:11"); var dtAfterFirstDt = DateTime.Parse("2000/01/01 12:35:23"); var dtMiddle = DateTime.Parse("2000/01/01 12:33:54"); Assert.Equal(-1, ts.GetIndex(dtBeforeFirstDt, SearchOption.ExactFirst)); Assert.Equal(0, ts.GetIndex(dtBeforeFirstDt, SearchOption.Next)); Assert.Equal(-1, ts.GetIndex(dtBeforeFirstDt, SearchOption.Prev)); Assert.Equal(-1, ts.GetIndex(dtAfterFirstDt, SearchOption.ExactFirst)); Assert.Equal(-1, ts.GetIndex(dtAfterFirstDt, SearchOption.Next)); Assert.Equal(ts.Count - 1, ts.GetIndex(dtAfterFirstDt, SearchOption.Prev)); Assert.Equal(-1, ts.GetIndex(dtMiddle, SearchOption.ExactFirst)); Assert.Equal(3, ts.GetIndex(dtMiddle, SearchOption.Prev)); Assert.Equal(4, ts.GetIndex(dtMiddle, SearchOption.Next)); }
public Simulator() { this.Intervals = new IntervalList(); this.InputSeries = new DataSeriesList(); this.simulationMode = SimulationMode.MaxSpeed; this.speedMultiplier = 1.0; this.SmCegm8IIv = false; this.paused = false; this.step = 0; this.StepEnabled = false; this.ObjectsInInterval = 0; this.CurrentState = SimulatorState.Stopped; this.XyXefUib4X = new MemorySeries<SimpleDataObject>("what"); this.UseReversedArray = false; }