-
Notifications
You must be signed in to change notification settings - Fork 8
/
Hub.js
38 lines (33 loc) · 979 Bytes
/
Hub.js
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
export var C_hub = 1;
export var list_hubs = [];
list_hubs.push(-1);
export class Hub
{
constructor()
{
this.ports = ["-1", "-1", "-1", "-1", "-1", "-1"];
this.serial = C_hub + 99;
C_hub++;
}
is_hport_vacant()
{
for(var i = 0; i < 6; i++)
{
if(this.ports[i] == "-1")
{
return 1;
}
}
return 0;
}
}
export function create_hub() // creates a hub
{
let hub = new Hub();
list_hubs.push(hub);
}
export function reset_hubs()
{
list_hubs = ["-1"];
C_hub = 1;
}