// @topic S-0314-13-04-10 Java Iterator and Visitor patterns
// @brief How to prevent ConcurrentModificationException

package week11;

import java.util.ArrayList;

public class MainApp {
    public static final int GARAGE_FLOOR = 0;

    public static void main(String[] args) {

        // building configuration being executed:
        ArrayList< Floor > floors = new ArrayList();
        floors.add( new Floor() );

        // scenario starts: create some visitors
        // and deposit them at a certain location:
        Floor garage = floors.get( GARAGE_FLOOR );
        garage.visitorArrived( new Visitor() );
        garage.visitorArrived( new Visitor() );
        garage.visitorArrived( new Visitor() );

        // scenario is running: generic updates
        // are issued by the background thread
        // at specific time intervals:
        System.out.println("\tFirst update:");
        garage.update();

        System.out.println("\tSecond update:");
        garage.update();
        
        //...Third update, and so on...

    }//main
    
}//class MainApp