#include <D:/Temp/vs/gal/source/ValueSets.h>
Inherits Chromosome::Representation::GaValueSet< T >< T >.
Public Member Functions | |
GaMultiValueSet (bool viceVersa) | |
This constructor initializes empty value set with user-defined treatment of inverted values. | |
GaMultiValueSet () | |
This constructor initializes empty value set with inverted values as members of the set. | |
virtual T GACALL | GenerateRandom () const |
More details are given in specification of GaValueSet::GenerateRandom method. | |
virtual bool GACALL | Inverse (const T &value, T &inverted) const |
More details are given in specification of GaValueSet::Inverse method. | |
virtual bool GACALL | Belongs (const T &value) const |
More details are given in specification of GaValueSet::Belongs method. | |
virtual const T &GACALL | ClosestValue (const T &value) const |
More details are given in specification of GaValueSet::ClosestValue method. | |
bool GACALL | Add (const T &original, const T &inverted) |
Add method inserts new value and its counterpart into value set. If original value is already in set call fails and method returns false . | |
int | Add (const T *values, const T *invertedValues, int size) |
Add method inserts new values and their counterpart into value set. New values which has duplicates in the set are ignored. Both arrays of values must be the same size. | |
bool GACALL | Remove (const T &value) |
Remove method removes value and its counterpart from the set. It removes value from the set if it's equal to specified value or if specified value is equal to inverted value. | |
bool GACALL | Remove (int pos) |
Remove method removes value and its counterpart from the set. It removes value by its position in the set. | |
const T &GACALL | GetValue (int pos) const |
GetValue method returns original value at given position. | |
void GACALL | GetValue (int pos, T &original, T &inverted) |
GetValue method returns value and its counterpart at given position. | |
const T &GACALL | GetInvertedValue (int pos) const |
GetInvertedValue method returns inverted value at given position. | |
void GACALL | SetValue (int pos, const T &value) |
SetValue method sets original value at given position. | |
void GACALL | SetValue (int pos, const T &original, const T &inverted) |
SetValue method sets value and its counterpart at given position. | |
void GACALL | SetInvertedValue (int pos, const T &value) |
SetInvertedValue method sets inverted value at given position. | |
Private Attributes | |
vector< T > | _values |
Array of original values. | |
vector< T > | _invertedValues |
array of counterparts of values in _values (inverted values). |
This class has built-in synchronizator so it is allowed to use LOCK_OBJECT
and LOCK_THIS_OBJECT
macros with instances of this class, but no public or private methods are thread-safe.
T | type of data in value set. |
Chromosome::Representation::GaMultiValueSet< T >::GaMultiValueSet | ( | bool | viceVersa | ) | [inline] |
This constructor initializes empty value set with user-defined treatment of inverted values.
viceVersa | if this parameter is set to true , inverted values are treated as members of the set, if it is set to false , inverted values are not treated as members of the set. |
Chromosome::Representation::GaMultiValueSet< T >::GaMultiValueSet | ( | ) | [inline] |
This constructor initializes empty value set with inverted values as members of the set.
virtual T GACALL Chromosome::Representation::GaMultiValueSet< T >::GenerateRandom | ( | ) | const [inline, virtual] |
More details are given in specification of GaValueSet::GenerateRandom method.
This method is not thread-safe.
Implements Chromosome::Representation::GaValueSet< T >.
virtual bool GACALL Chromosome::Representation::GaMultiValueSet< T >::Inverse | ( | const T & | value, | |
T & | inverted | |||
) | const [inline, virtual] |
More details are given in specification of GaValueSet::Inverse method.
This method is not thread-safe.
Implements Chromosome::Representation::GaValueSet< T >.
virtual bool GACALL Chromosome::Representation::GaMultiValueSet< T >::Belongs | ( | const T & | value | ) | const [inline, virtual] |
More details are given in specification of GaValueSet::Belongs method.
This method is not thread-safe.
Implements Chromosome::Representation::GaValueSet< T >.
virtual const T& GACALL Chromosome::Representation::GaMultiValueSet< T >::ClosestValue | ( | const T & | value | ) | const [inline, virtual] |
More details are given in specification of GaValueSet::ClosestValue method.
This method is not thread-safe.
Implements Chromosome::Representation::GaValueSet< T >.
bool GACALL Chromosome::Representation::GaMultiValueSet< T >::Add | ( | const T & | original, | |
const T & | inverted | |||
) | [inline] |
Add
method inserts new value and its counterpart into value set. If original value is already in set call fails and method returns false
.
This method is not thread-safe.
original | original value which is going to be added. | |
inverted | inverted value, counterpart of original value. |
true
if new value is added successfully. If original value already exists in set, method returns false
.int Chromosome::Representation::GaMultiValueSet< T >::Add | ( | const T * | values, | |
const T * | invertedValues, | |||
int | size | |||
) | [inline] |
Add
method inserts new values and their counterpart into value set. New values which has duplicates in the set are ignored. Both arrays of values must be the same size.
This method is not thread-safe.
values | array of original values which are going to be added. | |
invertedValues | array of inverted values, counterparts of original values. | |
size | number of values which are going to be added. |
bool GACALL Chromosome::Representation::GaMultiValueSet< T >::Remove | ( | const T & | value | ) | [inline] |
Remove
method removes value and its counterpart from the set. It removes value from the set if it's equal to specified value or if specified value is equal to inverted value.
This method is not thread-safe.
value | value which is should be removed. |
true
if it removed value successfully. It value doesn't belong to the set, method returns false
.bool GACALL Chromosome::Representation::GaMultiValueSet< T >::Remove | ( | int | pos | ) | [inline] |
Remove method removes value and its counterpart from the set. It removes value by its position in the set.
This method is not thread-safe.
pos | position of value which is should be removed. |
true
if it removed value successfully. It position is out of range it returns false
.const T& GACALL Chromosome::Representation::GaMultiValueSet< T >::GetValue | ( | int | pos | ) | const [inline] |
GetValue
method returns original value at given position.
This method is not thread-safe.
pos | position of the value. |
void GACALL Chromosome::Representation::GaMultiValueSet< T >::GetValue | ( | int | pos, | |
T & | original, | |||
T & | inverted | |||
) | [inline] |
GetValue method returns value and its counterpart at given position.
This method is not thread-safe.
pos | position of the value. | |
original | reference to variable to which original value is saved. | |
inverted | reference to variable to which inverted value is saved. |
const T& GACALL Chromosome::Representation::GaMultiValueSet< T >::GetInvertedValue | ( | int | pos | ) | const [inline] |
GetInvertedValue
method returns inverted value at given position.
This method is not thread-safe.
pos | position of the value. |
void GACALL Chromosome::Representation::GaMultiValueSet< T >::SetValue | ( | int | pos, | |
const T & | value | |||
) | [inline] |
SetValue
method sets original value at given position.
This method is not thread-safe.
pos | position of the value. | |
value | new original value. |
void GACALL Chromosome::Representation::GaMultiValueSet< T >::SetValue | ( | int | pos, | |
const T & | original, | |||
const T & | inverted | |||
) | [inline] |
SetValue
method sets value and its counterpart at given position.
This method is not thread-safe.
pos | position of the value. | |
original | new original value. | |
inverted | new inverted value. |
void GACALL Chromosome::Representation::GaMultiValueSet< T >::SetInvertedValue | ( | int | pos, | |
const T & | value | |||
) | [inline] |
SetInvertedValue
method sets inverted value at given position.
This method is not thread-safe.
pos | position of the value. | |
value | new inverted value. |
vector<T> Chromosome::Representation::GaMultiValueSet< T >::_values [private] |
Array of original values.
vector<T> Chromosome::Representation::GaMultiValueSet< T >::_invertedValues [private] |
array of counterparts of values in _values
(inverted values).