net.jetrix
Class Field

java.lang.Object
  extended by net.jetrix.Field

public class Field
extends Object

A game field.

Version:
$Revision: 870 $, $Date: 2010-09-16 22:50:33 +0200 (jeu., 16 sept. 2010) $
Author:
Emmanuel Bourg

Field Summary
static byte BLOCK_BLUE
           
static byte BLOCK_GREEN
           
static byte BLOCK_PREVIOUS
           
static byte BLOCK_PURPLE
           
static byte BLOCK_RED
           
static byte BLOCK_VOID
           
static byte BLOCK_YELLOW
           
static int HEIGHT
           
static int WIDTH
           
 
Constructor Summary
Field()
           
Field(byte[][] field)
           
 
Method Summary
 void clear()
          Clear the field.
 boolean contains(Special special)
          Check if the field contains the specified special block.
 boolean containsSpecialBlock()
          Check if the field contains a special block.
 byte getBlock(int x, int y)
          Return the block at the specified location. (0, 0) is the bottom left block, and (11, 21) is the upper right block.
 String getFieldString()
          Return the string representing this field as used in the FieldMessage messages.
 int getHighest()
          Return the height of the highest block.
 boolean hasHoles()
          Check if the field has holes (i.e. if a gravity block may have an effect).
 boolean isEmpty()
          Check if the field is empty.
 void load(InputStream in)
          Load the field from the specified stream
 void load(String file)
          Load the field from the specified file
 void save(String file)
          Save the field to the specified file.
 void update(FieldMessage message)
          Update the field with the specified FieldMessage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WIDTH

public static final int WIDTH
See Also:
Constant Field Values

HEIGHT

public static final int HEIGHT
See Also:
Constant Field Values

BLOCK_VOID

public static final byte BLOCK_VOID
See Also:
Constant Field Values

BLOCK_BLUE

public static final byte BLOCK_BLUE
See Also:
Constant Field Values

BLOCK_YELLOW

public static final byte BLOCK_YELLOW
See Also:
Constant Field Values

BLOCK_GREEN

public static final byte BLOCK_GREEN
See Also:
Constant Field Values

BLOCK_PURPLE

public static final byte BLOCK_PURPLE
See Also:
Constant Field Values

BLOCK_RED

public static final byte BLOCK_RED
See Also:
Constant Field Values

BLOCK_PREVIOUS

public static final byte BLOCK_PREVIOUS
See Also:
Constant Field Values
Constructor Detail

Field

public Field()

Field

public Field(byte[][] field)
Method Detail

isEmpty

public boolean isEmpty()
Check if the field is empty.


contains

public boolean contains(Special special)
Check if the field contains the specified special block.

Parameters:
special - the special to check
Since:
0.3

containsSpecialBlock

public boolean containsSpecialBlock()
Check if the field contains a special block.


hasHoles

public boolean hasHoles()
Check if the field has holes (i.e. if a gravity block may have an effect).

Since:
0.3

getHighest

public int getHighest()
Return the height of the highest block.

Since:
0.3

update

public void update(FieldMessage message)
Update the field with the specified FieldMessage.


getFieldString

public String getFieldString()
Return the string representing this field as used in the FieldMessage messages.


getBlock

public byte getBlock(int x,
                     int y)
Return the block at the specified location. (0, 0) is the bottom left block, and (11, 21) is the upper right block.

Parameters:
x -
y -

clear

public void clear()
Clear the field.


load

public void load(InputStream in)
          throws IOException
Load the field from the specified stream

Throws:
IOException
Since:
0.3

load

public void load(String file)
          throws IOException
Load the field from the specified file

Throws:
IOException
Since:
0.3

save

public void save(String file)
          throws IOException
Save the field to the specified file.

Throws:
IOException
Since:
0.3


Copyright © 2001-2010. All Rights Reserved.