Appendix H Elevator Model (on CD) 1423 118 (Yahoo web space)
Appendix H Elevator Model (on CD) 1423 118 String locationName = location.getLocationName(); 119 120 // open Door on Floor Location 121 if ( !locationName.equals( ELEVATOR_NAME ) ) 122 location.getDoor().openDoor( location ); 123 124 // send DoorEvent to listener 125 elevatorDoorListener.doorOpened( new DoorEvent( 126 doorEvent.getSource(), Elevator.this )); 127 } 128 129 // invoked when elevatorDoor has closed 130 public void doorClosed( DoorEvent doorEvent ) 131 { 132 // get Location associated with DoorEvent 133 Location location = doorEvent.getLocation(); 134 String locationName = location.getLocationName(); 135 136 // close Door on Floor Location 137 if ( !locationName.equals( ELEVATOR_NAME ) ) 138 location.getDoor().closeDoor( location ); 139 140 // send DoorEvent to listener 141 elevatorDoorListener.doorClosed( new DoorEvent( 142 doorEvent.getSource(), Elevator.this )); 143 } 144 } // end anonymous inner class 145 ); 146 } // end Elevator constructor 147 148 // swaps current Floor Location with opposite Floor Location 149 private void changeFloors() 150 { 151 Location location = currentFloorLocation; 152 currentFloorLocation = destinationFloorLocation; 153 destinationFloorLocation = location; 154 } 155 156 // start Elevator thread 157 public void start() 158 { 159 if ( thread == null ) 160 thread = new Thread( this ); 161 162 elevatorRunning = true; 163 thread.start(); 164 } 165 Fig. H.12 Class Elevatorrepresents the Elevatortraveling between two Floors, operating asynchronously with other objects (part 4 of 9).
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.