internal static TaskDurationDataSet Read(StateBinaryReader reader, VehicleSchedule schedule) { TaskDurationDataSet result = new TaskDurationDataSet(); result.DoRead(reader, schedule); return(result); }
public TaskDurationDataSet GetCopyWithAverageValues(Vehicle newVehicle, int dataBufferSize = 10) { TaskDurationDataSet result = new TaskDurationDataSet(dataBufferSize); CopyAverageValues(result, newVehicle); return(result); }
internal VehicleScheduleData(Vehicle vehicle) { this.Vehicle = vehicle; _travelData = new TaskTravelDurationDataSet(); _stationLoadingData = new TaskDurationDataSet(); _isDirty = true; _lastSnapshot = new Snapshot(vehicle.Schedule); }
/* Add own average values into the provided dataset */ public void AddAverageValuesToDataSet(TaskDurationDataSet data, Vehicle newVehicle) { foreach (KeyValuePair <RootTask, DurationDataSet> pair in _data) { TimeSpan?avg = pair.Value.Average; if (avg != null) { data.Add(newVehicle.Schedule.GetTasks()[pair.Key.GetIndex()], avg.Value); } } }
protected void CopyAverageValues(TaskDurationDataSet newDataSet, Vehicle newVehicle) { foreach (KeyValuePair <RootTask, DurationDataSet> pair in _data) { TimeSpan?avg = pair.Value.Average; if (avg != null) { newDataSet.Add(newVehicle.Schedule.GetTasks()[pair.Key.GetIndex()], avg.Value); } } }
internal static VehicleScheduleData Read(StateBinaryReader reader, Vehicle vehicle) { VehicleScheduleData result = new VehicleScheduleData(vehicle) { _travelData = TaskTravelDurationDataSet.Read(reader, vehicle.Schedule), _stationLoadingData = TaskDurationDataSet.Read(reader, vehicle.Schedule) }; if (reader.ReadBool()) { result._measurement = Measurement.Read(reader, vehicle.Schedule, result); } return(result); }