Class: BitArray

BitArray(options)

class representing bit array configuration, used for all problems with bit array configurations

Constructor

new BitArray(options)

Class constructor, can create from other BitArray, random with specified size, or all 0 with specific size
Parameters:
Name Type Description
options object contains options.fromBitArray(bool), options.size(int) and options.random(bool)
Source:

Methods

changeOn(index) → {class}

Change the value on specific index(bit flip)
Parameters:
Name Type Description
index int which index to change
Source:
Returns:
return the class
Type
class

copy() → {class}

Return copy of the class
Source:
Returns:
copy of the class
Type
class

equals(other) → {bool}

Typical equals function, compares two BitArrays
Parameters:
Name Type Description
other class other BitArray
Source:
Returns:
equals or not
Type
bool

getBitArray() → {array}

Returns the bit array, meaning the actual array not class
Source:
Returns:
bitArray variable
Type
array

getNeighbour(index) → {class}

Return neighbour, either random or selected with index
Parameters:
Name Type Description
index int which index will change to get the neighbour
Source:
Returns:
return copy of the class with the value on index changed
Type
class

getSize() → {int}

Return size of the BitArray
Source:
Returns:
size of the array
Type
int

getType() → {string}

Returns the type of the configuration, needed for specific method functions(like mutation for example)
Source:
Returns:
enum of the type
Type
string

toString() → {string}

Return the bitArray as string
Source:
Returns:
bitArray as string
Type
string