public Automat( int numberOfApartments )
 {
     NumberOfApartments = numberOfApartments;
     WaitingState = new WaitingState( this );
     GotApplicationState = new GotApplicationState( this );
     ApartmentRentedState = new ApartmentRentedState( this );
     FullyRentedState = new FullyRentedState( this );
     state = WaitingState;
 }
        public AutomatServer()
        {
            NumberOfApartments = 9;
            WaitingState = new WaitingState( this );
            GotApplicationState = new GotApplicationState( this );
            ApartmentRentedState = new ApartmentRentedState( this );
            FullyRentedState = new FullyRentedState( this );
            state = WaitingState;

            thread = new Thread( Run );
            thread.Start();
        }