/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lane"></param>
 public StayInLaneState(ArbiterLane lane, Probability confidence, IState previous)
 {
     this.Lane = lane;
     this.internalLaneState = new InternalState(lane.LaneId, lane.LaneId, confidence);
     this.IgnorableWaypoints = new List<IgnorableWaypoint>();
     this.CheckPreviousState(previous);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lane"></param>
 /// <param name="stopPoint"></param>
 /// <param name="currentPosition"></param>
 /// <param name="timeStamp"></param>
 public StoppingState(ArbiterLane lane, Coordinates stopPoint, Coordinates currentPosition, double timeStamp)
 {
     this.lane = lane;
     this.stopPoint = stopPoint;
     this.currentPosition = currentPosition;
     this.timeStamp = timeStamp;
     this.internalState = new InternalState(lane.LaneId, lane.LaneId);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lane"></param>
 /// <param name="waypoint"></param>
 /// <param name="turnDirection"></param>
 /// <param name="isNavigationExit"></param>
 /// <param name="desiredExit"></param>
 public StoppingAtStopState(ArbiterLane lane, ArbiterWaypoint waypoint, ArbiterTurnDirection turnDirection,
     bool isNavigationExit, ArbiterInterconnect desiredExit)
 {
     this.lane = lane;
     this.waypoint = waypoint;
     this.turnDirection = turnDirection;
     this.isNavigationExit = isNavigationExit;
     this.desiredExit = desiredExit;
     this.internalLaneState = new InternalState(lane.LaneId, lane.LaneId);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lane"></param>
 /// <param name="waypoint"></param>
 /// <param name="turnDirection"></param>
 /// <param name="isNavigationExit"></param>
 /// <param name="desiredExit"></param>
 public StoppingAtExitState(ArbiterLane lane, ArbiterWaypoint waypoint, ArbiterTurnDirection turnDirection,
     bool isNavigationExit, ArbiterInterconnect desiredExit, double timeStamp, Coordinates currentPosition)
 {
     this.lane = lane;
     this.waypoint = waypoint;
     this.turnDirection = turnDirection;
     this.isNavigationExit = isNavigationExit;
     this.desiredExit = desiredExit;
     this.internalLaneState = new InternalState(lane.LaneId, lane.LaneId);
     this.timeStamp = timeStamp;
     this.currentPosition = currentPosition;
     this.internalLaneState = new InternalState(this.lane.LaneId, this.lane.LaneId);
 }
        /// <summary>
        /// Updates teh internal state
        /// </summary>
        /// <param name="updatedState"></param>
        /// <param name="reset"></param>
        public void UpdateInternal(InternalState updatedState, bool reset)
        {
            if (reset)
            {
                this.PosteriorEvidence = new List<PosteriorEvidence>();
                this.PosteriorEvidence.Add(new PosteriorEvidence(new Dictionary<ArbiterLane, double>()));

                this.InternalState = new List<InternalState>();
                this.InternalState.Add(updatedState);
                this.InternalState.Add(updatedState);

                this.FilteredEstimate = new List<Probability>();
                this.FilteredEstimate.Add(updatedState.Confidence);
            }
            else
            {
                if (this.PosteriorEvidence.Count >= maxSteps)
                    this.PosteriorEvidence.RemoveAt(0);

                if (this.InternalState.Count >= maxSteps)
                    this.InternalState.RemoveAt(0);

                if (this.FilteredEstimate.Count >= maxSteps)
                    this.FilteredEstimate.RemoveAt(0);

                this.InternalState.Add(updatedState);
            }

            CoreCommon.CurrentInformation.LAInitial = updatedState.Target != null ? updatedState.Initial.ToString() : "";
            CoreCommon.CurrentInformation.LATarget = updatedState.Target != null ? updatedState.Target.ToString() : "";
        }