de.uni_paderborn.robots.data
Class Field

java.lang.Object
  |
  +--de.uni_paderborn.robots.data.Field
All Implemented Interfaces:
Identifyable, java.io.Serializable

public class Field
extends java.lang.Object
implements Identifyable, java.io.Serializable

A field in the arena.

See Also:
Serialized Form

Field Summary
private  Fields fields
          link to Fields object
private  int id
          ID of field
private  Item item
          the item on the field
static long serialVersionUID
          used for serialization
private  int x
          x-coordinate in matrix representation
private  int y
          y-coordinate in matrix representation
 
Constructor Summary
Field(Fields fields, int x, int y, Item item)
          constructor, creates a new field.
 
Method Summary
 Fields getFields()
          Returns the Fields object.
 int getID()
          Returns ID of the field.
 Item getItem()
          Returns the item on the field, null is used, if field is empty.
 int getX()
          Returns x-coordinate in matrix represenation of field.
 int getY()
          Returns x-coordinate in matrix represenation of field.
 void setItem(Item item, ArenaCanvas arenaCanvas)
          Sets the item of the field, null is used, if field is empty.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
used for serialization

fields

private Fields fields
link to Fields object

item

private Item item
the item on the field

x

private int x
x-coordinate in matrix representation

y

private int y
y-coordinate in matrix representation

id

private int id
ID of field
Constructor Detail

Field

public Field(Fields fields,
             int x,
             int y,
             Item item)
constructor, creates a new field.
Parameters:
fields - link to Fields object
x - x-coordinate in matrix representation
y - y-coordinate in matrix representation
item - item on the field
Method Detail

getItem

public Item getItem()
Returns the item on the field, null is used, if field is empty.
Returns:
items on the field

setItem

public void setItem(Item item,
                    ArenaCanvas arenaCanvas)
Sets the item of the field, null is used, if field is empty.
Parameters:
item - new item on the field
arenaCanvas - ArenaCanvas object which needs to be updated

getID

public int getID()
Returns ID of the field.
Specified by:
getID in interface Identifyable
Returns:
ID of the field

getX

public int getX()
Returns x-coordinate in matrix represenation of field.
Returns:
x-coordinate in matrix represenation of field

getY

public int getY()
Returns x-coordinate in matrix represenation of field.
Returns:
x-coordinate in matrix represenation of field

getFields

public Fields getFields()
Returns the Fields object.
Returns:
the Fields object