Grid

interface Grid

The library's specialized state collection that allows indexing by the particular address system used here.

Inheritors

Types

Link copied to clipboard
data class Address(val row: Int, val column: Int)

The index structure for Grid.

Link copied to clipboard
data class State(val isVisible: Boolean = true, val isSelected: Boolean = false)

The state class for grid cells.

Properties

Link copied to clipboard
abstract val columnCount: Int

The number of linear columns in the Grid.

Link copied to clipboard
abstract val enableEdgeLines: Boolean

Whether edge lines are enabled.

Link copied to clipboard
abstract val insetEvenLines: Boolean

Whether the even rows and columns are inset, or the odd ones.

Link copied to clipboard
abstract val rowCount: Int

The number of linear rows in the Grid.

Link copied to clipboard
abstract val size: Int

The total cell count, named size for consistency with other collections.

Functions

Link copied to clipboard
abstract fun copy(changes: Map<Grid.Address, Grid.State> = emptyMap()): Grid

Returns a new, modified instance of this Grid if changes actually causes any changes.

abstract fun copy(address: Grid.Address, change: Grid.State): Grid

Returns a modified copy of this Grid if change actually causes a change.

Link copied to clipboard
abstract fun findAddress(row: Int, column: Int): Grid.Address?

Returns the appropriate Grid.Address if row and column are valid coordinates.

Link copied to clipboard
abstract fun forEach(action: (Grid.Address, Grid.State) -> Unit)

Iterator function for Grid.

Link copied to clipboard
abstract operator fun get(address: Grid.Address): Grid.State

The Address-indexed get operator for Grid.

abstract operator fun get(row: Int, column: Int): Grid.State

The Int-indexed get operator for Grid.

Link copied to clipboard
abstract fun isLineInset(index: Int): Boolean

Returns whether the given line – row or column – is inset, per the insetEvenLines property.

Link copied to clipboard
abstract fun isValidAddress(row: Int, column: Int): Boolean

Returns true if row and column are valid coordinates for the current grid specifications.