|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mega.gasp.platform.impl.ApplicationInstanceImpl
ApplicationInstance represent a game session of a specific application. It contains a vector of ActorSession representing the actors want to play in. This classes manage the in game events.
Field Summary | |
private java.util.Vector |
actorSessions
|
private int |
applicationInstanceID
|
private java.lang.String |
applicationInstanceName
|
private byte |
applicationModel
|
private org.apache.log4j.Category |
cat
|
private CustomTypes |
customTypes
|
private boolean |
isPublicAI
|
private boolean |
isRunningAI
|
private java.util.Vector |
listeners
|
private MasterApplicationInstance |
masterApp
|
private int |
maxA
|
private int |
minA
|
private int |
ownerActorSessionID
|
private GASPServer |
server
|
private boolean |
toDestroy
|
Constructor Summary | |
ApplicationInstanceImpl(MasterApplicationInstance masterApplication,
Session ownerSession,
int minActors,
int maxActors,
java.lang.String[] actors,
java.lang.String path,
byte model)
|
Method Summary | |
int |
actorSessionSize()
Returns the current number of ActorSession objects, e.g the number of actors ready to play this game session. |
private void |
addActors(java.lang.String[] actors)
Set the pool of actors required for a private Application Instance. |
boolean |
addActorSession(ActorSession actorSession)
Add the actor to the actors vector. |
void |
addListener(java.lang.Object listener)
Provides to add a listener on events of application instance. |
boolean |
containsActorSession(int actorSessionID)
Determine if the ActorSession associated with the ActorSession ID is contained by this ApplicationInstance or not. |
int |
createNewActorSession(int aIID,
Session session)
Create a new ActorSession in the ApplicationInstance corresponding to the user Session object informations. |
java.util.Iterator |
enumerateActorSession()
Returns an iterator on the actor sessions vector. |
ActorSession |
getActorSession(int actorSessionID)
Returns the ActorSession object corresponding to the ActorSession ID. |
int |
getApplicationInstanceID()
Returns the ID of the ApplicationInstance. |
ApplicationInstanceInfos |
getApplicationInstanceInfos()
For Lobby service, this method provide informations of the ApplicationInstance. |
java.lang.String |
getApplicationInstanceName()
Returns the name of the ApplicationInstance. |
CustomTypes |
getCustomTypes()
Returns the encoder of the application associated with the application instance. |
int |
getMaxActors()
Returns the maximum number of actors can play the game session. |
int |
getMinActors()
Returns the minimum number of actors required to start the game session. |
int |
getOwnerAID()
Returns the ActorId of the ApplicationInstanceID owner. |
GASPServer |
getServer()
Returns the server associated with the ApplicationInstance. |
boolean |
isActorSessionEmpty()
Determine if the vector of ActorSession objects is empty or not. |
boolean |
isDestroyable()
Determine if the owner master application can destroy or not the AI. |
boolean |
isJoinable()
Determine if the the application instance is joignable by a player or not, eg if: the AI is not destroyable the AI is not running the max of players is reached |
boolean |
isPublic()
Determine if the ApplicationInstance is public or not. |
boolean |
isRunning()
Determine if the ApplicationInstance is running or not. |
boolean |
isStartable()
Determine if the the application instance is startable by the player owner or not. |
private void |
notifyDataToListeners(DataEvent e)
Raise the DataEvent to all external listenners, in particular the game server logic thread. |
private void |
notifyEndToListeners(EndEvent e)
Raise the EndEvent to all external listenners, in particular the game server logic thread. |
private void |
notifyJoinToListeners(JoinEvent e)
Raise the JoinEvent to all external listenners, in particular the game server logic thread. |
private void |
notifyQuitToListeners(QuitEvent e)
Raise the QuitEvent to all external listenners, in particular the game server logic thread. |
private void |
notifyStartToListeners(StartEvent e)
Raise the StartEvent to all external listenners, in particular the game server logic thread. |
private void |
notifyToAllOtherActorSession(Event e)
Put the event in event vectors of the ApplicationInstance ActorSessions. |
void |
onDataEvent(DataEvent e)
When a DataEvent arrives, notify to all listeners. |
void |
onEndEvent(EndEvent e)
When a EndEvent arrives, if the actor session ID of the event is the ownerASID then notify to all listeners and to all other actor sessions else do nothing. |
void |
onJoinEvent(JoinEvent e)
When a JoinEvent arrives, notify to all listeners and to all other actor sessions |
void |
onQuitEvent(QuitEvent qe)
When a QuitEvent arrives, then notify to all listeners and to all other actor sessions |
void |
onStartEvent(StartEvent e)
When a StartEvent arrives, if the actor session ID of the event is the ownerASID then notify to all listeners and to all other actor sessions else do nothing. |
void |
raisePseudoModification(int actorSessionID,
java.lang.String pseudoname)
Raise a JoinEvent to all other players containing the new pseudo |
boolean |
removeActorSession(int actorSessionID)
Remove the ActorSession object corresponding to the ActorSessionID. |
int |
retrieveApplicationID()
Retrieve the applicationID from the master application instance. |
void |
sendDataToActorSession(int actorSessionID,
DataEvent dataEvent)
Send a dataEvent to a specific actorSession. |
private void |
sendPlayersInfos(ActorSession actorSession)
This method provide the new player to know all of the players currently in the application instance. |
void |
sendPlayersInfos(int aSID)
This method provide the new player to know all of the players currently in the application instance. |
void |
setApplicationInstanceName(java.lang.String appInstanceName)
Specify the name of the Application Instance. |
java.lang.String |
treatPseudo(java.lang.String name)
If the pseudo already exist in the AI modify it, else no modifications. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.util.Vector actorSessions
private int applicationInstanceID
private MasterApplicationInstance masterApp
private int ownerActorSessionID
private int minA
private int maxA
private java.lang.String applicationInstanceName
private boolean isPublicAI
private boolean isRunningAI
private java.util.Vector listeners
private CustomTypes customTypes
private GASPServer server
private org.apache.log4j.Category cat
private byte applicationModel
private boolean toDestroy
Constructor Detail |
public ApplicationInstanceImpl(MasterApplicationInstance masterApplication, Session ownerSession, int minActors, int maxActors, java.lang.String[] actors, java.lang.String path, byte model)
Method Detail |
public GASPServer getServer()
getServer
in interface ApplicationInstance
public int getApplicationInstanceID()
getApplicationInstanceID
in interface ApplicationInstance
public int getMinActors()
getMinActors
in interface ApplicationInstance
public int getMaxActors()
getMaxActors
in interface ApplicationInstance
public int getOwnerAID()
getOwnerAID
in interface ApplicationInstance
public CustomTypes getCustomTypes()
getCustomTypes
in interface ApplicationInstance
public boolean isPublic()
isPublic
in interface ApplicationInstance
public boolean isRunning()
isRunning
in interface ApplicationInstance
public boolean isDestroyable()
isDestroyable
in interface ApplicationInstance
public boolean isJoinable()
isJoinable
in interface ApplicationInstance
public boolean isStartable()
isStartable
in interface ApplicationInstance
public int createNewActorSession(int aIID, Session session)
createNewActorSession
in interface ApplicationInstance
aIID
- the ApplicationInstancesession
- the Session object of the user
public void sendPlayersInfos(int aSID)
sendPlayersInfos
in interface ApplicationInstance
aSID
- the actor session associated to the playerprivate void sendPlayersInfos(ActorSession actorSession)
actorSession
- the actor session associated to the playerpublic ActorSession getActorSession(int actorSessionID)
getActorSession
in interface ApplicationInstance
actorSessionID
- the ActorSession ID
public boolean removeActorSession(int actorSessionID)
removeActorSession
in interface ApplicationInstance
actorSessionID
- the ActorSesion ID
public boolean isActorSessionEmpty()
isActorSessionEmpty
in interface ApplicationInstance
public int actorSessionSize()
actorSessionSize
in interface ApplicationInstance
public boolean containsActorSession(int actorSessionID)
containsActorSession
in interface ApplicationInstance
actorSessionID
-
public ApplicationInstanceInfos getApplicationInstanceInfos()
getApplicationInstanceInfos
in interface ApplicationInstance
public java.lang.String getApplicationInstanceName()
public java.util.Iterator enumerateActorSession()
enumerateActorSession
in interface ApplicationInstance
private void addActors(java.lang.String[] actors)
actors
- the table of actorIDpublic void setApplicationInstanceName(java.lang.String appInstanceName)
setApplicationInstanceName
in interface ApplicationInstance
appInstanceName
- public boolean addActorSession(ActorSession actorSession)
addActorSession
in interface ApplicationInstance
actorSession
- the ActorSession object
public void onJoinEvent(JoinEvent e)
onJoinEvent
in interface OnJoinEvent
public void onStartEvent(StartEvent e)
onStartEvent
in interface OnStartEvent
public void onEndEvent(EndEvent e)
onEndEvent
in interface OnEndEvent
public void onQuitEvent(QuitEvent qe)
onQuitEvent
in interface OnQuitEvent
public void onDataEvent(DataEvent e)
onDataEvent
in interface OnDataEvent
public void addListener(java.lang.Object listener)
listener
- the object to become a listenerprivate void notifyToAllOtherActorSession(Event e)
e
- the eventprivate void notifyJoinToListeners(JoinEvent e)
e
- the JoinEventprivate void notifyEndToListeners(EndEvent e)
e
- the EndEventprivate void notifyStartToListeners(StartEvent e)
e
- the StartEventprivate void notifyQuitToListeners(QuitEvent e)
e
- the QuitEventprivate void notifyDataToListeners(DataEvent e)
e
- the DataEventpublic void sendDataToActorSession(int actorSessionID, DataEvent dataEvent)
sendDataToActorSession
in interface ApplicationInstance
actorSessionID
- dataEvent
- public java.lang.String treatPseudo(java.lang.String name)
treatPseudo
in interface ApplicationInstance
name
-
public void raisePseudoModification(int actorSessionID, java.lang.String pseudoname)
raisePseudoModification
in interface ApplicationInstance
actorSessionID
- public int retrieveApplicationID()
retrieveApplicationID
in interface ApplicationInstance
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |