Passed
Push — master ( eb92cf...b39190 )
by Kolja
01:15
created

jgfMultiGraph.js ➔ metadata   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 2
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
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
};