Bridges-Java-3.0.2  3.0.2
Bridges(JavaAPI)
Public Member Functions | List of all members
bridges.base.GameGrid Class Reference
Inheritance diagram for bridges.base.GameGrid:
bridges.base.Grid< GameCell >

Detailed Description

This is a class in BRIDGES for representing an (m x n) grid. Each position in the grid will hold a GameCell object, each of which has a foreground color, background color, and a symbol.

Author
David Burlinson

Public Member Functions

void setEncoding (String encoding)
 Enable changing the game grid encoding when building JSON representation. More...
 
String getDataStructType ()
 
 GameGrid ()
 
 GameGrid (int rows, int cols)
 
void setBGColor (Integer row, Integer col, NamedColor color)
 
NamedColor getBGColor (Integer row, Integer col)
 
NamedSymbol getSymbol (Integer row, Integer col)
 
NamedColor getSymbolColor (Integer row, Integer col)
 
void setFGColor (Integer row, Integer col, NamedColor color)
 
void setBGColor (Integer row, Integer col, String color)
 
void setFGColor (Integer row, Integer col, String color)
 
void drawSymbol (Integer row, Integer col, Integer symbol)
 
void drawSymbol (Integer row, Integer col, NamedSymbol symbol)
 
void drawSymbol (Integer row, Integer col, Integer symbol, String color)
 
void drawSymbol (Integer row, Integer col, NamedSymbol symbol, String color)
 
void drawSymbol (Integer row, Integer col, Integer symbol, NamedColor color)
 
void drawSymbol (Integer row, Integer col, NamedSymbol symbol, NamedColor color)
 
String getDataStructureRepresentation ()
 
- Public Member Functions inherited from bridges.base.Grid< GameCell >
String getDataStructType ()
 
 Grid ()
 
 Grid (int size)
 
 Grid (int rows, int cols)
 
 Grid (int[] size)
 
int [] getDimensions ()
 
get (Integer row, Integer col)
 
void set (Integer row, Integer col, E val)
 
String getDataStructureRepresentation ()
 

Additional Inherited Members

- Protected Attributes inherited from bridges.base.Grid< GameCell >
ArrayList< ArrayList< E > > grid
 
int [] gridSize
 
- Static Protected Attributes inherited from bridges.base.Grid< GameCell >
static final int [] defaultGridSize
 
static int [] maxGridSize
 

Constructor & Destructor Documentation

◆ GameGrid() [1/2]

bridges.base.GameGrid.GameGrid ( )

Default Game Grid constructor

◆ GameGrid() [2/2]

bridges.base.GameGrid.GameGrid ( int  rows,
int  cols 
)

Grid constructor with grid size arguments

Parameters
rows- int representing the number of rows of the grid
cols- int representing the number of columns of the grid

Member Function Documentation

◆ drawSymbol() [1/6]

void bridges.base.GameGrid.drawSymbol ( Integer  row,
Integer  col,
Integer  symbol 
)

Draw a symbol at the specified location

Parameters
row,col- integer indices specifying the position to modify
symbol- Integer symbol argument to set the symbol at the chosen position

◆ drawSymbol() [2/6]

void bridges.base.GameGrid.drawSymbol ( Integer  row,
Integer  col,
NamedSymbol  symbol 
)

Draw a symbol at the specified location

Parameters
row,col- integer indices specifying the position to modify
symbol- Named symbol enum argument to set the symbol at the chosen position

◆ drawSymbol() [3/6]

void bridges.base.GameGrid.drawSymbol ( Integer  row,
Integer  col,
Integer  symbol,
String  color 
)

Draw a symbol at the specified location

Parameters
row,col- integer indices specifying the position to modify
symbol- Integer symbol argument to set the symbol at the chosen position
color- String color argument to set the background at the chosen position

◆ drawSymbol() [4/6]

void bridges.base.GameGrid.drawSymbol ( Integer  row,
Integer  col,
NamedSymbol  symbol,
String  color 
)

Draw a symbol at the specified location

Parameters
row,col- integer indices specifying the position to modify
symbol- Named Symbol enum argument to set the symbol at the chosen position
color- String color argument to set the background at the chosen position

◆ drawSymbol() [5/6]

void bridges.base.GameGrid.drawSymbol ( Integer  row,
Integer  col,
Integer  symbol,
NamedColor  color 
)

Draw a symbol at the specified location

Parameters
row,col- integer indices specifying the position to modify
symbol- Integer symbol argument to set the symbol at the chosen position
color- Named Color enum argument to set the foreground at the chosen position

◆ drawSymbol() [6/6]

void bridges.base.GameGrid.drawSymbol ( Integer  row,
Integer  col,
NamedSymbol  symbol,
NamedColor  color 
)

Draw a symbol at the specified location

Parameters
row,col- integer indices specifying the position to modify
symbol- Named Symbol enum argument to set the symbol at the chosen position
color- Named Color enum argument to set the foreground at the chosen position

◆ getBGColor()

NamedColor bridges.base.GameGrid.getBGColor ( Integer  row,
Integer  col 
)

◆ getDataStructType()

String bridges.base.GameGrid.getDataStructType ( )

◆ getDataStructureRepresentation()

String bridges.base.GameGrid.getDataStructureRepresentation ( )

get the JSON representation of the game grid. Contains separate foreground, background, and symbol arrays

Returns
the JSON representation of the game grid

◆ getSymbol()

NamedSymbol bridges.base.GameGrid.getSymbol ( Integer  row,
Integer  col 
)

◆ getSymbolColor()

NamedColor bridges.base.GameGrid.getSymbolColor ( Integer  row,
Integer  col 
)

◆ setBGColor() [1/2]

void bridges.base.GameGrid.setBGColor ( Integer  row,
Integer  col,
NamedColor  color 
)

Set background color of a cell using an enum argument

Parameters
row,col- integer indices specifying the position to modify
color- Named Color enum argument to set the background at the chosen position

◆ setBGColor() [2/2]

void bridges.base.GameGrid.setBGColor ( Integer  row,
Integer  col,
String  color 
)

Set background color of a cell using an enum argument

Parameters
row,col- integer indices specifying the position to modify
color- String color argument to set the background at the chosen position

◆ setEncoding()

void bridges.base.GameGrid.setEncoding ( String  encoding)

Enable changing the game grid encoding when building JSON representation.

Parameters
encodingtype of encoding. Supports "raw" and "rle"

◆ setFGColor() [1/2]

void bridges.base.GameGrid.setFGColor ( Integer  row,
Integer  col,
NamedColor  color 
)

Set foreground color of a cell using an enum argument

Parameters
row,col- integer indices specifying the position to modify
color- Named Color enum argument to set the foreground at the chosen position

◆ setFGColor() [2/2]

void bridges.base.GameGrid.setFGColor ( Integer  row,
Integer  col,
String  color 
)

Set background color of a cell using an enum argument

Parameters
row,col- integer indices specifying the position to modify
color- String color argument to set the background at the chosen position

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