Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

marauroa.game
Class RPServerManager  view RPServerManager download RPServerManager.java

java.lang.Object
  extended byjava.lang.Thread
      extended bymarauroa.game.RPServerManager
All Implemented Interfaces:
java.lang.Runnable

class RPServerManager
extends java.lang.Thread

This class is responsible for adding actions to scheduler, and to build and sent perceptions


Nested Class Summary
 
Nested classes inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  int deltaPerceptionSend
           
private  boolean isfinished
          isFinished is true when the thread has really exited.
private  boolean keepRunning
          The thread will be running while keepRunning is true
private  marauroa.net.NetworkServerManager netMan
          The networkServerManager so that we can send perceptions
private  PlayerEntryContainer playerContainer
          The PlayerEntryContainer so that we know where to send perceptions
private  RPRuleProcessor ruleProcessor
          The ruleProcessor that the scheduler will use to execute the actions
private  RPScheduler scheduler
          The scheduler needed to organize actions
private static int TOTAL_PERCEPTION_RELATION
          We send 1 TOTAL perception each TOTAL_PERCEPTION_RELATION DELTA perceptions
private  long turnDuration
          The time elapsed between 2 turns.
private  RPZone zone
          The place where the objects are stored
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RPServerManager(marauroa.net.NetworkServerManager netMan)
          Constructor
RPServerManager(marauroa.net.NetworkServerManager netMan, RPZone zone, RPRuleProcessor ruleProcessor, long turnDuration)
          Constructor
 
Method Summary
 void addRPAction(RPAction action)
           
 void addRPObject(RPObject object)
           
private  void buildPerceptions()
           
 void finish()
           
 RPObject getRPObject(RPObject.ID id)
           
 boolean hasRPObject(RPObject.ID id)
           
 RPObject removeRPObject(RPObject.ID id)
           
private  void removeTimedoutPlayers(java.util.List playersToRemove)
           
 void run()
          The method of Thread that will be run if there is no Runnable object associated with the Thread.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOTAL_PERCEPTION_RELATION

private static final int TOTAL_PERCEPTION_RELATION
We send 1 TOTAL perception each TOTAL_PERCEPTION_RELATION DELTA perceptions

See Also:
Constant Field Values

keepRunning

private boolean keepRunning
The thread will be running while keepRunning is true


isfinished

private boolean isfinished
isFinished is true when the thread has really exited.


turnDuration

private long turnDuration
The time elapsed between 2 turns.


scheduler

private RPScheduler scheduler
The scheduler needed to organize actions


ruleProcessor

private RPRuleProcessor ruleProcessor
The ruleProcessor that the scheduler will use to execute the actions


zone

private RPZone zone
The place where the objects are stored


netMan

private marauroa.net.NetworkServerManager netMan
The networkServerManager so that we can send perceptions


playerContainer

private PlayerEntryContainer playerContainer
The PlayerEntryContainer so that we know where to send perceptions


deltaPerceptionSend

private int deltaPerceptionSend
Constructor Detail

RPServerManager

public RPServerManager(marauroa.net.NetworkServerManager netMan)
Constructor


RPServerManager

public RPServerManager(marauroa.net.NetworkServerManager netMan,
                       RPZone zone,
                       RPRuleProcessor ruleProcessor,
                       long turnDuration)
Constructor

Method Detail

finish

public void finish()

addRPAction

public void addRPAction(RPAction action)
                 throws RPScheduler.ActionInvalidException

addRPObject

public void addRPObject(RPObject object)
                 throws RPZone.RPObjectInvalidException

getRPObject

public RPObject getRPObject(RPObject.ID id)
                     throws RPZone.RPObjectNotFoundException

hasRPObject

public boolean hasRPObject(RPObject.ID id)

removeRPObject

public RPObject removeRPObject(RPObject.ID id)
                        throws RPZone.RPObjectNotFoundException

buildPerceptions

private void buildPerceptions()

removeTimedoutPlayers

private void removeTimedoutPlayers(java.util.List playersToRemove)

run

public void run()
Description copied from class: java.lang.Thread
The method of Thread that will be run if there is no Runnable object associated with the Thread. Thread's implementation does nothing at all.