GridBuilder

floodsim.model.dsl.GridDSL.GridBuilder
final case class GridBuilder(cells: Vector[Vector[CellValue]])

Builder class for constructing grids from DSL expressions.

Value parameters

cells

the 2D vector of cell values representing the grid layout

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Abstract methods

def getNotEmptyCells: Seq[(Coordinate, T)]

Lists cells that are not empty according to a presence criterion. For elements of type floodsim.model.cell.Cell this means water volume strictly greater than 0. Useful for identifying active flood areas and computing simulation statistics.

Lists cells that are not empty according to a presence criterion. For elements of type floodsim.model.cell.Cell this means water volume strictly greater than 0. Useful for identifying active flood areas and computing simulation statistics.

Attributes

Returns

sequence of pairs (coordinate, element) that are not empty

def getNotFullNeighbors(coordinate: Coordinate): Seq[(Coordinate, T)]

Returns neighbors of the coordinate that are not "full" per the filling metric. Searches at a dynamic radius based on distance to nearest not-full cell, optimizing neighbor discovery in sparsely flooded grids. Falls back to immediate (distance=1) neighbors if no not-full cells found at computed radius. For elements of type floodsim.model.cell.Cell, "not full" means the flooded percentage is less than 100%.

Returns neighbors of the coordinate that are not "full" per the filling metric. Searches at a dynamic radius based on distance to nearest not-full cell, optimizing neighbor discovery in sparsely flooded grids. Falls back to immediate (distance=1) neighbors if no not-full cells found at computed radius. For elements of type floodsim.model.cell.Cell, "not full" means the flooded percentage is less than 100%.

Value parameters

coordinate

source cell

Attributes

Returns

sequence of pairs (coordinate, element) for cells eligible to receive water

def map(f: (Coordinate, T) => T): DistanceGrid[T]

Applies an immutable transformation to all elements, with access to their coordinates.

Applies an immutable transformation to all elements, with access to their coordinates.

Value parameters

f

transformation function (coordinate, element) => new element

Attributes

Returns

new floodsim.model.cell.Cell with transformed elements

def overwrite(coordinate: Coordinate, element: T): DistanceGrid[T]

Returns a new grid with the element at the coordinate replaced, if the coordinate is inside bounds. If the coordinate is out of bounds, returns the same instance unchanged.

Returns a new grid with the element at the coordinate replaced, if the coordinate is inside bounds. If the coordinate is out of bounds, returns the same instance unchanged.

Value parameters

coordinate

position to update

element

new element

Attributes

Returns

new DistanceGrid with the update applied

Concrete methods

Constructs a DistanceGrid from the accumulated cell values.

Constructs a DistanceGrid from the accumulated cell values.

Attributes

Returns

a DistanceGrid containing Cell objects with appropriate water levels

Throws
IllegalArgumentException

if the grid dimensions are invalid

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Inherited and Abstract methods

def getElementAt(coordinate: Coordinate): Option[T]

Returns the element at the specified coordinate, if present.

Returns the element at the specified coordinate, if present.

Value parameters

coordinate

requested position

Attributes

Returns

Some(element) if present, otherwise None

Inherited from:
Grid
def height: Int

Grid height (number of rows).

Grid height (number of rows).

Attributes

Inherited from:
Grid
def width: Int

Grid width (number of columns).

Grid width (number of columns).

Attributes

Inherited from:
Grid