dk.itu.smds.torusman
Class DistTorus

java.lang.Object
  extended by dk.itu.smds.torusman.LocalTorus
      extended by dk.itu.smds.torusman.DistTorus
All Implemented Interfaces:
Torus

public class DistTorus
extends LocalTorus
implements Torus

The class DistTorus holds all information about a torus used in the mobile version of the Torus game.


Field Summary
 java.io.DataInputStream in
          The in.
 BTListener listener
          The listener.
 LocalMan myMan
          The man.
 java.io.DataOutputStream out
          The out.
 BTSender sender
          The sender.
 
Constructor Summary
DistTorus(byte[][][][] grid, LocalMan man)
          Instantiates a new dist. torus with a listener for packages and then a sender.
 
Method Summary
 Scores addPoints(byte manId, byte teamId, int points)
          First adds the points of the local torus and then sends the points to all the other players in the game using the bluetooth sender and then returns the score.
 Board getBoard(Man man)
          Gets the board of the man.
 void moveTo(ManData manData, byte X, byte Y)
          Moves the torus for the local player and send the relevant information to all other players.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sender

public BTSender sender
The sender.


listener

public BTListener listener
The listener.


in

public java.io.DataInputStream in
The in.


out

public java.io.DataOutputStream out
The out.


myMan

public LocalMan myMan
The man.

Constructor Detail

DistTorus

public DistTorus(byte[][][][] grid,
                 LocalMan man)
Instantiates a new dist. torus with a listener for packages and then a sender.

Parameters:
grid - the grid
man - the man
Method Detail

addPoints

public Scores addPoints(byte manId,
                        byte teamId,
                        int points)
First adds the points of the local torus and then sends the points to all the other players in the game using the bluetooth sender and then returns the score.

Specified by:
addPoints in interface Torus
Overrides:
addPoints in class LocalTorus
Parameters:
manId - the man id of the torus
teamId - the team id of the torus
points - the added points
Returns:
Scores
See Also:
LocalTorus.addPoints(byte, byte, int)

getBoard

public Board getBoard(Man man)
Gets the board of the man.

Specified by:
getBoard in interface Torus
Overrides:
getBoard in class LocalTorus
Parameters:
man - the given man
Returns:
Board
See Also:
LocalTorus.getBoard(dk.itu.smds.torusman.Man)

moveTo

public void moveTo(ManData manData,
                   byte X,
                   byte Y)
Moves the torus for the local player and send the relevant information to all other players.

Specified by:
moveTo in interface Torus
Overrides:
moveTo in class LocalTorus
Parameters:
manData - the man data to be sent
X - the new position
Y - the new position
See Also:
LocalTorus.moveTo(dk.itu.smds.torusman.ManData, byte, byte)