Merge branch 'master' of git.inpt.fr:tocard-inc/enseeiht/gls/projet

This commit is contained in:
Laurent Fainsin 2022-01-18 19:52:14 +01:00
commit 275f849c47
28 changed files with 1210 additions and 176 deletions

View file

@ -0,0 +1,3 @@
op finished = lieu_Succes \/ lieu_Echec;
[] (finished => dead);
[] <> finished ;

View file

@ -4,49 +4,7 @@ create OUT: petrinet from IN: game;
helper context game!Explorateur helper context String
def: getJeu() : game!Jeu =
game!Jeu.allInstances()
->asSequence()
->first();
helper context game!Objet
def: getJeu() : game!Jeu =
game!Jeu.allInstances()
->asSequence()
->first();
helper context game!Connaissance
def: getJeu() : game!Jeu =
game!Jeu.allInstances()
->asSequence()
->first();
helper context game!Action
def: getJeu() : game!Jeu =
game!Jeu.allInstances()
->asSequence()
->first();
helper context game!Personne
def: getJeu() : game!Jeu =
game!Jeu.allInstances()
->asSequence()
->first();
helper context game!Chemin
def: getJeu() : game!Jeu =
game!Jeu.allInstances()
->asSequence()
->first();
helper context game!Lieu
def: getJeu() : game!Jeu =
game!Jeu.allInstances()
->asSequence()
->first();
helper context game!Interaction
def: getJeu() : game!Jeu = def: getJeu() : game!Jeu =
game!Jeu.allInstances() game!Jeu.allInstances()
->asSequence() ->asSequence()
@ -56,7 +14,7 @@ helper context String
def: getTaille() : Integer = def: getTaille() : Integer =
game!Objet.allInstances() game!Objet.allInstances()
->asSequence() ->asSequence()
->select(o | o.nom.nom = self) ->select(o | o.name = self)
->first().taille; ->first().taille;
helper context game!Lieu helper context game!Lieu
@ -68,12 +26,6 @@ def : estDepart() : Integer =
->size() > 0) ->size() > 0)
->size(); ->size();
-- Obtenir le network
helper def: getNetwork() : petrinet!Network =
petrinet!Network.allInstances()
->select(n | n.name = 'jeu')
->asSequence()->first();
-- Obtenir la taille de l'explorateur -- Obtenir la taille de l'explorateur
helper context String helper context String
def: getTailleExp() : Integer = def: getTailleExp() : Integer =
@ -94,7 +46,7 @@ def : getNombreInit() : Integer =
game!Explorateur.allInstances() game!Explorateur.allInstances()
->asSequence() ->asSequence()
->first().objets ->first().objets
->select(o | o.nom = self.nom.nom) ->select(o | o.name = self.name)
->size(); ->size();
-- Nombre de connaissances initiaux de l'explo -- Nombre de connaissances initiaux de l'explo
@ -103,7 +55,7 @@ def : getNombreInit() : Integer =
game!Explorateur.allInstances() game!Explorateur.allInstances()
->asSequence() ->asSequence()
->first().connaissances ->first().connaissances
->select(c | c.nom = self.nom.nom) ->select(c | c.name = self.name)
->size(); ->size();
-- Nombre de place libre itiale de l'explo -- Nombre de place libre itiale de l'explo
@ -113,18 +65,11 @@ def : getNombreInit() : Integer =
->asSequence() ->asSequence()
->iterate(o; res : Integer = self.tailleInventaire | res - o.getNombreInit() * o.taille); ->iterate(o; res : Integer = self.tailleInventaire | res - o.getNombreInit() * o.taille);
-- Obtenir la place d'un chemin (in / out)
helper context game!Chemin
def: getPlaceOf(s : String): petrinet!Place =
petrinet!Place.allInstances()
->select(p | p.name = s)
->asSequence()
->first();
helper context game!Lieu helper context game!Lieu
def: getPlace(): petrinet!Place = def: getPlace(): petrinet!Place =
petrinet!Place.allInstances() petrinet!Place.allInstances()
->select(p | p.name = 'lieu_' + self.nom.nom) ->select(p | p.name = 'lieu_' + self.name)
->asSequence() ->asSequence()
->first(); ->first();
@ -141,7 +86,7 @@ def: getPersonne(): game!Personne =
helper context String helper context String
def : getObjet() : game!Objet = def : getObjet() : game!Objet =
game!Objet.allInstances() game!Objet.allInstances()
->select(o | o.nom.nom = self) ->select(o | o.name = self)
->asSequence() ->asSequence()
->first(); ->first();
@ -149,7 +94,7 @@ helper context game!Personne
def: getLieu(): game!Lieu = def: getLieu(): game!Lieu =
game!Lieu.allInstances() game!Lieu.allInstances()
->select(l | l.personnes ->select(l | l.personnes
->select(p | p.nom = self.nom.nom) ->select(p | p.name = self.name)
->asSequence() ->asSequence()
->size() > 0) ->size() > 0)
->asSequence() ->asSequence()
@ -159,16 +104,16 @@ helper context game!Action
def : getInteraction() : game!Interaction = def : getInteraction() : game!Interaction =
game!Interaction.allInstances() game!Interaction.allInstances()
->select(i | i.actions ->select(i | i.actions
->select(a | a.nom.nom = self.nom.nom) ->select(a | a.name = self.name)
->asSequence() ->asSequence()
->size() > 0) ->size() > 0)
->asSequence() ->asSequence()
->first(); ->first();
helper context petrinet!Transition helper context String
def : getPlace(s : String) : petrinet!Place = def : getPlace() : petrinet!Place =
petrinet!Place.allInstances() petrinet!Place.allInstances()
->select(p | p.name = s) ->select(p | p.name = self)
->asSequence() ->asSequence()
->first(); ->first();
@ -184,142 +129,170 @@ rule Explorateur2Petrinet {
p: petrinet!Place( p: petrinet!Place(
name <- 'taille', name <- 'taille',
tokens <- e.getNombreInit(), tokens <- e.getNombreInit(),
network <- e.getJeu()) network <- ''.getJeu())
} }
rule Objet2PetriNet { rule Objet2PetriNet {
from o: game!Objet from o: game!Objet
to to
p_obj: petrinet!Place( p_obj: petrinet!Place(
name <- 'objet_' + o.nom.nom, name <- 'objet_' + o.name,
tokens <- o.getNombreInit(), tokens <- o.getNombreInit(),
network <- o.getJeu()), network <- ''.getJeu()),
p_objneg: petrinet!Place( p_objneg: petrinet!Place(
name <- 'objet_' + o.nom.nom + '_neg', name <- 'objet_' + o.name + '_neg',
tokens <- ''.getTailleExp() div o.taille - o.getNombreInit(), tokens <- ''.getTailleExp() div o.taille - o.getNombreInit(),
network <- o.getJeu()) network <- ''.getJeu())
} }
rule Connaissance2PetriNet { rule Connaissance2PetriNet {
from c: game!Connaissance from c: game!Connaissance
to to
p_con: petrinet!Place( p_con: petrinet!Place(
name <- 'connaissance_' + c.nom.nom, name <- 'connaissance_' + c.name,
tokens <- c.getNombreInit(), tokens <- c.getNombreInit(),
network <- c.getJeu()), network <- ''.getJeu()),
p_conneg: petrinet!Place( p_conneg: petrinet!Place(
name <- 'connaissance_' + c.nom.nom + '_neg', name <- 'connaissance_' + c.name + '_neg',
tokens <- 1 - c.getNombreInit(), tokens <- 1 - c.getNombreInit(),
network <- c.getJeu()) network <- ''.getJeu())
} }
rule Personne2PetriNet { rule Personne2PetriNet {
from p: game!Personne from p: game!Personne
to to
pers: petrinet!Place( pers: petrinet!Place(
name <- 'personne_' + p.nom.nom, name <- 'personne_' + p.name,
tokens <- 0, tokens <- 0,
network <- p.getJeu()) network <- ''.getJeu())
} }
rule Lieu2PetriNet { rule Lieu2PetriNet {
from l: game!Lieu from l: game!Lieu
to to
p: petrinet!Place( p: petrinet!Place(
name <- 'lieu_' + l.nom.nom, name <- 'lieu_' + l.name,
tokens <- l.estDepart(), tokens <- l.estDepart(),
network <- l.getJeu()) network <- ''.getJeu())
} }
rule Chemin2PetriNet { rule Chemin2PetriNet {
from c: game!Chemin from c: game!Chemin
to using {
t: petrinet!Transition( index : Integer = 0;
name <- 'chemin_' + c.nom.nom, }
network <- c.getJeu()),
arcIn: petrinet!Arc(
place <- c.getPlaceOf('lieu_' + c.lieuIn.nom),
transition <- t,
outgoing <- false,
weight <- 1),
arcOut: petrinet!Arc(
place <- c.getPlaceOf('lieu_' + c.lieuOut.nom),
transition <- t,
outgoing <- true,
weight <- 1)
do { do {
for (o in c.objetsConso) { index <- 0;
thisModule.consoObjet(t, o.nom); for (condVis in c.visible.condition) {
} for (condOuv in c.ouvert.condition) {
for (o in c.objetsRecus) { thisModule.newChemin(c, index, condVis.conditionTest.union(condOuv.conditionTest));
thisModule.recuObjet(t, o.nom); index <- index + 1;
}
for (con in c.connaissances) {
thisModule.recuConn(t, con.nom);
}
for (cond in c.visible.condition) {
for (cond2 in cond.conditionTest) {
if (cond2.oclIsKindOf(game!ConditionObjet)) {
thisModule.readObjetEga(t, cond2.objet, cond2.nombre);
} else {
if (cond2.negation = '!') {
thisModule.readConnNeg(t, cond2.connaissance);
} else {
thisModule.readConn(t, cond2.connaissance);
}
}
} }
} }
} }
} }
rule Interaction2PetriNet { rule newChemin(c : game!Chemin, index : Integer, conditions : game!ConditionTest) {
from i: game!Interaction
to to
t: petrinet!Transition( t: petrinet!Transition(
name <- 'interaction_' + i.nom.nom + '_' + i.getPersonne().nom.nom, name <- 'chemin_' + c.name + '_' + index.toString(),
network <- i.getJeu()), network <- ''.getJeu()),
arcIn: petrinet!Arc(
place <- ('lieu_' + c.lieuIn.name).getPlace(),
transition <- t,
outgoing <- false,
weight <- 1),
arcOut: petrinet!Arc( arcOut: petrinet!Arc(
place <- i.getPersonne(), place <- ('lieu_' + c.lieuOut.name).getPlace(),
transition <- t,
outgoing <- true,
weight <- 1)
do {
for (o in c.objetsConso) {
thisModule.consoObjet(t, o.name);
}
for (o in c.objetsRecus) {
thisModule.recuObjet(t, o.name);
}
for (con in c.connaissances) {
thisModule.recuConn(t, con.name);
}
thisModule.Condition2PetriNet(t, conditions);
}
}
rule Interaction2PetriNet {
from i: game!Interaction
using {
index : Integer = 0;
}
do {
index <- 0;
for (condVis in i.getPersonne().visible.condition) {
thisModule.newInteraction(i, index, condVis.conditionTest);
index <- index + 1;
}
}
}
rule newInteraction(i : game!Interaction, index : Integer, conditions : game!ConditionTest) {
to
t: petrinet!Transition(
name <- 'interaction_' + i.name + '_' + i.getPersonne().name + '_' + index.toString(),
network <- ''.getJeu()),
arcIn: petrinet!Arc(
place <- ('personne_' + i.getPersonne().name).getPlace(),
transition <- t, transition <- t,
outgoing <- true, outgoing <- true,
weight <- 1), weight <- 1),
arcIn: petrinet!Arc( arcOut: petrinet!Arc(
place <- i.getPersonne().getLieu().getPlace(), place <- ('lieu_' + i.getPersonne().getLieu().name).getPlace(),
transition <- t, transition <- t,
outgoing <- false, outgoing <- false,
weight <- 1) weight <- 1)
do { do {
for (o in i.objetsConso) { for (o in i.objetsConso) {
thisModule.consoObjet(t, o.nom); thisModule.consoObjet(t, o.name);
} }
for (o in i.objetsRecus) { for (o in i.objetsRecus) {
thisModule.recuObjet(t, o.nom); thisModule.recuObjet(t, o.name);
} }
for (c in i.connaissances) { for (con in i.connaissances) {
thisModule.recuConn(t, c.nom); thisModule.recuConn(t, con.name);
} }
for (cond in i.getPersonne().visible.condition) { thisModule.Condition2PetriNet(t, conditions);
for (cond2 in cond.conditionTest) { }
if (cond2.oclIsKindOf(game!ConditionObjet)) { }
if (cond2.comparateur = '==') {
thisModule.readObjetEga(('interaction_' + i.nom.nom + '_' + i.getPersonne().nom.nom).getTransition(), cond2.objet, cond2.nombre);
} else if (cond2.comparateur = '>') { rule Condition2PetriNet(t : petrinet!Transition, c : game!Condition) {
thisModule.readObjetSup(('interaction_' + i.nom.nom + '_' + i.getPersonne().nom.nom).getTransition(), cond2.objet, cond2.nombre); do {
} for (cond in c) {
} else { if (cond.oclIsKindOf(game!ConditionObjet)) {
if (cond2.negation = '!') { if (cond.comparateur = '==') {
thisModule.readConnNeg(('interaction_' + i.nom.nom + '_' + i.getPersonne().nom.nom).getTransition(), cond2.connaissance); thisModule.readObjetEga(t, cond.objet.name, cond.nombre);
} else { } else if (cond.comparateur = '>') {
thisModule.readConn(('interaction_' + i.nom.nom + '_' + i.getPersonne().nom.nom).getTransition(), cond2.connaissance); thisModule.readObjetSup(t, cond.objet.name, cond.nombre);
} } else if (cond.comparateur = '>=') {
thisModule.readObjetSup(t, cond.objet.name, cond.nombre - 1);
} else if (cond.comparateur = '<') {
thisModule.readObjetInf(t, cond.objet.name, cond.nombre);
} else if (cond.comparateur = '<=') {
thisModule.readObjetInf(t, cond.objet.name, cond.nombre + 1);
} }
} else if (cond.oclIsKindOf(game!ConditionConnaissance)) {
if (cond.negation = '!') {
thisModule.readConnNeg(t, cond.connaissance.name);
} else {
thisModule.readConn(t, cond.connaissance.name);
}
} else {
} }
} }
} }
@ -327,10 +300,23 @@ rule Interaction2PetriNet {
rule Action2PetriNet { rule Action2PetriNet {
from a: game!Action from a: game!Action
using {
index : Integer = 0;
}
do {
index <- 0;
for (condVis in a.visible.condition) {
thisModule.newAction(a, index, condVis.conditionTest);
index <- index + 1;
}
}
}
rule newAction(a : game!Action, index : Integer, conditions : game!ConditionTest) {
to to
t: petrinet!Transition( t: petrinet!Transition(
name <- 'action_' + a.nom.nom, name <- 'action_' + a.name,
network <- a.getJeu()), network <- ''.getJeu()),
arcIn: petrinet!Arc( arcIn: petrinet!Arc(
place <- a.getInteraction().getPersonne(), place <- a.getInteraction().getPersonne(),
@ -345,13 +331,13 @@ rule Action2PetriNet {
weight <- 1) weight <- 1)
do { do {
for (o in a.objetsConso) { for (o in a.objetsConso) {
thisModule.consoObjet(t, o.nom); thisModule.consoObjet(t, o.name);
} }
for (o in a.objetsRecus) { for (o in a.objetsRecus) {
thisModule.recuObjet(t, o.nom); thisModule.recuObjet(t, o.name);
} }
for (c in a.connaissances) { for (c in a.connaissances) {
thisModule.recuConn(t, c.nom); thisModule.recuConn(t, c.name);
} }
} }
} }
@ -359,19 +345,19 @@ rule Action2PetriNet {
rule consoObjet(t : game!Transition, s : String) { rule consoObjet(t : game!Transition, s : String) {
to to
arc : petrinet!Arc( arc : petrinet!Arc(
place <- t.getPlace('objet_' + s), place <- ('objet_' + s).getPlace(),
transition <- t, transition <- t,
outgoing <- false, outgoing <- false,
weight <- 1), weight <- 1),
arcNeg : petrinet!Arc( arcNeg : petrinet!Arc(
place <- t.getPlace('objet_' + s + '_neg'), place <- ('objet_' + s + '_neg').getPlace(),
transition <- t, transition <- t,
outgoing <- true, outgoing <- true,
weight <- 1), weight <- 1),
arcTaille : petrinet!Arc( arcTaille : petrinet!Arc(
place <- t.getPlace('taille'), place <- 'taille'.getPlace(),
transition <- t, transition <- t,
outgoing <- true, outgoing <- true,
weight <- s.getObjet().taille) weight <- s.getObjet().taille)
@ -380,55 +366,70 @@ rule consoObjet(t : game!Transition, s : String) {
rule readObjetEga(t : game!Transition, s : String, n : Integer) { rule readObjetEga(t : game!Transition, s : String, n : Integer) {
to to
arc : petrinet!Arc( arc : petrinet!Arc(
place <- t.getPlace('objet_' + s), place <- ('objet_' + s).getPlace(),
transition <- t, transition <- t,
outgoing <- false, outgoing <- false,
weight <- n), weight <- n),
arc2 : petrinet!Arc( arc2 : petrinet!Arc(
place <- t.getPlace('objet_' + s), place <- ('objet_' + s).getPlace(),
transition <- t, transition <- t,
outgoing <- true, outgoing <- true,
weight <- n), weight <- n),
arc_neg : petrinet!Arc( arc_neg : petrinet!Arc(
place <- t.getPlace('objet_' + s + '_neg'), place <- ('objet_' + s + '_neg').getPlace(),
transition <- t, transition <- t,
outgoing <- false, outgoing <- false,
weight <- (s.getTailleExp() div s.getTaille()) - n), weight <- (''.getTailleExp() div s.getTaille()) - n),
arc2_neg : petrinet!Arc( arc2_neg : petrinet!Arc(
place <- t.getPlace('objet_' + s + '_neg'), place <- ('objet_' + s + '_neg').getPlace(),
transition <- t, transition <- t,
outgoing <- true, outgoing <- true,
weight <- (s.getTailleExp() div s.getTaille()) - n) weight <- (''.getTailleExp() div s.getTaille()) - n)
} }
rule readObjetSup(t : game!Transition, s : String, n : Integer) { rule readObjetSup(t : game!Transition, s : String, n : Integer) {
to to
arc : petrinet!Arc( arc : petrinet!Arc(
place <- t.getPlace('objet_' + s), place <- ('objet_' + s).getPlace(),
transition <- t, transition <- t,
outgoing <- false, outgoing <- false,
weight <- n + 1), weight <- n + 1),
arc2 : petrinet!Arc( arc2 : petrinet!Arc(
place <- t.getPlace('objet_' + s), place <- ('objet_' + s).getPlace(),
transition <- t, transition <- t,
outgoing <- true, outgoing <- true,
weight <- n + 1) weight <- n + 1)
} }
rule readObjetInf(t : game!Transition, s : String, n : Integer) {
to
arc : petrinet!Arc(
place <- ('objet_' + s + '_neg').getPlace(),
transition <- t,
outgoing <- false,
weight <- (s.getTailleExp() div s.getTaille()) - n + 1),
arc2 : petrinet!Arc(
place <- ('objet_' + s + '_neg').getPlace(),
transition <- t,
outgoing <- true,
weight <- (s.getTailleExp() div s.getTaille()) - n + 1)
}
rule readConn(t : game!Transition, s : String) { rule readConn(t : game!Transition, s : String) {
to to
arc : petrinet!Arc( arc : petrinet!Arc(
place <- t.getPlace('connaissance_' + s), place <- ('connaissance_' + s).getPlace(),
transition <- t, transition <- t,
outgoing <- false, outgoing <- false,
weight <- 1), weight <- 1),
arc2 : petrinet!Arc( arc2 : petrinet!Arc(
place <- t.getPlace('connaissance_' + s), place <- ('connaissance_' + s).getPlace(),
transition <- t, transition <- t,
outgoing <- true, outgoing <- true,
weight <- 1) weight <- 1)
@ -437,13 +438,13 @@ rule readConn(t : game!Transition, s : String) {
rule readConnNeg(t : game!Transition, s : String) { rule readConnNeg(t : game!Transition, s : String) {
to to
arc : petrinet!Arc( arc : petrinet!Arc(
place <- t.getPlace('connaissance_' + s + '_neg'), place <- ('connaissance_' + s + '_neg').getPlace(),
transition <- t, transition <- t,
outgoing <- false, outgoing <- false,
weight <- 1), weight <- 1),
arc2 : petrinet!Arc( arc2 : petrinet!Arc(
place <- t.getPlace('connaissance_' + s + '_neg'), place <- ('connaissance_' + s + '_neg').getPlace(),
transition <- t, transition <- t,
outgoing <- true, outgoing <- true,
weight <- 1) weight <- 1)
@ -452,19 +453,19 @@ rule readConnNeg(t : game!Transition, s : String) {
rule recuObjet(t : game!Transition, s : String) { rule recuObjet(t : game!Transition, s : String) {
to to
arc : petrinet!Arc( arc : petrinet!Arc(
place <- t.getPlace('objet_' + s), place <- ('objet_' + s).getPlace(),
transition <- t, transition <- t,
outgoing <- true, outgoing <- true,
weight <- 1), weight <- 1),
arcNeg : petrinet!Arc( arcNeg : petrinet!Arc(
place <- t.getPlace('objet_' + s + '_neg'), place <- ('objet_' + s + '_neg').getPlace(),
transition <- t, transition <- t,
outgoing <- false, outgoing <- false,
weight <- 1), weight <- 1),
arcTaille : petrinet!Arc( arcTaille : petrinet!Arc(
place <- t.getPlace('taille'), place <- 'taille'.getPlace(),
transition <- t, transition <- t,
outgoing <- false, outgoing <- false,
weight <- s.getObjet().taille) weight <- s.getObjet().taille)
@ -473,13 +474,13 @@ rule recuObjet(t : game!Transition, s : String) {
rule recuConn(t : game!Transition, s : String) { rule recuConn(t : game!Transition, s : String) {
to to
arc : petrinet!Arc( arc : petrinet!Arc(
place <- t.getPlace('connaissance_' + s), place <- ('connaissance_' + s).getPlace(),
transition <- t, transition <- t,
outgoing <- true, outgoing <- true,
weight <- 1), weight <- 1),
arcNeg : petrinet!Arc( arcNeg : petrinet!Arc(
place <- t.getPlace('connaissance_' + s + '_neg'), place <- ('connaissance_' + s + '_neg').getPlace(),
transition <- t, transition <- t,
outgoing <- false, outgoing <- false,
weight <- 1) weight <- 1)

View file

@ -8,8 +8,8 @@ pl personne_Sphinx (0)
pl lieu_Enigme (1) pl lieu_Enigme (1)
pl lieu_Succes (0) pl lieu_Succes (0)
pl lieu_Echec (0) pl lieu_Echec (0)
tr chemin_win lieu_Enigme*1 connaissance_Reussite*1 -> lieu_Succes*1 connaissance_Reussite*1 tr chemin_Win_0 lieu_Enigme*1 connaissance_Reussite*1 -> lieu_Succes*1 connaissance_Reussite*1
tr chemin_loose lieu_Enigme*1 objet_tentative*0 objet_tentative_neg*3 -> lieu_Echec*1 objet_tentative*0 objet_tentative_neg*3 tr chemin_Loose_0 lieu_Enigme*1 objet_tentative*0 objet_tentative_neg*3 -> lieu_Echec*1 objet_tentative*0 objet_tentative_neg*3
tr interaction_Parler_Sphinx lieu_Enigme*1 connaissance_Reussite_neg*1 objet_tentative*1 -> personne_Sphinx*1 connaissance_Reussite_neg*1 objet_tentative*1 tr interaction_Parler_Sphinx_0 lieu_Enigme*1 connaissance_Reussite_neg*1 objet_tentative*1 -> personne_Sphinx*1 connaissance_Reussite_neg*1 objet_tentative*1
tr action_Reponse_1 personne_Sphinx*1 connaissance_Reussite_neg*1 -> lieu_Enigme*1 connaissance_Reussite*1 tr action_Reponse_1 personne_Sphinx*1 connaissance_Reussite_neg*1 -> lieu_Enigme*1 connaissance_Reussite*1
tr action_Reponse_2 personne_Sphinx*1 objet_tentative*1 -> lieu_Enigme*1 objet_tentative_neg*1 taille*1 tr action_Reponse_2 personne_Sphinx*1 objet_tentative*1 -> lieu_Enigme*1 objet_tentative_neg*1 taille*1

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>fr.n7.game.toLTL.ui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5

View file

@ -0,0 +1,20 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Acceleo ToLTL Module IDE Plug-in
Bundle-SymbolicName: fr.n7.game.toLTL.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: fr.n7.game.toLTL.ui.Activator
Bundle-Vendor: Eclipse Modeling Project
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
fr.n7.game.toLTL,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi,
org.eclipse.ocl,
org.eclipse.ocl.ecore,
org.eclipse.acceleo.model,
org.eclipse.acceleo.engine
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true

View file

@ -0,0 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
icons/

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
adaptable="true"
objectClass="org.eclipse.core.resources.IFile"
nameFilter="*.game"
id="fr.n7.game.toLTL.ui.popupMenus.contribution.IFile">
<menu id="org.eclipse.acceleo.module.menu" label="Acceleo Model to Text" path="additionsAcceleo">
<groupMarker name="acceleo"/>
</menu>
<action
class="fr.n7.game.toLTL.ui.popupMenus.AcceleoGenerateToLTLAction"
enablesFor="+"
id="fr.n7.game.toLTL.ui.popupMenus.acceleoGenerateToLTLAction"
icon="icons/default.gif"
label="Generate ToLTL"
menubarPath="org.eclipse.acceleo.module.menu/acceleo"/>
</objectContribution>
</extension>
</plugin>

View file

@ -0,0 +1,66 @@
/*******************************************************************************
* Copyright (c) 2008, 2012 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package fr.n7.game.toLTL.ui;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle.
*/
public class Activator extends AbstractUIPlugin {
/**
* The plug-in ID.
*/
public static final String PLUGIN_ID = "fr.n7.game.toLTL.ui";
/**
* The shared instance.
*/
private static Activator plugin;
/**
* The constructor.
*/
public Activator() {
}
/**{@inheritDoc}
*
* @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
* @generated
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/**{@inheritDoc}
*
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
* @generated
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance.
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}

View file

@ -0,0 +1,86 @@
/*******************************************************************************
* Copyright (c) 2008, 2012 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package fr.n7.game.toLTL.ui.common;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.common.util.URI;
/**
* Main entry point of the 'ToLTL' generation module.
*/
public class GenerateAll {
/**
* The model URI.
*/
private URI modelURI;
/**
* The output folder.
*/
private IContainer targetFolder;
/**
* The other arguments.
*/
List<? extends Object> arguments;
/**
* Constructor.
*
* @param modelURI
* is the URI of the model.
* @param targetFolder
* is the output folder
* @param arguments
* are the other arguments
* @throws IOException
* Thrown when the output cannot be saved.
* @generated
*/
public GenerateAll(URI modelURI, IContainer targetFolder, List<? extends Object> arguments) {
this.modelURI = modelURI;
this.targetFolder = targetFolder;
this.arguments = arguments;
}
/**
* Launches the generation.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* Thrown when the output cannot be saved.
* @generated
*/
public void doGenerate(IProgressMonitor monitor) throws IOException {
if (!targetFolder.getLocation().toFile().exists()) {
targetFolder.getLocation().toFile().mkdirs();
}
monitor.subTask("Loading...");
fr.n7.game.toLTL.main.ToLTL gen0 = new fr.n7.game.toLTL.main.ToLTL(modelURI, targetFolder.getLocation().toFile(), arguments);
monitor.worked(1);
String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("fr.n7.game.toLTL", "fr.n7.game.toLTL.main.ToLTL", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
gen0.setGenerationID(generationID);
gen0.doGenerate(BasicMonitor.toMonitor(monitor));
}
}

View file

@ -0,0 +1,116 @@
/*******************************************************************************
* Copyright (c) 2008, 2012 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package fr.n7.game.toLTL.ui.popupMenus;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.URI;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import fr.n7.game.toLTL.ui.Activator;
import fr.n7.game.toLTL.ui.common.GenerateAll;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionDelegate;
/**
* ToLTL code generation.
*/
public class AcceleoGenerateToLTLAction extends ActionDelegate implements IActionDelegate {
/**
* Selected model files.
*/
protected List<IFile> files;
/**{@inheritDoc}
*
* @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
* @generated
*/
@SuppressWarnings("unchecked")
public void selectionChanged(IAction action, ISelection selection) {
if (selection instanceof IStructuredSelection) {
files = ((IStructuredSelection) selection).toList();
}
}
/**{@inheritDoc}
*
* @see org.eclipse.ui.actions.ActionDelegate#run(org.eclipse.jface.action.IAction)
* @generated
*/
public void run(IAction action) {
if (files != null) {
IRunnableWithProgress operation = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
try {
Iterator<IFile> filesIt = files.iterator();
while (filesIt.hasNext()) {
IFile model = (IFile)filesIt.next();
URI modelURI = URI.createPlatformResourceURI(model.getFullPath().toString(), true);
IContainer targetFolder = null;
try {
IContainer target = model.getProject().getFolder("src-gen");
targetFolder = target;
GenerateAll generator = new GenerateAll(modelURI, targetFolder, getArguments());
generator.doGenerate(monitor);
} catch (IOException e) {
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
Activator.getDefault().getLog().log(status);
} finally {
if (targetFolder != null) {
targetFolder.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
}
}
}
} catch (CoreException e) {
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
Activator.getDefault().getLog().log(status);
}
}
};
try {
PlatformUI.getWorkbench().getProgressService().run(true, true, operation);
} catch (InvocationTargetException e) {
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
Activator.getDefault().getLog().log(status);
} catch (InterruptedException e) {
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
Activator.getDefault().getLog().log(status);
}
}
}
/**
* Computes the arguments of the generator.
*
* @return the arguments
* @generated
*/
protected List<? extends Object> getArguments() {
return new ArrayList<String>();
}
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-12"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" output="bin" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>fr.n7.game.toLTL</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.acceleo.ide.ui.acceleoBuilder</name>
<arguments>
<dictionary>
<key>compilation.kind</key>
<value>compilation.platform.resource</value>
</dictionary>
<dictionary>
<key>compliance</key>
<value>pragmatic</value>
</dictionary>
<dictionary>
<key>resource.kind</key>
<value>xmi</value>
</dictionary>
<dictionary>
<key>trim-position</key>
<value>false</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.acceleo.ide.ui.acceleoNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,23 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Acceleo ToLTL Module Runtime Plug-in
Bundle-SymbolicName: fr.n7.game.toLTL
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: fr.n7.game.toLTL.Activator
Bundle-Vendor: Eclipse Modeling Project
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore,
org.eclipse.emf.ecore.xmi,
org.eclipse.ocl,
org.eclipse.ocl.ecore,
org.eclipse.acceleo.common;bundle-version="3.3.0",
org.eclipse.acceleo.model;bundle-version="3.3.0",
org.eclipse.acceleo.profiler;bundle-version="3.3.0",
org.eclipse.acceleo.engine;bundle-version="3.3.0",
com.google.guava
Bundle-RequiredExecutionEnvironment: JavaSE-12
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Export-Package: fr.n7.game.toLTL.main

View file

@ -0,0 +1 @@
/fr/

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
jre.compilation.profile = JavaSE-12

View file

@ -0,0 +1,66 @@
/*******************************************************************************
* Copyright (c) 2008, 2011 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package fr.n7.game.toLTL;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle.
*/
public class Activator extends Plugin {
/**
* The plug-in ID.
*/
public static final String PLUGIN_ID = "fr.n7.game.toLTL";
/**
* The shared instance.
*/
private static Activator plugin;
/**
* The constructor.
*/
public Activator() {
}
/**
* {@inheritDoc}
*
* @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance.
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}

View file

@ -0,0 +1,412 @@
/*******************************************************************************
* Copyright (c) 2008, 2012 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package fr.n7.game.toLTL.main;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.common.util.Monitor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
/**
* Entry point of the 'ToLTL' generation module.
*
* @generated
*/
public class ToLTL extends AbstractAcceleoGenerator {
/**
* The name of the module.
*
* @generated
*/
public static final String MODULE_FILE_NAME = "/fr/n7/game/toLTL/main/toLTL";
/**
* The name of the templates that are to be generated.
*
* @generated
*/
public static final String[] TEMPLATE_NAMES = { "generateElement" };
/**
* The list of properties files from the launch parameters (Launch configuration).
*
* @generated
*/
private List<String> propertiesFiles = new ArrayList<String>();
/**
* Allows the public constructor to be used. Note that a generator created
* this way cannot be used to launch generations before one of
* {@link #initialize(EObject, File, List)} or
* {@link #initialize(URI, File, List)} is called.
* <p>
* The main reason for this constructor is to allow clients of this
* generation to call it from another Java file, as it allows for the
* retrieval of {@link #getProperties()} and
* {@link #getGenerationListeners()}.
* </p>
*
* @generated
*/
public ToLTL() {
// Empty implementation
}
/**
* This allows clients to instantiates a generator with all required information.
*
* @param modelURI
* URI where the model on which this generator will be used is located.
* @param targetFolder
* This will be used as the output folder for this generation : it will be the base path
* against which all file block URLs will be resolved.
* @param arguments
* If the template which will be called requires more than one argument taken from the model,
* pass them here.
* @throws IOException
* This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
* the model cannot be loaded.
* @generated
*/
public ToLTL(URI modelURI, File targetFolder,
List<? extends Object> arguments) throws IOException {
initialize(modelURI, targetFolder, arguments);
}
/**
* This allows clients to instantiates a generator with all required information.
*
* @param model
* We'll iterate over the content of this element to find Objects matching the first parameter
* of the template we need to call.
* @param targetFolder
* This will be used as the output folder for this generation : it will be the base path
* against which all file block URLs will be resolved.
* @param arguments
* If the template which will be called requires more than one argument taken from the model,
* pass them here.
* @throws IOException
* This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
* @generated
*/
public ToLTL(EObject model, File targetFolder,
List<? extends Object> arguments) throws IOException {
initialize(model, targetFolder, arguments);
}
/**
* This can be used to launch the generation from a standalone application.
*
* @param args
* Arguments of the generation.
* @generated
*/
public static void main(String[] args) {
try {
if (args.length < 2) {
System.out.println("Arguments not valid : {model, folder}.");
} else {
URI modelURI = URI.createFileURI(args[0]);
File folder = new File(args[1]);
List<String> arguments = new ArrayList<String>();
/*
* If you want to change the content of this method, do NOT forget to change the "@generated"
* tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
* of the Acceleo module with the main template that has caused the creation of this class will
* revert your modifications.
*/
/*
* Add in this list all the arguments used by the starting point of the generation
* If your main template is called on an element of your model and a String, you can
* add in "arguments" this "String" attribute.
*/
ToLTL generator = new ToLTL(modelURI, folder, arguments);
/*
* Add the properties from the launch arguments.
* If you want to programmatically add new properties, add them in "propertiesFiles"
* You can add the absolute path of a properties files, or even a project relative path.
* If you want to add another "protocol" for your properties files, please override
* "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
* The behavior of the properties loader service is explained in the Acceleo documentation
* (Help -> Help Contents).
*/
for (int i = 2; i < args.length; i++) {
generator.addPropertiesFile(args[i]);
}
generator.doGenerate(new BasicMonitor());
}
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Launches the generation described by this instance.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* This will be thrown if any of the output files cannot be saved to disk.
* @generated
*/
@Override
public void doGenerate(Monitor monitor) throws IOException {
/*
* TODO if you wish to change the generation as a whole, override this. The default behavior should
* be sufficient in most cases. If you want to change the content of this method, do NOT forget to
* change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag,
* any compilation of the Acceleo module with the main template that has caused the creation of this
* class will revert your modifications. If you encounter a problem with an unresolved proxy during the
* generation, you can remove the comments in the following instructions to check for problems. Please
* note that those instructions may have a significant impact on the performances.
*/
//org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
/*
* If you want to check for potential errors in your models before the launch of the generation, you
* use the code below.
*/
//if (model != null && model.eResource() != null) {
// List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
// for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
// System.err.println(diagnostic.toString());
// }
//}
super.doGenerate(monitor);
}
/**
* If this generator needs to listen to text generation events, listeners can be returned from here.
*
* @return List of listeners that are to be notified when text is generated through this launch.
* @generated
*/
@Override
public List<IAcceleoTextGenerationListener> getGenerationListeners() {
List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
/*
* TODO if you need to listen to generation event, add listeners to the list here. If you want to change
* the content of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method
* to "@generated NOT". Without this new tag, any compilation of the Acceleo module with the main template
* that has caused the creation of this class will revert your modifications.
*/
return listeners;
}
/**
* If you need to change the way files are generated, this is your entry point.
* <p>
* The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
* files on the fly. If you only need to preview the results, return a new
* {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
* the running Eclipse and can be used standalone.
* </p>
* <p>
* If you need the file generation to be aware of the workspace (A typical example is when you wanna
* override files that are under clear case or any other VCS that could forbid the overriding), then
* return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
* <b>Note</b>, however, that this <b>cannot</b> be used standalone.
* </p>
* <p>
* All three of these default strategies support merging through JMerge.
* </p>
*
* @return The generation strategy that is to be used for generations launched through this launcher.
* @generated
*/
@Override
public IAcceleoGenerationStrategy getGenerationStrategy() {
return super.getGenerationStrategy();
}
/**
* This will be called in order to find and load the module that will be launched through this launcher.
* We expect this name not to contain file extension, and the module to be located beside the launcher.
*
* @return The name of the module that is to be launched.
* @generated
*/
@Override
public String getModuleName() {
return MODULE_FILE_NAME;
}
/**
* If the module(s) called by this launcher require properties files, return their qualified path from
* here.Take note that the first added properties files will take precedence over subsequent ones if they
* contain conflicting keys.
*
* @return The list of properties file we need to add to the generation context.
* @see java.util.ResourceBundle#getBundle(String)
* @generated
*/
@Override
public List<String> getProperties() {
/*
* If you want to change the content of this method, do NOT forget to change the "@generated"
* tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
* of the Acceleo module with the main template that has caused the creation of this class will
* revert your modifications.
*/
/*
* TODO if your generation module requires access to properties files, add their qualified path to the list here.
*
* Properties files can be located in an Eclipse plug-in or in the file system (all Acceleo projects are Eclipse
* plug-in). In order to use properties files located in an Eclipse plugin, you need to add the path of the properties
* files to the "propertiesFiles" list:
*
* final String prefix = "platform:/plugin/";
* final String pluginName = "org.eclipse.acceleo.module.sample";
* final String packagePath = "/org/eclipse/acceleo/module/sample/properties/";
* final String fileName = "default.properties";
* propertiesFiles.add(prefix + pluginName + packagePath + fileName);
*
* With this mechanism, you can load properties files from your plugin or from another plugin.
*
* You may want to load properties files from the file system, for that you need to add the absolute path of the file:
*
* propertiesFiles.add("C:\Users\MyName\MyFile.properties");
*
* If you want to let your users add properties files located in the same folder as the model:
*
* if (EMFPlugin.IS_ECLIPSE_RUNNING && model != null && model.eResource() != null) {
* propertiesFiles.addAll(AcceleoEngineUtils.getPropertiesFilesNearModel(model.eResource()));
* }
*
* To learn more about Properties Files, have a look at the Acceleo documentation (Help -> Help Contents).
*/
return propertiesFiles;
}
/**
* Adds a properties file in the list of properties files.
*
* @param propertiesFile
* The properties file to add.
* @generated
* @since 3.1
*/
@Override
public void addPropertiesFile(String propertiesFile) {
this.propertiesFiles.add(propertiesFile);
}
/**
* This will be used to get the list of templates that are to be launched by this launcher.
*
* @return The list of templates to call on the module {@link #getModuleName()}.
* @generated
*/
@Override
public String[] getTemplateNames() {
return TEMPLATE_NAMES;
}
/**
* This can be used to update the resource set's package registry with all needed EPackages.
*
* @param resourceSet
* The resource set which registry has to be updated.
* @generated
*/
@Override
public void registerPackages(ResourceSet resourceSet) {
super.registerPackages(resourceSet);
/*
* If you want to change the content of this method, do NOT forget to change the "@generated"
* tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
* of the Acceleo module with the main template that has caused the creation of this class will
* revert your modifications.
*/
/*
* If you need additional package registrations, you can register them here. The following line
* (in comment) is an example of the package registration for UML.
*
* You can use the method "isInWorkspace(Class c)" to check if the package that you are about to
* register is in the workspace.
*
* To register a package properly, please follow the following conventions:
*
* If the package is located in another plug-in, already installed in Eclipse. The following content should
* have been generated at the beginning of this method. Do not register the package using this mechanism if
* the metamodel is located in the workspace.
*
* if (!isInWorkspace(UMLPackage.class)) {
* // The normal package registration if your metamodel is in a plugin.
* resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
* }
*
* If the package is located in another project in your workspace, the plugin containing the package has not
* been register by EMF and Acceleo should register it automatically. If you want to use the generator in
* stand alone, the regular registration (seen a couple lines before) is needed.
*
* To learn more about Package Registration, have a look at the Acceleo documentation (Help -> Help Contents).
*/
}
/**
* This can be used to update the resource set's resource factory registry with all needed factories.
*
* @param resourceSet
* The resource set which registry has to be updated.
* @generated
*/
@Override
public void registerResourceFactories(ResourceSet resourceSet) {
super.registerResourceFactories(resourceSet);
/*
* If you want to change the content of this method, do NOT forget to change the "@generated"
* tag in the Javadoc of this method to "@generated NOT". Without this new tag, any compilation
* of the Acceleo module with the main template that has caused the creation of this class will
* revert your modifications.
*/
/*
* TODO If you need additional resource factories registrations, you can register them here. the following line
* (in comment) is an example of the resource factory registration.
*
* If you want to use the generator in stand alone, the resource factory registration will be required.
*
* To learn more about the registration of Resource Factories, have a look at the Acceleo documentation (Help -> Help Contents).
*/
// resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(XyzResource.FILE_EXTENSION, XyzResource.Factory.INSTANCE);
/*
* Some metamodels require a very complex setup for standalone usage. For example, if you want to use a generator
* targetting UML models in standalone, you NEED to use the following:
*/
// UMLResourcesUtil.init(resourceSet)
}
}

View file

@ -0,0 +1,21 @@
[comment encoding = UTF-8 /]
[module toLTL('http://www.n7.fr/game/xtext/Game')]
[template public generateElement(aJeu : Jeu)]
[comment @main/]
[file ('Prototype.ltl', false, 'UTF-8')]
[let lieux : OrderedSet(Lieu) = aJeu.getLieuxFinaux() ]
[for (lieux) before ('op finished = ') separator (' \\/ ') after (';')]['lieu_' + self.name/][/for]
[/let]
['[] (finished => dead);'/]
['[] <> finished ;'/]
[/file]
[/template]
[query public getLieuxFinaux(j : Jeu) : OrderedSet(Lieu) =
j.territoire.lieux
->select(l | l.fin.condition->first().conditionTest->first().oclIsKindOf(ConditionBoolean)
and l.fin.condition->first().conditionTest->first().oclAsType(ConditionBoolean).valeur = 'true')
->asOrderedSet()
/]

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="toLTL" name="fr.n7.game.toLTL">
<property name="ECLIPSE_HOME" value="../../../../../../../../mnt/n7fs/ens/tp_cregut/eclipse-gls-2020-09"/>
<property name="ECLIPSE_WORKSPACE" value="../.."/>
<!-- The classpath with only the dependencies used by the project -->
<path id="fr.n7.game.toLTL.libraryclasspath">
<pathelement location="${ECLIPSE_WORKSPACE}/fr.n7.game.toLTL/bin"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime_3.19.0.v20200724-1004.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.osgi_3.16.0.v20200828-0759.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.osgi.compatibility.state_1.2.100.v20200811-1344.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.common_3.13.0.v20200828-1034.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.jobs_3.10.800.v20200421-0950.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.registry_3.9.0.v20200625-1425.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.preferences_3.8.0.v20200422-1833.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.contenttype_3.7.800.v20200724-0804.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.app_1.5.0.v20200717-0620.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.23.0.v20200630-0516.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.20.0.v20200822-0801.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore.xmi_2.16.0.v20190528-0725.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl_3.15.100.v20201208-2229.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/lpg.runtime.java_2.0.17.v201004271640.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.common_1.8.500.v20201208-2229.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_3.15.100.v20201208-2229.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.common_3.7.11.202102190929.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.model_3.7.11.202102190929.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.profiler_3.7.11.202102190929.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.engine_3.7.11.202102190929.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen.ecore_2.23.0.v20200701-0840.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen_2.21.0.v20200708-0547.jar"/>
<pathelement location="${ECLIPSE_HOME}/plugins/com.google.guava_27.1.0.v20190517-1946.jar"/>
</path>
<path id="fr.n7.game.toLTL.classpath">
<path refid="fr.n7.game.toLTL.libraryclasspath"/>
</path>
<!-- The classpath with only the jars available in the plugin folder of Eclipse -->
<path id="fr.n7.game.toLTL.libraryclasspath.alljars">
<pathelement location="../fr.n7.game.toLTL/bin"/>
<fileset dir="${ECLIPSE_HOME}/plugins/" includes="*.jar"/>
</path>
<path id="fr.n7.game.toLTL.classpath.alljars">
<path refid="fr.n7.game.toLTL.libraryclasspath.alljars"/>
</path>
<!-- The default task with the jars used by this project -->
<target name="toLTL">
<java classname="fr.n7.game.toLTL.main.ToLTL" classpathref="fr.n7.game.toLTL.classpath">
<arg value="${model}"/>
<arg value="${target}"/>
</java>
</target>
<!--
In case of problem you can also try with all the jar available in your Eclipse
Keep in mind that having two versions of the same jar can create problems
-->
<target name="toLTL.alljars">
<java classname="fr.n7.game.toLTL.main.ToLTL" classpathref="fr.n7.game.toLTL.classpath">
<arg value="${model}"/>
<arg value="${target}"/>
</java>
</target>
</project>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Place this file in the target project and call it with "External Tools > Run As > Ant Build" -->
<!-- You have to change the MODEL and the TARGET values -->
<project basedir="." default="toLTLSample" name="fr.n7.game.toLTLSample">
<import file="../../fr.n7.game.toLTL/tasks/toLTL.xml"/>
<!-- Change the values of MODEL and TARGET to point to your model and output folder -->
<property name="MODEL" value="${basedir}/model/file.xmi"/>
<property name="TARGET" value="${basedir}/src-gen"/>
<target name="toLTLSample" description="Generate files in 'TARGET'">
<antcall target="toLTL" >
<param name="model" value="${MODEL}"/>
<param name="target" value="${TARGET}"/>
</antcall>
</target>
</project>

View file

@ -0,0 +1 @@
/fr/

View file

@ -99,19 +99,19 @@ Description:
; ;
Condition: Condition:
condition+=ConditionEt ('||' condition+=ConditionEt)* condition+=ConditionEt ('||' condition+=ConditionEt)*
; ;
ConditionEt: ConditionEt:
conditionTest+=ConditionTest ('&&' conditionTest+=ConditionTest)* conditionTest+=ConditionTest ('&&' conditionTest+=ConditionTest)*
; ;
ConditionTest: ConditionTest:
ConditionBoolean | ConditionConnaissance | ConditionObjet ConditionBoolean | ConditionConnaissance | ConditionObjet
; ;
ConditionBoolean: ConditionBoolean:
valeur=BOOLEAN valeur=BOOLEAN
; ;
ConditionConnaissance: ConditionConnaissance:
@ -123,9 +123,9 @@ ConditionObjet:
; ;
terminal COMPARATEUR: terminal COMPARATEUR:
'<' | '>' | '==' | '<=' | '>=' | '!=' '<' | '>' | '==' | '<=' | '>=' | '!='
; ;
terminal BOOLEAN: terminal BOOLEAN:
'true' | 'false' 'true' | 'false'
; ;

View file

@ -0,0 +1 @@
/fr/