40 parse(description,
true);
66 const std::string distName = description.substr(0, description.find(
'('));
67 if (distName ==
"norm" || distName ==
"normc") {
68 const std::vector<std::string> params =
StringTokenizer(description.substr(distName.size() + 1, description.size() - distName.size() - 2),
',').
getVector();
82 throw ProcessError(
TL(
"Invalid format of distribution parameterized"));
84 WRITE_ERROR(
TL(
"Invalid format of distribution parameterized"));
94 const std::string error = dummy.
isValid();
100 WRITE_ERROR(
TL(
"Invalid format of distribution parameterized"));
114 const double max =
getMax();
115 while (val < min || val > max) {
147const std::vector<double>&
170 return TLF(
"minimum value % larger than maximum %",
getMin(),
getMax());
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
double sample(SumoRNG *which=0) const
Draw a sample of the distribution.
void parse(const std::string &description, const bool hardFail)
Overwrite by parsable distribution description.
virtual ~Distribution_Parameterized()
Destructor.
double getMax() const
Returns the maximum value of this distribution.
double getMin() const
Returns the minimum value of this distribution.
Distribution_Parameterized(const std::string &description)
Constructor for any temporary distribution parsed directly from the description.
std::string toStr(std::streamsize accuracy) const
Returns the string representation of this distribution.
static bool isValidDescription(const std::string &description)
validate input description
std::vector< double > & getParameter()
Returns the parameters of this distribution.
const std::string isValid() const
check whether the distribution is valid
std::vector< double > myParameter
The distribution's parameters.
std::string myID
The name of the object.
virtual void setID(const std::string &newID)
resets the id
static double randNorm(double mean, double variance, SumoRNG *rng=nullptr)
Access to a random number from a normal distribution.
std::vector< std::string > getVector()
return vector of strings
static double toDouble(const std::string &sData)
converts a string into the double value described by it by calling the char-type converter