Class: Word

Word()

Class representing a word as an array of Tris. Each word is of size WORD_SIZE defined in constants.js. Words are intended as the basic unit of data storage and are stored in one place. They are not intended to be used as registers or for computation, use IOBusses for that. As a result the data is a protected field and can only be accessed through the readWord() and writeWord() methods.

Constructor

new Word()

Properties:
Name Type Description
data Array.<Tri> the private array of Tris that make up the word
Source:

Classes

Word

Methods

readWord() → {Array.<Tri>}

Return the data array stored in the word to read their states
Source:
Returns:
- the array of Tris stored in the word
Type
Array.<Tri>

toString() → {string}

Return a string representation of the word. The string is the concatenation of the states of the Tris in the word
Source:
Returns:
- a string representation of the word
Type
string

writeWord(data)

Write an array of Tris to the word. The array must be of size WORD_SIZE
Parameters:
Name Type Description
data Array.<Tri> the array of Tris to write to the word
Source:
Throws:
- if the array is not of size WORD_SIZE
Type
Error