/// <summary> /// Calculcates the metrics. /// </summary> /// <param name="vehicle"></param> /// <param name="p"></param> /// <returns></returns> public override Dictionary <string, double> Calculate(Vehicle vehicle, AggregatedPoint p) { Dictionary <string, double> result = new Dictionary <string, double>(); result.Add(DISTANCE_KEY, 0); result.Add(TIME_KEY, 0); Aggregated next = p; while (next != null) { if (next is AggregatedPoint) { AggregatedPoint point = (next as AggregatedPoint); this.CalculatePointMetrics(vehicle, result, point); } if (next is AggregatedArc) { AggregatedArc arc = (next as AggregatedArc); this.CalculateArcMetrics(vehicle, result, arc); } next = next.GetNext(); } return(result); }
/// <summary> /// Plans all the messages in the aggregated /// </summary> /// <param name="p"></param> public List <Instruction> Plan(AggregatedPoint p) { // set the current aggregated object. _current = p; // loop until the current object is null. while (_current != null) { while (_current != null) { if (_current is AggregatedPoint) { if ((_current as AggregatedPoint).Location.Latitude == 51.254875183105469) { Console.WriteLine("BINGO!"); } } // plan the current message. this.PlanNewMessage(_current); // get the next object. _current = _current.GetNext(); } // show the latest success anyway. if (_latest_final >= 0) { // do the latest succes. this.Success(_latest_machine); // get the next object. if (_current != null) { _current = _current.GetNext(); } } else if (_messages_stack.Count > 0) { // no machine matches everything until the end of the route. throw new MicroPlannerException("No machine could be found matching the current stack of messages!", _messages_stack); } } // return the instructions list accumulated in the scentence planner. return(this.SentencePlanner.Instructions); }
/// <summary> /// Plans all the messages in the aggregated /// </summary> /// <param name="route"></param> /// <param name="p"></param> public List <Instruction> Plan(Route route, AggregatedPoint p) { // set the current aggregated object. _current = p; // loop until the current object is null. while (_current != null) { while (_current != null) { // plan the current message. this.PlanNewMessage(route, _current); // get the next object. _current = _current.GetNext(); } // show the latest success anyway. if (_latestFinal >= 0) { // do the latest succes. this.Success(_latestMachine); // get the next object. if (_current != null) { _current = _current.GetNext(); } } else if (_messagesStack.Count > 0) { // no machine matches everything until the end of the route. throw new MicroPlannerException("No machine could be found matching the current stack of messages!", _messagesStack); } } // return the instructions list accumulated in the scentence planner. return(this.SentencePlanner.Instructions); }