-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocs-globals.jsdoc
120 lines (104 loc) · 3.4 KB
/
docs-globals.jsdoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/**
* @overview This file provides global JSDoc symbols used throughout
* the API's documentation.
* @author Bart Busschots
* @license BSD-2-Clause
*/
//
//=== Define External Symbols =================================================
//
/**
* A jQuery object.
* @external jQuery
* @see {@link http://api.jquery.com/}
*/
//
//=== Define Global Types =====================================================
//
/**
* A non-empty string, i.e. a string with a length of at least one.
* @typedef {string} NonEmptyString
*/
/**
* A primitive JavaScript value, i.e. a boolean, number, or string.
* @typedef {(boolean|number|string)} PrimitiveValue
*/
/**
* A plain JavaScript object, i.e. an object with no prototype other than
* `Object`.
*
* jQuery's `$.isPlainObject()` function is used to validate this type.
* @typedef {Object} PlainObject
* @see external:jQuery
*/
/**
* A jQuery object representing exactly one element which can be used as a
* container for a cellular automaton. The following HTML elements are
* premitted:
* * `div`
* * `p`
* * `main`
* * `section`
* @typedef {external:jQuery} jQuerySingleContainer
*/
/**
* A jQuery object representing exactly one `table` element.
* @typedef {external:jQuery} jQuerySingleTable
*/
/**
* A jQuery object representing exactly one table data cell (`td` element).
* @typedef {external:jQuery} jQuerySingleTD
*/
/**
* A number representing an x or y coordinate within a CA. Specifically, a whole
* number greater than or equal to zero.
* @typedef {number} GridCoordinate
*/
/**
* The total width or height of a cellular automaton in number of cells.
* Specifically, a whole number greater than or equal to one.
* @typedef {number} GridDimension
*/
/**
* A time interval as a number of milliseconds, must be a whole number greater
* than zero.
* @typedef {number} IntervalMS
*/
//
//=== Define Callbacks ========================================================
//
/**
* A step function is used to calcualte the next value of each cell for each
* step the cellular automaton takes.
*
* @callback stepFunction
* @param {CellState} currentState - the curent state of the cell.
* @param {CellState[]} neighbourStates - the current state of each
* neighbouring cell as an array with the cell at 12 o'clock at index zero, and
* moving around the cell clockwise from there. If a cell is on an edge, there
* will still be array elements representing the non-existent neighbours, but
* they will have the valye `null`.
* @returns {CellState} the next state for the cell.
*/
/**
* A render function should style a table data cell so it represents a given
* state. This function will be used to render each cell in a cellular
* automaton.
*
* @callback renderFunction
* @param {jQuerySingleTD} $td - a jQuery object representing the table data
* cell to be rendered.
* @param {CellState} s - the state of the cell the table data cell represents.
*/
/**
* An initialisation function is used to set the initial states of each cell in
* a cellular automaton. The function will be called once for each cell, and it
* will return an initial state for each.
*
* @callback initialisationFunction
* @param {GridCoordinate} x - the zero-indexed X-coordinate of the cell being
* initialised within the cellular automaton's grid.
* @param {GridCoordinate} y - the zero-indexed Y-coordinate of the cell being
* initialised within the cellular automaton's grid.
* @returns {CellState} an initial state.
*/