Board module
Properties:
Name | Type | Description |
---|---|---|
occupiedSlots |
Map | List of occupied slots on the board |
components |
Map | List of components on the board |
closed |
boolean | Indicates whether the circuit on the board is closed or not |
circuits |
Array.<Circuit> | Each item in this array stores a Circuit object |
Methods
(protected) addCircuit(circuit)
Adds given circuit to the array of circuits
Parameters:
Name | Type | Description |
---|---|---|
circuit |
Circuit |
Board(widthopt, heightopt) → {Board}
Board
Example
let board = Board(100, 100);
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
width |
number |
<optional> |
10
|
Width of the board - 0 indexed |
height |
number |
<optional> |
10
|
Height of the board - 0 indexed |
Returns:
- Type
- Board
getActiveSources() → {Array.<Components>}
Get array of active source Components
Returns:
- Type
- Array.<Components>
hasType(type) → {Boolean}
Returns true if Component Type is found on the Board
Parameters:
Name | Type | Description |
---|---|---|
type |
ComponentType |
Returns:
- Type
- Boolean
hasUnfinishedNode() → {Boolean}
Returns true if any true node has any untraveled components
Returns:
- Type
- Boolean
(protected) place(component, positions)
- Source:
- See:
-
- Use Component#place method instead
Place Component pins into respective Slots
Uses Slot#add
Uses Slot#add
Parameters:
Name | Type | Description |
---|---|---|
component |
Component | |
positions |
Array.<Positions> |
(protected) remove(component)
- Source:
- See:
-
- Use Component#remove method
Remove Component from its Slots
Uses Slot#remove
Uses Slot#remove
Parameters:
Name | Type | Description |
---|---|---|
component |
Component |