Bridges-Java  3.4.2
Bridges(Java API)
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
bridges.base.Grid< E > Class Template Reference
Inheritance diagram for bridges.base.Grid< E >:
bridges.base.DataStruct

Detailed Description

This is a class in BRIDGES for representing an (m x n) grid.

Author
David Burlinson
Date
5/14/18, 7/14/19

Public Member Functions

String getDataStructType ()
 
 Grid ()
 
 Grid (int size)
 
 Grid (int rows, int cols)
 Construct a rows x cols size grid. More...
 
 Grid (int[] size)
 Construct a size[0] by size[1] sized grid. More...
 
void resize (int rows, int cols)
 
int[] getDimensions ()
 Get the grid dimensions. More...
 
get (Integer row, Integer col)
 Get the (row, col) element in the grid. More...
 
void set (Integer row, Integer col, E val)
 
String getDataStructureRepresentation ()
 Get data structure representation. More...
 

Protected Attributes

ArrayList< ArrayList< E > > grid
 
int[] gridSize
 
- Protected Attributes inherited from bridges.base.DataStruct
String QUOTE = "\""
 

Static Protected Attributes

static final int[] defaultGridSize = {10, 10}
 
static int[] maxGridSize = {1080, 1920}
 

Additional Inherited Members

- Package Attributes inherited from bridges.base.DataStruct
String COMMA = ","
 
String COLON = ":"
 
String OPEN_CURLY = "{"
 
String CLOSE_CURLY = "}"
 
String OPEN_PAREN = "("
 
String CLOSE_PAREN = ")"
 
String OPEN_BOX = "["
 
String CLOSE_BOX = "]"
 

Constructor & Destructor Documentation

◆ Grid() [1/4]

Construct a grid with default sizes

◆ Grid() [2/4]

bridges.base.Grid< E >.Grid ( int  size)

Construct a size x size grid

◆ Grid() [3/4]

bridges.base.Grid< E >.Grid ( int  rows,
int  cols 
)

Construct a rows x cols size grid.

Parameters
rowsnumber of rows in grid
colsnumber of rows in grid

◆ Grid() [4/4]

bridges.base.Grid< E >.Grid ( int[]  size)

Construct a size[0] by size[1] sized grid.

Parameters
size[]specifies rows and column sizes of the grid

Member Function Documentation

◆ get()

E bridges.base.Grid< E >.get ( Integer  row,
Integer  col 
)

Get the (row, col) element in the grid.

Parameters
rowrow index
colcolumn index
Returns
the element at (row, col)

◆ getDataStructType()

String bridges.base.Grid< E >.getDataStructType ( )

Get data structure name

Returns
data type name

Reimplemented from bridges.base.DataStruct.

◆ getDataStructureRepresentation()

String bridges.base.Grid< E >.getDataStructureRepresentation ( )

Get data structure representation.

Returns
the JSON of the grid representation

Reimplemented from bridges.base.DataStruct.

◆ getDimensions()

int [] bridges.base.Grid< E >.getDimensions ( )

Get the grid dimensions.

Returns
an array of two values (rows, cols) of the grid

◆ resize()

void bridges.base.Grid< E >.resize ( int  rows,
int  cols 
)

◆ set()

void bridges.base.Grid< E >.set ( Integer  row,
Integer  col,
val 
)

Set the (row, col) element in the grid

Parameters
row,colcell to change
valthe value to be set to

Member Data Documentation

◆ defaultGridSize

final int [] bridges.base.Grid< E >.defaultGridSize = {10, 10}
staticprotected

◆ grid

ArrayList<ArrayList<E> > bridges.base.Grid< E >.grid
protected

◆ gridSize

int [] bridges.base.Grid< E >.gridSize
protected

◆ maxGridSize

int [] bridges.base.Grid< E >.maxGridSize = {1080, 1920}
staticprotected

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