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) |
Methods
changeOn(index) → {class}
Change the value on specific index(bit flip)
Parameters:
Name | Type | Description |
---|---|---|
index |
int | which index to change |
Returns:
return the class
- Type
- class
copy() → {class}
Return copy of the class
Returns:
copy of the class
- Type
- class
equals(other) → {bool}
Typical equals function, compares two BitArrays
Parameters:
Name | Type | Description |
---|---|---|
other |
class | other BitArray |
Returns:
equals or not
- Type
- bool
getBitArray() → {array}
Returns the bit array, meaning the actual array not class
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 |
Returns:
return copy of the class with the value on index changed
- Type
- class
getSize() → {int}
Return size of the BitArray
Returns:
size of the array
- Type
- int
getType() → {string}
Returns the type of the configuration, needed for specific method functions(like mutation for example)
Returns:
enum of the type
- Type
- string
toString() → {string}
Return the bitArray as string
Returns:
bitArray as string
- Type
- string