Commit 6e0778f3 authored by Nicolas Biri's avatar Nicolas Biri
Browse files

Update to jsmf-core 0.4

parent 780e8cd2
v0.6:
- Migration to jsmf-core 0.4
......@@ -8,23 +8,22 @@ var inspect = require('eyes').inspector({
//** ********************************
var ma = new Model('a');
var instancea = MM.A.newInstance('a');
instancea.setName('toto');
instancea.name = 'toto';
var instanceaa = A.newInstance('aa');
instanceaa.setName('titi');
instanceaa.name = 'titi';
var instancec = C.newInstance('c');
instancec.setId(3);
instancec.id = 3;
var instancecc = C.newInstance('cc');
instancecc.setId(15);
instancecc.id = 15;
instancea.setToC(instancec);
instancea.setToC(instancecc);
instancea.toC = instancec;
instancea.toC = instancecc;
ma.setReferenceModel(MM.mma); //should check conformance?
ma.setModellingElements([instancea,instanceaa,instancec,instancecc]); //add a dummy creator of modelling elements
//should be created by default in ma model...
inspect(ma);
//Create an empty model mb
var mb = new Model('b');
......@@ -34,6 +33,5 @@ mb.setReferenceModel(MM.mmb);
module.exports = {
ma : ma,
mb : mb
};
......@@ -9,20 +9,15 @@ var mma = new Model('MetaA');
var mmb = new Model('MetaB');
var e = new Enum('MyEnum');
e.setLiteral('input',0);
e.setLiteral('output',1);
e.setLiteral('in-output',2);
//console.log('e',e);
var e = new Enum('MyEnum', ['input', 'output', 'in-output']);
var A = Class.newInstance('A');
A.setAttribute('name', String);
//A.setAttribute('value', e);
A.setAttribute('value', e);
var C = Class.newInstance('C');
C.setAttribute('id', Number); //define other primitive types?
C.setAttribute('id', Number);
A.setReference('toC', C, -1);
......
......@@ -16,7 +16,7 @@ var _ = require('lodash');
/*****************************************************************
* example transformation input model (ma) and output model (mb)
* ma: A(name) -> C(id)
* ma: A(name) -> C(id)
* ^ ^ ^
* | | |
* mb: B(nameB) -> D(num)
......@@ -31,6 +31,7 @@ var _ = require('lodash');
var trule2 = { //ATL <=> rule trule2 {
in : function(inputModel) { //ATL <=> from inputModel : MM!C
console.log(inputModel.Filter(MM.C));
return inputModel.Filter(MM.C);
},
......
......@@ -76,7 +76,7 @@ module.addRule({
in: function(x) { return NAV.allInstancesFromModel(MMI.App, x)},
out: function(i) {
var b = MMO.BehaviouralConcerns.newInstance();
b.setTimeConfig(MMO.TimeConfig.newInstance({initialTime: 0, debounce: 200}));
b.timeConfig = MMO.TimeConfig.newInstance({initialTime: 0, debounce: 200});
this.assign(b, 'stateFunction', i.state);
this.assign(b, 'mainLoop', i.initial);
return [b];
......
......@@ -42,8 +42,8 @@ switchExample.add(off);
/*
* set transitions
*/
tOn.setNext(off);
tOff.setNext(on);
tOn.next = off;
tOff.next = on;
/*
......
......@@ -6,61 +6,48 @@ var inspect = require('eyes').inspector({
var ma = new Model('a');
var familyMarch = MM.Family.newInstance('march');
familyMarch.setLastName('March');
familyMarch.lastName = 'March';
var fatherM = MM.Member.newInstance('Jim');
fatherM.setFirstName('Jim');
fatherM.firstName = 'Jim';
var motherM = MM.Member.newInstance('Cindy');
motherM.setFirstName('Cindy');
motherM.firstName = 'Cindy';
var sonM = MM.Member.newInstance('Brandon');
sonM.setFirstName('Brandon');
sonM.firstName = 'Brandon';
var daughterM = MM.Member.newInstance('Brenda');
daughterM.setFirstName('Brenda');
daughterM.firstName = 'Brenda';
//Should be resolved later with opposite!!!!!!!
//familyMarch.setFather(fatherM);
fatherM.setFamilyFather(familyMarch);
//familyMarch.setmother(motherM);
motherM.setFamilyMother(familyMarch);
//familyMarch.setsons(sonM);
sonM.setFamilySon(familyMarch);
//familyMarch.setdaughters(daughterM);
daughterM.setFamilyDaughter(familyMarch);
fatherM.familyFather = familyMarch;
motherM.familyMother = familyMarch;
sonM.familySon = familyMarch;
daughterM.familyDaughter = familyMarch;
var familySailor = MM.Family.newInstance('Sailor');
familySailor.setLastName('Sailor');
familySailor.lastName = 'Sailor';
var FatherS = MM.Member.newInstance('Peter');
FatherS.setFirstName('Peter');
FatherS.firstName = 'Peter';
var MotherS = MM.Member.newInstance('Jackie');
MotherS.setFirstName('Jackie');
MotherS.firstName = 'Jackie';
var SonS1 = MM.Member.newInstance('David');
SonS1.setFirstName('David');
SonS1.firstName = 'David';
var SonS2 = MM.Member.newInstance('Dylan');
SonS2.setFirstName('Dylan');
SonS2.firstName = 'Dylan';
var DaughterS = MM.Member.newInstance('Kelly');
DaughterS.setFirstName('Kelly');
DaughterS.firstName = 'Kelly';
//familySailor.setFather(FatherS);
FatherS.setFamilyFather(familySailor);
//familySailor.setmother(MotherS);
MotherS.setFamilyMother(familySailor);
//familySailor.setsons(SonS1);
SonS1.setFamilySon(familySailor);
//familySailor.setsons(SonS2);
SonS2.setFamilySon(familySailor);
//familySailor.setdaughters(DaughterS);
DaughterS.setFamilyDaughter(familySailor);
FatherS.familyFather = familySailor;
MotherS.familyMother = familySailor;
SonS1.familySon = familySailor;
SonS2.familySon = familySailor;
DaughterS.familyDaughter = familySailor;
//ma.setReferenceModel(MM.mma);
ma.setModellingElements([familyMarch,fatherM,motherM,sonM,daughterM,familySailor,FatherS,MotherS,SonS1,SonS2,DaughterS]);
//ma.setModellingElements([familyMarch,familySailor]);
module.exports = {
ma : ma
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment