avancement MTL prototype
This commit is contained in:
parent
f026271028
commit
c4f41f6f22
|
@ -17,6 +17,7 @@ List<Objet> jeu_objets = new ArrayList<>();
|
|||
false
|
||||
);
|
||||
);
|
||||
conditions_ET_objet_tentative_description_1.add(conditions_TEST_objet_tentative_description_1);
|
||||
|
||||
Condition condition_objet_tentative_description_1 = new Condition(conditions_ET_objet_tentative_description_1);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<mapEntry key="petrinet" value="METAMODELOUTPUT"/>
|
||||
</mapAttribute>
|
||||
<mapAttribute key="Options">
|
||||
<mapEntry key="OPTION_CLEAR" value="false"/>
|
||||
<mapEntry key="OPTION_CLEAR" value="true"/>
|
||||
<mapEntry key="OPTION_CONTENT_TYPE" value="false"/>
|
||||
<mapEntry key="OPTION_DERIVED" value="true"/>
|
||||
<mapEntry key="allowInterModelReferences" value="false"/>
|
||||
|
|
|
@ -29,7 +29,7 @@ rule Lieu2PetriNet {
|
|||
p: petrinet!Place(
|
||||
name <- 'lieu_' + l.nom.nom,
|
||||
tokens <- 0,
|
||||
network <- p.getNetwork('jeu'))
|
||||
network <- p.getNetwork())
|
||||
}
|
||||
|
||||
-- Traduire une WorkDefinition en un motif sur le réseau de Petri
|
||||
|
@ -38,7 +38,7 @@ rule Chemin2PetriNet {
|
|||
to
|
||||
-- TRANSITIONS d'un Chemin
|
||||
t: petrinet!Transition(
|
||||
name <- 'chemin_' + c.nom.nom,
|
||||
name <- 'chemin_' + c.Nom.nom,
|
||||
network <- t.getNetwork()),
|
||||
-- ARCS d'un Chemin
|
||||
arcIn: petrinet!Arc(
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -8,72 +8,47 @@
|
|||
public class Prototype {
|
||||
public static void main(String['['/][']'/] args) {
|
||||
|
||||
[comment Objets /]
|
||||
// "Objets"
|
||||
|
||||
List<Objet> jeu_objets = new ArrayList<>();
|
||||
|
||||
[for (o : Objet | jeu.objets)]
|
||||
List<Description> objet_[o.nom.nom/]_descriptions = new ArrayList<>();
|
||||
|
||||
[for (d : Description | o.descriptions)]
|
||||
[print(d.condition, 'objet_' + o.nom.nom + '_description_' + i.toString())/]
|
||||
|
||||
objet_[o.nom.nom/]_descriptions.add(
|
||||
new Description(
|
||||
"[d.texte/]",
|
||||
objet_[o.nom.nom/]_description_[i/]
|
||||
)
|
||||
);
|
||||
[/for]
|
||||
|
||||
[for (o : Objet | jeu.objets)]
|
||||
[print(o.descriptions, 'objet_' + o.nom.nom)/]
|
||||
Objet objet_[o.nom.nom/] = new Objet(
|
||||
"[o.nom.nom/]",
|
||||
[o.taille/],
|
||||
vraie,
|
||||
objet_[o.nom.nom/]_descriptions
|
||||
);
|
||||
jeu_objets.add(objet_[o.nom.nom/]);
|
||||
|
||||
jeu_objets.add(tentative_objet);
|
||||
[/for]
|
||||
|
||||
[comment Connaissances /]
|
||||
// "Connaissances"
|
||||
|
||||
List<Conaissance> jeu_connaissances = new ArrayList<>();
|
||||
|
||||
[for (c : Connaissance | jeu.connaissances)]
|
||||
List<Description> connaissance_[c.nom.nom/]_descriptions = new ArrayList<>();
|
||||
|
||||
[for (d : Description | c.descriptions)]
|
||||
objet_[c.nom.nom/]_descriptions.add(
|
||||
new Description(
|
||||
"[d.texte/]",
|
||||
vraie
|
||||
)
|
||||
);
|
||||
[/for]
|
||||
|
||||
[print(c.descriptions, 'connaissance_' + c.nom.nom)/]
|
||||
[print(c.visible, 'connaissance_' + c.nom.nom + '_visible')/]
|
||||
Connaissance connaissance_[c.nom.nom/] = new Connaissance(
|
||||
"[c.nom.nom/]",
|
||||
vraie,
|
||||
connaissance_[c.nom.nom/]_visible,
|
||||
connaissance_[c.nom.nom/]_descriptions
|
||||
);
|
||||
|
||||
jeu_connaissances.add(reussite_connaissance);
|
||||
jeu_connaissances.add(connaissance_[c.nom.nom/]);
|
||||
[/for]
|
||||
|
||||
|
||||
[comment Explorateur /]
|
||||
// "Explorateur"
|
||||
|
||||
List<Objet> explorateur_inventaire = new ArrayList<>();
|
||||
|
||||
[for (o : Nom | jeu.explorateur.objets)]
|
||||
explorateur_inventaire.add([o.nom/]);
|
||||
explorateur_inventaire.add(objet_[o.nom/]);
|
||||
[/for]
|
||||
|
||||
List<Connaissance> explorateur_connaissances = new ArrayList<>();
|
||||
|
||||
[for (c : Nom | jeu.explorateur.connaissances)]
|
||||
explorateur_inventaire.add([c.nom/]);
|
||||
explorateur_inventaire.add(connaissance_[c.nom/]);
|
||||
[/for]
|
||||
|
||||
Jeu.explorateur = new Explorateur(
|
||||
|
@ -82,67 +57,125 @@ Jeu.explorateur = new Explorateur(
|
|||
explorateur_inventaire
|
||||
);
|
||||
|
||||
// "Personnes"
|
||||
|
||||
List<Personne> jeu_personnes = new ArrayList<>();
|
||||
|
||||
[for (p : Personne | jeu.personnes)]
|
||||
Personne personne_[p.nom.nom/] = new Personne(
|
||||
"[p.nom.nom/]",
|
||||
condition0,
|
||||
vraie,
|
||||
personne_[p.nom.nom/]_interactions
|
||||
);
|
||||
|
||||
jeu_personnes.add(personne_[p.nom.nom/]);
|
||||
[/for]
|
||||
|
||||
jeu.jouer();
|
||||
|
||||
}
|
||||
}
|
||||
[/file]
|
||||
[/template]
|
||||
|
||||
[template public print(c : Condition, name: String) post (trim()) ]
|
||||
List<ConditionEt> conditions_ET_[name/] = new ArrayList<>();
|
||||
List<ConditionEt> [name/]_conditions_ET = new ArrayList<>();
|
||||
|
||||
[for (cET : ConditionEt | c.condition)]
|
||||
List<ConditionTest> conditions_TEST_[name/] = new ArrayList<>();
|
||||
List<ConditionTest> [name/]_conditions_TEST_[i/] = new ArrayList<>();
|
||||
|
||||
[for (cTEST : ConditionTest | cET.conditionTest)]
|
||||
[name/]_conditions_TEST_[i/].add(
|
||||
[if (cTEST.oclIsTypeOf(ConditionBoolean))]
|
||||
[let cBOOL : ConditionBoolean = cTEST.oclAsType(ConditionBoolean)]
|
||||
conditions_TEST_[name/].add(
|
||||
new ConditionBoolean(
|
||||
new ConditionBoolean(
|
||||
[cBOOL.valeur/],
|
||||
);
|
||||
);
|
||||
)
|
||||
[/let]
|
||||
[elseif (cTEST.oclIsTypeOf(ConditionConnaissance))]
|
||||
[let cCONN : ConditionConnaissance = cTEST.oclAsType(ConditionConnaissance)]
|
||||
conditions_TEST_[name/].add(
|
||||
new ConditionConnaissance(
|
||||
connaissance_[cCONN.connaissance.nom/],
|
||||
[if (cCONN.connaissance.nom.startsWith('!'))]true[else]false[/if]
|
||||
);
|
||||
);
|
||||
)
|
||||
[/let]
|
||||
[elseif (cTEST.oclIsTypeOf(ConditionObjet))]
|
||||
[let cOBJET : ConditionObjet = cTEST.oclAsType(ConditionObjet)]
|
||||
conditions_TEST_[name/].add(
|
||||
new ConditionObjet(
|
||||
objet_[cOBJET.objet.nom/],
|
||||
"[cOBJET.comparateur/]",
|
||||
[cOBJET.nombre/]
|
||||
);
|
||||
);
|
||||
)
|
||||
[/let]
|
||||
[/if]
|
||||
);
|
||||
[name/]_conditions_ET.add([name/]_conditions_TEST_[i/])
|
||||
[/for]
|
||||
[/for]
|
||||
|
||||
Condition condition_[name/] = new Condition(conditions_ET_[name/]);
|
||||
Condition [name/]_condition = new Condition([name/]_conditions_ET);
|
||||
[/template]
|
||||
|
||||
[template public print(ds : OrderedSet(Description), name: String) post (trim()) ]
|
||||
List<Description> [name/]_descriptions = new ArrayList<>();
|
||||
|
||||
[for (d : Description | ds)]
|
||||
[print(d.condition, name + '_description_condition_' + i.toString())/]
|
||||
|
||||
[name/]_descriptions.add(
|
||||
new Description(
|
||||
"[d.texte/]",
|
||||
[name/]_description_[i/]_condition
|
||||
)
|
||||
);
|
||||
[/for]
|
||||
[/template]
|
||||
|
||||
[template public print(as : OrderedSet(Action), name: String) post (trim()) ]
|
||||
List<Action> [name/]_actions = new ArrayList<>();
|
||||
|
||||
[for (a : Action | as)]
|
||||
[print(a.visible, name + '_action_visible_' + i.toString())/]
|
||||
[print(a.finInteraction, name + '_action_fin_' + i.toString())/]
|
||||
[print(a.descriptions, name)/]
|
||||
|
||||
List<Connaissance> [name/]_action_[i/]_connaissances = new ArrayList<>();
|
||||
[for (c : Nom | a.connaissances)]
|
||||
[name/]_action_[i/]_connaissances.add(connaissance_[c.nom/]);
|
||||
[/for]
|
||||
List<Objet> [name/]_action_[i/]_objets_conso = new ArrayList<>();
|
||||
[for (c : Nom | a.objetsConso)]
|
||||
[name/]_action_[i/]_objets_conso.add(objet_[c.nom/]);
|
||||
[/for]
|
||||
List<Objet> [name/]_action_[i/]_objets_recus = new ArrayList<>();
|
||||
[for (c : Nom | a.objetsRecus)]
|
||||
[name/]_action_[i/]_objets_recus.add(objet_[c.nom/]);
|
||||
[/for]
|
||||
|
||||
[name/]_actions.add(
|
||||
new Action(
|
||||
[name/]_action_visible_[i/]_condition,
|
||||
[name/]_action_fin_[i/]_condition,
|
||||
[name/]_action_[i/]_connaissances,
|
||||
[name/]_action_[i/]_objets_conso,
|
||||
[name/]_action_[i/]_objets_recus,
|
||||
[name/]_action_[i/]_descriptions
|
||||
)
|
||||
);
|
||||
[/for]
|
||||
[/template]
|
||||
|
||||
[template public print(is: Interaction, name: String)]
|
||||
List<Action> [name/]_interactions = new ArrayList<>();
|
||||
|
||||
[for (it : Interaction | is)]
|
||||
[print(it.visible, name + '_interaction_visible_' + i.toString())/]
|
||||
[print(it.actions, name + '_' + i.toString())/]
|
||||
|
||||
List<Connaissance> [name/]_interaction_[i/]_connaissances = new ArrayList<>();
|
||||
[for (c : Nom | it.connaissances)]
|
||||
[name/]_interaction_[i/]_connaissances.add(connaissance_[c.nom/]);
|
||||
[/for]
|
||||
List<Objet> [name/]_interaction_[i/]_objets_conso = new ArrayList<>();
|
||||
[for (c : Nom | it.objetsConso)]
|
||||
[name/]_interaction_[i/]_objets_conso.add(objet_[c.nom/]);
|
||||
[/for]
|
||||
List<Objet> [name/]_interaction_[i/]_objets_recus = new ArrayList<>();
|
||||
[for (c : Nom | it.objetsRecus)]
|
||||
[name/]_interaction_[i/]_objets_recus.add(objet_[c.nom/]);
|
||||
[/for]
|
||||
|
||||
[name/]_actions.add(
|
||||
new Action(
|
||||
[name/]_interaction_visible_[i/]_condition,
|
||||
[name/]_interaction_[i/]_connaissances,
|
||||
[name/]_interaction_[i/]_objets_conso,
|
||||
[name/]_interaction_[i/]_objets_recus,
|
||||
[name/]_interaction_[i/]_actions
|
||||
)
|
||||
);
|
||||
[/for]
|
||||
[/template]
|
|
@ -8,72 +8,47 @@
|
|||
public class Prototype {
|
||||
public static void main(String['['/][']'/] args) {
|
||||
|
||||
[comment Objets /]
|
||||
// "Objets"
|
||||
|
||||
List<Objet> jeu_objets = new ArrayList<>();
|
||||
|
||||
[for (o : Objet | jeu.objets)]
|
||||
List<Description> objet_[o.nom.nom/]_descriptions = new ArrayList<>();
|
||||
|
||||
[for (d : Description | o.descriptions)]
|
||||
[print(d.condition, 'objet_' + o.nom.nom + '_description_' + i.toString())/]
|
||||
|
||||
objet_[o.nom.nom/]_descriptions.add(
|
||||
new Description(
|
||||
"[d.texte/]",
|
||||
objet_[o.nom.nom/]_description_[i/]
|
||||
)
|
||||
);
|
||||
[/for]
|
||||
|
||||
[for (o : Objet | jeu.objets)]
|
||||
[print(o.descriptions, 'objet_' + o.nom.nom)/]
|
||||
Objet objet_[o.nom.nom/] = new Objet(
|
||||
"[o.nom.nom/]",
|
||||
[o.taille/],
|
||||
vraie,
|
||||
objet_[o.nom.nom/]_descriptions
|
||||
);
|
||||
jeu_objets.add(objet_[o.nom.nom/]);
|
||||
|
||||
jeu_objets.add(tentative_objet);
|
||||
[/for]
|
||||
|
||||
[comment Connaissances /]
|
||||
// "Connaissances"
|
||||
|
||||
List<Conaissance> jeu_connaissances = new ArrayList<>();
|
||||
|
||||
[for (c : Connaissance | jeu.connaissances)]
|
||||
List<Description> connaissance_[c.nom.nom/]_descriptions = new ArrayList<>();
|
||||
|
||||
[for (d : Description | c.descriptions)]
|
||||
objet_[c.nom.nom/]_descriptions.add(
|
||||
new Description(
|
||||
"[d.texte/]",
|
||||
vraie
|
||||
)
|
||||
);
|
||||
[/for]
|
||||
|
||||
[print(c.descriptions, 'connaissance_' + c.nom.nom)/]
|
||||
[print(c.visible, 'connaissance_' + c.nom.nom + '_visible')/]
|
||||
Connaissance connaissance_[c.nom.nom/] = new Connaissance(
|
||||
"[c.nom.nom/]",
|
||||
vraie,
|
||||
connaissance_[c.nom.nom/]_visible,
|
||||
connaissance_[c.nom.nom/]_descriptions
|
||||
);
|
||||
|
||||
jeu_connaissances.add(reussite_connaissance);
|
||||
jeu_connaissances.add(connaissance_[c.nom.nom/]);
|
||||
[/for]
|
||||
|
||||
|
||||
[comment Explorateur /]
|
||||
// "Explorateur"
|
||||
|
||||
List<Objet> explorateur_inventaire = new ArrayList<>();
|
||||
|
||||
[for (o : Nom | jeu.explorateur.objets)]
|
||||
explorateur_inventaire.add([o.nom/]);
|
||||
explorateur_inventaire.add(objet_[o.nom/]);
|
||||
[/for]
|
||||
|
||||
List<Connaissance> explorateur_connaissances = new ArrayList<>();
|
||||
|
||||
[for (c : Nom | jeu.explorateur.connaissances)]
|
||||
explorateur_inventaire.add([c.nom/]);
|
||||
explorateur_inventaire.add(connaissance_[c.nom/]);
|
||||
[/for]
|
||||
|
||||
Jeu.explorateur = new Explorateur(
|
||||
|
@ -82,67 +57,125 @@ Jeu.explorateur = new Explorateur(
|
|||
explorateur_inventaire
|
||||
);
|
||||
|
||||
// "Personnes"
|
||||
|
||||
List<Personne> jeu_personnes = new ArrayList<>();
|
||||
|
||||
[for (p : Personne | jeu.personnes)]
|
||||
Personne personne_[p.nom.nom/] = new Personne(
|
||||
"[p.nom.nom/]",
|
||||
condition0,
|
||||
vraie,
|
||||
personne_[p.nom.nom/]_interactions
|
||||
);
|
||||
|
||||
jeu_personnes.add(personne_[p.nom.nom/]);
|
||||
[/for]
|
||||
|
||||
jeu.jouer();
|
||||
|
||||
}
|
||||
}
|
||||
[/file]
|
||||
[/template]
|
||||
|
||||
[template public print(c : Condition, name: String) post (trim()) ]
|
||||
List<ConditionEt> conditions_ET_[name/] = new ArrayList<>();
|
||||
List<ConditionEt> [name/]_conditions_ET = new ArrayList<>();
|
||||
|
||||
[for (cET : ConditionEt | c.condition)]
|
||||
List<ConditionTest> conditions_TEST_[name/] = new ArrayList<>();
|
||||
List<ConditionTest> [name/]_conditions_TEST_[i/] = new ArrayList<>();
|
||||
|
||||
[for (cTEST : ConditionTest | cET.conditionTest)]
|
||||
[name/]_conditions_TEST_[i/].add(
|
||||
[if (cTEST.oclIsTypeOf(ConditionBoolean))]
|
||||
[let cBOOL : ConditionBoolean = cTEST.oclAsType(ConditionBoolean)]
|
||||
conditions_TEST_[name/].add(
|
||||
new ConditionBoolean(
|
||||
new ConditionBoolean(
|
||||
[cBOOL.valeur/],
|
||||
);
|
||||
);
|
||||
)
|
||||
[/let]
|
||||
[elseif (cTEST.oclIsTypeOf(ConditionConnaissance))]
|
||||
[let cCONN : ConditionConnaissance = cTEST.oclAsType(ConditionConnaissance)]
|
||||
conditions_TEST_[name/].add(
|
||||
new ConditionConnaissance(
|
||||
connaissance_[cCONN.connaissance.nom/],
|
||||
[if (cCONN.connaissance.nom.startsWith('!'))]true[else]false[/if]
|
||||
);
|
||||
);
|
||||
)
|
||||
[/let]
|
||||
[elseif (cTEST.oclIsTypeOf(ConditionObjet))]
|
||||
[let cOBJET : ConditionObjet = cTEST.oclAsType(ConditionObjet)]
|
||||
conditions_TEST_[name/].add(
|
||||
new ConditionObjet(
|
||||
objet_[cOBJET.objet.nom/],
|
||||
"[cOBJET.comparateur/]",
|
||||
[cOBJET.nombre/]
|
||||
);
|
||||
);
|
||||
)
|
||||
[/let]
|
||||
[/if]
|
||||
);
|
||||
[name/]_conditions_ET.add([name/]_conditions_TEST_[i/])
|
||||
[/for]
|
||||
[/for]
|
||||
|
||||
Condition condition_[name/] = new Condition(conditions_ET_[name/]);
|
||||
Condition [name/]_condition = new Condition([name/]_conditions_ET);
|
||||
[/template]
|
||||
|
||||
[template public print(ds : OrderedSet(Description), name: String) post (trim()) ]
|
||||
List<Description> [name/]_descriptions = new ArrayList<>();
|
||||
|
||||
[for (d : Description | ds)]
|
||||
[print(d.condition, name + '_description_condition_' + i.toString())/]
|
||||
|
||||
[name/]_descriptions.add(
|
||||
new Description(
|
||||
"[d.texte/]",
|
||||
[name/]_description_[i/]_condition
|
||||
)
|
||||
);
|
||||
[/for]
|
||||
[/template]
|
||||
|
||||
[template public print(as : OrderedSet(Action), name: String) post (trim()) ]
|
||||
List<Action> [name/]_actions = new ArrayList<>();
|
||||
|
||||
[for (a : Action | as)]
|
||||
[print(a.visible, name + '_action_visible_' + i.toString())/]
|
||||
[print(a.finInteraction, name + '_action_fin_' + i.toString())/]
|
||||
[print(a.descriptions, name)/]
|
||||
|
||||
List<Connaissance> [name/]_action_[i/]_connaissances = new ArrayList<>();
|
||||
[for (c : Nom | a.connaissances)]
|
||||
[name/]_action_[i/]_connaissances.add(connaissance_[c.nom/]);
|
||||
[/for]
|
||||
List<Objet> [name/]_action_[i/]_objets_conso = new ArrayList<>();
|
||||
[for (c : Nom | a.objetsConso)]
|
||||
[name/]_action_[i/]_objets_conso.add(objet_[c.nom/]);
|
||||
[/for]
|
||||
List<Objet> [name/]_action_[i/]_objets_recus = new ArrayList<>();
|
||||
[for (c : Nom | a.objetsRecus)]
|
||||
[name/]_action_[i/]_objets_recus.add(objet_[c.nom/]);
|
||||
[/for]
|
||||
|
||||
[name/]_actions.add(
|
||||
new Action(
|
||||
[name/]_action_visible_[i/]_condition,
|
||||
[name/]_action_fin_[i/]_condition,
|
||||
[name/]_action_[i/]_connaissances,
|
||||
[name/]_action_[i/]_objets_conso,
|
||||
[name/]_action_[i/]_objets_recus,
|
||||
[name/]_action_[i/]_descriptions
|
||||
)
|
||||
);
|
||||
[/for]
|
||||
[/template]
|
||||
|
||||
[template public print(is: Interaction, name: String)]
|
||||
List<Action> [name/]_interactions = new ArrayList<>();
|
||||
|
||||
[for (it : Interaction | is)]
|
||||
[print(it.visible, name + '_interaction_visible_' + i.toString())/]
|
||||
[print(it.actions, name + '_' + i.toString())/]
|
||||
|
||||
List<Connaissance> [name/]_interaction_[i/]_connaissances = new ArrayList<>();
|
||||
[for (c : Nom | it.connaissances)]
|
||||
[name/]_interaction_[i/]_connaissances.add(connaissance_[c.nom/]);
|
||||
[/for]
|
||||
List<Objet> [name/]_interaction_[i/]_objets_conso = new ArrayList<>();
|
||||
[for (c : Nom | it.objetsConso)]
|
||||
[name/]_interaction_[i/]_objets_conso.add(objet_[c.nom/]);
|
||||
[/for]
|
||||
List<Objet> [name/]_interaction_[i/]_objets_recus = new ArrayList<>();
|
||||
[for (c : Nom | it.objetsRecus)]
|
||||
[name/]_interaction_[i/]_objets_recus.add(objet_[c.nom/]);
|
||||
[/for]
|
||||
|
||||
[name/]_actions.add(
|
||||
new Action(
|
||||
[name/]_interaction_visible_[i/]_condition,
|
||||
[name/]_interaction_[i/]_connaissances,
|
||||
[name/]_interaction_[i/]_objets_conso,
|
||||
[name/]_interaction_[i/]_objets_recus,
|
||||
[name/]_interaction_[i/]_actions
|
||||
)
|
||||
);
|
||||
[/for]
|
||||
[/template]
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue