InequalityExpressionMatcher
Struct that is used to validate inequality expressions.
The only ValueType
supported for this expression is Int
.
It takes value type, sign of inequality and value from expression pattern
and then try to use those attributes to validate passed String
value
that will be converted to Int
.
-
Type of value that will be passed for validation. It supports only
Int
Declaration
Swift
let valueType: ValueType
-
InequalitySign
of expression to be matched.Declaration
Swift
let sign: InequalitySign
-
Value that will be used during validation to compare to passed one.
Declaration
Swift
let value: Int
-
Initialization method takes few parameters that has been fetched from expression parser.
Declaration
Swift
init(valueType: ValueType, sign: InequalitySign, value: Int)
Parameters
valueType
type of value that will be matched (passed to validate(val:) method).
sign
InequalitySign
parsed from expression pattern.value
value that will be used to compare.
Return Value
inquality expression matcher.
-
Method used to validate passed value and check if it match to expression.
Declaration
Swift
func validate(val: String) -> Bool
Parameters
val
value passed as
String
that will be converted toInt
later.Return Value
true
ifval
match expression pattern, otherwisefalse
.