| 1 |
function bool = versionCompare( vA, operator, vB ) |
| 2 |
%VERSIONCOMPARE Performs a version comparison operation |
| 3 |
switch operator |
| 4 |
case '<' |
| 5 |
bool = isVersionBelow(vA, vB); |
| 6 |
case '>' |
| 7 |
bool = isVersionBelow(vB, vA); |
| 8 |
case {'<=', '=<'} |
| 9 |
bool = ~isVersionBelow(vB, vA); |
| 10 |
case {'>=', '=>'} |
| 11 |
bool = ~isVersionBelow(vA, vB); |
| 12 |
case {'=', '=='} |
| 13 |
bool = ~isVersionBelow(vA, vB) && ~isVersionBelow(vB, vA); |
| 14 |
case {'~=', '!='} |
| 15 |
bool = isVersionBelow(vA, vB) || isVersionBelow(vB, vA); |
| 16 |
otherwise |
| 17 |
error('versionCompare:UnknownOperator',... |
| 18 |
'"%s" is not a known comparison operator', operator); |
| 19 |
end |
| 20 |
end |