本文整理汇总了C#中Route.CanAddOrder方法的典型用法代码示例。如果您正苦于以下问题:C# Route.CanAddOrder方法的具体用法?C# Route.CanAddOrder怎么用?C# Route.CanAddOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route.CanAddOrder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: executeStrategy
public override Solution executeStrategy(Solution toStartFrom)
{
var dayArray = Enum.GetValues(typeof(Days));
Days day = (Days)dayArray.GetValue(random.Next(1, dayArray.Length));
if (day.Equals(Days.None))
Console.WriteLine("Day is Days.None at RouteAddStrategy! FIX ME!");
routeCreated = new Route(day);
var allClusters = toStartFrom.GetAllClusters();
int clusterIndex = random.Next(allClusters.Count);
for (int i = 0; i < 16; i++) //64 -> 16
{
clusterIndex = random.Next(allClusters.Count);
if (allClusters[clusterIndex].AvailableOrdersInCluster.Count == 0)
continue;
int randomIndex = random.Next(allClusters[clusterIndex].AvailableOrdersInCluster.Count);
Order order = allClusters[clusterIndex].AvailableOrdersInCluster[randomIndex];
if (!routeCreated.CanAddOrder(order))
continue;
routeCreated.AddOrder(order);
order.RemoveAvailableOrderFromCluster();
}
if (routeCreated.Orders.Count > 1) // Does the route have orders added to it
{
toStartFrom.AddRoute(routeCreated);
strategyHasExecuted = true;
}
return toStartFrom;
}