Fhernd

F16.java

Mar 7th, 2026
8,019
0
Never
15
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.26 KB | None | 0 0
  1. public interface IAircraft {
  2.    //Empty interface
  3. }
  4.  
  5. public class F16 implements IAircraft {
  6.  
  7.     private ParkedState parkedState = new ParkedState(this);
  8.     private CrashState crashState = new CrashState(this);
  9.     private LandState landState = new LandState(this);
  10.     private TaxiState taxiState = new TaxiState(this);
  11.     private AirborneState airborneState = new AirborneState(this);
  12.  
  13.     IPilotActions state;
  14.  
  15.     public F16() {
  16.         state = parkedState;
  17.     }
  18.  
  19.     void startsEngine() {
  20.         state.pilotTaxies(this);
  21.     }
  22.  
  23.     void fliesPlane() {
  24.         state.pilotFlies(this);
  25.     }
  26.  
  27.     void landsPlane() {
  28.         state.pilotLands(this);
  29.     }
  30.  
  31.     void ejectsPlane() {
  32.         state.pilotEjects(this);
  33.     }
  34.  
  35.     void parksPlane() {
  36.         state.pilotParks(this);
  37.     }
  38.  
  39.     void setState(IPilotActions IPilotActions) {
  40.         state = IPilotActions;
  41.     }
  42.  
  43.     ParkedState getParkedState() {
  44.         return parkedState;
  45.     }
  46.  
  47.     CrashState getCrashState() {
  48.         return crashState;
  49.     }
  50.  
  51.     LandState getLandState() {
  52.         return landState;
  53.     }
  54.  
  55.     TaxiState getTaxiState() {
  56.         return taxiState;
  57.     }
  58.  
  59.     public AirborneState getAirborneState() {
  60.         return airborneState;
  61.     }
  62.  
  63. }
Advertisement