/// <summary> /// Fill depot-specific properties. /// </summary> /// <param name="depot">Depot.</param> /// <param name="settings">Current solver settings.</param> /// <param name="result">Stop information to fill in.</param> private static void _FillDepotProperties(Location depot, SolverSettings settings, StopInfo result) { Debug.Assert(depot != null); Debug.Assert(result != null); // Fill curb approach policies. if (settings != null) { result.CurbApproach = settings.GetDepotCurbApproach(); } }
/// <summary> /// Fill order-specific properties. /// </summary> /// <param name="order">Order.</param> /// <param name="settings">Current solver settings.</param> /// <param name="result">Stop information to fill in.</param> private static void _FillOrderProperties(Order order, SolverSettings settings, StopInfo result) { Debug.Assert(order != null); Debug.Assert(result != null); result.OrderType = order.Type; result.Priority = order.Priority; result.MaxViolationTime = (int)order.MaxViolationTime; // Fill curb approach policies. if (settings != null) { result.CurbApproach = settings.GetOrderCurbApproach(); } }
/// <summary> /// Exports the specified stop into a serializable stop info object. /// </summary> /// <param name="stop">The reference to the stop object to be exported.</param> /// <param name="sortedRouteStops">A collection of route stops sorted by their sequence /// numbers.</param> /// <param name="exportOrderProperties">The reference to the collection /// of custom order properties to be exported.</param> /// <param name="addressProperties">The reference to the collection /// of order address properties to be exported.</param> /// <param name="capacityProperties">The reference to the collection /// of order capacity properties to be exported.</param> /// <param name="customProperties">The reference to the collection /// of custom order properties to be exported.</param> /// <param name="settings">Current solver settings to be used for retrieving stop /// properties.</param> /// <returns>A stop info object corresponding to the specified stop.</returns> private static StopInfo _ExportStop( Stop stop, IList <Stop> sortedRouteStops, IEnumerable <OrderPropertyInfo> exportOrderProperties, IEnumerable <OrderPropertyInfo> addressProperties, IEnumerable <OrderPropertyInfo> capacityProperties, IEnumerable <OrderPropertyInfo> customProperties, SolverSettings settings) { Debug.Assert(stop != null); Debug.Assert(sortedRouteStops != null); Debug.Assert(sortedRouteStops.All(s => s != null)); Debug.Assert(sortedRouteStops.All(s => stop.Route == s.Route)); var commentsProperties = _GetOrderProperties(stop, exportOrderProperties); var result = new StopInfo { Name = _GetStopName(stop, sortedRouteStops), Location = _GetStopLocation(stop, sortedRouteStops), Address = _GetOrderProperties(stop, addressProperties), Capacities = _GetOrderProperties(stop, capacityProperties), CustomOrderProperties = _GetOrderProperties(stop, customProperties), OrderComments = _GetOrderComments(commentsProperties), ArriveTime = stop.ArriveTime, }; // Fill optional order-specific or depot-specific properties. var order = stop.AssociatedObject as Order; var depot = stop.AssociatedObject as Location; if (order != null) { _FillOrderProperties(order, settings, result); } else if (depot != null) { _FillDepotProperties(depot, settings, result); } return(result); }
/// <summary> /// Exports the specified stop into a serializable stop info object. /// </summary> /// <param name="stop">The reference to the stop object to be exported.</param> /// <param name="sortedRouteStops">A collection of route stops sorted by their sequence /// numbers.</param> /// <param name="exportOrderProperties">The reference to the collection /// of custom order properties to be exported.</param> /// <param name="addressProperties">The reference to the collection /// of order address properties to be exported.</param> /// <param name="capacityProperties">The reference to the collection /// of order capacity properties to be exported.</param> /// <param name="customProperties">The reference to the collection /// of custom order properties to be exported.</param> /// <param name="settings">Current solver settings to be used for retrieving stop /// properties.</param> /// <returns>A stop info object corresponding to the specified stop.</returns> private static StopInfo _ExportStop( Stop stop, IList<Stop> sortedRouteStops, IEnumerable<OrderPropertyInfo> exportOrderProperties, IEnumerable<OrderPropertyInfo> addressProperties, IEnumerable<OrderPropertyInfo> capacityProperties, IEnumerable<OrderPropertyInfo> customProperties, SolverSettings settings) { Debug.Assert(stop != null); Debug.Assert(sortedRouteStops != null); Debug.Assert(sortedRouteStops.All(s => s != null)); Debug.Assert(sortedRouteStops.All(s => stop.Route == s.Route)); var commentsProperties = _GetOrderProperties(stop, exportOrderProperties); var result = new StopInfo { Name = _GetStopName(stop, sortedRouteStops), Location = _GetStopLocation(stop, sortedRouteStops), Address = _GetOrderProperties(stop, addressProperties), Capacities = _GetOrderProperties(stop, capacityProperties), CustomOrderProperties = _GetOrderProperties(stop, customProperties), OrderComments = _GetOrderComments(commentsProperties), ArriveTime = stop.ArriveTime, }; // Fill optional order-specific or depot-specific properties. var order = stop.AssociatedObject as Order; var depot = stop.AssociatedObject as Location; if (order != null) { _FillOrderProperties(order, settings, result); } else if (depot != null) { _FillDepotProperties(depot, settings, result); } return result; }