Evoplex
0.2.1
|
The IntervalOfValues class. More...
#include <attributerange.h>
Public Member Functions | |
IntervalOfValues (int id, const QString &attrName, Type type, const Value &min, const Value &max) | |
Constructor. More... | |
~IntervalOfValues () override=default | |
Destructor. | |
Value | rand (PRG *prg) const override |
Gets a random value in the attribute range. More... | |
Value | next (const Value &v) const override |
Gets the value after v . More... | |
Value | prev (const Value &v) const override |
Gets the value before v . More... | |
![]() | |
~AttributeRange () override=default | |
Destructor. | |
Value | validate (const QString &valueStr) const |
Checks if the valueStr belongs to this attribute range. More... | |
bool | isValid () const |
Checks if this AttributeRange is valid. More... | |
int | id () const |
Gets the attribute id. | |
const QString & | attrName () const |
Gets the attribute name. | |
const QString & | attrRangeStr () const |
Gets the original attribute's range string. More... | |
Type | type () const |
Gets the current attribute's range type. | |
const Value & | min () const |
Gets the minimum value in the range. | |
const Value & | max () const |
Gets the maximum value in the range. | |
![]() | |
virtual | ~AttributeRangeInterface ()=default |
Destructor. | |
Additional Inherited Members | |
![]() | |
enum | Type { Invalid, Double_Range, Int_Range, Bool, Double_Set, Int_Set, String_Set, String, NonEmptyString, DirPath, FilePath } |
An enum for the attribute range types. More... | |
![]() | |
static AttributeRangePtr | parse (int attrId, const QString &attrName, const QString &attrRangeStr) |
Creates an AttributeRange object from a valid attrRangeStr string. More... | |
![]() | |
AttributeRange (int id, const QString &attrName, Type type) | |
AttributeRange constructor. More... | |
![]() | |
const int | m_id |
const QString | m_attrName |
const Type | m_type |
QString | m_attrRangeStr |
Value | m_min |
Value | m_max |
The IntervalOfValues class.
It handles the 'attribute ranges' defined by an interval of values, e.g., AttributeRange::Double_Range, AttributeRange::Int_Range and AttributeRange::Bool.
evoplex::IntervalOfValues::IntervalOfValues | ( | int | id, |
const QString & | attrName, | ||
Type | type, | ||
const Value & | min, | ||
const Value & | max | ||
) |
Constructor.
id | The attribute id. |
attrName | The attribute name. |
type | The range type. |
min | The smallest value in the range. |
max | The largest value in the range. |
Gets the value after v
.
v | A value in the attribute range. If v is the last, it returns the first value in the attrRange. if v is not in the attrRange, it returns v . |
Implements evoplex::AttributeRangeInterface.
Gets the value before v
.
v | A value in the attribute range. If v is the first, it returns the last value in the attrRange. if v is not in the attrRange, it returns v . |
Implements evoplex::AttributeRangeInterface.
Gets a random value in the attribute range.
prg | A pointer to a valid PRG. |
Implements evoplex::AttributeRangeInterface.