/// <summary> /// reverts to the specified time or the closest datapoint after and moves the skipped datapoints into an array in oldData removing them from the list /// </summary> /// <param name="time">the desired time to revert the simulation to</param> public void revertTo(double time) { List <DataPoint> tempList = new List <DataPoint>(); int revertTo = SortTools.IDbyTime(simulationData, time); for (int i = simulationData.Count - revertTo - 1; i < simulationData.Count; i++) { tempList.Add(simulationData.ElementAt(revertTo + 1)); simulationData.RemoveAt(revertTo + 1); } oldData.Add(tempList); }
/// <summary> /// returns a list containing all DataPoint structs within the requested timespan, inclusive. Defaults to closest after. /// </summary> /// <param name="fromTime">time of the earliest DataPoint desired</param> /// <param name="toTime">time of the latest DataPoint desired</param> /// <returns>returns a list of DataPoints</returns> public List <DataPoint> getSpan(double fromTime, double toTime) { int startID, endID; startID = SortTools.IDbyTime(simulationData, fromTime); endID = SortTools.IDbyTime(simulationData, toTime); List <DataPoint> DPlist = new List <DataPoint>(); for (int i = startID; i <= endID; i++) { DPlist.Add(simulationData.ElementAt(i)); } return(DPlist); }
/// <summary> /// returns the full DataPoint struct with the requested time, or the closest after /// </summary> /// <param name="time">the time for which data is desired</param> /// <returns>returns a DataPoint struct</returns> public DataPoint getDataPoint(double time) { return(SortTools.byTime(simulationData, time)); }