Component module
- Source:
Properties:
Name | Type | Description |
---|---|---|
id |
string | Component id |
label |
string | Component label |
type |
ComponentType | Component type |
V |
number | Voltage |
R |
number | Resistance |
I |
number | Impedence |
openEnded |
boolean | Component is an open-ended component or not e.g., Ground |
active |
boolean | Component is active or not |
traveled |
boolean | Component has been traveled by Traverser or not |
pins |
Array.<Positions> | Component pins |
board |
Board | STATIC property which references to the Board object |
Methods
(static) hasDuplicatePositions(pins) → {boolean}
- Source:
Return true if duplicate pins are found
Parameters:
Name | Type | Description |
---|---|---|
pins |
Array.<Positions> | Array of pins e.g. [[1,1], [2,2], [4,4]] |
Returns:
- Type
- boolean
getOtherPins(pos) → {Array.<Positions>}
- Source:
Returns array of pin positions except the one passed in
Parameters:
Name | Type | Description |
---|---|---|
pos |
Position |
Returns:
- Type
- Array.<Positions>
place(positions)
- Source:
Place Component onto specified Slots
Uses Board#place
Uses Board#place
Example
let component = new Component();
component.place([0,0],[0,5]);
Parameters:
Name | Type | Description |
---|---|---|
positions |
Array.<Position> |
remove()
- Source:
Remove Component from board
Uses Board#remove
Uses Board#remove
Example
let component = new Component();
component.place([0,0],[0,5]);
component.remove();