Exemplo n.º 1
0
        public override AirplaneState ComputeNextState(FlightPlan flightPlan, AtcInstruction instruction)
        {
            FlightPlan.Validate(flightPlan);

            ApproachClearance approachClearance = instruction as ApproachClearance;

            if (approachClearance != null)
            {
                if (this.Fix == approachClearance.LocationOrLimit)
                {
                    return(new ApproachState(approachClearance.LocationOrLimit));
                }
            }

            EnrouteClearance enrouteClearance = instruction as EnrouteClearance;

            if (enrouteClearance != null)
            {
                Fix next = flightPlan.GetNextFix(this.Fix);

                if (enrouteClearance.IsClearedTo(this.Fix, next))
                {
                    return(new EnrouteState(this.Fix, next));
                }
            }

            // By default continue holding
            return(this);
        }
Exemplo n.º 2
0
        public override AirplaneState ComputeNextState(FlightPlan flightPlan, AtcInstruction instruction)
        {
            FlightPlan.Validate(flightPlan);

            if (this.To == flightPlan.Destination)
            {
                ApproachClearance clearance = instruction as ApproachClearance;
                if (clearance != null && clearance.LocationOrLimit == flightPlan.Destination)
                {
                    return(new ApproachState(flightPlan.Destination));
                }
                else
                {
                    return(new HoldingState(flightPlan.Destination));
                }
            }
            else
            {
                Fix next = flightPlan.GetNextFix(this.To);
                return(new EnrouteState(this.To, next));
            }
        }