32 const scalarRange::testType type,
67 else if (
equal(minVal, maxVal))
69 type_ = scalarRange::EQ;
105 return scalarRange(scalarRange::LE, -GREAT, maxVal);
111 return scalarRange(scalarRange::LT, -GREAT, maxVal);
128 type_ = scalarRange::NONE;
134 return type_ == scalarRange::NONE;
146 return type_ == scalarRange::EQ;
166 case scalarRange::EQ:
167 case scalarRange::GE:
168 case scalarRange::GT:
171 case scalarRange::LE:
172 case scalarRange::LT:
175 case scalarRange::GE_LE:
177 return (0.5 * min_) + (0.5 * max_);
189 case scalarRange::EQ:
return equal(val, min_);
190 case scalarRange::GE:
return (val >= min_);
191 case scalarRange::GT:
return (val > min_);
192 case scalarRange::LE:
return (val <= max_);
193 case scalarRange::LT:
return (val < max_);
194 case scalarRange::GE_LE:
return (val >= min_ && val <= max_);
195 case scalarRange::ALWAYS:
return true;
196 default:
return false;
215 return (type_ == rhs.type_ && min_ == rhs.min_ && max_ == rhs.max_);
225 return !(*
this == rhs);
Ostream & operator()() const
Output stream (master only).
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
Scalar bounds to be used as a unary predicate.
void clear() noexcept
Reset to an empty (inverse, NONE) range.
bool single() const noexcept
True if the range bounds represent a single value.
static constexpr scalarRange ge0() noexcept
A greater-equals zero bound.
scalar value() const
A representative (average) value for the range.
static constexpr scalarRange le(const scalar maxVal) noexcept
A less-equals bound.
bool match(const scalar &val) const
True if the value matches the condition.
bool empty() const noexcept
True if range is empty (eg, inverted, NONE)
scalar min() const noexcept
The min value of the range.
static constexpr scalarRange ge(const scalar minVal) noexcept
A greater-equals bound.
bool valid() const noexcept
True if range is non-empty.
static constexpr scalarRange gt0() noexcept
A greater-than zero bound.
static constexpr scalarRange lt(const scalar maxVal) noexcept
A less-than bound.
scalar max() const noexcept
The max value of the range.
constexpr scalarRange() noexcept
Construct an empty (inverse, NONE) range - never matches.
static constexpr scalarRange gt(const scalar minVal) noexcept
A greater-than bound.
static constexpr scalarRange zero_one() noexcept
A greater-equals 0, less-equals 1 bound.
bool equal(const T &s1, const T &s2)
Compare two values for equality.