This repository has been archived by the owner on Aug 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.js
65 lines (44 loc) · 1.52 KB
/
helper.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
'use strict'
var jsmf = require('jsmf-core'),
Class = jsmf.Class, Model = jsmf.Model;
//Helper model to test functionalities - should be improved with larger model
function buildModel() {
var MM = new Model('MetaVisu');
var ClassA = Class.newInstance("A");
ClassA.addAttribute('wheels', Number);
ClassA.setReference('next',ClassA,1)
var ClassB = Class.newInstance("B");
ClassB.setAttribute('name',String)
ClassB.addAttribute('quality', String);
ClassB.setReference('wheelQuality',ClassA,-1);
ClassA.setReference('xf',ClassB,1);
var ClassC = Class.newInstance("C");
ClassC.addAttribute('name', String);
ClassA.setReference('reminder',ClassC,-1);
MM.add([ClassA,ClassB,ClassC])
var smallA = ClassA.newInstance();
smallA.wheels = 4;
var bigA = ClassA.newInstance();
bigA.wheels = 6;
bigA.next=smallA
var smallB = ClassB.newInstance();
smallB.name='TUV'
smallB.quality = 'good';
smallB.wheelQuality=[smallA, bigA];
var xA = ClassA.newInstance({wheels: 2});
var xxA = ClassA.newInstance({wheels: 1});
smallA.next=xA;
xA.next=xxA;
var smallx = ClassB.newInstance({name: 'NordVerif', quality: 'medium'});
smallx.wheelQuality=[xA,xxA];
var cein = ClassC.newInstance({name: 'Change'});
smallA.reminder=cein;
xxA.reminder=cein;
var M = new Model('Testvisu')
M.setReferenceModel(MM);
M.add([smallA, smallB, bigA, cein, xA, xxA, smallx]);
return M;
}
module.exports = {
buildModel: buildModel
};