Total Complexity | 6 |
Complexity/F | 1.2 |
Lines of Code | 43 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | const { Guard } = require('./guard'); |
||
2 | |||
3 | /** |
||
4 | * Jgf multiple graphs. |
||
5 | */ |
||
6 | class JgfMultiGraph { |
||
7 | |||
8 | /** |
||
9 | * Constructor |
||
10 | */ |
||
11 | constructor(type, label, metadata = null) { |
||
12 | this.type = type; |
||
13 | this.label = label; |
||
14 | this._metadata = metadata; |
||
15 | |||
16 | this._graphs = []; |
||
17 | } |
||
18 | |||
19 | /** |
||
20 | * Add a single graph. |
||
21 | * @param {JgfGraph} graph |
||
22 | */ |
||
23 | addGraph(graph) { |
||
24 | this._graphs.push(graph); |
||
25 | } |
||
26 | |||
27 | get graphs() { |
||
28 | return this._graphs; |
||
29 | } |
||
30 | |||
31 | set metadata(metadata) { |
||
32 | Guard.assertValidMetadata(metadata); |
||
33 | this._metadata = metadata; |
||
34 | } |
||
35 | |||
36 | get metadata() { |
||
37 | return this._metadata; |
||
38 | } |
||
39 | } |
||
40 | |||
41 | module.exports = { |
||
42 | JgfMultiGraph, |
||
43 | }; |