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

jgfMultiGraph.js   A

Complexity

Total Complexity 6
Complexity/F 1.2

Size

Lines of Code 43
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
eloc 18
c 1
b 0
f 0
nc 1
dl 0
loc 43
rs 10
wmc 6
mnd 0
bc 5
fnc 5
bpm 1
cpm 1.2
noi 0

4 Functions

Rating   Name   Duplication   Size   Complexity  
A ➔ addGraph 0 3 1
A ➔ constructor 0 7 1
A ➔ metadata 0 4 1
A ➔ graphs 0 3 1
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
};