Class MessageTemplate

java.lang.Object
  |
  +--PrintSuperClass
        |
        +--MessageTemplate
Direct Known Subclasses:
Message

public abstract class MessageTemplate
extends PrintSuperClass

Message SuperClass used by Battleship to send Message to Players

Only BattleShip$PlayerType may create authenicated messages. Has been made a template to facility the ability to send messages to other classes, SeriesRating and/or PerformanceRating


Field Summary
protected  java.lang.Object classPtr
          points to class object relative current message
protected  int details
          Details of current message, child must be able to set this on demand
protected  int msgID
           
 
Constructor Summary
MessageTemplate()
           
 
Method Summary
 boolean checkAuthenication(java.lang.Object forMe)
           
 void copy(MessageTemplate msg)
           
 int get()
           
 java.lang.Object getClassPointer()
           
 int getDetails()
           
abstract  java.lang.String getName()
           
 java.lang.Object getRecipient()
           
 java.lang.String getSignature()
           
 void print(java.io.PrintWriter pw)
           
 void println(java.io.PrintWriter pw)
           
protected  boolean setAuthenication(java.lang.Object cp, java.lang.Object r)
          used by battleship simulator to setAuthenicatioon Set authenication between sender BattleShip$PlayerType and recipient player Authenicator called by constructor
 void setClassPointer(java.lang.Object cp)
          Deprecated. done by setMessageID
abstract  java.lang.String toString()
           
 
Methods inherited from class PrintSuperClass
print, print, print, println, println, println
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

msgID

protected int msgID

details

protected int details
Details of current message, child must be able to set this on demand

classPtr

protected java.lang.Object classPtr
points to class object relative current message
Constructor Detail

MessageTemplate

public MessageTemplate()
Method Detail

copy

public final void copy(MessageTemplate msg)

checkAuthenication

public final boolean checkAuthenication(java.lang.Object forMe)
Parameters:
forMe - is your this player pointer
Returns:
true if sender and recipient are authorized

setAuthenication

protected final boolean setAuthenication(java.lang.Object cp,
                                         java.lang.Object r)
used by battleship simulator to setAuthenicatioon Set authenication between sender BattleShip$PlayerType and recipient player Authenicator called by constructor

getSignature

public final java.lang.String getSignature()
Returns:
returns signature of message sender

getRecipient

public final java.lang.Object getRecipient()
Returns:
intended recipient of message

setClassPointer

public void setClassPointer(java.lang.Object cp)
Deprecated. done by setMessageID


getClassPointer

public java.lang.Object getClassPointer()
Returns:
returns ClassPointer of current message note for message IDPlaceShips, classPtr represents the ship class to place your ships on

getDetails

public final int getDetails()
Returns:
details of current message

getName

public abstract java.lang.String getName()
Returns:
returns descriptive String name of current Message

print

public void print(java.io.PrintWriter pw)
Overrides:
print in class PrintSuperClass

println

public void println(java.io.PrintWriter pw)
Overrides:
println in class PrintSuperClass

toString

public abstract java.lang.String toString()
Overrides:
toString in class java.lang.Object

get

public int get()