71 long target =
static_cast< long >(indice) +
_minBound_;
73 return std::to_string(target);
85 std::istringstream i(std::string{
label});
98 long res =
static_cast< long >(std::floor(val));
99 if (val -
static_cast< double >(res) > 0.5) ++res;
137 if (
_minBound_ != cv._minBound_)
return false;
138 if (
_maxBound_ != cv._maxBound_)
return false;
Exception : the element we looked for cannot be found.
Exception : out of bound.
Defines a discrete random variable over an integer interval.
void setMaxVal(long maxVal)
Set a new value of the upper bound.
RangeVariable * clone() const final
Copy Factory.
Idx closestIndex(double val) const final
returns the closest index of the value
std::string label(Idx index) const final
Get the index-th label.
long maxVal() const
Returns the upper bound.
long _minBound_
The upper bound.
bool belongs(long val) const
Returns true if the param belongs to the variable's interval.
bool _checkSameDomain_(const Variable &aRV) const final
check the domain
void setMinVal(long minVal)
Set a new value for the lower bound.
Size domainSize() const final
returns the size of the random discrete variable domain
VarType varType() const final
returns the type of variable
RangeVariable & operator=(const RangeVariable &aRV)
Copy operator.
double numerical(Idx index) const final
get a numerical representation of the index-the value.
std::string stype() const final
string represent the type of the variable
long minVal() const
Returns the lower bound.
RangeVariable(std::string_view aName, std::string_view aDesc, long minVal, long maxVal)
constructors
long _maxBound_
The upper bound.
Idx index(std::string_view) const final
Base class for every random variable.
#define GUM_ERROR(type, msg)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Size Idx
Type for indexes.
gum is the global namespace for all aGrUM entities
Header of gumRangeVariable.