NumberComparator
extends Comparator
in package
NumberComparator compiles a simple comparison to an anonymous subroutine, which you can call with a value to be tested again.
Now this would be very pointless, if NumberCompare didn't understand magnitudes.
The target value may use magnitudes of kilobytes (k, ki), megabytes (m, mi), or gigabytes (g, gi). Those suffixed with an i use the appropriate 2**n version in accordance with the IEC standard: http://physics.nist.gov/cuu/Units/binary.html
Based on the Perl Number::Compare module.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- getOperator() : string
- Gets the comparison operator.
- getTarget() : string
- Gets the target value.
- test() : bool
- Tests against the target.
Properties
$operator
private
string
$operator
$target
private
string
$target
Methods
__construct()
public
__construct(string|null $test) : mixed
Parameters
- $test : string|null
-
A comparison string or null
Tags
getOperator()
Gets the comparison operator.
public
getOperator() : string
Return values
stringgetTarget()
Gets the target value.
public
getTarget() : string
Return values
stringtest()
Tests against the target.
public
test(mixed $test) : bool
Parameters
- $test : mixed