LuigiEnzoFerrari / Java-path

In order to create great software, one doesn’t only write code, one needs to design it first. This project will introduce to you the concept of UML class diagrams and object oriented design patterns, all implemented in the Java language.
0 stars 0 forks source link

Bug skipt aricraft after unregistered #13

Closed LuigiEnzoFerrari closed 5 months ago

LuigiEnzoFerrari commented 5 months ago

Scenario 1

25 Baloon B1 2 3 20 Baloon B2 1 8 66 JetPlane J1 23 44 32 Helicopter H1 654 33 20 Helicopter H2 22 33 44 Helicopter H3 98 68 99 Baloon B3 102 22 34 JetPlane J2 11 99 768 Helicopter H4 223 23 54

Bug

When a aircraft is unregistered, skips the next one

simulation.txt

Tower says: Baloon#B1(0) registered to weather tower. Tower says: Baloon#B2(1) registered to weather tower. Tower says: JetPlane#J1(2) registered to weather tower. Tower says: Helicopter#H1(3) registered to weather tower. Tower says: Helicopter#H2(4) registered to weather tower. Tower says: Helicopter#H3(5) registered to weather tower. Tower says: Baloon#B3(6) registered to weather tower. Tower says: JetPlane#J2(7) registered to weather tower. Tower says: Helicopter#H4(8) registered to weather tower. Baloon#B1(0): Looks like we're inside a snow globe! Baloon#B2(1): Anyone up for high-altitude snowball fights JetPlane#J1(2): Sunscreen would have been a good idea up here! Helicopter#H1(3): It's hot Helicopter#H2(4): Playing hide and seek with the runway today Helicopter#H3(5): Snow's so heavy, I think my plane just hibernated. Baloon#B3(6): Time to trust the instruments more than my eyes JetPlane#J2(7): Anyone up for high-altitude snowball fights Helicopter#H4(8): It's a good day for ducks, not for flying! Baloon#B1(0): Snow way we're landing on time today! Tower says: Baloon#B1(0) unregistered from weather tower. JetPlane#J1(2): Sunscreen would have been a good idea up here! Helicopter#H1(3): Let's not fly too high or we are toast Helicopter#H2(4): Time to trust the instruments more than my eyes Helicopter#H3(5): Snow's so heavy, I think my plane just hibernated. Baloon#B3(6): At least the sky isn’t falling, just the water! JetPlane#J2(7): Anyone up for high-altitude snowball fights Helicopter#H4(8): I think I need an umbrella!

...

Baloon#B2(1): Snow way we're landing on time today! Tower says: Baloon#B2(1) unregistered from weather tower. Helicopter#H1(3): It's rainning Helicopter#H2(4): Time to trust the instruments more than my eyes Helicopter#H3(5): Who put this cloud in my way Baloon#B3(6): At least the sky isn’t falling, just the water! JetPlane#J2(7): Snow's so heavy, I think my plane just hibernated. Helicopter#H4(8): I think I need an umbrella!

Tower.java

protected void conditionChanged() {
    if (observers == null || observers.isEmpty() == true) {
        return ;
    }
    for (int i = 0; i < observers.size(); i++) {
        observers.get(i).updateConditions();
    }
};

When a aircraft is unregistered changes the size and elements locations of List observers