-
-
Save landarskiy/7612eb5f0f85ab8b71a956878cdaf614 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public data class GridPadCells( | |
val rowSizes: ImmutableList<GridPadCellSize>, | |
val columnSizes: ImmutableList<GridPadCellSize> | |
) { | |
public constructor( | |
rowSizes: Iterable<GridPadCellSize>, columnSizes: Iterable<GridPadCellSize> | |
) : this(rowSizes = rowSizes.toImmutableList(), columnSizes = columnSizes.toImmutableList()) | |
//... | |
public class Builder(rowCount: Int, columnCount: Int) { | |
private val rowSizes: MutableList<GridPadCellSize> = GridPadCellSize.weight(rowCount) | |
private val columnSizes: MutableList<GridPadCellSize> = GridPadCellSize.weight(columnCount) | |
public fun rowSize(index: Int, size: GridPadCellSize): Builder = apply { | |
rowSizes[index] = size | |
} | |
public fun columnSize(index: Int, size: GridPadCellSize): Builder = apply { | |
columnSizes[index] = size | |
} | |
public fun build(): GridPadCells { | |
return GridPadCells( | |
rowSizes = rowSizes, columnSizes = columnSizes | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment