feat: avancement prototype
This commit is contained in:
parent
03b4222df6
commit
71b2144c04
|
@ -5,8 +5,7 @@ public class Condition {
|
||||||
|
|
||||||
List<ConditionEt> conditionEts;
|
List<ConditionEt> conditionEts;
|
||||||
|
|
||||||
public Condition(
|
public Condition(ConditionEt... conditionEts) {
|
||||||
ConditionEt... conditionEts) {
|
|
||||||
this.conditionEts = new ArrayList<>();
|
this.conditionEts = new ArrayList<>();
|
||||||
for (ConditionEt c : conditionEts) {
|
for (ConditionEt c : conditionEts) {
|
||||||
this.conditionEts.add(c);
|
this.conditionEts.add(c);
|
||||||
|
|
|
@ -6,21 +6,21 @@ public class Personne {
|
||||||
String nom;
|
String nom;
|
||||||
Condition visible;
|
Condition visible;
|
||||||
Condition obligatoire;
|
Condition obligatoire;
|
||||||
List<Interaction> interractions;
|
List<Interaction> interactions;
|
||||||
|
|
||||||
public Personne(
|
public Personne(
|
||||||
String nom,
|
String nom,
|
||||||
Condition visible,
|
Condition visible,
|
||||||
Condition obligatoire,
|
Condition obligatoire,
|
||||||
List<Interaction> interractions) {
|
List<Interaction> interactions) {
|
||||||
this.nom = nom;
|
this.nom = nom;
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
this.obligatoire = obligatoire;
|
this.obligatoire = obligatoire;
|
||||||
this.interractions = interractions;
|
this.interactions = interactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void interragir(BufferedReader reader, Lieu lieu) {
|
void interragir(BufferedReader reader, Lieu lieu) {
|
||||||
for (Interaction i : this.interractions) {
|
for (Interaction i : this.interactions) {
|
||||||
if (i.visible.evaluer()) {
|
if (i.visible.evaluer()) {
|
||||||
i.interragir(reader, lieu);
|
i.interragir(reader, lieu);
|
||||||
}
|
}
|
||||||
|
|
43
runtime-workspace/fr.n7.game.examples/src-gen/Prototype.java
Normal file
43
runtime-workspace/fr.n7.game.examples/src-gen/Prototype.java
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
Condition vraie = new Condition(new ConditionEt(new ConditionBoolean(true)));
|
||||||
|
|
||||||
|
// "Objets"
|
||||||
|
List<Objet> jeu_objets = new ArrayList<>();
|
||||||
|
List<Description> objet_tentative_descriptions = new new ArrayList<>();
|
||||||
|
|
||||||
|
objet_tentative_descriptions.add(
|
||||||
|
new Description(
|
||||||
|
"permet répondre une question du sphinx",
|
||||||
|
vraie
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
Objet objet_tentative = new Objet(
|
||||||
|
"tentative",
|
||||||
|
1,
|
||||||
|
vraie,
|
||||||
|
objet_tentative_descriptions
|
||||||
|
);
|
||||||
|
|
||||||
|
jeu_objets.add(tentative_objet);
|
||||||
|
|
||||||
|
// "Connaissances"
|
||||||
|
List<Conaissance> jeu_connaissances = new ArrayList<>();
|
||||||
|
List<Description> connaissance_Réussite_descriptions = new new ArrayList<>();
|
||||||
|
|
||||||
|
objet_Réussite_descriptions.add(
|
||||||
|
new Description(
|
||||||
|
"Permet de se casser de là",
|
||||||
|
vraie
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
Connaissance connaissance_Réussite = new Connaissance(
|
||||||
|
"Réussite",
|
||||||
|
vraie,
|
||||||
|
connaissance_Réussite_descriptions
|
||||||
|
);
|
||||||
|
|
||||||
|
jeu_connaissances.add(reussite_connaissance);
|
||||||
|
}
|
7
workspace/fr.n7.game.toPrototype.ui/.classpath
Normal file
7
workspace/fr.n7.game.toPrototype.ui/.classpath
Normal 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>
|
28
workspace/fr.n7.game.toPrototype.ui/.project
Normal file
28
workspace/fr.n7.game.toPrototype.ui/.project
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>fr.n7.game.toPrototype.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>
|
|
@ -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
|
20
workspace/fr.n7.game.toPrototype.ui/META-INF/MANIFEST.MF
Normal file
20
workspace/fr.n7.game.toPrototype.ui/META-INF/MANIFEST.MF
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: Acceleo ToPrototype Module IDE Plug-in
|
||||||
|
Bundle-SymbolicName: fr.n7.game.toPrototype.ui;singleton:=true
|
||||||
|
Bundle-Version: 1.0.0.qualifier
|
||||||
|
Bundle-Activator: fr.n7.game.toPrototype.ui.Activator
|
||||||
|
Bundle-Vendor: Eclipse Modeling Project
|
||||||
|
Require-Bundle: org.eclipse.ui,
|
||||||
|
org.eclipse.core.runtime,
|
||||||
|
org.eclipse.core.resources,
|
||||||
|
fr.n7.game.toPrototype,
|
||||||
|
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
|
7
workspace/fr.n7.game.toPrototype.ui/build.properties
Normal file
7
workspace/fr.n7.game.toPrototype.ui/build.properties
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
source.. = src/
|
||||||
|
output.. = bin/
|
||||||
|
bin.includes = META-INF/,\
|
||||||
|
.,\
|
||||||
|
plugin.xml,\
|
||||||
|
icons/
|
||||||
|
|
BIN
workspace/fr.n7.game.toPrototype.ui/icons/default.gif
Normal file
BIN
workspace/fr.n7.game.toPrototype.ui/icons/default.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 534 B |
22
workspace/fr.n7.game.toPrototype.ui/plugin.xml
Normal file
22
workspace/fr.n7.game.toPrototype.ui/plugin.xml
Normal 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.toPrototype.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.toPrototype.ui.popupMenus.AcceleoGenerateToPrototypeAction"
|
||||||
|
enablesFor="+"
|
||||||
|
id="fr.n7.game.toPrototype.ui.popupMenus.acceleoGenerateToPrototypeAction"
|
||||||
|
icon="icons/default.gif"
|
||||||
|
label="Generate ToPrototype"
|
||||||
|
menubarPath="org.eclipse.acceleo.module.menu/acceleo"/>
|
||||||
|
</objectContribution>
|
||||||
|
</extension>
|
||||||
|
</plugin>
|
|
@ -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.toPrototype.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.toPrototype.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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.toPrototype.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 'ToPrototype' 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.toPrototype.main.ToPrototype gen0 = new fr.n7.game.toPrototype.main.ToPrototype(modelURI, targetFolder.getLocation().toFile(), arguments);
|
||||||
|
monitor.worked(1);
|
||||||
|
String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("fr.n7.game.toPrototype", "fr.n7.game.toPrototype.main.ToPrototype", modelURI.toString(), targetFolder.getFullPath().toString(), new ArrayList<String>());
|
||||||
|
gen0.setGenerationID(generationID);
|
||||||
|
gen0.doGenerate(BasicMonitor.toMonitor(monitor));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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.toPrototype.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.toPrototype.ui.Activator;
|
||||||
|
import fr.n7.game.toPrototype.ui.common.GenerateAll;
|
||||||
|
import org.eclipse.ui.IActionDelegate;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.actions.ActionDelegate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ToPrototype code generation.
|
||||||
|
*/
|
||||||
|
public class AcceleoGenerateToPrototypeAction 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>();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load diff
|
@ -7,29 +7,155 @@
|
||||||
[file ('Prototype.java', false, 'UTF-8')]
|
[file ('Prototype.java', false, 'UTF-8')]
|
||||||
public static void main(String['['/][']'/] args) {
|
public static void main(String['['/][']'/] args) {
|
||||||
|
|
||||||
|
Condition faux = new Condition(new ConditionEt(new ConditionBoolean(false)));
|
||||||
Condition vraie = new Condition(new ConditionEt(new ConditionBoolean(true)));
|
Condition vraie = new Condition(new ConditionEt(new ConditionBoolean(true)));
|
||||||
|
|
||||||
|
// "Objets"
|
||||||
|
|
||||||
List<Objet> jeu_objets = new ArrayList<>();
|
List<Objet> jeu_objets = new ArrayList<>();
|
||||||
|
|
||||||
[for (o : Objet | jeu.objets)]
|
[for (o : Objet | jeu.objets)]
|
||||||
List<Description> objet_[o.nom.nom/]_descriptions = new new ArrayList<>();
|
List<Description> objet_[o.nom.nom/]_descriptions = new new ArrayList<>();
|
||||||
|
|
||||||
[for (d : Description | o.descriptions)]
|
[for (d : Description | o.descriptions)]
|
||||||
objet_[o.nom.nom/]_descriptions.add(
|
objet_[o.nom.nom/]_descriptions.add(
|
||||||
new Description(
|
new Description(
|
||||||
[d.texte/],
|
"[d.texte/]",
|
||||||
vraie));
|
vraie
|
||||||
|
)
|
||||||
|
);
|
||||||
[/for]
|
[/for]
|
||||||
|
|
||||||
Objet objet_[o.nom.nom/] = new Objet(
|
Objet objet_[o.nom.nom/] = new Objet(
|
||||||
[o.nom.nom/],
|
"[o.nom.nom/]",
|
||||||
[o.taille/],
|
[o.taille/],
|
||||||
vraie,
|
vraie,
|
||||||
objet_[o.nom/]_descriptions);
|
objet_[o.nom.nom/]_descriptions
|
||||||
|
);
|
||||||
|
|
||||||
jeu_objets.add(tentative_objet);
|
jeu_objets.add(tentative_objet);
|
||||||
[/for]
|
[/for]
|
||||||
|
|
||||||
|
// "Connaissances"
|
||||||
|
|
||||||
|
List<Conaissance> jeu_connaissances = new ArrayList<>();
|
||||||
|
|
||||||
|
[for (c : Connaissance | jeu.connaissances)]
|
||||||
|
List<Description> connaissance_[c.nom.nom/]_descriptions = new new ArrayList<>();
|
||||||
|
|
||||||
|
[for (d : Description | c.descriptions)]
|
||||||
|
objet_[c.nom.nom/]_descriptions.add(
|
||||||
|
new Description(
|
||||||
|
"[d.texte/]",
|
||||||
|
vraie
|
||||||
|
)
|
||||||
|
);
|
||||||
|
[/for]
|
||||||
|
|
||||||
|
Connaissance connaissance_[c.nom.nom/] = new Connaissance(
|
||||||
|
"[c.nom.nom/]",
|
||||||
|
vraie,
|
||||||
|
connaissance_[c.nom.nom/]_descriptions
|
||||||
|
);
|
||||||
|
|
||||||
|
jeu_connaissances.add(reussite_connaissance);
|
||||||
|
[/for]
|
||||||
|
|
||||||
|
|
||||||
|
// "Explorateur"
|
||||||
|
|
||||||
|
List<Objet> explorateur_inventaire = new ArrayList<>();
|
||||||
|
|
||||||
|
[for (o : Nom | jeu.explorateur.objets)]
|
||||||
|
explorateur_inventaire.add([o.nom/]);
|
||||||
|
[/for]
|
||||||
|
|
||||||
|
List<Connaissance> explorateur_connaissances = new ArrayList<>();
|
||||||
|
|
||||||
|
[for (c : Nom | jeu.explorateur.connaissances)]
|
||||||
|
explorateur_inventaire.add([c.nom/]);
|
||||||
|
[/for]
|
||||||
|
|
||||||
|
Jeu.explorateur = new Explorateur(
|
||||||
|
[jeu.explorateur.tailleInventaire/],
|
||||||
|
explorateur_connaissances,
|
||||||
|
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]
|
[/file]
|
||||||
[/template]
|
[/template]
|
||||||
|
|
||||||
|
[template public print(c : Condition, name: String) post (trim()) ]
|
||||||
|
Condition condition_[name/] = new Condition(
|
||||||
|
new ConditionEt(
|
||||||
|
new ConditionConnaissance(
|
||||||
|
reussite_connaissance,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
new ConditionObjet(
|
||||||
|
tentative_objet,
|
||||||
|
">",
|
||||||
|
0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
List<ConditionEt> conditions_ET_[name/] = new ArrayList<>();
|
||||||
|
|
||||||
|
[for (cET : ConditionEt | c.condition)]
|
||||||
|
|
||||||
|
List<ConditionTest> conditions_TEST_[name/] = new ArrayList<>();
|
||||||
|
|
||||||
|
[for (cTEST : ConditionTest | cET.conditionTest)]
|
||||||
|
[if (cTEST.oclIsTypeOf(ConditionObjet))]
|
||||||
|
[let cOBJET : ConditionObjet = cTEST.oclAsType(ConditionObjet)]
|
||||||
|
conditions_TEST_[name/].add(
|
||||||
|
new ConditionObjet(
|
||||||
|
objet_[cOBJET.objet.nom/],
|
||||||
|
"[cOBJET.comparateur/]",
|
||||||
|
[cOBJET.nombre/]
|
||||||
|
);
|
||||||
|
);
|
||||||
|
[/let]
|
||||||
|
[elseif (cTEST.oclIsTypeOf(ConditionConnaissance))]
|
||||||
|
[let cCONN : ConditionConnaissance = cTEST.oclAsType(ConditionConnaissance)]
|
||||||
|
conditions_TEST_[name/].add(
|
||||||
|
new ConditionConnaissance(
|
||||||
|
connaissance_[cCONN.connaissance.nom/],
|
||||||
|
[cCONN.negation/],
|
||||||
|
);
|
||||||
|
);
|
||||||
|
[/let]
|
||||||
|
[elseif (cTEST.oclIsTypeOf(ConditionBoolean))]
|
||||||
|
[let cBOOL : ConditionBoolean = cTEST.oclAsType(ConditionBoolean)]
|
||||||
|
conditions_TEST_[name/].add(
|
||||||
|
new ConditionBoolean(
|
||||||
|
[cBOOL.valeur/],
|
||||||
|
);
|
||||||
|
);
|
||||||
|
[/let]
|
||||||
|
[/if]
|
||||||
|
[/for]
|
||||||
|
[/for]
|
||||||
|
|
||||||
|
Condition condition_[name/] = new Condition(conditions_ET_[name/]);
|
||||||
|
|
||||||
|
[/template]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,29 +7,155 @@
|
||||||
[file ('Prototype.java', false, 'UTF-8')]
|
[file ('Prototype.java', false, 'UTF-8')]
|
||||||
public static void main(String['['/][']'/] args) {
|
public static void main(String['['/][']'/] args) {
|
||||||
|
|
||||||
|
Condition faux = new Condition(new ConditionEt(new ConditionBoolean(false)));
|
||||||
Condition vraie = new Condition(new ConditionEt(new ConditionBoolean(true)));
|
Condition vraie = new Condition(new ConditionEt(new ConditionBoolean(true)));
|
||||||
|
|
||||||
|
// "Objets"
|
||||||
|
|
||||||
List<Objet> jeu_objets = new ArrayList<>();
|
List<Objet> jeu_objets = new ArrayList<>();
|
||||||
|
|
||||||
[for (o : Objet | jeu.objets)]
|
[for (o : Objet | jeu.objets)]
|
||||||
List<Description> objet_[o.nom.nom/]_descriptions = new new ArrayList<>();
|
List<Description> objet_[o.nom.nom/]_descriptions = new new ArrayList<>();
|
||||||
|
|
||||||
[for (d : Description | o.descriptions)]
|
[for (d : Description | o.descriptions)]
|
||||||
objet_[o.nom.nom/]_descriptions.add(
|
objet_[o.nom.nom/]_descriptions.add(
|
||||||
new Description(
|
new Description(
|
||||||
[d.texte/],
|
"[d.texte/]",
|
||||||
vraie));
|
vraie
|
||||||
|
)
|
||||||
|
);
|
||||||
[/for]
|
[/for]
|
||||||
|
|
||||||
Objet objet_[o.nom.nom/] = new Objet(
|
Objet objet_[o.nom.nom/] = new Objet(
|
||||||
[o.nom.nom/],
|
"[o.nom.nom/]",
|
||||||
[o.taille/],
|
[o.taille/],
|
||||||
vraie,
|
vraie,
|
||||||
objet_[o.nom/]_descriptions);
|
objet_[o.nom.nom/]_descriptions
|
||||||
|
);
|
||||||
|
|
||||||
jeu_objets.add(tentative_objet);
|
jeu_objets.add(tentative_objet);
|
||||||
[/for]
|
[/for]
|
||||||
|
|
||||||
|
// "Connaissances"
|
||||||
|
|
||||||
|
List<Conaissance> jeu_connaissances = new ArrayList<>();
|
||||||
|
|
||||||
|
[for (c : Connaissance | jeu.connaissances)]
|
||||||
|
List<Description> connaissance_[c.nom.nom/]_descriptions = new new ArrayList<>();
|
||||||
|
|
||||||
|
[for (d : Description | c.descriptions)]
|
||||||
|
objet_[c.nom.nom/]_descriptions.add(
|
||||||
|
new Description(
|
||||||
|
"[d.texte/]",
|
||||||
|
vraie
|
||||||
|
)
|
||||||
|
);
|
||||||
|
[/for]
|
||||||
|
|
||||||
|
Connaissance connaissance_[c.nom.nom/] = new Connaissance(
|
||||||
|
"[c.nom.nom/]",
|
||||||
|
vraie,
|
||||||
|
connaissance_[c.nom.nom/]_descriptions
|
||||||
|
);
|
||||||
|
|
||||||
|
jeu_connaissances.add(reussite_connaissance);
|
||||||
|
[/for]
|
||||||
|
|
||||||
|
|
||||||
|
// "Explorateur"
|
||||||
|
|
||||||
|
List<Objet> explorateur_inventaire = new ArrayList<>();
|
||||||
|
|
||||||
|
[for (o : Nom | jeu.explorateur.objets)]
|
||||||
|
explorateur_inventaire.add([o.nom/]);
|
||||||
|
[/for]
|
||||||
|
|
||||||
|
List<Connaissance> explorateur_connaissances = new ArrayList<>();
|
||||||
|
|
||||||
|
[for (c : Nom | jeu.explorateur.connaissances)]
|
||||||
|
explorateur_inventaire.add([c.nom/]);
|
||||||
|
[/for]
|
||||||
|
|
||||||
|
Jeu.explorateur = new Explorateur(
|
||||||
|
[jeu.explorateur.tailleInventaire/],
|
||||||
|
explorateur_connaissances,
|
||||||
|
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]
|
[/file]
|
||||||
[/template]
|
[/template]
|
||||||
|
|
||||||
|
[template public print(c : Condition, name: String) post (trim()) ]
|
||||||
|
Condition condition_[name/] = new Condition(
|
||||||
|
new ConditionEt(
|
||||||
|
new ConditionConnaissance(
|
||||||
|
reussite_connaissance,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
new ConditionObjet(
|
||||||
|
tentative_objet,
|
||||||
|
">",
|
||||||
|
0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
List<ConditionEt> conditions_ET_[name/] = new ArrayList<>();
|
||||||
|
|
||||||
|
[for (cET : ConditionEt | c.condition)]
|
||||||
|
|
||||||
|
List<ConditionTest> conditions_TEST_[name/] = new ArrayList<>();
|
||||||
|
|
||||||
|
[for (cTEST : ConditionTest | cET.conditionTest)]
|
||||||
|
[if (cTEST.oclIsTypeOf(ConditionObjet))]
|
||||||
|
[let cOBJET : ConditionObjet = cTEST.oclAsType(ConditionObjet)]
|
||||||
|
conditions_TEST_[name/].add(
|
||||||
|
new ConditionObjet(
|
||||||
|
objet_[cOBJET.objet.nom/],
|
||||||
|
"[cOBJET.comparateur/]",
|
||||||
|
[cOBJET.nombre/]
|
||||||
|
);
|
||||||
|
);
|
||||||
|
[/let]
|
||||||
|
[elseif (cTEST.oclIsTypeOf(ConditionConnaissance))]
|
||||||
|
[let cCONN : ConditionConnaissance = cTEST.oclAsType(ConditionConnaissance)]
|
||||||
|
conditions_TEST_[name/].add(
|
||||||
|
new ConditionConnaissance(
|
||||||
|
connaissance_[cCONN.connaissance.nom/],
|
||||||
|
[cCONN.negation/],
|
||||||
|
);
|
||||||
|
);
|
||||||
|
[/let]
|
||||||
|
[elseif (cTEST.oclIsTypeOf(ConditionBoolean))]
|
||||||
|
[let cBOOL : ConditionBoolean = cTEST.oclAsType(ConditionBoolean)]
|
||||||
|
conditions_TEST_[name/].add(
|
||||||
|
new ConditionBoolean(
|
||||||
|
[cBOOL.valeur/],
|
||||||
|
);
|
||||||
|
);
|
||||||
|
[/let]
|
||||||
|
[/if]
|
||||||
|
[/for]
|
||||||
|
[/for]
|
||||||
|
|
||||||
|
Condition condition_[name/] = new Condition(conditions_ET_[name/]);
|
||||||
|
|
||||||
|
[/template]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>fr.n7.game2petrinet</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2m.atl.adt.builder.atlBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.m2m.atl.adt.builder.atlNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
Loading…
Reference in a new issue