|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsjrd.tricktakinggame.network.NetworkConnection
sjrd.tricktakinggame.network.ThreadedConnection
sjrd.tricktakinggame.network.commands.CommandBasedConnection
public class CommandBasedConnection
Connexion basée sur la réponse à des commandes
Field Summary | |
---|---|
protected List<Command> |
commands
Liste des commandes |
private boolean |
executingCommand
Indique si une commande est en cours d'exécution |
private Object |
executingCommandLock
Verrou de la propriété executingCommand |
Fields inherited from class sjrd.tricktakinggame.network.NetworkConnection |
---|
reader, socket, writer |
Constructor Summary | |
---|---|
CommandBasedConnection(Socket aSocket)
Crée une connexion base sur la réponse à des commandes |
|
CommandBasedConnection(Socket aSocket,
boolean createSuspended)
Crée une connexion base sur la réponse à des commandes |
Method Summary | |
---|---|
protected void |
checkParameters(Command command,
String[] commandLine)
Vérifie les paramètres pour une commande |
protected void |
execute()
Lit et exécute une commande |
protected void |
executeCommand(Command command,
String[] commandLine)
Exécute une commande |
protected Command |
findCommandByName(String commandName)
Trouve une commande à partir de son nom |
boolean |
isExecutingCommand()
Indique si une commande est en train d'être exécutée |
private void |
setExecutingCommand(boolean value)
Modifie l'état d'exécution de commande |
Methods inherited from class sjrd.tricktakinggame.network.ThreadedConnection |
---|
getThread, onIOException, onNetworkException, onThreadTerminated, recreateThread |
Methods inherited from class sjrd.tricktakinggame.network.NetworkConnection |
---|
close, getReader, getSocket, getWriter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final List<Command> commands
private final Object executingCommandLock
private boolean executingCommand
Constructor Detail |
---|
public CommandBasedConnection(Socket aSocket, boolean createSuspended) throws IOException
aSocket
- createSuspended
-
IOException
public CommandBasedConnection(Socket aSocket) throws IOException
aSocket
-
IOException
Method Detail |
---|
public boolean isExecutingCommand()
private void setExecutingCommand(boolean value)
value
- true si en train d'exécuter une commande,
false sinonprotected Command findCommandByName(String commandName)
commandName
- Nom de la commande
protected void checkParameters(Command command, String[] commandLine) throws NetworkProtocolException
command
- CommandecommandLine
- Ligne de commande
NetworkProtocolException
- Paramètres invalidesprotected void executeCommand(Command command, String[] commandLine) throws IOException
command
- Commande à exécutercommandLine
- Ligne de commande
NetworkProtocolException
- Erreur de protocole
NetworkException
- Erreur de réseau
IOException
- Erreur de communicationprotected void execute() throws IOException
execute
in class ThreadedConnection
NetworkException
- Erreur réseau
IOException
- Erreur I/OThreadedConnection.execute()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |