Class ScrabbleProtocol

java.lang.Object
  extended byScrabbleProtocol

public class ScrabbleProtocol
extends java.lang.Object

Class to handle message transaction in the remote game. Allows for simple encryption and coding of messages.

Version:
2.0
Author:
3GP01 - Hardev Bhamra, Deepak Chandarana, James Tompkin
See Also:
Client, ServerThread

Constructor Summary
ScrabbleProtocol()
           
 
Method Summary
 java.lang.String decryptMessage(java.lang.String ciphertext)
          Rotation method to decrypt the encoded message.
 java.lang.String encryptMessage(java.lang.String plaintext)
          Method to encypt a message based on a simple rotation.
 java.lang.String[] processInput(java.lang.String theInput)
          Processes an encrypted, coded message and returns a String array containing only the useful information.
 java.lang.String processOutput(int uid, int index, java.lang.String message)
          Constructs, codes and encrypts an outgoing message.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScrabbleProtocol

public ScrabbleProtocol()
Method Detail

encryptMessage

public java.lang.String encryptMessage(java.lang.String plaintext)
Method to encypt a message based on a simple rotation.

Parameters:
plaintext - The text to encrypt.
Returns:
String

decryptMessage

public java.lang.String decryptMessage(java.lang.String ciphertext)
Rotation method to decrypt the encoded message.

Parameters:
ciphertext - The ciphertext.
Returns:
String The plaintext.

processInput

public java.lang.String[] processInput(java.lang.String theInput)
Processes an encrypted, coded message and returns a String array containing only the useful information.

Parameters:
theInput - The ciphertext message.
Returns:
String[]

processOutput

public java.lang.String processOutput(int uid,
                                      int index,
                                      java.lang.String message)
Constructs, codes and encrypts an outgoing message.

Parameters:
uid - The unique identifier of the client.
index - The message type.
message - The message body.
Returns:
String The ciphertext.