floodsim.model.grid

Members list

Type members

Classlikes

final case class Coordinate(x: Int, y: Int)

Represents a two-dimensional coordinate on a discrete Cartesian grid. Coordinates are zero-based: x and y start at 0 and increase to the right (x) and downward (y).

Represents a two-dimensional coordinate on a discrete Cartesian grid. Coordinates are zero-based: x and y start at 0 and increase to the right (x) and downward (y).

Value parameters

x

x-axis index of the cell

y

y-axis index of the cell

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
trait DistanceGrid[T <: GridElement] extends Grid[T]

Extension of Grid providing distance-based operations. This trait adds spatial awareness to grid operations by computing distances to not-full cells, enabling dynamic neighbor search and efficient water distribution All operations are immutable: transformation methods return new instances.

Extension of Grid providing distance-based operations. This trait adds spatial awareness to grid operations by computing distances to not-full cells, enabling dynamic neighbor search and efficient water distribution All operations are immutable: transformation methods return new instances.

Type parameters

T

grid element type

Attributes

Companion
object
Supertypes
trait Grid[T]
class Object
trait Matchable
class Any
Known subtypes
object DistanceGrid

Factory for building DistanceGrid.

Factory for building DistanceGrid.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
trait Grid[T <: GridElement]

Abstraction of a 2D grid indexed by Coordinate containing elements of type T.

Abstraction of a 2D grid indexed by Coordinate containing elements of type T.

Type parameters

T

type of the elements, constrained to GridElement

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait DistanceGrid[T]
class MapBasedGrid[T]
object Grid

Factory for building grids.

Factory for building grids.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Grid.type
trait GridElement

Marker trait for elements that can be placed on a grid.

Marker trait for elements that can be placed on a grid.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait Cell
enum Weather
final case class MapBasedDistanceGrid[T <: GridElement](grid: MapBasedGrid[T]) extends DistanceGrid[T]

DistanceGrid implementation backed by an internal MapBasedGrid. Provides efficient distance-based neighbor searches using a multi-source BFS computed from all not-full cells. The distance map is lazily evaluated and cached to optimize repeated neighbor queries during flood propagation. Transparently exports properties and methods of the internal grid (width, height, getElementAt, elementsMap) for seamless integration with existing grid operations.

DistanceGrid implementation backed by an internal MapBasedGrid. Provides efficient distance-based neighbor searches using a multi-source BFS computed from all not-full cells. The distance map is lazily evaluated and cached to optimize repeated neighbor queries during flood propagation. Transparently exports properties and methods of the internal grid (width, height, getElementAt, elementsMap) for seamless integration with existing grid operations.

Type parameters

T

element type

Value parameters

grid

underlying immutable grid

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait DistanceGrid[T]
trait Grid[T]
class Object
trait Matchable
class Any
Show all
final case class MapBasedGrid[T <: GridElement](width: Int, height: Int, elementsMap: Map[Coordinate, T]) extends Grid[T]

Grid implementation backed by an immutable map Coordinate -> T. Requires positive dimensions; the presence of a map entry determines whether a cell is populated.

Grid implementation backed by an immutable map Coordinate -> T. Requires positive dimensions; the presence of a map entry determines whether a cell is populated.

Value parameters

elementsMap

immutable map from coordinates to elements

height

grid height (>= 1)

width

grid width (>= 1)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Grid[T]
class Object
trait Matchable
class Any
Show all

Types

type DistanceMap = Map[Coordinate, Int]

Immutable map from Coordinate to non-negative distance.

Immutable map from Coordinate to non-negative distance.

Attributes