Labyrinth
A labyrinth game assignment
host.labyrinth.Supply Class Reference

This class is the representation of the supplies in the game. More...

Package Functions

Constructors
 Supply (int id, int row, int col)
 The main constructor of the Supply constructed from (row,column) More...
 
 Supply (int id, int tileId)
 A second constructor of the Supply constructed from supplyTileId. More...
 
 Supply (Supply s)
 A deep copy constructor. More...
 
Supply's main application interface
int supplyId ()
 
int supplyId (int sID)
 Set the supplyId. More...
 
Position position ()
 
Position position (int row, int col)
 Set the position of the supply from a (row, column) pair. More...
 
Position position (int tileId)
 Set the position of the supply from a tileId. More...
 
void removeSupply ()
 Marks the supply removed. More...
 
Accessor/Mutator interface
Note
Please consider not to use mutator interface. Its the abstraction killer :( We have added a bit of logic however, in order to make it a bit more safe.
int getSupplyId ()
 
int getX ()
 
int getY ()
 
int getSupplyTileId ()
 
void setSupplyId (int Id)
 
void setX (int x)
 
void setY (int y)
 
void setSupplyTileId (int tileId)
 

Private Attributes

Class data
int supplyId
 The unique identifier of the tile. More...
 
int x
 The x coordinate of the tile as if the board lies in the 1st quadrant. More...
 
int y
 The y coordinate of the tile as if the board lies in the 1st quadrant. More...
 
int supplyTileId
 The Id of the tile on the board, in witch the supply is located. More...
 

Detailed Description

This class is the representation of the supplies in the game.

Supplies are the game "goodies". They placed randomly in the board. In each tile there can be only one supply. The player has to collect all of them in order to complete the game successfully.

Definition at line 20 of file Supply.java.

Constructor & Destructor Documentation

◆ Supply() [1/3]

host.labyrinth.Supply.Supply ( int  id,
int  row,
int  col 
)
package

The main constructor of the Supply constructed from (row,column)

Parameters
idThe Id of the created supply
rowThe row coordinate to place the supply
colThe column coordinate to place the supply

Definition at line 32 of file Supply.java.

◆ Supply() [2/3]

host.labyrinth.Supply.Supply ( int  id,
int  tileId 
)
package

A second constructor of the Supply constructed from supplyTileId.

Parameters
idThe Id of the created supply
tileIdThe linear combination of (row, column)

Definition at line 50 of file Supply.java.

◆ Supply() [3/3]

host.labyrinth.Supply.Supply ( Supply  s)
package

A deep copy constructor.

Definition at line 65 of file Supply.java.

Member Function Documentation

◆ getSupplyId()

int host.labyrinth.Supply.getSupplyId ( )
package

Definition at line 145 of file Supply.java.

◆ getSupplyTileId()

int host.labyrinth.Supply.getSupplyTileId ( )
package

Definition at line 148 of file Supply.java.

◆ getX()

int host.labyrinth.Supply.getX ( )
package

Definition at line 146 of file Supply.java.

◆ getY()

int host.labyrinth.Supply.getY ( )
package

Definition at line 147 of file Supply.java.

◆ position() [1/3]

Position host.labyrinth.Supply.position ( )
package
Returns
the position of the supply as a Position object
See also
Position

Definition at line 91 of file Supply.java.

◆ position() [2/3]

Position host.labyrinth.Supply.position ( int  row,
int  col 
)
package

Set the position of the supply from a (row, column) pair.

Parameters
rowThe row coordinate of the tile
colThe column coordinate of the tile
Returns
the position of the supply as a Position object
Note
This function also returns the Position to help in chained expressions.
See also
Position

Definition at line 101 of file Supply.java.

◆ position() [3/3]

Position host.labyrinth.Supply.position ( int  tileId)
package

Set the position of the supply from a tileId.

Parameters
tileIdThe tileId position
Returns
The position of the supply as Position object
Note
This function also returns the Position to help in chained expressions.
See also
Position

Definition at line 120 of file Supply.java.

◆ removeSupply()

void host.labyrinth.Supply.removeSupply ( )
package

Marks the supply removed.

This usually mean the supply is picked up by a user.

Definition at line 135 of file Supply.java.

◆ setSupplyId()

void host.labyrinth.Supply.setSupplyId ( int  Id)
package

Definition at line 150 of file Supply.java.

◆ setSupplyTileId()

void host.labyrinth.Supply.setSupplyTileId ( int  tileId)
package

Definition at line 161 of file Supply.java.

◆ setX()

void host.labyrinth.Supply.setX ( int  x)
package

Definition at line 151 of file Supply.java.

◆ setY()

void host.labyrinth.Supply.setY ( int  y)
package

Definition at line 156 of file Supply.java.

◆ supplyId() [1/2]

int host.labyrinth.Supply.supplyId ( )
package
Returns
the supplyId

Definition at line 78 of file Supply.java.

◆ supplyId() [2/2]

int host.labyrinth.Supply.supplyId ( int  sID)
package

Set the supplyId.

Parameters
sIDThe Id to set
Returns
The supplyId
Note
This function also returns the supplyId to help in chained expressions.

Definition at line 85 of file Supply.java.

Member Data Documentation

◆ supplyId

int host.labyrinth.Supply.supplyId
private

The unique identifier of the tile.

This must not be confused with TileID

Definition at line 173 of file Supply.java.

◆ supplyTileId

int host.labyrinth.Supply.supplyTileId
private

The Id of the tile on the board, in witch the supply is located.

Definition at line 176 of file Supply.java.

◆ x

int host.labyrinth.Supply.x
private

The x coordinate of the tile as if the board lies in the 1st quadrant.

Definition at line 174 of file Supply.java.

◆ y

int host.labyrinth.Supply.y
private

The y coordinate of the tile as if the board lies in the 1st quadrant.

Definition at line 175 of file Supply.java.


The documentation for this class was generated from the following file: