mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-03-11 12:52:23 +00:00
generate docs for a lot of API (test try)
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
package dev.inmo.micro_utils.matrix
|
||||
|
||||
/**
|
||||
* Represents a matrix as a list of rows, where each row is a list of elements.
|
||||
* This is essentially a 2D structure represented as `List<List<T>>`.
|
||||
*
|
||||
* @param T The type of elements in the matrix
|
||||
*/
|
||||
typealias Matrix<T> = List<Row<T>>
|
||||
|
||||
@@ -1,15 +1,37 @@
|
||||
package dev.inmo.micro_utils.matrix
|
||||
|
||||
/**
|
||||
* Creates a matrix using a DSL-style builder.
|
||||
* Allows defining multiple rows using the [MatrixBuilder] API.
|
||||
*
|
||||
* @param T The type of elements in the matrix
|
||||
* @param block A builder lambda to define the matrix structure
|
||||
* @return A constructed [Matrix]
|
||||
*/
|
||||
fun <T> matrix(block: MatrixBuilder<T>.() -> Unit): Matrix<T> {
|
||||
return MatrixBuilder<T>().also(block).matrix
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a single-row matrix using a DSL-style builder.
|
||||
*
|
||||
* @param T The type of elements in the matrix
|
||||
* @param block A builder lambda to define the row elements
|
||||
* @return A [Matrix] containing a single row
|
||||
*/
|
||||
fun <T> flatMatrix(block: RowBuilder<T>.() -> Unit): Matrix<T> {
|
||||
return MatrixBuilder<T>().apply {
|
||||
row(block)
|
||||
}.matrix
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a single-row matrix from the provided elements.
|
||||
*
|
||||
* @param T The type of elements in the matrix
|
||||
* @param elements The elements to include in the single row
|
||||
* @return A [Matrix] containing a single row with the specified elements
|
||||
*/
|
||||
fun <T> flatMatrix(vararg elements: T): Matrix<T> {
|
||||
return MatrixBuilder<T>().apply {
|
||||
row { elements.forEach { +it } }
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
package dev.inmo.micro_utils.matrix
|
||||
|
||||
/**
|
||||
* Represents a single row in a matrix as a list of elements.
|
||||
*
|
||||
* @param T The type of elements in the row
|
||||
*/
|
||||
typealias Row<T> = List<T>
|
||||
|
||||
Reference in New Issue
Block a user