spellcast.client
Class cengine

java.lang.Object
  extended by spellcast.client.cenginei
      extended by spellcast.client.cengine
All Implemented Interfaces:
java.lang.Runnable

public class cengine
extends cenginei
implements java.lang.Runnable


Field Summary
 
Fields inherited from class spellcast.client.cenginei
_LR_defaults_state, _LR_STATE_after_init, _LR_STATE_connected, _LR_STATE_defaults, _LR_STATE_not_connected, connect_event, disconnect_event, game_sync_event, game_update_event, io_error_event, message_event, ok_event, stop_event, terminate_event, the_exception_event, the_next_event, unknown_event
 
Constructor Summary
cengine(SpellcastView view, ClientConnectionHandler clientConnectionHandler)
           
 
Method Summary
 void add_connection()
          Add a wizard to the game.
 int cengine_execute(java.lang.String[] args)
           
 void connect_this_client()
          This is the first message received by the client.
 void display_message()
          Display a message to the client.
 void get_external_event()
           
 void handle_io_error()
           
 void handle_unknown_event()
           
 void initialise_the_program()
           
 int mapGameEventToStateMachineEvent()
           
 void remove_connection()
          If the target of this event is the client's wizardID then we gracefully shutdown.
 void run()
          When clientConnectionHandler has successfully connected to the Server it will create the cengine thread.
 void sync_game()
          If there is no game info, just use the one given.
 void update_game()
          A property has changed in the game.
 
Methods inherited from class spellcast.client.cenginei
execute, raise_exception
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

cengine

public cengine(SpellcastView view,
               ClientConnectionHandler clientConnectionHandler)
Method Detail

run

public void run()
When clientConnectionHandler has successfully connected to the Server it will create the cengine thread. This will read the events sent from the Server and process them. The thread will finish when the state machine terminates.

Specified by:
run in interface java.lang.Runnable

cengine_execute

public int cengine_execute(java.lang.String[] args)

initialise_the_program

public void initialise_the_program()
Specified by:
initialise_the_program in class cenginei

get_external_event

public void get_external_event()
Specified by:
get_external_event in class cenginei

mapGameEventToStateMachineEvent

public int mapGameEventToStateMachineEvent()

add_connection

public void add_connection()
Add a wizard to the game. This also notifies the view that a wizard was added and sends a messages indicating the connection.

Specified by:
add_connection in class cenginei

connect_this_client

public void connect_this_client()
This is the first message received by the client. From this message the server tells us what our WizardID is.

Specified by:
connect_this_client in class cenginei

remove_connection

public void remove_connection()
If the target of this event is the client's wizardID then we gracefully shutdown. Otherwise just display a message.

Specified by:
remove_connection in class cenginei

display_message

public void display_message()
Display a message to the client.

Specified by:
display_message in class cenginei

update_game

public void update_game()
A property has changed in the game. Update the local copy to reflect this change. PropertyChangeEvent's source is transient so we create a new local PropertyChangeEvent with the source field taken from the GameUpdateEvent.

Specified by:
update_game in class cenginei

handle_unknown_event

public void handle_unknown_event()
Specified by:
handle_unknown_event in class cenginei

sync_game

public void sync_game()
If there is no game info, just use the one given. Otherwise check to see what is different and include the new objects.

Specified by:
sync_game in class cenginei

handle_io_error

public void handle_io_error()
Specified by:
handle_io_error in class cenginei


Copyright © 2001-2005 Spellcast. All Rights Reserved.