dk.itu.smds.torusman
Class Board

java.lang.Object
  extended by dk.itu.smds.torusman.Board

public class Board
extends java.lang.Object

Data structure for holding board data.


Field Summary
 byte[][] grid
          Board contents.
 int height
          Number of board rows; must be less than 256.
 int width
          Number of board columns; must be less than 256.
 
Constructor Summary
Board()
          Nullary constructor, only used for deserialization.
Board(int width, int height, byte[][] grid)
          Board constructor.
 
Method Summary
 void deserialize(java.io.DataInputStream in)
          Deserialize this object from a stream.
 void serialize(java.io.DataOutputStream out)
          Serialize this object to a stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

width

public int width
Number of board columns; must be less than 256.


height

public int height
Number of board rows; must be less than 256.


grid

public byte[][] grid
Board contents. grid[y][x] contains data for the tile at row y, column x. Note the order of x and y!

Constructor Detail

Board

public Board(int width,
             int height,
             byte[][] grid)
Board constructor. Note that the grid is copied into the board, not just referenced.

Parameters:
width - must be less than 256.
height - must be less than 256.
grid -

Board

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

Method Detail

serialize

public void serialize(java.io.DataOutputStream out)
               throws java.io.IOException
Serialize this object to a stream.

Throws:
java.io.IOException

deserialize

public void deserialize(java.io.DataInputStream in)
                 throws java.io.IOException
Deserialize this object from a stream.

Throws:
java.io.IOException