dk.itu.smds.torusman
Class LocalMan

java.lang.Object
  extended by dk.itu.smds.torusman.LocalMan
All Implemented Interfaces:
Man

public class LocalMan
extends java.lang.Object
implements Man

The Class LocalMan.


Nested Class Summary
 class LocalMan.Other
          Structure to hold other's position and data freshness.
 
Field Summary
 int key_down
          The key_down.
 int key_left
          The key_left.
 int key_right
          The key_right.
 int key_up
          The key_up.
 ManData manData
          Man and team ID, and position and direction within the board.
 java.util.Hashtable otherMen
          A table mapping other men's ID to their current position
 Scores scores
          A table mapping a teamID to current score.
 int time
          The LocalMan's notion of time.
 
Constructor Summary
LocalMan()
          Nullary constructor, used only for deserialization.
LocalMan(byte manId, byte teamId, int key_up, int key_down, int key_left, int key_right)
          Instantiates a new local man.
 
Method Summary
 void deserialize(java.io.DataInputStream in)
          (non-Javadoc)
 byte getManId()
          (non-Javadoc)
 byte getX()
          (non-Javadoc)
 byte getY()
          (non-Javadoc)
 void movedTo(ManData manData)
          (non-Javadoc)
 void serialize(java.io.DataOutputStream out)
          (non-Javadoc)
 void updatePoints(Scores scores)
          (non-Javadoc)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

manData

public ManData manData
Man and team ID, and position and direction within the board.


time

public int time
The LocalMan's notion of time. The time displayed on the playing field is some constant fraction of this value.


otherMen

public java.util.Hashtable otherMen
A table mapping other men's ID to their current position


scores

public Scores scores
A table mapping a teamID to current score.


key_up

public int key_up
The key_up.


key_down

public int key_down
The key_down.


key_left

public int key_left
The key_left.


key_right

public int key_right
The key_right.

Constructor Detail

LocalMan

public LocalMan(byte manId,
                byte teamId,
                int key_up,
                int key_down,
                int key_left,
                int key_right)
Instantiates a new local man.

Parameters:
manId - the man id
teamId - the team id
key_up - the key_up
key_down - the key_down
key_left - the key_left
key_right - the key_right

LocalMan

public LocalMan()
Nullary constructor, used only for deserialization.

Method Detail

getManId

public byte getManId()
(non-Javadoc)

Specified by:
getManId in interface Man
Returns:
the man id
See Also:
Man.getManId()

getX

public byte getX()
(non-Javadoc)

Specified by:
getX in interface Man
Returns:
the X
See Also:
Man.getX()

getY

public byte getY()
(non-Javadoc)

Specified by:
getY in interface Man
Returns:
the Y
See Also:
Man.getY()

movedTo

public void movedTo(ManData manData)
(non-Javadoc)

Specified by:
movedTo in interface Man
Parameters:
manData - the man data
See Also:
Man.movedTo(dk.itu.smds.torusman.ManData)

updatePoints

public void updatePoints(Scores scores)
(non-Javadoc)

Specified by:
updatePoints in interface Man
Parameters:
scores - Table mapping teamId to team points.
See Also:
Man.updatePoints(dk.itu.smds.torusman.Scores)

serialize

public void serialize(java.io.DataOutputStream out)
               throws java.io.IOException
(non-Javadoc)

Specified by:
serialize in interface Man
Parameters:
out - the out
Throws:
java.io.IOException - Signals that an I/O exception has occurred.
See Also:
Man.serialize(java.io.DataOutputStream)

deserialize

public void deserialize(java.io.DataInputStream in)
                 throws java.io.IOException
(non-Javadoc)

Specified by:
deserialize in interface Man
Parameters:
in - the in
Throws:
java.io.IOException - Signals that an I/O exception has occurred.
See Also:
Man.deserialize(java.io.DataInputStream)