Package koma.util.validation
Types
| Name | Summary |
|---|---|
| ValidationContext | class ValidationContextA lambda receiver with state and convenience methods for validating a group of matrices. |
| Validator | interface ValidatorCallback used by ValidationContext after evaluating all rules. Subclass this if your validation plugin needs to hold all validation until the end. |
Properties
| Name | Summary |
|---|---|
| max | varValidationContext.max:DoubleMaximum value for individual elements in the matrix. |
| min | varValidationContext.min:DoubleMinimum value for individual elements in the matrix. |
| symmetric | valValidationContext.symmetric:ValidationContextRequire the current matrix to be symmetric. |
| transposable | valValidationContext.transposable:ValidationContextAccept a transposed version of the matrix as satisfying the dimensions check. For example, allow a 1 x 3 matrix when dimensions are declared as 3 x 1. |
Functions
| Name | Summary |
|---|---|
| dim | funValidationContext.dim(rows:Int, cols:Int):ValidationContextRequire the current matrix to have exactly the given number of rows and columns. funValidationContext.dim(rows:Int, cols:Char):ValidationContextRequire the current matrix to have exactly the given number of rows and match the number of columns with other dimensions in other matrices based on the cols variable name. funValidationContext.dim(rows:Char, cols:Int):ValidationContextRequire the current matrix to have exactly the given number of columns and match the number of rows with other dimensions in other matrices based on the rows variable name. funValidationContext.dim(rows:Char, cols:Char):ValidationContextRequire the current matrix's dimensions to correspond to the given variable names. Compares with other dimensions in other matrices in the context that are assigned the same variable name and raises an error if they don't all match. |
| max | funValidationContext.max(value:Double):ValidationContextEnsure all of the elements in the current matrix are >= the given value. |
| min | funValidationContext.min(value:Double):ValidationContextEnsure all of the elements in the current matrix are >= the given value. |
| symmetric | funValidationContext.symmetric(precision:Double= 1e-5):ValidationContext |
| testMatrix | fun testMatrix(matrix:Matrix<Double>):ValidationContextReturn a validation context that can be used to validate the given matrix with the default name of "matrix". fun testMatrix(matrix:Matrix<Double>, name:String):ValidationContextReturn a validation context that can be used to validate the given matrix with the given name. |
| validate | fun validate(fn:ValidationContext.() ->Unit):UnitExecute the given rules within a ValidationContext, letting you validate multiple matrices at once with interrelated dimensions, and return a list of matrices that match your validation rules. funMatrix<Double>.validate(fn:ValidationContext.() ->Unit):UnitUse the given fn to validate a matrix. Return either the matrix itself or a copy that has been transformed to match the validation rules. funMatrix<Double>.validate(name:String, fn:ValidationContext.() ->Unit):UnitUse the given fn to validate a matrix with the given name. Return either the matrix itself or a copy that has been transformed to match the validation rules. |