feat: added petrinet from miniprojet

This commit is contained in:
Laurent Fainsin 2021-12-03 08:24:06 +01:00
parent 87afcca542
commit 70f299cc2f
189 changed files with 10223 additions and 25 deletions

147
test.game Normal file
View file

@ -0,0 +1,147 @@
{
"Explorateur": {
"taille": 3,
"connaissances": [],
"objets": [
{
"nom": "tentative",
"qty": 3
}
]
},
"Territoires": {
"Lieux": [
{
"nom": "Énigme",
"description": "lieu de départ",
"deposable": "(false)",
"depart": "(true)",
"fin": "(false)",
"connaissances": [],
"personnes": [
"Sphinx"
],
"objets": []
},
{
"nom": "Succès",
"description": "lieu succès",
"deposable": "(false)",
"depart": "(false)",
"fin": "(true)",
"connaissances": [],
"personnes": [],
"objets": []
},
{
"nom": "Échec",
"description": "lieu échec",
"deposable": "(false)",
"depart": "(false)",
"fin": "(true)",
"connaissances": [],
"personnes": [],
"objets": []
}
],
"Chemins": [
{
"lieu_in": "Énigme",
"lieu_out": "Succès",
"ouvert": "(true)",
"visible": "(connaissance_Réussite==1)",
"obligatoire": "(false)",
"connaissances_gift": [],
"objets_gift": [],
"objets_conso": [],
"descriptions": [
{
"texte": "Le chemin de la victoire !",
"condition": "(true)"
}
]
},
{
"lieu_in": "Énigme",
"lieu_out": "Échec",
"ouvert": "(true)",
"visible": "(objet_tentatives==0)",
"obligatoire": "(false)",
"connaissances": [],
"objets": [],
"objets_conso": [],
"descriptions": [
{
"texte": "Le chemin de la loose !",
"condition": "(true)"
}
]
}
]
},
"Objets": [
{
"nom": "tentative",
"taille": 1,
"visible": "(true)",
"descriptions": [
{
"texte": "permet répondre une question du sphinx",
"condition": "(true)"
}
]
}
],
"Connaissances": [
{
"nom": "Réussite",
"descriptions": [
{
"nom": "Permet de se casser de là",
"condition": "(true)"
}
]
}
],
"Personnes": [
{
"nom": "Sphinx",
"visible": "(true)",
"obligatoire": "(true)",
"interactions": [
{
"connaissances_gift": [],
"objets_gift": [],
"visible": "(true)",
"actions": [
{
"connaissances_gift": [
"Réussite"
],
"objets_gift": [],
"objets_conso": [
{
"nom": "tentative",
"qty": 1
}
],
"visible": "(true)"
},
{
"connaissances_gift": [],
"objets_gift": [],
"objets_conso": [
{
"nom": "tentative",
"qty": 1
}
],
"visible": "(true)"
}
]
}
]
}
],
"Transformations": []
}

View file

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

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>fr.n7.petrinet.edit</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.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: fr.n7.petrinet.edit;singleton:=true
Automatic-Module-Name: fr.n7.petrinet.edit
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: petrinet.provider.PetrinetEditPlugin$Implementation
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: petrinet.provider
Require-Bundle: org.eclipse.core.runtime,
fr.n7.petrinet;visibility:=reexport,
org.eclipse.emf.edit;visibility:=reexport
Bundle-ActivationPolicy: lazy

View file

@ -0,0 +1 @@
/petrinet/

View file

@ -0,0 +1,10 @@
#
bin.includes = .,\
icons/,\
META-INF/,\
plugin.xml,\
plugin.properties
jars.compile.order = .
source.. = src/
output.. = bin/

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

View file

@ -0,0 +1,37 @@
#
pluginName = Petrinet Edit Support
providerName = www.example.org
_UI_CreateChild_text = {0}
_UI_CreateChild_text2 = {1} {0}
_UI_CreateChild_text3 = {1}
_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
_UI_PropertyDescriptor_description = The {0} of the {1}
_UI_Network_type = Network
_UI_Node_type = Node
_UI_Place_type = Place
_UI_Arc_type = Arc
_UI_Transition_type = Transition
_UI_Unknown_type = Object
_UI_Unknown_datatype= Value
_UI_Network_name_feature = Name
_UI_Network_nodes_feature = Nodes
_UI_Node_name_feature = Name
_UI_Place_tokens_feature = Tokens
_UI_Arc_weight_feature = Weight
_UI_Arc_outgoing_feature = Outgoing
_UI_Arc_target_feature = Target
_UI_Transition_arcs_feature = Arcs
_UI_Unknown_feature = Unspecified
_UI_Node_network_feature = Network
_UI_Place_arcs_feature = Arcs
_UI_Arc_place_feature = Place
_UI_Arc_transition_feature = Transition

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
-->
<plugin>
<extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
<!-- @generated petrinet -->
<factory
uri="http://petrinet"
class="petrinet.provider.PetrinetItemProviderAdapterFactory"
supportedTypes=
"org.eclipse.emf.edit.provider.IEditingDomainItemProvider
org.eclipse.emf.edit.provider.IStructuredItemContentProvider
org.eclipse.emf.edit.provider.ITreeItemContentProvider
org.eclipse.emf.edit.provider.IItemLabelProvider
org.eclipse.emf.edit.provider.IItemPropertySource"/>
</extension>
</plugin>

View file

@ -0,0 +1,213 @@
/**
*/
package petrinet.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import petrinet.Arc;
import petrinet.PetrinetPackage;
import petrinet.Place;
import petrinet.Transition;
/**
* This is the item provider adapter for a {@link petrinet.Arc} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class ArcItemProvider
extends ItemProviderAdapter
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ArcItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addWeightPropertyDescriptor(object);
addOutgoingPropertyDescriptor(object);
addPlacePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Weight feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addWeightPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Arc_weight_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Arc_weight_feature", "_UI_Arc_type"),
PetrinetPackage.Literals.ARC__WEIGHT,
true,
false,
false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Outgoing feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addOutgoingPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Arc_outgoing_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Arc_outgoing_feature", "_UI_Arc_type"),
PetrinetPackage.Literals.ARC__OUTGOING,
true,
false,
false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Place feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addPlacePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Arc_place_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Arc_place_feature", "_UI_Arc_type"),
PetrinetPackage.Literals.ARC__PLACE,
true,
false,
true,
null,
null,
null));
}
/**
* This returns Arc.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Arc"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String getText(Object object) {
Arc arc = (Arc)object;
Transition transition = arc.getTransition();
Place place = arc.getPlace();
int weight = arc.getWeight();
boolean outgoing = arc.isOutgoing();
return (outgoing) ?
transition.getName() + " --" + weight + "--> " + place.getName():
place.getName() + " --" + weight + "--> " + transition.getName();
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Arc.class)) {
case PetrinetPackage.ARC__PLACE:
case PetrinetPackage.ARC__TRANSITION:
case PetrinetPackage.ARC__WEIGHT:
case PetrinetPackage.ARC__OUTGOING:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return PetrinetEditPlugin.INSTANCE;
}
}

View file

@ -0,0 +1,204 @@
/**
*/
package petrinet.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import petrinet.Network;
import petrinet.PetrinetFactory;
import petrinet.PetrinetPackage;
/**
* This is the item provider adapter for a {@link petrinet.Network} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class NetworkItemProvider
extends ItemProviderAdapter
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NetworkItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addNamePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Network_name_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Network_name_feature", "_UI_Network_type"),
PetrinetPackage.Literals.NETWORK__NAME,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures.add(PetrinetPackage.Literals.NETWORK__NODES);
}
return childrenFeatures;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EStructuralFeature getChildFeature(Object object, Object child) {
// Check the type of the specified child object and return the proper feature to use for
// adding (see {@link AddCommand}) it as a child.
return super.getChildFeature(object, child);
}
/**
* This returns Network.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Network"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((Network)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_Network_type") :
getString("_UI_Network_type") + " " + label;
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Network.class)) {
case PetrinetPackage.NETWORK__NAME:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case PetrinetPackage.NETWORK__NODES:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(PetrinetPackage.Literals.NETWORK__NODES,
PetrinetFactory.eINSTANCE.createPlace()));
newChildDescriptors.add
(createChildParameter
(PetrinetPackage.Literals.NETWORK__NODES,
PetrinetFactory.eINSTANCE.createTransition()));
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return PetrinetEditPlugin.INSTANCE;
}
}

View file

@ -0,0 +1,147 @@
/**
*/
package petrinet.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
import petrinet.Node;
import petrinet.PetrinetPackage;
/**
* This is the item provider adapter for a {@link petrinet.Node} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class NodeItemProvider
extends ItemProviderAdapter
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NodeItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addNamePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Node_name_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Node_name_feature", "_UI_Node_type"),
PetrinetPackage.Literals.NODE__NAME,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((Node)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_Node_type") :
getString("_UI_Node_type") + " " + label;
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Node.class)) {
case PetrinetPackage.NODE__NAME:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return PetrinetEditPlugin.INSTANCE;
}
}

View file

@ -0,0 +1,89 @@
/**
*/
package petrinet.provider;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.ResourceLocator;
/**
* This is the central singleton for the Petrinet edit plugin.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public final class PetrinetEditPlugin extends EMFPlugin {
/**
* Keep track of the singleton.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final PetrinetEditPlugin INSTANCE = new PetrinetEditPlugin();
/**
* Keep track of the singleton.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static Implementation plugin;
/**
* Create the instance.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetEditPlugin() {
super
(new ResourceLocator [] {
});
}
/**
* Returns the singleton instance of the Eclipse plugin.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the singleton instance.
* @generated
*/
@Override
public ResourceLocator getPluginResourceLocator() {
return plugin;
}
/**
* Returns the singleton instance of the Eclipse plugin.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the singleton instance.
* @generated
*/
public static Implementation getPlugin() {
return plugin;
}
/**
* The actual implementation of the Eclipse <b>Plugin</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static class Implementation extends EclipsePlugin {
/**
* Creates an instance.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Implementation() {
super();
// Remember the static instance.
//
plugin = this;
}
}
}

View file

@ -0,0 +1,271 @@
/**
*/
package petrinet.provider;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.edit.provider.ChangeNotifier;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.IChangeNotifier;
import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.INotifyChangedListener;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import petrinet.util.PetrinetAdapterFactory;
/**
* This is the factory that is used to provide the interfaces needed to support Viewers.
* The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
* The adapters also support Eclipse property sheets.
* Note that most of the adapters are shared among multiple instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class PetrinetItemProviderAdapterFactory extends PetrinetAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
/**
* This keeps track of the root adapter factory that delegates to this adapter factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ComposedAdapterFactory parentAdapterFactory;
/**
* This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IChangeNotifier changeNotifier = new ChangeNotifier();
/**
* This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<Object> supportedTypes = new ArrayList<Object>();
/**
* This constructs an instance.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetItemProviderAdapterFactory() {
supportedTypes.add(IEditingDomainItemProvider.class);
supportedTypes.add(IStructuredItemContentProvider.class);
supportedTypes.add(ITreeItemContentProvider.class);
supportedTypes.add(IItemLabelProvider.class);
supportedTypes.add(IItemPropertySource.class);
}
/**
* This keeps track of the one adapter used for all {@link petrinet.Network} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected NetworkItemProvider networkItemProvider;
/**
* This creates an adapter for a {@link petrinet.Network}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter createNetworkAdapter() {
if (networkItemProvider == null) {
networkItemProvider = new NetworkItemProvider(this);
}
return networkItemProvider;
}
/**
* This keeps track of the one adapter used for all {@link petrinet.Place} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PlaceItemProvider placeItemProvider;
/**
* This creates an adapter for a {@link petrinet.Place}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter createPlaceAdapter() {
if (placeItemProvider == null) {
placeItemProvider = new PlaceItemProvider(this);
}
return placeItemProvider;
}
/**
* This keeps track of the one adapter used for all {@link petrinet.Arc} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ArcItemProvider arcItemProvider;
/**
* This creates an adapter for a {@link petrinet.Arc}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter createArcAdapter() {
if (arcItemProvider == null) {
arcItemProvider = new ArcItemProvider(this);
}
return arcItemProvider;
}
/**
* This keeps track of the one adapter used for all {@link petrinet.Transition} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TransitionItemProvider transitionItemProvider;
/**
* This creates an adapter for a {@link petrinet.Transition}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter createTransitionAdapter() {
if (transitionItemProvider == null) {
transitionItemProvider = new TransitionItemProvider(this);
}
return transitionItemProvider;
}
/**
* This returns the root adapter factory that contains this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ComposeableAdapterFactory getRootAdapterFactory() {
return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
}
/**
* This sets the composed adapter factory that contains this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
this.parentAdapterFactory = parentAdapterFactory;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isFactoryForType(Object type) {
return supportedTypes.contains(type) || super.isFactoryForType(type);
}
/**
* This implementation substitutes the factory itself as the key for the adapter.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter adapt(Notifier notifier, Object type) {
return super.adapt(notifier, this);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object adapt(Object object, Object type) {
if (isFactoryForType(type)) {
Object adapter = super.adapt(object, type);
if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
return adapter;
}
}
return null;
}
/**
* This adds a listener.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void addListener(INotifyChangedListener notifyChangedListener) {
changeNotifier.addListener(notifyChangedListener);
}
/**
* This removes a listener.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void removeListener(INotifyChangedListener notifyChangedListener) {
changeNotifier.removeListener(notifyChangedListener);
}
/**
* This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void fireNotifyChanged(Notification notification) {
changeNotifier.fireNotifyChanged(notification);
if (parentAdapterFactory != null) {
parentAdapterFactory.fireNotifyChanged(notification);
}
}
/**
* This disposes all of the item providers created by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void dispose() {
if (networkItemProvider != null) networkItemProvider.dispose();
if (placeItemProvider != null) placeItemProvider.dispose();
if (arcItemProvider != null) arcItemProvider.dispose();
if (transitionItemProvider != null) transitionItemProvider.dispose();
}
}

View file

@ -0,0 +1,155 @@
/**
*/
package petrinet.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import petrinet.PetrinetPackage;
import petrinet.Place;
/**
* This is the item provider adapter for a {@link petrinet.Place} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class PlaceItemProvider extends NodeItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PlaceItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addTokensPropertyDescriptor(object);
addArcsPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Tokens feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addTokensPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Place_tokens_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Place_tokens_feature", "_UI_Place_type"),
PetrinetPackage.Literals.PLACE__TOKENS,
true,
false,
false,
ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Arcs feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addArcsPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Place_arcs_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Place_arcs_feature", "_UI_Place_type"),
PetrinetPackage.Literals.PLACE__ARCS,
true,
false,
true,
null,
null,
null));
}
/**
* This returns Place.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Place"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String getText(Object object) {
String label = ((Place)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_Place_type") :
getString("_UI_Place_type") + " " + label + " (" + ((Place)object).getTokens() +")";
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Place.class)) {
case PetrinetPackage.PLACE__TOKENS:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
}

View file

@ -0,0 +1,145 @@
/**
*/
package petrinet.provider;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
import petrinet.PetrinetFactory;
import petrinet.PetrinetPackage;
import petrinet.Transition;
/**
* This is the item provider adapter for a {@link petrinet.Transition} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class TransitionItemProvider extends NodeItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TransitionItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
}
return itemPropertyDescriptors;
}
/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures.add(PetrinetPackage.Literals.TRANSITION__ARCS);
}
return childrenFeatures;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EStructuralFeature getChildFeature(Object object, Object child) {
// Check the type of the specified child object and return the proper feature to use for
// adding (see {@link AddCommand}) it as a child.
return super.getChildFeature(object, child);
}
/**
* This returns Transition.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Transition"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((Transition)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_Transition_type") :
getString("_UI_Transition_type") + " " + label;
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Transition.class)) {
case PetrinetPackage.TRANSITION__ARCS:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(PetrinetPackage.Literals.TRANSITION__ARCS,
PetrinetFactory.eINSTANCE.createArc()));
}
}

View file

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

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>fr.n7.petrinet.editor</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.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: fr.n7.petrinet.editor;singleton:=true
Automatic-Module-Name: fr.n7.petrinet.editor
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: petrinet.presentation.PetrinetEditorPlugin$Implementation
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: petrinet.presentation
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources;visibility:=reexport,
fr.n7.petrinet.edit;visibility:=reexport,
org.eclipse.emf.ecore.xmi;visibility:=reexport,
org.eclipse.emf.edit.ui;visibility:=reexport,
org.eclipse.ui.ide;visibility:=reexport
Bundle-ActivationPolicy: lazy

View file

@ -0,0 +1 @@
/petrinet/

View file

@ -0,0 +1,10 @@
#
bin.includes = .,\
icons/,\
META-INF/,\
plugin.xml,\
plugin.properties
jars.compile.order = .
source.. = src/
output.. = bin

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,53 @@
#
pluginName = Petrinet Editor
providerName = www.example.org
_UI_PetrinetEditor_menu = &Petrinet Editor
_UI_CreateChild_menu_item = &New Child
_UI_CreateSibling_menu_item = N&ew Sibling
_UI_ShowPropertiesView_menu_item = Show &Properties View
_UI_RefreshViewer_menu_item = &Refresh
_UI_SelectionPage_label = Selection
_UI_ParentPage_label = Parent
_UI_ListPage_label = List
_UI_TreePage_label = Tree
_UI_TablePage_label = Table
_UI_TreeWithColumnsPage_label = Tree with Columns
_UI_ObjectColumn_label = Object
_UI_SelfColumn_label = Self
_UI_NoObjectSelected = Selected Nothing
_UI_SingleObjectSelected = Selected Object: {0}
_UI_MultiObjectSelected = Selected {0} Objects
_UI_OpenEditorError_label = Open Editor
_UI_Wizard_category = Example EMF Model Creation Wizards
_UI_CreateModelError_message = Problems encountered in file "{0}"
_UI_PetrinetModelWizard_label = Petrinet Model
_UI_PetrinetModelWizard_description = Create a new Petrinet model
_UI_PetrinetEditor_label = Petrinet Model Editor
_UI_PetrinetEditorFilenameDefaultBase = My
_UI_PetrinetEditorFilenameExtensions = petrinet
_UI_Wizard_label = New
_WARN_FilenameExtension = The file name must end in ''.{0}''
_WARN_FilenameExtensions = The file name must have one of the following extensions: {0}
_UI_ModelObject = &Model Object
_UI_XMLEncoding = &XML Encoding
_UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1
_UI_Wizard_initial_object_description = Select a model object to create
_UI_FileConflict_label = File Conflict
_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes?

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
-->
<plugin>
<extension point="org.eclipse.ui.newWizards">
<!-- @generated petrinet -->
<category
id="org.eclipse.emf.ecore.Wizard.category.ID"
name="%_UI_Wizard_category"/>
<wizard
id="petrinet.presentation.PetrinetModelWizardID"
name="%_UI_PetrinetModelWizard_label"
class="petrinet.presentation.PetrinetModelWizard"
category="org.eclipse.emf.ecore.Wizard.category.ID"
icon="icons/full/obj16/PetrinetModelFile.gif">
<description>%_UI_PetrinetModelWizard_description</description>
<selection class="org.eclipse.core.resources.IResource"/>
</wizard>
</extension>
<extension point="org.eclipse.ui.editors">
<!-- @generated petrinet -->
<editor
id="petrinet.presentation.PetrinetEditorID"
name="%_UI_PetrinetEditor_label"
icon="icons/full/obj16/PetrinetModelFile.gif"
extensions="petrinet"
class="petrinet.presentation.PetrinetEditor"
contributorClass="petrinet.presentation.PetrinetActionBarContributor">
</editor>
</extension>
</plugin>

View file

@ -0,0 +1,424 @@
/**
*/
package petrinet.presentation;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
import org.eclipse.emf.edit.ui.action.ControlAction;
import org.eclipse.emf.edit.ui.action.CreateChildAction;
import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
import org.eclipse.emf.edit.ui.action.LoadResourceAction;
import org.eclipse.emf.edit.ui.action.ValidateAction;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IContributionManager;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.SubContributionItem;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
/**
* This is the action bar contributor for the Petrinet model editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class PetrinetActionBarContributor
extends EditingDomainActionBarContributor
implements ISelectionChangedListener {
/**
* This keeps track of the active editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IEditorPart activeEditorPart;
/**
* This keeps track of the current selection provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ISelectionProvider selectionProvider;
/**
* This action opens the Properties view.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IAction showPropertiesViewAction =
new Action(PetrinetEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {
@Override
public void run() {
try {
getPage().showView("org.eclipse.ui.views.PropertySheet");
}
catch (PartInitException exception) {
PetrinetEditorPlugin.INSTANCE.log(exception);
}
}
};
/**
* This action refreshes the viewer of the current editor if the editor
* implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IAction refreshViewerAction =
new Action(PetrinetEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) {
@Override
public boolean isEnabled() {
return activeEditorPart instanceof IViewerProvider;
}
@Override
public void run() {
if (activeEditorPart instanceof IViewerProvider) {
Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
if (viewer != null) {
viewer.refresh();
}
}
}
};
/**
* This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
* generated for the current selection by the item provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<IAction> createChildActions;
/**
* This is the menu manager into which menu contribution items should be added for CreateChild actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IMenuManager createChildMenuManager;
/**
* This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor
* generated for the current selection by the item provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<IAction> createSiblingActions;
/**
* This is the menu manager into which menu contribution items should be added for CreateSibling actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IMenuManager createSiblingMenuManager;
/**
* This creates an instance of the contributor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetActionBarContributor() {
super(ADDITIONS_LAST_STYLE);
loadResourceAction = new LoadResourceAction();
validateAction = new ValidateAction();
controlAction = new ControlAction();
}
/**
* This adds Separators for editor additions to the tool bar.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void contributeToToolBar(IToolBarManager toolBarManager) {
super.contributeToToolBar(toolBarManager);
toolBarManager.add(new Separator("petrinet-settings"));
toolBarManager.add(new Separator("petrinet-additions"));
}
/**
* This adds to the menu bar a menu and some separators for editor additions,
* as well as the sub-menus for object creation items.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void contributeToMenu(IMenuManager menuManager) {
super.contributeToMenu(menuManager);
IMenuManager submenuManager = new MenuManager(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetEditor_menu"), "petrinetMenuID");
menuManager.insertAfter("additions", submenuManager);
submenuManager.add(new Separator("settings"));
submenuManager.add(new Separator("actions"));
submenuManager.add(new Separator("additions"));
submenuManager.add(new Separator("additions-end"));
// Prepare for CreateChild item addition or removal.
//
createChildMenuManager = new MenuManager(PetrinetEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
submenuManager.insertBefore("additions", createChildMenuManager);
// Prepare for CreateSibling item addition or removal.
//
createSiblingMenuManager = new MenuManager(PetrinetEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
submenuManager.insertBefore("additions", createSiblingMenuManager);
// Force an update because Eclipse hides empty menus now.
//
submenuManager.addMenuListener
(new IMenuListener() {
public void menuAboutToShow(IMenuManager menuManager) {
menuManager.updateAll(true);
}
});
addGlobalActions(submenuManager);
}
/**
* When the active editor changes, this remembers the change and registers with it as a selection provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
activeEditorPart = part;
// Switch to the new selection provider.
//
if (selectionProvider != null) {
selectionProvider.removeSelectionChangedListener(this);
}
if (part == null) {
selectionProvider = null;
}
else {
selectionProvider = part.getSite().getSelectionProvider();
selectionProvider.addSelectionChangedListener(this);
// Fake a selection changed event to update the menus.
//
if (selectionProvider.getSelection() != null) {
selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
}
}
}
/**
* This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
* handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
* that can be added to the selected object and updating the menus accordingly.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void selectionChanged(SelectionChangedEvent event) {
// Remove any menu items for old selection.
//
if (createChildMenuManager != null) {
depopulateManager(createChildMenuManager, createChildActions);
}
if (createSiblingMenuManager != null) {
depopulateManager(createSiblingMenuManager, createSiblingActions);
}
// Query the new selection for appropriate new child/sibling descriptors
//
Collection<?> newChildDescriptors = null;
Collection<?> newSiblingDescriptors = null;
ISelection selection = event.getSelection();
if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
Object object = ((IStructuredSelection)selection).getFirstElement();
EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
newChildDescriptors = domain.getNewChildDescriptors(object, null);
newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
}
// Generate actions for selection; populate and redraw the menus.
//
createChildActions = generateCreateChildActions(newChildDescriptors, selection);
createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
if (createChildMenuManager != null) {
populateManager(createChildMenuManager, createChildActions, null);
createChildMenuManager.update(true);
}
if (createSiblingMenuManager != null) {
populateManager(createSiblingMenuManager, createSiblingActions, null);
createSiblingMenuManager.update(true);
}
}
/**
* This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>,
* and returns the collection of these actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
Collection<IAction> actions = new ArrayList<IAction>();
if (descriptors != null) {
for (Object descriptor : descriptors) {
actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
}
}
return actions;
}
/**
* This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>,
* and returns the collection of these actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) {
Collection<IAction> actions = new ArrayList<IAction>();
if (descriptors != null) {
for (Object descriptor : descriptors) {
actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
}
}
return actions;
}
/**
* This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s
* based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection,
* by inserting them before the specified contribution item <code>contributionID</code>.
* If <code>contributionID</code> is <code>null</code>, they are simply added.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) {
if (actions != null) {
for (IAction action : actions) {
if (contributionID != null) {
manager.insertBefore(contributionID, action);
}
else {
manager.add(action);
}
}
}
}
/**
* This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
* based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) {
if (actions != null) {
IContributionItem[] items = manager.getItems();
for (int i = 0; i < items.length; i++) {
// Look into SubContributionItems
//
IContributionItem contributionItem = items[i];
while (contributionItem instanceof SubContributionItem) {
contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
}
// Delete the ActionContributionItems with matching action.
//
if (contributionItem instanceof ActionContributionItem) {
IAction action = ((ActionContributionItem)contributionItem).getAction();
if (actions.contains(action)) {
manager.remove(contributionItem);
}
}
}
}
}
/**
* This populates the pop-up menu before it appears.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void menuAboutToShow(IMenuManager menuManager) {
super.menuAboutToShow(menuManager);
MenuManager submenuManager = null;
submenuManager = new MenuManager(PetrinetEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
populateManager(submenuManager, createChildActions, null);
menuManager.insertBefore("edit", submenuManager);
submenuManager = new MenuManager(PetrinetEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
populateManager(submenuManager, createSiblingActions, null);
menuManager.insertBefore("edit", submenuManager);
}
/**
* This inserts global actions before the "additions-end" separator.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void addGlobalActions(IMenuManager menuManager) {
menuManager.insertAfter("additions-end", new Separator("ui-actions"));
menuManager.insertAfter("ui-actions", showPropertiesViewAction);
refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
menuManager.insertAfter("ui-actions", refreshViewerAction);
super.addGlobalActions(menuManager);
}
/**
* This ensures that a delete action will clean up all references to deleted objects.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean removeAllReferencesOnDelete() {
return true;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,91 @@
/**
*/
package petrinet.presentation;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.ui.EclipseUIPlugin;
import org.eclipse.emf.common.util.ResourceLocator;
/**
* This is the central singleton for the Petrinet editor plugin.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public final class PetrinetEditorPlugin extends EMFPlugin {
/**
* Keep track of the singleton.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final PetrinetEditorPlugin INSTANCE = new PetrinetEditorPlugin();
/**
* Keep track of the singleton.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static Implementation plugin;
/**
* Create the instance.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetEditorPlugin() {
super
(new ResourceLocator [] {
});
}
/**
* Returns the singleton instance of the Eclipse plugin.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the singleton instance.
* @generated
*/
@Override
public ResourceLocator getPluginResourceLocator() {
return plugin;
}
/**
* Returns the singleton instance of the Eclipse plugin.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the singleton instance.
* @generated
*/
public static Implementation getPlugin() {
return plugin;
}
/**
* The actual implementation of the Eclipse <b>Plugin</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static class Implementation extends EclipseUIPlugin {
/**
* Creates an instance.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Implementation() {
super();
// Remember the static instance.
//
plugin = this;
}
}
}

View file

@ -0,0 +1,627 @@
/**
*/
package petrinet.presentation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.StringTokenizer;
import org.eclipse.emf.common.CommonPlugin;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.part.ISetSelectionTarget;
import petrinet.PetrinetFactory;
import petrinet.PetrinetPackage;
import petrinet.provider.PetrinetEditPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
/**
* This is a simple wizard for creating a new model file.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class PetrinetModelWizard extends Wizard implements INewWizard {
/**
* The supported extensions for created files.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final List<String> FILE_EXTENSIONS =
Collections.unmodifiableList(Arrays.asList(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetEditorFilenameExtensions").split("\\s*,\\s*")));
/**
* A formatted list of supported file extensions, suitable for display.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String FORMATTED_FILE_EXTENSIONS =
PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
/**
* This caches an instance of the model package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PetrinetPackage petrinetPackage = PetrinetPackage.eINSTANCE;
/**
* This caches an instance of the model factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PetrinetFactory petrinetFactory = petrinetPackage.getPetrinetFactory();
/**
* This is the file creation page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PetrinetModelWizardNewFileCreationPage newFileCreationPage;
/**
* This is the initial object creation page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PetrinetModelWizardInitialObjectCreationPage initialObjectCreationPage;
/**
* Remember the selection during initialization for populating the default container.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IStructuredSelection selection;
/**
* Remember the workbench during initialization.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected IWorkbench workbench;
/**
* Caches the names of the types that can be created as the root object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected List<String> initialObjectNames;
/**
* This just records the information.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
this.workbench = workbench;
this.selection = selection;
setWindowTitle(PetrinetEditorPlugin.INSTANCE.getString("_UI_Wizard_label"));
setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(PetrinetEditorPlugin.INSTANCE.getImage("full/wizban/NewPetrinet")));
}
/**
* Returns the names of the types that can be created as the root object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<String> getInitialObjectNames() {
if (initialObjectNames == null) {
initialObjectNames = new ArrayList<String>();
for (EClassifier eClassifier : petrinetPackage.getEClassifiers()) {
if (eClassifier instanceof EClass) {
EClass eClass = (EClass)eClassifier;
if (!eClass.isAbstract()) {
initialObjectNames.add(eClass.getName());
}
}
}
Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
}
return initialObjectNames;
}
/**
* Create a new model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected EObject createInitialModel() {
EClass eClass = (EClass)petrinetPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName());
EObject rootObject = petrinetFactory.create(eClass);
return rootObject;
}
/**
* Do the work after everything is specified.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean performFinish() {
try {
// Remember the file.
//
final IFile modelFile = getModelFile();
// Do the work within an operation.
//
WorkspaceModifyOperation operation =
new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor progressMonitor) {
try {
// Create a resource set
//
ResourceSet resourceSet = new ResourceSetImpl();
// Get the URI of the model file.
//
URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
// Create a resource for this file.
//
Resource resource = resourceSet.createResource(fileURI);
// Add the initial model object to the contents.
//
EObject rootObject = createInitialModel();
if (rootObject != null) {
resource.getContents().add(rootObject);
}
// Save the contents of the resource to the file system.
//
Map<Object, Object> options = new HashMap<Object, Object>();
options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
resource.save(options);
}
catch (Exception exception) {
PetrinetEditorPlugin.INSTANCE.log(exception);
}
finally {
progressMonitor.done();
}
}
};
getContainer().run(false, false, operation);
// Select the new file resource in the current view.
//
IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
IWorkbenchPage page = workbenchWindow.getActivePage();
final IWorkbenchPart activePart = page.getActivePart();
if (activePart instanceof ISetSelectionTarget) {
final ISelection targetSelection = new StructuredSelection(modelFile);
getShell().getDisplay().asyncExec
(new Runnable() {
public void run() {
((ISetSelectionTarget)activePart).selectReveal(targetSelection);
}
});
}
// Open an editor on the new file.
//
try {
page.openEditor
(new FileEditorInput(modelFile),
workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
}
catch (PartInitException exception) {
MessageDialog.openError(workbenchWindow.getShell(), PetrinetEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
return false;
}
return true;
}
catch (Exception exception) {
PetrinetEditorPlugin.INSTANCE.log(exception);
return false;
}
}
/**
* This is the one page of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class PetrinetModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
/**
* Pass in the selection.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) {
super(pageId, selection);
}
/**
* The framework calls this to see if the file is correct.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean validatePage() {
if (super.validatePage()) {
String extension = new Path(getFileName()).getFileExtension();
if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
setErrorMessage(PetrinetEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
return false;
}
return true;
}
return false;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IFile getModelFile() {
return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));
}
}
/**
* This is the page where the type of object to create is selected.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class PetrinetModelWizardInitialObjectCreationPage extends WizardPage {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Combo initialObjectField;
/**
* @generated
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*/
protected List<String> encodings;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Combo encodingField;
/**
* Pass in the selection.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetModelWizardInitialObjectCreationPage(String pageId) {
super(pageId);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE); {
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.verticalSpacing = 12;
composite.setLayout(layout);
GridData data = new GridData();
data.verticalAlignment = GridData.FILL;
data.grabExcessVerticalSpace = true;
data.horizontalAlignment = GridData.FILL;
composite.setLayoutData(data);
}
Label containerLabel = new Label(composite, SWT.LEFT);
{
containerLabel.setText(PetrinetEditorPlugin.INSTANCE.getString("_UI_ModelObject"));
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
containerLabel.setLayoutData(data);
}
initialObjectField = new Combo(composite, SWT.BORDER);
{
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
initialObjectField.setLayoutData(data);
}
for (String objectName : getInitialObjectNames()) {
initialObjectField.add(getLabel(objectName));
}
if (initialObjectField.getItemCount() == 1) {
initialObjectField.select(0);
}
initialObjectField.addModifyListener(validator);
Label encodingLabel = new Label(composite, SWT.LEFT);
{
encodingLabel.setText(PetrinetEditorPlugin.INSTANCE.getString("_UI_XMLEncoding"));
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
encodingLabel.setLayoutData(data);
}
encodingField = new Combo(composite, SWT.BORDER);
{
GridData data = new GridData();
data.horizontalAlignment = GridData.FILL;
data.grabExcessHorizontalSpace = true;
encodingField.setLayoutData(data);
}
for (String encoding : getEncodings()) {
encodingField.add(encoding);
}
encodingField.select(0);
encodingField.addModifyListener(validator);
setPageComplete(validatePage());
setControl(composite);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ModifyListener validator =
new ModifyListener() {
public void modifyText(ModifyEvent e) {
setPageComplete(validatePage());
}
};
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected boolean validatePage() {
return getInitialObjectName() != null && getEncodings().contains(encodingField.getText());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible) {
if (initialObjectField.getItemCount() == 1) {
initialObjectField.clearSelection();
encodingField.setFocus();
}
else {
encodingField.clearSelection();
initialObjectField.setFocus();
}
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getInitialObjectName() {
String label = initialObjectField.getText();
for (String name : getInitialObjectNames()) {
if (getLabel(name).equals(label)) {
return name;
}
}
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getEncoding() {
return encodingField.getText();
}
/**
* Returns the label for the specified type name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected String getLabel(String typeName) {
try {
return PetrinetEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type");
}
catch(MissingResourceException mre) {
PetrinetEditorPlugin.INSTANCE.log(mre);
}
return typeName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<String> getEncodings() {
if (encodings == null) {
encodings = new ArrayList<String>();
for (StringTokenizer stringTokenizer = new StringTokenizer(PetrinetEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) {
encodings.add(stringTokenizer.nextToken());
}
}
return encodings;
}
}
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new PetrinetModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetModelWizard_label"));
newFileCreationPage.setDescription(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetModelWizard_description"));
newFileCreationPage.setFileName(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
//
if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
// Make up a unique new name here.
//
String defaultModelBaseFilename = PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
}
}
}
initialObjectCreationPage = new PetrinetModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(PetrinetEditorPlugin.INSTANCE.getString("_UI_PetrinetModelWizard_label"));
initialObjectCreationPage.setDescription(PetrinetEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}
/**
* Get the file from the page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IFile getModelFile() {
return newFileCreationPage.getModelFile();
}
}

View file

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

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>fr.n7.petrinet.tests</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.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: fr.n7.petrinet.tests;singleton:=true
Automatic-Module-Name: fr.n7.petrinet.tests
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: petrinet.tests
Require-Bundle: org.eclipse.core.runtime,
fr.n7.petrinet;visibility:=reexport,
org.eclipse.emf.ecore.xmi;visibility:=reexport,
org.junit;visibility:=reexport
Bundle-ActivationPolicy: lazy

View file

@ -0,0 +1 @@
/petrinet/

View file

@ -0,0 +1,8 @@
#
bin.includes = .,\
META-INF/,\
plugin.properties
jars.compile.order = .
source.. = src/
output.. = bin/

View file

@ -0,0 +1,4 @@
#
pluginName = Petrinet Tests
providerName = www.example.org

View file

@ -0,0 +1,89 @@
/**
*/
package petrinet.tests;
import junit.framework.TestCase;
import junit.textui.TestRunner;
import petrinet.Arc;
import petrinet.PetrinetFactory;
/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Arc</b></em>'.
* <!-- end-user-doc -->
* @generated
*/
public class ArcTest extends TestCase {
/**
* The fixture for this Arc test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Arc fixture = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args) {
TestRunner.run(ArcTest.class);
}
/**
* Constructs a new Arc test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ArcTest(String name) {
super(name);
}
/**
* Sets the fixture for this Arc test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void setFixture(Arc fixture) {
this.fixture = fixture;
}
/**
* Returns the fixture for this Arc test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Arc getFixture() {
return fixture;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#setUp()
* @generated
*/
@Override
protected void setUp() throws Exception {
setFixture(PetrinetFactory.eINSTANCE.createArc());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#tearDown()
* @generated
*/
@Override
protected void tearDown() throws Exception {
setFixture(null);
}
} //ArcTest

View file

@ -0,0 +1,89 @@
/**
*/
package petrinet.tests;
import junit.framework.TestCase;
import junit.textui.TestRunner;
import petrinet.Network;
import petrinet.PetrinetFactory;
/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Network</b></em>'.
* <!-- end-user-doc -->
* @generated
*/
public class NetworkTest extends TestCase {
/**
* The fixture for this Network test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Network fixture = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args) {
TestRunner.run(NetworkTest.class);
}
/**
* Constructs a new Network test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NetworkTest(String name) {
super(name);
}
/**
* Sets the fixture for this Network test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void setFixture(Network fixture) {
this.fixture = fixture;
}
/**
* Returns the fixture for this Network test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Network getFixture() {
return fixture;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#setUp()
* @generated
*/
@Override
protected void setUp() throws Exception {
setFixture(PetrinetFactory.eINSTANCE.createNetwork());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#tearDown()
* @generated
*/
@Override
protected void tearDown() throws Exception {
setFixture(null);
}
} //NetworkTest

View file

@ -0,0 +1,55 @@
/**
*/
package petrinet.tests;
import junit.framework.TestCase;
import petrinet.Node;
/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Node</b></em>'.
* <!-- end-user-doc -->
* @generated
*/
public abstract class NodeTest extends TestCase {
/**
* The fixture for this Node test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Node fixture = null;
/**
* Constructs a new Node test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NodeTest(String name) {
super(name);
}
/**
* Sets the fixture for this Node test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void setFixture(Node fixture) {
this.fixture = fixture;
}
/**
* Returns the fixture for this Node test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Node getFixture() {
return fixture;
}
} //NodeTest

View file

@ -0,0 +1,46 @@
/**
*/
package petrinet.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
/**
* <!-- begin-user-doc -->
* A test suite for the '<em><b>Petrinet</b></em>' model.
* <!-- end-user-doc -->
* @generated
*/
public class PetrinetAllTests extends TestSuite {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args) {
TestRunner.run(suite());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static Test suite() {
TestSuite suite = new PetrinetAllTests("Petrinet Tests");
return suite;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetAllTests(String name) {
super(name);
}
} //PetrinetAllTests

View file

@ -0,0 +1,121 @@
/**
*/
package petrinet.tests;
import java.io.File;
import java.io.IOException;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.Diagnostician;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import petrinet.Network;
import petrinet.PetrinetFactory;
import petrinet.PetrinetPackage;
/**
* <!-- begin-user-doc -->
* A sample utility for the '<em><b>petrinet</b></em>' package.
* <!-- end-user-doc -->
* @generated
*/
public class PetrinetExample {
/**
* <!-- begin-user-doc -->
* Load all the argument file paths or URIs as instances of the model.
* <!-- end-user-doc -->
* @param args the file paths or URIs.
* @generated
*/
public static void main(String[] args) {
// Create a resource set to hold the resources.
//
ResourceSet resourceSet = new ResourceSetImpl();
// Register the appropriate resource factory to handle all file extensions.
//
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put
(Resource.Factory.Registry.DEFAULT_EXTENSION,
new XMIResourceFactoryImpl());
// Register the package to ensure it is available during loading.
//
resourceSet.getPackageRegistry().put
(PetrinetPackage.eNS_URI,
PetrinetPackage.eINSTANCE);
// If there are no arguments, emit an appropriate usage message.
//
if (args.length == 0) {
System.out.println("Enter a list of file paths or URIs that have content like this:");
try {
Resource resource = resourceSet.createResource(URI.createURI("http:///My.petrinet"));
Network root = PetrinetFactory.eINSTANCE.createNetwork();
resource.getContents().add(root);
resource.save(System.out, null);
}
catch (IOException exception) {
exception.printStackTrace();
}
}
else {
// Iterate over all the arguments.
//
for (int i = 0; i < args.length; ++i) {
// Construct the URI for the instance file.
// The argument is treated as a file path only if it denotes an existing file.
// Otherwise, it's directly treated as a URL.
//
File file = new File(args[i]);
URI uri = file.isFile() ? URI.createFileURI(file.getAbsolutePath()): URI.createURI(args[i]);
try {
// Demand load resource for this file.
//
Resource resource = resourceSet.getResource(uri, true);
System.out.println("Loaded " + uri);
// Validate the contents of the loaded resource.
//
for (EObject eObject : resource.getContents()) {
Diagnostic diagnostic = Diagnostician.INSTANCE.validate(eObject);
if (diagnostic.getSeverity() != Diagnostic.OK) {
printDiagnostic(diagnostic, "");
}
}
}
catch (RuntimeException exception) {
System.out.println("Problem loading " + uri);
exception.printStackTrace();
}
}
}
}
/**
* <!-- begin-user-doc -->
* Prints diagnostics with indentation.
* <!-- end-user-doc -->
* @param diagnostic the diagnostic to print.
* @param indent the indentation for printing.
* @generated
*/
protected static void printDiagnostic(Diagnostic diagnostic, String indent) {
System.out.print(indent);
System.out.println(diagnostic.getMessage());
for (Diagnostic child : diagnostic.getChildren()) {
printDiagnostic(child, indent + " ");
}
}
} //PetrinetExample

View file

@ -0,0 +1,46 @@
/**
*/
package petrinet.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
/**
* <!-- begin-user-doc -->
* A test suite for the '<em><b>petrinet</b></em>' package.
* <!-- end-user-doc -->
* @generated
*/
public class PetrinetTests extends TestSuite {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args) {
TestRunner.run(suite());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static Test suite() {
TestSuite suite = new PetrinetTests("petrinet Tests");
return suite;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetTests(String name) {
super(name);
}
} //PetrinetTests

View file

@ -0,0 +1,70 @@
/**
*/
package petrinet.tests;
import junit.textui.TestRunner;
import petrinet.PetrinetFactory;
import petrinet.Place;
/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Place</b></em>'.
* <!-- end-user-doc -->
* @generated
*/
public class PlaceTest extends NodeTest {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args) {
TestRunner.run(PlaceTest.class);
}
/**
* Constructs a new Place test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PlaceTest(String name) {
super(name);
}
/**
* Returns the fixture for this Place test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected Place getFixture() {
return (Place)fixture;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#setUp()
* @generated
*/
@Override
protected void setUp() throws Exception {
setFixture(PetrinetFactory.eINSTANCE.createPlace());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#tearDown()
* @generated
*/
@Override
protected void tearDown() throws Exception {
setFixture(null);
}
} //PlaceTest

View file

@ -0,0 +1,70 @@
/**
*/
package petrinet.tests;
import junit.textui.TestRunner;
import petrinet.PetrinetFactory;
import petrinet.Transition;
/**
* <!-- begin-user-doc -->
* A test case for the model object '<em><b>Transition</b></em>'.
* <!-- end-user-doc -->
* @generated
*/
public class TransitionTest extends NodeTest {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static void main(String[] args) {
TestRunner.run(TransitionTest.class);
}
/**
* Constructs a new Transition test case with the given name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TransitionTest(String name) {
super(name);
}
/**
* Returns the fixture for this Transition test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected Transition getFixture() {
return (Transition)fixture;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#setUp()
* @generated
*/
@Override
protected void setUp() throws Exception {
setFixture(PetrinetFactory.eINSTANCE.createTransition());
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see junit.framework.TestCase#tearDown()
* @generated
*/
@Override
protected void tearDown() throws Exception {
setFixture(null);
}
} //TransitionTest

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.petrinet.toTINA.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 ToTINA Module IDE Plug-in
Bundle-SymbolicName: fr.n7.petrinet.toTINA.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: fr.n7.petrinet.toTINA.ui.Activator
Bundle-Vendor: Eclipse Modeling Project
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
fr.n7.petrinet.toTINA,
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="*.petrinet"
id="fr.n7.petrinet.toTINA.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.petrinet.toTINA.ui.popupMenus.AcceleoGenerateToTINAAction"
enablesFor="+"
id="fr.n7.petrinet.toTINA.ui.popupMenus.acceleoGenerateToTINAAction"
icon="icons/default.gif"
label="Generate ToTINA"
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.petrinet.toTINA.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.petrinet.toTINA.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.petrinet.toTINA.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 'ToTINA' 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.petrinet.toTINA.main.ToTINA gen0 = new fr.n7.petrinet.toTINA.main.ToTINA(modelURI, targetFolder.getLocation().toFile(), arguments);
monitor.worked(1);
String generationID = org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil.computeUIProjectID("fr.n7.petrinet.toTINA", "fr.n7.petrinet.toTINA.main.ToTINA", 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.petrinet.toTINA.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.petrinet.toTINA.ui.Activator;
import fr.n7.petrinet.toTINA.ui.common.GenerateAll;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionDelegate;
/**
* ToTINA code generation.
*/
public class AcceleoGenerateToTINAAction 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-11"/>
<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.petrinet.toTINA</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,24 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Acceleo ToTINA Module Runtime Plug-in
Bundle-SymbolicName: fr.n7.petrinet.toTINA
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: fr.n7.petrinet.toTINA.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-11
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
Export-Package: fr.n7.petrinet.toTINA.main
Import-Package: petrinet

View file

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

View file

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

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.petrinet.toTINA;
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.petrinet.toTINA";
/**
* 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,417 @@
/*******************************************************************************
* 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.petrinet.toTINA.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;
import petrinet.PetrinetPackage;
/**
* Entry point of the 'ToTINA' generation module.
*
* @generated
*/
public class ToTINA extends AbstractAcceleoGenerator {
/**
* The name of the module.
*
* @generated
*/
public static final String MODULE_FILE_NAME = "/fr/n7/petrinet/toTINA/main/toTINA";
/**
* The name of the templates that are to be generated.
*
* @generated
*/
public static final String[] TEMPLATE_NAMES = { "networkToTINA" };
/**
* 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 ToTINA() {
// 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 ToTINA(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 ToTINA(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.
*/
ToTINA generator = new ToTINA(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 NOT
*/
@Override
public void registerPackages(ResourceSet resourceSet) {
super.registerPackages(resourceSet);
if (!isInWorkspace(PetrinetPackage.class))
resourceSet.getPackageRegistry().put(
PetrinetPackage.eNS_URI, PetrinetPackage.eINSTANCE);
/*
* 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,44 @@
[comment encoding = UTF-8 /]
[module toTINA('http://petrinet')]
[template public networkToTINA(aNetwork : Network)]
[comment @main/]
[file (aNetwork.name + '.net', false, 'UTF-8')]
net [aNetwork.name/]
[let places : OrderedSet(Place) = aNetwork.getPlaces() ]
[if (places->size() > 0)]
[for (place : Place | places)]
pl [place.name/] ([place.tokens/])
[/for]
[else]
[/if]
[/let]
[let transitions : OrderedSet(Transition) = aNetwork.getTransitions() ]
[if (transitions->size() > 0)]
[for (transition : Transition | transitions)]
[transition.afficher()/]
[/for]
[else]
[/if]
[/let]
[/file]
[/template]
[query public getPlaces(n: Network) : OrderedSet(Place) =
n.nodes
->select( e | e.oclIsTypeOf(Place) )
->collect( e | e.oclAsType(Place) )
->asOrderedSet()
/]
[query public getTransitions(n: Network) : OrderedSet(Transition) =
n.nodes
->select( e | e.oclIsTypeOf(Transition) )
->collect( e | e.oclAsType(Transition) )
->asOrderedSet()
/]
[template public afficher(t : Transition) post (trim()) ]
[comment][let outgoing = t.getArcs()->select( e | e.isOutgoing() ) /][/comment]
tr [t.name/] [for (a : Arc | t.arcs)][if (not a.outgoing)][a.place.name/]*[a.weight/] [/if][/for]-> [for (a : Arc | t.arcs)][if (a.outgoing)][a.place.name/]*[a.weight/] [/if][/for]
[/template]

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="toTINA" name="fr.n7.petrinet.toTINA">
<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.petrinet.toTINA.libraryclasspath">
<pathelement location="${ECLIPSE_WORKSPACE}/fr.n7.petrinet.toTINA/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.petrinet.toTINA.classpath">
<path refid="fr.n7.petrinet.toTINA.libraryclasspath"/>
</path>
<!-- The classpath with only the jars available in the plugin folder of Eclipse -->
<path id="fr.n7.petrinet.toTINA.libraryclasspath.alljars">
<pathelement location="../fr.n7.petrinet.toTINA/bin"/>
<fileset dir="${ECLIPSE_HOME}/plugins/" includes="*.jar"/>
</path>
<path id="fr.n7.petrinet.toTINA.classpath.alljars">
<path refid="fr.n7.petrinet.toTINA.libraryclasspath.alljars"/>
</path>
<!-- The default task with the jars used by this project -->
<target name="toTINA">
<java classname="fr.n7.petrinet.toTINA.main.ToTINA" classpathref="fr.n7.petrinet.toTINA.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="toTINA.alljars">
<java classname="fr.n7.petrinet.toTINA.main.ToTINA" classpathref="fr.n7.petrinet.toTINA.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="toTINASample" name="fr.n7.petrinet.toTINASample">
<import file="../../fr.n7.petrinet.toTINA/tasks/toTINA.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="toTINASample" description="Generate files in 'TARGET'">
<antcall target="toTINA" >
<param name="model" value="${MODEL}"/>
<param name="target" value="${TARGET}"/>
</antcall>
</target>
</project>

View file

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

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>fr.n7.petrinet</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ocl.pivot.ui.oclbuilder</name>
<arguments>
<dictionary>
<key>disabledExtensions</key>
<value>*,essentialocl</value>
</dictionary>
<dictionary>
<key>disabledPaths</key>
<value>bin/**,target/**</value>
</dictionary>
<dictionary>
<key>enabledExtensions</key>
<value>ecore,ocl,oclinecore,oclstdlib,uml</value>
</dictionary>
<dictionary>
<key>enabledPaths</key>
<value>**</value>
</dictionary>
</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.ocl.pivot.ui.oclnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: fr.n7.petrinet;singleton:=true
Automatic-Module-Name: fr.n7.petrinet
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: petrinet,
petrinet.impl,
petrinet.util
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport
Bundle-ActivationPolicy: lazy

View file

@ -0,0 +1 @@
/petrinet/

View file

@ -0,0 +1,10 @@
#
bin.includes = .,\
model/,\
META-INF/,\
plugin.xml,\
plugin.properties
jars.compile.order = .
source.. = src/
output.. = bin/

View file

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<petrinet:Network
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:petrinet="http://petrinet"
xsi:schemaLocation="http://petrinet petriNET.ecore"
name="mauvaisNetwork">
<nodes xsi:type="petrinet:Place"
name="okay"
tokens="10"/>
<nodes xsi:type="petrinet:Place"
name="1"
tokens="1"/>
<nodes xsi:type="petrinet:Place"
name="placeNeg"
tokens="-5"/>
<nodes xsi:type="petrinet:Transition"
name="debut2fin">
<arcs weight="-5"
target="//@nodes.1"/>
<arcs weight="1"
outgoing="true"
target="//@nodes.2"/>
</nodes>
</petrinet:Network>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<petrinet:Network
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:petrinet="http://petrinet"
xsi:schemaLocation="http://petrinet petriNET.ecore"
name="gentilleNetwork">
<nodes xsi:type="petrinet:Place"
name="debut"
tokens="1"/>
<nodes xsi:type="petrinet:Place"
name="fin"/>
<nodes xsi:type="petrinet:Transition"
name="debut2fin">
<arcs weight="1"
target="//@nodes.0"/>
<arcs weight="1"
outgoing="true"
target="//@nodes.1"/>
</nodes>
</petrinet:Network>

View file

@ -0,0 +1,367 @@
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.3/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style">
<viewpoint:DAnalysis uid="_8tPnQCxCEeyIb_aAzHoOBA" selectedViews="_8vS1sCxCEeyIb_aAzHoOBA _8veb4CxCEeyIb_aAzHoOBA _8vfqACxCEeyIb_aAzHoOBA _8vitUCxCEeyIb_aAzHoOBA" version="14.3.1.202003261200">
<semanticResources>petriNet.ecore</semanticResources>
<semanticResources>petriNet.genmodel</semanticResources>
<ownedViews xmi:type="viewpoint:DView" uid="_8vS1sCxCEeyIb_aAzHoOBA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']"/>
<ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" uid="_9Y_6ASxCEeyIb_aAzHoOBA" name="petrinet class diagram" repPath="#_9Y5zYCxCEeyIb_aAzHoOBA" changeId="4f3bb097-e80a-4128-9372-c3fe2680afe4">
<description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
<target xmi:type="ecore:EPackage" href="petriNet.ecore#/"/>
</ownedRepresentationDescriptors>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_8veb4CxCEeyIb_aAzHoOBA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Review']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_8vfqACxCEeyIb_aAzHoOBA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Archetype']"/>
</ownedViews>
<ownedViews xmi:type="viewpoint:DView" uid="_8vitUCxCEeyIb_aAzHoOBA">
<viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Generation']"/>
</ownedViews>
</viewpoint:DAnalysis>
<diagram:DSemanticDiagram uid="_9Y5zYCxCEeyIb_aAzHoOBA">
<ownedAnnotationEntries xmi:type="description:AnnotationEntry" uid="_9ZEygCxCEeyIb_aAzHoOBA" source="GMF_DIAGRAMS">
<data xmi:type="notation:Diagram" xmi:id="_9ZEygSxCEeyIb_aAzHoOBA" type="Sirius" element="_9Y5zYCxCEeyIb_aAzHoOBA" measurementUnit="Pixel">
<children xmi:type="notation:Node" xmi:id="_9x0psCxCEeyIb_aAzHoOBA" type="2003" element="_9xmAMCxCEeyIb_aAzHoOBA">
<children xmi:type="notation:Node" xmi:id="_9x1QwCxCEeyIb_aAzHoOBA" type="5007"/>
<children xmi:type="notation:Node" xmi:id="_9x1QwSxCEeyIb_aAzHoOBA" type="7004">
<children xmi:type="notation:Node" xmi:id="_9x3F8CxCEeyIb_aAzHoOBA" type="3010" element="_9xtU8ixCEeyIb_aAzHoOBA">
<styles xmi:type="notation:FontStyle" xmi:id="_9x3F8SxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8" bold="true"/>
<layoutConstraint xmi:type="notation:Location" xmi:id="_9x3F8ixCEeyIb_aAzHoOBA"/>
</children>
<styles xmi:type="notation:SortingStyle" xmi:id="_9x1QwixCEeyIb_aAzHoOBA"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_9x1QwyxCEeyIb_aAzHoOBA"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_9x0psSxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x0psixCEeyIb_aAzHoOBA" x="230" y="160"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x130CxCEeyIb_aAzHoOBA" type="2003" element="_9xn1YCxCEeyIb_aAzHoOBA">
<children xmi:type="notation:Node" xmi:id="_9x130yxCEeyIb_aAzHoOBA" type="5007"/>
<children xmi:type="notation:Node" xmi:id="_9x131CxCEeyIb_aAzHoOBA" type="7004">
<children xmi:type="notation:Node" xmi:id="_9x3F8yxCEeyIb_aAzHoOBA" type="3010" element="_9xt8ASxCEeyIb_aAzHoOBA">
<styles xmi:type="notation:FontStyle" xmi:id="_9x3F9CxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8" bold="true"/>
<layoutConstraint xmi:type="notation:Location" xmi:id="_9x3F9SxCEeyIb_aAzHoOBA"/>
</children>
<styles xmi:type="notation:SortingStyle" xmi:id="_9x131SxCEeyIb_aAzHoOBA"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_9x131ixCEeyIb_aAzHoOBA"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_9x130SxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8" italic="true"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x130ixCEeyIb_aAzHoOBA" x="495" y="160"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x131yxCEeyIb_aAzHoOBA" type="2003" element="_9xoccCxCEeyIb_aAzHoOBA">
<children xmi:type="notation:Node" xmi:id="_9x132ixCEeyIb_aAzHoOBA" type="5007"/>
<children xmi:type="notation:Node" xmi:id="_9x132yxCEeyIb_aAzHoOBA" type="7004">
<children xmi:type="notation:Node" xmi:id="_9x3tACxCEeyIb_aAzHoOBA" type="3010" element="_9xujESxCEeyIb_aAzHoOBA">
<styles xmi:type="notation:FontStyle" xmi:id="_9x3tASxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8" bold="true"/>
<layoutConstraint xmi:type="notation:Location" xmi:id="_9x3tAixCEeyIb_aAzHoOBA"/>
</children>
<styles xmi:type="notation:SortingStyle" xmi:id="_9x133CxCEeyIb_aAzHoOBA"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_9x133SxCEeyIb_aAzHoOBA"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_9x132CxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x132SxCEeyIb_aAzHoOBA" x="770" y="340"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x2e4CxCEeyIb_aAzHoOBA" type="2003" element="_9xpDgSxCEeyIb_aAzHoOBA">
<children xmi:type="notation:Node" xmi:id="_9x2e4yxCEeyIb_aAzHoOBA" type="5007"/>
<children xmi:type="notation:Node" xmi:id="_9x2e5CxCEeyIb_aAzHoOBA" type="7004">
<children xmi:type="notation:Node" xmi:id="_9x3tAyxCEeyIb_aAzHoOBA" type="3010" element="_9xvKISxCEeyIb_aAzHoOBA">
<styles xmi:type="notation:FontStyle" xmi:id="_9x3tBCxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8" bold="true"/>
<layoutConstraint xmi:type="notation:Location" xmi:id="_9x3tBSxCEeyIb_aAzHoOBA"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x4UECxCEeyIb_aAzHoOBA" type="3010" element="_9xvxMSxCEeyIb_aAzHoOBA">
<styles xmi:type="notation:FontStyle" xmi:id="_9x4UESxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8" bold="true"/>
<layoutConstraint xmi:type="notation:Location" xmi:id="_9x4UEixCEeyIb_aAzHoOBA"/>
</children>
<styles xmi:type="notation:SortingStyle" xmi:id="_9x2e5SxCEeyIb_aAzHoOBA"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_9x2e5ixCEeyIb_aAzHoOBA"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_9x2e4SxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x2e4ixCEeyIb_aAzHoOBA" x="472" y="340"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x2e5yxCEeyIb_aAzHoOBA" type="2003" element="_9xpqkSxCEeyIb_aAzHoOBA">
<children xmi:type="notation:Node" xmi:id="_9x2e6ixCEeyIb_aAzHoOBA" type="5007"/>
<children xmi:type="notation:Node" xmi:id="_9x2e6yxCEeyIb_aAzHoOBA" type="7004">
<styles xmi:type="notation:SortingStyle" xmi:id="_9x2e7CxCEeyIb_aAzHoOBA"/>
<styles xmi:type="notation:FilteringStyle" xmi:id="_9x2e7SxCEeyIb_aAzHoOBA"/>
</children>
<styles xmi:type="notation:ShapeStyle" xmi:id="_9x2e6CxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8"/>
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x2e6SxCEeyIb_aAzHoOBA" x="230" y="340"/>
</children>
<styles xmi:type="notation:DiagramStyle" xmi:id="_9ZEygixCEeyIb_aAzHoOBA"/>
<edges xmi:type="notation:Edge" xmi:id="_9x4UEyxCEeyIb_aAzHoOBA" type="4001" element="_9xw_UCxCEeyIb_aAzHoOBA" source="_9x131yxCEeyIb_aAzHoOBA" target="_9x130CxCEeyIb_aAzHoOBA">
<children xmi:type="notation:Node" xmi:id="_9x4UFyxCEeyIb_aAzHoOBA" type="6001">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x4UGCxCEeyIb_aAzHoOBA" y="-10"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x4UGSxCEeyIb_aAzHoOBA" type="6002">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x4UGixCEeyIb_aAzHoOBA" y="10"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x4UGyxCEeyIb_aAzHoOBA" type="6003">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x4UHCxCEeyIb_aAzHoOBA" y="10"/>
</children>
<styles xmi:type="notation:ConnectorStyle" xmi:id="_9x4UFCxCEeyIb_aAzHoOBA" routing="Tree"/>
<styles xmi:type="notation:FontStyle" xmi:id="_9x4UFSxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9x4UFixCEeyIb_aAzHoOBA" points="[-1, 0, 96, 380]$[-2, -320, 95, 60]$[-98, -380, -1, 0]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9x47ICxCEeyIb_aAzHoOBA" id="(0.5084745762711864,0.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9x47ISxCEeyIb_aAzHoOBA" id="(0.5084745762711864,1.0)"/>
</edges>
<edges xmi:type="notation:Edge" xmi:id="_9x47IixCEeyIb_aAzHoOBA" type="4001" element="_9xxmYyxCEeyIb_aAzHoOBA" source="_9x2e5yxCEeyIb_aAzHoOBA" target="_9x130CxCEeyIb_aAzHoOBA">
<children xmi:type="notation:Node" xmi:id="_9x47JixCEeyIb_aAzHoOBA" type="6001">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x47JyxCEeyIb_aAzHoOBA" x="-29" y="-10"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x47KCxCEeyIb_aAzHoOBA" type="6002">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x47KSxCEeyIb_aAzHoOBA" x="-7" y="-4"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x47KixCEeyIb_aAzHoOBA" type="6003">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x47KyxCEeyIb_aAzHoOBA" x="-29" y="10"/>
</children>
<styles xmi:type="notation:ConnectorStyle" xmi:id="_9x47IyxCEeyIb_aAzHoOBA" routing="Tree"/>
<styles xmi:type="notation:FontStyle" xmi:id="_9x47JCxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9x47JSxCEeyIb_aAzHoOBA" points="[0, 0, -265, 82]$[0, -35, -265, 47]$[265, -35, 0, 47]$[265, -82, 0, 0]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9x47LCxCEeyIb_aAzHoOBA" id="(0.5084745762711864,0.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9x5iMCxCEeyIb_aAzHoOBA" id="(0.5084745762711864,1.0)"/>
</edges>
<edges xmi:type="notation:Edge" xmi:id="_9x5iMSxCEeyIb_aAzHoOBA" type="4001" element="_9xyNcCxCEeyIb_aAzHoOBA" source="_9x0psCxCEeyIb_aAzHoOBA" target="_9x130CxCEeyIb_aAzHoOBA">
<children xmi:type="notation:Node" xmi:id="_9x5iNSxCEeyIb_aAzHoOBA" type="6001">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x5iNixCEeyIb_aAzHoOBA" y="-10"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x5iNyxCEeyIb_aAzHoOBA" type="6002">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x5iOCxCEeyIb_aAzHoOBA" x="19" y="8"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x5iOSxCEeyIb_aAzHoOBA" type="6003">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x5iOixCEeyIb_aAzHoOBA" x="-9" y="-7"/>
</children>
<styles xmi:type="notation:ConnectorStyle" xmi:id="_9x5iMixCEeyIb_aAzHoOBA" routing="Rectilinear"/>
<styles xmi:type="notation:FontStyle" xmi:id="_9x5iMyxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9x5iNCxCEeyIb_aAzHoOBA" points="[58, 48, -207, -50]$[205, 48, -60, -50]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9x5iOyxCEeyIb_aAzHoOBA" id="(0.5084745762711864,0.0)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9x5iPCxCEeyIb_aAzHoOBA" id="(0.5084745762711864,1.0)"/>
</edges>
<edges xmi:type="notation:Edge" xmi:id="_9x5iPSxCEeyIb_aAzHoOBA" type="4001" element="_9xy0iSxCEeyIb_aAzHoOBA" source="_9x2e4CxCEeyIb_aAzHoOBA" target="_9x2e5yxCEeyIb_aAzHoOBA">
<children xmi:type="notation:Node" xmi:id="_9x5iQSxCEeyIb_aAzHoOBA" type="6001">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x5iQixCEeyIb_aAzHoOBA" y="10"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x5iQyxCEeyIb_aAzHoOBA" type="6002">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x5iRCxCEeyIb_aAzHoOBA" x="10" y="7"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x5iRSxCEeyIb_aAzHoOBA" type="6003">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x5iRixCEeyIb_aAzHoOBA" x="-22" y="-8"/>
</children>
<styles xmi:type="notation:ConnectorStyle" xmi:id="_9x5iPixCEeyIb_aAzHoOBA" routing="Rectilinear"/>
<styles xmi:type="notation:FontStyle" xmi:id="_9x5iPyxCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8" bold="true"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9x5iQCxCEeyIb_aAzHoOBA" points="[-82, -1, 183, -1]$[-206, -1, 59, -1]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9x5iRyxCEeyIb_aAzHoOBA" id="(0.5,0.5)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9x5iSCxCEeyIb_aAzHoOBA" id="(0.5,0.5)"/>
</edges>
<edges xmi:type="notation:Edge" xmi:id="_9x6JQCxCEeyIb_aAzHoOBA" type="4001" element="_9xzblixCEeyIb_aAzHoOBA" source="_9x131yxCEeyIb_aAzHoOBA" target="_9x2e4CxCEeyIb_aAzHoOBA">
<children xmi:type="notation:Node" xmi:id="_9x6JRCxCEeyIb_aAzHoOBA" type="6001">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x6JRSxCEeyIb_aAzHoOBA" x="9" y="-10"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x6JRixCEeyIb_aAzHoOBA" type="6002">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x6JRyxCEeyIb_aAzHoOBA" x="13" y="7"/>
</children>
<children xmi:type="notation:Node" xmi:id="_9x6JSCxCEeyIb_aAzHoOBA" type="6003">
<layoutConstraint xmi:type="notation:Bounds" xmi:id="_9x6JSSxCEeyIb_aAzHoOBA" x="-11" y="-8"/>
</children>
<styles xmi:type="notation:ConnectorStyle" xmi:id="_9x6JQSxCEeyIb_aAzHoOBA" routing="Rectilinear"/>
<styles xmi:type="notation:FontStyle" xmi:id="_9x6JQixCEeyIb_aAzHoOBA" fontName="Ubuntu" fontHeight="8"/>
<bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9x6JQyxCEeyIb_aAzHoOBA" points="[-59, -1, 216, -1]$[-193, -1, 82, -1]"/>
<sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9x6JSixCEeyIb_aAzHoOBA" id="(0.5,0.5)"/>
<targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_9x6JSyxCEeyIb_aAzHoOBA" id="(0.5,0.5)"/>
</edges>
</data>
</ownedAnnotationEntries>
<ownedAnnotationEntries xmi:type="description:AnnotationEntry" uid="_9ZMHQCxCEeyIb_aAzHoOBA" source="DANNOTATION_CUSTOMIZATION_KEY">
<data xmi:type="diagram:ComputedStyleDescriptionRegistry" uid="_9ZMHQSxCEeyIb_aAzHoOBA">
<computedStyleDescriptions xmi:type="style:BundledImageDescription" xmi:id="_9xtU8yxCEeyIb_aAzHoOBA" labelExpression="service:render" labelAlignment="LEFT" tooltipExpression="service:renderTooltip" sizeComputationExpression="1">
<borderColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<labelFormat>bold</labelFormat>
<labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<color xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
</computedStyleDescriptions>
<computedStyleDescriptions xmi:type="style:EdgeStyleDescription" xmi:id="_9xy0gCxCEeyIb_aAzHoOBA" sourceArrow="FillDiamond" routingStyle="manhattan">
<strokeColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<beginLabelStyleDescription xmi:type="style:BeginLabelStyleDescription" xmi:id="_9xy0gSxCEeyIb_aAzHoOBA" showIcon="false" labelExpression="service:renderEOpposite">
<labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
</beginLabelStyleDescription>
<endLabelStyleDescription xmi:type="style:EndLabelStyleDescription" xmi:id="_9xy0gixCEeyIb_aAzHoOBA" showIcon="false" labelExpression="service:render">
<labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
</endLabelStyleDescription>
</computedStyleDescriptions>
<computedStyleDescriptions xmi:type="style:EdgeStyleDescription" xmi:id="_9xy0iixCEeyIb_aAzHoOBA" sourceArrow="InputArrow" targetArrow="FillDiamond" routingStyle="manhattan">
<strokeColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
<beginLabelStyleDescription xmi:type="style:BeginLabelStyleDescription" xmi:id="_9xy0iyxCEeyIb_aAzHoOBA" showIcon="false" labelExpression="service:renderEOpposite">
<labelFormat>bold</labelFormat>
<labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
</beginLabelStyleDescription>
<endLabelStyleDescription xmi:type="style:EndLabelStyleDescription" xmi:id="_9xy0jCxCEeyIb_aAzHoOBA" showIcon="false" labelExpression="service:render">
<labelFormat>bold</labelFormat>
<labelColor xmi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
</endLabelStyleDescription>
</computedStyleDescriptions>
</data>
</ownedAnnotationEntries>
<ownedDiagramElements xmi:type="diagram:DNodeList" uid="_9xmAMCxCEeyIb_aAzHoOBA" name="Network" tooltipText="" outgoingEdges="_9xyNcCxCEeyIb_aAzHoOBA" width="12" height="10">
<target xmi:type="ecore:EClass" href="petriNet.ecore#//Network"/>
<semanticElements xmi:type="ecore:EClass" href="petriNet.ecore#//Network"/>
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
<arrangeConstraints>KEEP_SIZE</arrangeConstraints>
<arrangeConstraints>KEEP_RATIO</arrangeConstraints>
<ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_9xmnQCxCEeyIb_aAzHoOBA" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
<ownedElements xmi:type="diagram:DNodeListElement" uid="_9xtU8ixCEeyIb_aAzHoOBA" name="name : EString" tooltipText="">
<target xmi:type="ecore:EAttribute" href="petriNet.ecore#//Network/name"/>
<semanticElements xmi:type="ecore:EAttribute" href="petriNet.ecore#//Network/name"/>
<ownedStyle xmi:type="diagram:BundledImage" uid="_9xt8ACxCEeyIb_aAzHoOBA" labelAlignment="LEFT" description="_9xtU8yxCEeyIb_aAzHoOBA">
<labelFormat>bold</labelFormat>
</ownedStyle>
<actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
</ownedElements>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNodeList" uid="_9xn1YCxCEeyIb_aAzHoOBA" name="Node" tooltipText="" incomingEdges="_9xw_UCxCEeyIb_aAzHoOBA _9xxmYyxCEeyIb_aAzHoOBA _9xyNcCxCEeyIb_aAzHoOBA" width="12" height="10">
<target xmi:type="ecore:EClass" href="petriNet.ecore#//Node"/>
<semanticElements xmi:type="ecore:EClass" href="petriNet.ecore#//Node"/>
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
<arrangeConstraints>KEEP_SIZE</arrangeConstraints>
<arrangeConstraints>KEEP_RATIO</arrangeConstraints>
<ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_9xn1YSxCEeyIb_aAzHoOBA" iconPath="/org.eclipse.emf.ecoretools.design/icons/full/obj16/EClass_abstract.gif" borderSize="1" borderSizeComputationExpression="1" borderColor="125,125,125" backgroundStyle="Liquid" foregroundColor="228,228,228">
<labelFormat>italic</labelFormat>
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@conditionnalStyles.1/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
<ownedElements xmi:type="diagram:DNodeListElement" uid="_9xt8ASxCEeyIb_aAzHoOBA" name="name : EString" tooltipText="">
<target xmi:type="ecore:EAttribute" href="petriNet.ecore#//Node/name"/>
<semanticElements xmi:type="ecore:EAttribute" href="petriNet.ecore#//Node/name"/>
<ownedStyle xmi:type="diagram:BundledImage" uid="_9xujECxCEeyIb_aAzHoOBA" labelAlignment="LEFT" description="_9xtU8yxCEeyIb_aAzHoOBA">
<labelFormat>bold</labelFormat>
</ownedStyle>
<actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
</ownedElements>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNodeList" uid="_9xoccCxCEeyIb_aAzHoOBA" name="Place" tooltipText="" outgoingEdges="_9xw_UCxCEeyIb_aAzHoOBA _9xzblixCEeyIb_aAzHoOBA" width="12" height="10">
<target xmi:type="ecore:EClass" href="petriNet.ecore#//Place"/>
<semanticElements xmi:type="ecore:EClass" href="petriNet.ecore#//Place"/>
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
<arrangeConstraints>KEEP_SIZE</arrangeConstraints>
<arrangeConstraints>KEEP_RATIO</arrangeConstraints>
<ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_9xoccSxCEeyIb_aAzHoOBA" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
<ownedElements xmi:type="diagram:DNodeListElement" uid="_9xujESxCEeyIb_aAzHoOBA" name="tokens : EInt" tooltipText="">
<target xmi:type="ecore:EAttribute" href="petriNet.ecore#//Place/tokens"/>
<semanticElements xmi:type="ecore:EAttribute" href="petriNet.ecore#//Place/tokens"/>
<ownedStyle xmi:type="diagram:BundledImage" uid="_9xvKICxCEeyIb_aAzHoOBA" labelAlignment="LEFT" description="_9xtU8yxCEeyIb_aAzHoOBA">
<labelFormat>bold</labelFormat>
</ownedStyle>
<actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
</ownedElements>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNodeList" uid="_9xpDgSxCEeyIb_aAzHoOBA" name="Arc" tooltipText="" outgoingEdges="_9xy0iSxCEeyIb_aAzHoOBA" incomingEdges="_9xzblixCEeyIb_aAzHoOBA" width="12" height="10">
<target xmi:type="ecore:EClass" href="petriNet.ecore#//Arc"/>
<semanticElements xmi:type="ecore:EClass" href="petriNet.ecore#//Arc"/>
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
<arrangeConstraints>KEEP_SIZE</arrangeConstraints>
<arrangeConstraints>KEEP_RATIO</arrangeConstraints>
<ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_9xpDgixCEeyIb_aAzHoOBA" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
<ownedElements xmi:type="diagram:DNodeListElement" uid="_9xvKISxCEeyIb_aAzHoOBA" name="weight : EInt" tooltipText="">
<target xmi:type="ecore:EAttribute" href="petriNet.ecore#//Arc/weight"/>
<semanticElements xmi:type="ecore:EAttribute" href="petriNet.ecore#//Arc/weight"/>
<ownedStyle xmi:type="diagram:BundledImage" uid="_9xvxMCxCEeyIb_aAzHoOBA" labelAlignment="LEFT" description="_9xtU8yxCEeyIb_aAzHoOBA">
<labelFormat>bold</labelFormat>
</ownedStyle>
<actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
</ownedElements>
<ownedElements xmi:type="diagram:DNodeListElement" uid="_9xvxMSxCEeyIb_aAzHoOBA" name="outgoing : EBoolean = false" tooltipText="">
<target xmi:type="ecore:EAttribute" href="petriNet.ecore#//Arc/outgoing"/>
<semanticElements xmi:type="ecore:EAttribute" href="petriNet.ecore#//Arc/outgoing"/>
<ownedStyle xmi:type="diagram:BundledImage" uid="_9xvxMixCEeyIb_aAzHoOBA" labelAlignment="LEFT" description="_9xtU8yxCEeyIb_aAzHoOBA">
<labelFormat>bold</labelFormat>
</ownedStyle>
<actualMapping xmi:type="description_1:NodeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@subNodeMappings[name='EC%20EAttribute']"/>
</ownedElements>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNodeList" uid="_9xpqkSxCEeyIb_aAzHoOBA" name="Transition" tooltipText="" outgoingEdges="_9xxmYyxCEeyIb_aAzHoOBA" incomingEdges="_9xy0iSxCEeyIb_aAzHoOBA" width="12" height="10">
<target xmi:type="ecore:EClass" href="petriNet.ecore#//Transition"/>
<semanticElements xmi:type="ecore:EClass" href="petriNet.ecore#//Transition"/>
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
<arrangeConstraints>KEEP_SIZE</arrangeConstraints>
<arrangeConstraints>KEEP_RATIO</arrangeConstraints>
<ownedStyle xmi:type="diagram:FlatContainerStyle" uid="_9xpqkixCEeyIb_aAzHoOBA" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DEdge" uid="_9xw_UCxCEeyIb_aAzHoOBA" sourceNode="_9xoccCxCEeyIb_aAzHoOBA" targetNode="_9xn1YCxCEeyIb_aAzHoOBA">
<target xmi:type="ecore:EClass" href="petriNet.ecore#//Place"/>
<semanticElements xmi:type="ecore:EClass" href="petriNet.ecore#//Place"/>
<ownedStyle xmi:type="diagram:EdgeStyle" uid="_9xw_USxCEeyIb_aAzHoOBA" targetArrow="InputClosedArrow" routingStyle="tree">
<description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
<beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_9xw_UixCEeyIb_aAzHoOBA" showIcon="false">
<labelFormat>italic</labelFormat>
</beginLabelStyle>
<centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_9xw_UyxCEeyIb_aAzHoOBA" showIcon="false"/>
</ownedStyle>
<actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DEdge" uid="_9xxmYyxCEeyIb_aAzHoOBA" sourceNode="_9xpqkSxCEeyIb_aAzHoOBA" targetNode="_9xn1YCxCEeyIb_aAzHoOBA">
<target xmi:type="ecore:EClass" href="petriNet.ecore#//Transition"/>
<semanticElements xmi:type="ecore:EClass" href="petriNet.ecore#//Transition"/>
<ownedStyle xmi:type="diagram:EdgeStyle" uid="_9xxmZCxCEeyIb_aAzHoOBA" targetArrow="InputClosedArrow" routingStyle="tree">
<description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']/@style"/>
<beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_9xxmZSxCEeyIb_aAzHoOBA" showIcon="false">
<labelFormat>italic</labelFormat>
</beginLabelStyle>
<centerLabelStyle xmi:type="diagram:CenterLabelStyle" uid="_9xxmZixCEeyIb_aAzHoOBA" showIcon="false"/>
</ownedStyle>
<actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='EC%20ESupertypes']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DEdge" uid="_9xyNcCxCEeyIb_aAzHoOBA" sourceNode="_9xmAMCxCEeyIb_aAzHoOBA" targetNode="_9xn1YCxCEeyIb_aAzHoOBA" beginLabel="[1..1] network" endLabel="[0..*] nodes">
<target xmi:type="ecore:EReference" href="petriNet.ecore#//Network/nodes"/>
<semanticElements xmi:type="ecore:EReference" href="petriNet.ecore#//Node/network"/>
<semanticElements xmi:type="ecore:EReference" href="petriNet.ecore#//Network/nodes"/>
<ownedStyle xmi:type="diagram:EdgeStyle" uid="_9xy0gyxCEeyIb_aAzHoOBA" description="_9xy0gCxCEeyIb_aAzHoOBA" sourceArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0">
<beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_9xy0hCxCEeyIb_aAzHoOBA" showIcon="false"/>
<endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_9xy0hSxCEeyIb_aAzHoOBA" showIcon="false"/>
</ownedStyle>
<actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DEdge" uid="_9xy0iSxCEeyIb_aAzHoOBA" sourceNode="_9xpDgSxCEeyIb_aAzHoOBA" targetNode="_9xpqkSxCEeyIb_aAzHoOBA" beginLabel="[0..*] arcs" endLabel="[1..1] transition">
<target xmi:type="ecore:EReference" href="petriNet.ecore#//Arc/transition"/>
<semanticElements xmi:type="ecore:EReference" href="petriNet.ecore#//Transition/arcs"/>
<semanticElements xmi:type="ecore:EReference" href="petriNet.ecore#//Arc/transition"/>
<ownedStyle xmi:type="diagram:EdgeStyle" uid="_9xzbkCxCEeyIb_aAzHoOBA" description="_9xy0iixCEeyIb_aAzHoOBA" sourceArrow="InputArrow" targetArrow="FillDiamond" routingStyle="manhattan" strokeColor="0,0,0">
<beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_9xzbkSxCEeyIb_aAzHoOBA" showIcon="false">
<labelFormat>bold</labelFormat>
</beginLabelStyle>
<endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_9xzbkixCEeyIb_aAzHoOBA" showIcon="false">
<labelFormat>bold</labelFormat>
</endLabelStyle>
</ownedStyle>
<actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DEdge" uid="_9xzblixCEeyIb_aAzHoOBA" sourceNode="_9xoccCxCEeyIb_aAzHoOBA" targetNode="_9xpDgSxCEeyIb_aAzHoOBA" beginLabel="[1..1] place" endLabel="[0..*] arcs">
<target xmi:type="ecore:EReference" href="petriNet.ecore#//Place/arcs"/>
<semanticElements xmi:type="ecore:EReference" href="petriNet.ecore#//Place/arcs"/>
<semanticElements xmi:type="ecore:EReference" href="petriNet.ecore#//Arc/place"/>
<ownedStyle xmi:type="diagram:EdgeStyle" uid="_9xzblyxCEeyIb_aAzHoOBA" sourceArrow="InputArrow" routingStyle="manhattan" strokeColor="0,0,0">
<description xmi:type="style:EdgeStyleDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']/@style"/>
<beginLabelStyle xmi:type="diagram:BeginLabelStyle" uid="_9xzbmCxCEeyIb_aAzHoOBA" showIcon="false"/>
<endLabelStyle xmi:type="diagram:EndLabelStyle" uid="_9xzbmSxCEeyIb_aAzHoOBA" showIcon="false"/>
</ownedStyle>
<actualMapping xmi:type="description_1:EdgeMapping" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@edgeMappings[name='Bi-directional%20EC_EReference%20']"/>
</ownedDiagramElements>
<description xmi:type="description_1:DiagramDescription" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']"/>
<filterVariableHistory xmi:type="diagram:FilterVariableHistory" uid="_9Y8PoCxCEeyIb_aAzHoOBA"/>
<activatedLayers xmi:type="description_1:Layer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer"/>
<activatedLayers xmi:type="description_1:AdditionalLayer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']"/>
<activatedLayers xmi:type="description_1:AdditionalLayer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Validation']"/>
<activatedLayers xmi:type="description_1:AdditionalLayer" href="platform:/plugin/org.eclipse.emf.ecoretools.design/description/ecore.odesign#//@ownedViewpoints[name='Archetype']/@ownedRepresentationExtensions[name='Entities%20With%20Archetypes']/@layers[name='Archetypes']"/>
<target xmi:type="ecore:EPackage" href="petriNet.ecore#/"/>
</diagram:DSemanticDiagram>
</xmi:XMI>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="petrinet" nsURI="http://petrinet" nsPrefix="petrinet">
<eClassifiers xsi:type="ecore:EClass" name="Network">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="nodes" upperBound="-1"
eType="#//Node" containment="true" eOpposite="#//Node/network"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Node" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="network" lowerBound="1"
eType="#//Network" eOpposite="#//Network/nodes"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Place" eSuperTypes="#//Node">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="tokens" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="arcs" upperBound="-1" eType="#//Arc"
eOpposite="#//Arc/place"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Arc">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="weight" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="outgoing" lowerBound="1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="place" lowerBound="1" eType="#//Place"
eOpposite="#//Place/arcs"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="transition" lowerBound="1"
eType="#//Transition" eOpposite="#//Transition/arcs"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Transition" eSuperTypes="#//Node">
<eStructuralFeatures xsi:type="ecore:EReference" name="arcs" upperBound="-1" eType="#//Arc"
containment="true" eOpposite="#//Arc/transition"/>
</eClassifiers>
</ecore:EPackage>

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/fr.n7.petrinet/src" modelPluginID="fr.n7.petrinet"
modelName="Petrinet" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" copyrightFields="false"
operationReflection="true" importOrganizing="true">
<foreignModel>petriNet.ecore</foreignModel>
<genPackages prefix="Petrinet" disposableProviderFactory="true" ecorePackage="petriNet.ecore#/">
<genClasses ecoreClass="petriNet.ecore#//Network">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute petriNet.ecore#//Network/name"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference petriNet.ecore#//Network/nodes"/>
</genClasses>
<genClasses image="false" ecoreClass="petriNet.ecore#//Node">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute petriNet.ecore#//Node/name"/>
<genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference petriNet.ecore#//Node/network"/>
</genClasses>
<genClasses ecoreClass="petriNet.ecore#//Place">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute petriNet.ecore#//Place/tokens"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference petriNet.ecore#//Place/arcs"/>
</genClasses>
<genClasses ecoreClass="petriNet.ecore#//Arc">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute petriNet.ecore#//Arc/weight"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute petriNet.ecore#//Arc/outgoing"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference petriNet.ecore#//Arc/place"/>
<genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference petriNet.ecore#//Arc/transition"/>
</genClasses>
<genClasses ecoreClass="petriNet.ecore#//Transition">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference petriNet.ecore#//Transition/arcs"/>
</genClasses>
</genPackages>
</genmodel:GenModel>

View file

@ -0,0 +1,21 @@
import 'petriNet.ecore'
package petrinet
context Network
inv validName('Invalid name: ' + self.name):
self.name.matches('[A-Za-z_][A-Za-z0-9_]*')
inv uniqNamesNode: self.nodes
->forAll(n1, n2 | n1 = n2 or n1.name <> n2.name)
context Node
inv nameMin2Char: self.name.matches('..+')
inv weirdName: not self.name.matches('([0-9]*|_*)')
context Place
inv negativeQuantity: self.tokens >= 0
context Arc
inv negativeQuantity: self.weight >= 0
endpackage

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

View file

@ -0,0 +1,4 @@
#
pluginName = Petrinet Model
providerName = www.example.org

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<!--
-->
<plugin>
<extension point="org.eclipse.emf.ecore.generated_package">
<!-- @generated petrinet -->
<package
uri="http://petrinet"
class="petrinet.PetrinetPackage"
genModel="petriNet.genmodel"/>
</extension>
</plugin>

View file

@ -0,0 +1,119 @@
/**
*/
package petrinet;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Arc</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link petrinet.Arc#getWeight <em>Weight</em>}</li>
* <li>{@link petrinet.Arc#isOutgoing <em>Outgoing</em>}</li>
* <li>{@link petrinet.Arc#getPlace <em>Place</em>}</li>
* <li>{@link petrinet.Arc#getTransition <em>Transition</em>}</li>
* </ul>
*
* @see petrinet.PetrinetPackage#getArc()
* @model
* @generated
*/
public interface Arc extends EObject {
/**
* Returns the value of the '<em><b>Weight</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Weight</em>' attribute.
* @see #setWeight(int)
* @see petrinet.PetrinetPackage#getArc_Weight()
* @model required="true"
* @generated
*/
int getWeight();
/**
* Sets the value of the '{@link petrinet.Arc#getWeight <em>Weight</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Weight</em>' attribute.
* @see #getWeight()
* @generated
*/
void setWeight(int value);
/**
* Returns the value of the '<em><b>Outgoing</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Outgoing</em>' attribute.
* @see #setOutgoing(boolean)
* @see petrinet.PetrinetPackage#getArc_Outgoing()
* @model required="true"
* @generated
*/
boolean isOutgoing();
/**
* Sets the value of the '{@link petrinet.Arc#isOutgoing <em>Outgoing</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Outgoing</em>' attribute.
* @see #isOutgoing()
* @generated
*/
void setOutgoing(boolean value);
/**
* Returns the value of the '<em><b>Place</b></em>' reference.
* It is bidirectional and its opposite is '{@link petrinet.Place#getArcs <em>Arcs</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Place</em>' reference.
* @see #setPlace(Place)
* @see petrinet.PetrinetPackage#getArc_Place()
* @see petrinet.Place#getArcs
* @model opposite="arcs" required="true"
* @generated
*/
Place getPlace();
/**
* Sets the value of the '{@link petrinet.Arc#getPlace <em>Place</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Place</em>' reference.
* @see #getPlace()
* @generated
*/
void setPlace(Place value);
/**
* Returns the value of the '<em><b>Transition</b></em>' container reference.
* It is bidirectional and its opposite is '{@link petrinet.Transition#getArcs <em>Arcs</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Transition</em>' container reference.
* @see #setTransition(Transition)
* @see petrinet.PetrinetPackage#getArc_Transition()
* @see petrinet.Transition#getArcs
* @model opposite="arcs" required="true" transient="false"
* @generated
*/
Transition getTransition();
/**
* Sets the value of the '{@link petrinet.Arc#getTransition <em>Transition</em>}' container reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Transition</em>' container reference.
* @see #getTransition()
* @generated
*/
void setTransition(Transition value);
} // Arc

View file

@ -0,0 +1,63 @@
/**
*/
package petrinet;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Network</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link petrinet.Network#getName <em>Name</em>}</li>
* <li>{@link petrinet.Network#getNodes <em>Nodes</em>}</li>
* </ul>
*
* @see petrinet.PetrinetPackage#getNetwork()
* @model
* @generated
*/
public interface Network extends EObject {
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
* @see petrinet.PetrinetPackage#getNetwork_Name()
* @model required="true"
* @generated
*/
String getName();
/**
* Sets the value of the '{@link petrinet.Network#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
void setName(String value);
/**
* Returns the value of the '<em><b>Nodes</b></em>' containment reference list.
* The list contents are of type {@link petrinet.Node}.
* It is bidirectional and its opposite is '{@link petrinet.Node#getNetwork <em>Network</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Nodes</em>' containment reference list.
* @see petrinet.PetrinetPackage#getNetwork_Nodes()
* @see petrinet.Node#getNetwork
* @model opposite="network" containment="true"
* @generated
*/
EList<Node> getNodes();
} // Network

View file

@ -0,0 +1,71 @@
/**
*/
package petrinet;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Node</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link petrinet.Node#getName <em>Name</em>}</li>
* <li>{@link petrinet.Node#getNetwork <em>Network</em>}</li>
* </ul>
*
* @see petrinet.PetrinetPackage#getNode()
* @model abstract="true"
* @generated
*/
public interface Node extends EObject {
/**
* Returns the value of the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Name</em>' attribute.
* @see #setName(String)
* @see petrinet.PetrinetPackage#getNode_Name()
* @model required="true"
* @generated
*/
String getName();
/**
* Sets the value of the '{@link petrinet.Node#getName <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Name</em>' attribute.
* @see #getName()
* @generated
*/
void setName(String value);
/**
* Returns the value of the '<em><b>Network</b></em>' container reference.
* It is bidirectional and its opposite is '{@link petrinet.Network#getNodes <em>Nodes</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Network</em>' container reference.
* @see #setNetwork(Network)
* @see petrinet.PetrinetPackage#getNode_Network()
* @see petrinet.Network#getNodes
* @model opposite="nodes" required="true" transient="false"
* @generated
*/
Network getNetwork();
/**
* Sets the value of the '{@link petrinet.Node#getNetwork <em>Network</em>}' container reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Network</em>' container reference.
* @see #getNetwork()
* @generated
*/
void setNetwork(Network value);
} // Node

View file

@ -0,0 +1,69 @@
/**
*/
package petrinet;
import org.eclipse.emf.ecore.EFactory;
/**
* <!-- begin-user-doc -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @see petrinet.PetrinetPackage
* @generated
*/
public interface PetrinetFactory extends EFactory {
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
PetrinetFactory eINSTANCE = petrinet.impl.PetrinetFactoryImpl.init();
/**
* Returns a new object of class '<em>Network</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Network</em>'.
* @generated
*/
Network createNetwork();
/**
* Returns a new object of class '<em>Place</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Place</em>'.
* @generated
*/
Place createPlace();
/**
* Returns a new object of class '<em>Arc</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Arc</em>'.
* @generated
*/
Arc createArc();
/**
* Returns a new object of class '<em>Transition</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Transition</em>'.
* @generated
*/
Transition createTransition();
/**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the package supported by this factory.
* @generated
*/
PetrinetPackage getPetrinetPackage();
} //PetrinetFactory

View file

@ -0,0 +1,669 @@
/**
*/
package petrinet;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
/**
* <!-- begin-user-doc -->
* The <b>Package</b> for the model.
* It contains accessors for the meta objects to represent
* <ul>
* <li>each class,</li>
* <li>each feature of each class,</li>
* <li>each operation of each class,</li>
* <li>each enum,</li>
* <li>and each data type</li>
* </ul>
* <!-- end-user-doc -->
* @see petrinet.PetrinetFactory
* @model kind="package"
* @generated
*/
public interface PetrinetPackage extends EPackage {
/**
* The package name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String eNAME = "petrinet";
/**
* The package namespace URI.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String eNS_URI = "http://petrinet";
/**
* The package namespace name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String eNS_PREFIX = "petrinet";
/**
* The singleton instance of the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
PetrinetPackage eINSTANCE = petrinet.impl.PetrinetPackageImpl.init();
/**
* The meta object id for the '{@link petrinet.impl.NetworkImpl <em>Network</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see petrinet.impl.NetworkImpl
* @see petrinet.impl.PetrinetPackageImpl#getNetwork()
* @generated
*/
int NETWORK = 0;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int NETWORK__NAME = 0;
/**
* The feature id for the '<em><b>Nodes</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int NETWORK__NODES = 1;
/**
* The number of structural features of the '<em>Network</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int NETWORK_FEATURE_COUNT = 2;
/**
* The number of operations of the '<em>Network</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int NETWORK_OPERATION_COUNT = 0;
/**
* The meta object id for the '{@link petrinet.impl.NodeImpl <em>Node</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see petrinet.impl.NodeImpl
* @see petrinet.impl.PetrinetPackageImpl#getNode()
* @generated
*/
int NODE = 1;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int NODE__NAME = 0;
/**
* The feature id for the '<em><b>Network</b></em>' container reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int NODE__NETWORK = 1;
/**
* The number of structural features of the '<em>Node</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int NODE_FEATURE_COUNT = 2;
/**
* The number of operations of the '<em>Node</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int NODE_OPERATION_COUNT = 0;
/**
* The meta object id for the '{@link petrinet.impl.PlaceImpl <em>Place</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see petrinet.impl.PlaceImpl
* @see petrinet.impl.PetrinetPackageImpl#getPlace()
* @generated
*/
int PLACE = 2;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int PLACE__NAME = NODE__NAME;
/**
* The feature id for the '<em><b>Network</b></em>' container reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int PLACE__NETWORK = NODE__NETWORK;
/**
* The feature id for the '<em><b>Tokens</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int PLACE__TOKENS = NODE_FEATURE_COUNT + 0;
/**
* The feature id for the '<em><b>Arcs</b></em>' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int PLACE__ARCS = NODE_FEATURE_COUNT + 1;
/**
* The number of structural features of the '<em>Place</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int PLACE_FEATURE_COUNT = NODE_FEATURE_COUNT + 2;
/**
* The number of operations of the '<em>Place</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int PLACE_OPERATION_COUNT = NODE_OPERATION_COUNT + 0;
/**
* The meta object id for the '{@link petrinet.impl.ArcImpl <em>Arc</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see petrinet.impl.ArcImpl
* @see petrinet.impl.PetrinetPackageImpl#getArc()
* @generated
*/
int ARC = 3;
/**
* The feature id for the '<em><b>Weight</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ARC__WEIGHT = 0;
/**
* The feature id for the '<em><b>Outgoing</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ARC__OUTGOING = 1;
/**
* The feature id for the '<em><b>Place</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ARC__PLACE = 2;
/**
* The feature id for the '<em><b>Transition</b></em>' container reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ARC__TRANSITION = 3;
/**
* The number of structural features of the '<em>Arc</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ARC_FEATURE_COUNT = 4;
/**
* The number of operations of the '<em>Arc</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ARC_OPERATION_COUNT = 0;
/**
* The meta object id for the '{@link petrinet.impl.TransitionImpl <em>Transition</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see petrinet.impl.TransitionImpl
* @see petrinet.impl.PetrinetPackageImpl#getTransition()
* @generated
*/
int TRANSITION = 4;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int TRANSITION__NAME = NODE__NAME;
/**
* The feature id for the '<em><b>Network</b></em>' container reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int TRANSITION__NETWORK = NODE__NETWORK;
/**
* The feature id for the '<em><b>Arcs</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int TRANSITION__ARCS = NODE_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Transition</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int TRANSITION_FEATURE_COUNT = NODE_FEATURE_COUNT + 1;
/**
* The number of operations of the '<em>Transition</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int TRANSITION_OPERATION_COUNT = NODE_OPERATION_COUNT + 0;
/**
* Returns the meta object for class '{@link petrinet.Network <em>Network</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Network</em>'.
* @see petrinet.Network
* @generated
*/
EClass getNetwork();
/**
* Returns the meta object for the attribute '{@link petrinet.Network#getName <em>Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Name</em>'.
* @see petrinet.Network#getName()
* @see #getNetwork()
* @generated
*/
EAttribute getNetwork_Name();
/**
* Returns the meta object for the containment reference list '{@link petrinet.Network#getNodes <em>Nodes</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Nodes</em>'.
* @see petrinet.Network#getNodes()
* @see #getNetwork()
* @generated
*/
EReference getNetwork_Nodes();
/**
* Returns the meta object for class '{@link petrinet.Node <em>Node</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Node</em>'.
* @see petrinet.Node
* @generated
*/
EClass getNode();
/**
* Returns the meta object for the attribute '{@link petrinet.Node#getName <em>Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Name</em>'.
* @see petrinet.Node#getName()
* @see #getNode()
* @generated
*/
EAttribute getNode_Name();
/**
* Returns the meta object for the container reference '{@link petrinet.Node#getNetwork <em>Network</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the container reference '<em>Network</em>'.
* @see petrinet.Node#getNetwork()
* @see #getNode()
* @generated
*/
EReference getNode_Network();
/**
* Returns the meta object for class '{@link petrinet.Place <em>Place</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Place</em>'.
* @see petrinet.Place
* @generated
*/
EClass getPlace();
/**
* Returns the meta object for the attribute '{@link petrinet.Place#getTokens <em>Tokens</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Tokens</em>'.
* @see petrinet.Place#getTokens()
* @see #getPlace()
* @generated
*/
EAttribute getPlace_Tokens();
/**
* Returns the meta object for the reference list '{@link petrinet.Place#getArcs <em>Arcs</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference list '<em>Arcs</em>'.
* @see petrinet.Place#getArcs()
* @see #getPlace()
* @generated
*/
EReference getPlace_Arcs();
/**
* Returns the meta object for class '{@link petrinet.Arc <em>Arc</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Arc</em>'.
* @see petrinet.Arc
* @generated
*/
EClass getArc();
/**
* Returns the meta object for the attribute '{@link petrinet.Arc#getWeight <em>Weight</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Weight</em>'.
* @see petrinet.Arc#getWeight()
* @see #getArc()
* @generated
*/
EAttribute getArc_Weight();
/**
* Returns the meta object for the attribute '{@link petrinet.Arc#isOutgoing <em>Outgoing</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Outgoing</em>'.
* @see petrinet.Arc#isOutgoing()
* @see #getArc()
* @generated
*/
EAttribute getArc_Outgoing();
/**
* Returns the meta object for the reference '{@link petrinet.Arc#getPlace <em>Place</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Place</em>'.
* @see petrinet.Arc#getPlace()
* @see #getArc()
* @generated
*/
EReference getArc_Place();
/**
* Returns the meta object for the container reference '{@link petrinet.Arc#getTransition <em>Transition</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the container reference '<em>Transition</em>'.
* @see petrinet.Arc#getTransition()
* @see #getArc()
* @generated
*/
EReference getArc_Transition();
/**
* Returns the meta object for class '{@link petrinet.Transition <em>Transition</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Transition</em>'.
* @see petrinet.Transition
* @generated
*/
EClass getTransition();
/**
* Returns the meta object for the containment reference list '{@link petrinet.Transition#getArcs <em>Arcs</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Arcs</em>'.
* @see petrinet.Transition#getArcs()
* @see #getTransition()
* @generated
*/
EReference getTransition_Arcs();
/**
* Returns the factory that creates the instances of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the factory that creates the instances of the model.
* @generated
*/
PetrinetFactory getPetrinetFactory();
/**
* <!-- begin-user-doc -->
* Defines literals for the meta objects that represent
* <ul>
* <li>each class,</li>
* <li>each feature of each class,</li>
* <li>each operation of each class,</li>
* <li>each enum,</li>
* <li>and each data type</li>
* </ul>
* <!-- end-user-doc -->
* @generated
*/
interface Literals {
/**
* The meta object literal for the '{@link petrinet.impl.NetworkImpl <em>Network</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see petrinet.impl.NetworkImpl
* @see petrinet.impl.PetrinetPackageImpl#getNetwork()
* @generated
*/
EClass NETWORK = eINSTANCE.getNetwork();
/**
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute NETWORK__NAME = eINSTANCE.getNetwork_Name();
/**
* The meta object literal for the '<em><b>Nodes</b></em>' containment reference list feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference NETWORK__NODES = eINSTANCE.getNetwork_Nodes();
/**
* The meta object literal for the '{@link petrinet.impl.NodeImpl <em>Node</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see petrinet.impl.NodeImpl
* @see petrinet.impl.PetrinetPackageImpl#getNode()
* @generated
*/
EClass NODE = eINSTANCE.getNode();
/**
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute NODE__NAME = eINSTANCE.getNode_Name();
/**
* The meta object literal for the '<em><b>Network</b></em>' container reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference NODE__NETWORK = eINSTANCE.getNode_Network();
/**
* The meta object literal for the '{@link petrinet.impl.PlaceImpl <em>Place</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see petrinet.impl.PlaceImpl
* @see petrinet.impl.PetrinetPackageImpl#getPlace()
* @generated
*/
EClass PLACE = eINSTANCE.getPlace();
/**
* The meta object literal for the '<em><b>Tokens</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute PLACE__TOKENS = eINSTANCE.getPlace_Tokens();
/**
* The meta object literal for the '<em><b>Arcs</b></em>' reference list feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference PLACE__ARCS = eINSTANCE.getPlace_Arcs();
/**
* The meta object literal for the '{@link petrinet.impl.ArcImpl <em>Arc</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see petrinet.impl.ArcImpl
* @see petrinet.impl.PetrinetPackageImpl#getArc()
* @generated
*/
EClass ARC = eINSTANCE.getArc();
/**
* The meta object literal for the '<em><b>Weight</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute ARC__WEIGHT = eINSTANCE.getArc_Weight();
/**
* The meta object literal for the '<em><b>Outgoing</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute ARC__OUTGOING = eINSTANCE.getArc_Outgoing();
/**
* The meta object literal for the '<em><b>Place</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference ARC__PLACE = eINSTANCE.getArc_Place();
/**
* The meta object literal for the '<em><b>Transition</b></em>' container reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference ARC__TRANSITION = eINSTANCE.getArc_Transition();
/**
* The meta object literal for the '{@link petrinet.impl.TransitionImpl <em>Transition</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see petrinet.impl.TransitionImpl
* @see petrinet.impl.PetrinetPackageImpl#getTransition()
* @generated
*/
EClass TRANSITION = eINSTANCE.getTransition();
/**
* The meta object literal for the '<em><b>Arcs</b></em>' containment reference list feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference TRANSITION__ARCS = eINSTANCE.getTransition_Arcs();
}
} //PetrinetPackage

View file

@ -0,0 +1,61 @@
/**
*/
package petrinet;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Place</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link petrinet.Place#getTokens <em>Tokens</em>}</li>
* <li>{@link petrinet.Place#getArcs <em>Arcs</em>}</li>
* </ul>
*
* @see petrinet.PetrinetPackage#getPlace()
* @model
* @generated
*/
public interface Place extends Node {
/**
* Returns the value of the '<em><b>Tokens</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Tokens</em>' attribute.
* @see #setTokens(int)
* @see petrinet.PetrinetPackage#getPlace_Tokens()
* @model required="true"
* @generated
*/
int getTokens();
/**
* Sets the value of the '{@link petrinet.Place#getTokens <em>Tokens</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Tokens</em>' attribute.
* @see #getTokens()
* @generated
*/
void setTokens(int value);
/**
* Returns the value of the '<em><b>Arcs</b></em>' reference list.
* The list contents are of type {@link petrinet.Arc}.
* It is bidirectional and its opposite is '{@link petrinet.Arc#getPlace <em>Place</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Arcs</em>' reference list.
* @see petrinet.PetrinetPackage#getPlace_Arcs()
* @see petrinet.Arc#getPlace
* @model opposite="place"
* @generated
*/
EList<Arc> getArcs();
} // Place

View file

@ -0,0 +1,38 @@
/**
*/
package petrinet;
import org.eclipse.emf.common.util.EList;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Transition</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link petrinet.Transition#getArcs <em>Arcs</em>}</li>
* </ul>
*
* @see petrinet.PetrinetPackage#getTransition()
* @model
* @generated
*/
public interface Transition extends Node {
/**
* Returns the value of the '<em><b>Arcs</b></em>' containment reference list.
* The list contents are of type {@link petrinet.Arc}.
* It is bidirectional and its opposite is '{@link petrinet.Arc#getTransition <em>Transition</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Arcs</em>' containment reference list.
* @see petrinet.PetrinetPackage#getTransition_Arcs()
* @see petrinet.Arc#getTransition
* @model opposite="transition" containment="true"
* @generated
*/
EList<Arc> getArcs();
} // Transition

View file

@ -0,0 +1,407 @@
/**
*/
package petrinet.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import petrinet.Arc;
import petrinet.PetrinetPackage;
import petrinet.Place;
import petrinet.Transition;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Arc</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link petrinet.impl.ArcImpl#getWeight <em>Weight</em>}</li>
* <li>{@link petrinet.impl.ArcImpl#isOutgoing <em>Outgoing</em>}</li>
* <li>{@link petrinet.impl.ArcImpl#getPlace <em>Place</em>}</li>
* <li>{@link petrinet.impl.ArcImpl#getTransition <em>Transition</em>}</li>
* </ul>
*
* @generated
*/
public class ArcImpl extends MinimalEObjectImpl.Container implements Arc {
/**
* The default value of the '{@link #getWeight() <em>Weight</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getWeight()
* @generated
* @ordered
*/
protected static final int WEIGHT_EDEFAULT = 0;
/**
* The cached value of the '{@link #getWeight() <em>Weight</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getWeight()
* @generated
* @ordered
*/
protected int weight = WEIGHT_EDEFAULT;
/**
* The default value of the '{@link #isOutgoing() <em>Outgoing</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOutgoing()
* @generated
* @ordered
*/
protected static final boolean OUTGOING_EDEFAULT = false;
/**
* The cached value of the '{@link #isOutgoing() <em>Outgoing</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOutgoing()
* @generated
* @ordered
*/
protected boolean outgoing = OUTGOING_EDEFAULT;
/**
* The cached value of the '{@link #getPlace() <em>Place</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPlace()
* @generated
* @ordered
*/
protected Place place;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ArcImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PetrinetPackage.Literals.ARC;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getWeight() {
return weight;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setWeight(int newWeight) {
int oldWeight = weight;
weight = newWeight;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.ARC__WEIGHT, oldWeight, weight));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isOutgoing() {
return outgoing;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOutgoing(boolean newOutgoing) {
boolean oldOutgoing = outgoing;
outgoing = newOutgoing;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.ARC__OUTGOING, oldOutgoing, outgoing));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Place getPlace() {
if (place != null && place.eIsProxy()) {
InternalEObject oldPlace = (InternalEObject)place;
place = (Place)eResolveProxy(oldPlace);
if (place != oldPlace) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, PetrinetPackage.ARC__PLACE, oldPlace, place));
}
}
return place;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Place basicGetPlace() {
return place;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetPlace(Place newPlace, NotificationChain msgs) {
Place oldPlace = place;
place = newPlace;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PetrinetPackage.ARC__PLACE, oldPlace, newPlace);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setPlace(Place newPlace) {
if (newPlace != place) {
NotificationChain msgs = null;
if (place != null)
msgs = ((InternalEObject)place).eInverseRemove(this, PetrinetPackage.PLACE__ARCS, Place.class, msgs);
if (newPlace != null)
msgs = ((InternalEObject)newPlace).eInverseAdd(this, PetrinetPackage.PLACE__ARCS, Place.class, msgs);
msgs = basicSetPlace(newPlace, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.ARC__PLACE, newPlace, newPlace));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Transition getTransition() {
if (eContainerFeatureID() != PetrinetPackage.ARC__TRANSITION) return null;
return (Transition)eInternalContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTransition(Transition newTransition, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newTransition, PetrinetPackage.ARC__TRANSITION, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTransition(Transition newTransition) {
if (newTransition != eInternalContainer() || (eContainerFeatureID() != PetrinetPackage.ARC__TRANSITION && newTransition != null)) {
if (EcoreUtil.isAncestor(this, newTransition))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newTransition != null)
msgs = ((InternalEObject)newTransition).eInverseAdd(this, PetrinetPackage.TRANSITION__ARCS, Transition.class, msgs);
msgs = basicSetTransition(newTransition, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.ARC__TRANSITION, newTransition, newTransition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PetrinetPackage.ARC__PLACE:
if (place != null)
msgs = ((InternalEObject)place).eInverseRemove(this, PetrinetPackage.PLACE__ARCS, Place.class, msgs);
return basicSetPlace((Place)otherEnd, msgs);
case PetrinetPackage.ARC__TRANSITION:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetTransition((Transition)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PetrinetPackage.ARC__PLACE:
return basicSetPlace(null, msgs);
case PetrinetPackage.ARC__TRANSITION:
return basicSetTransition(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case PetrinetPackage.ARC__TRANSITION:
return eInternalContainer().eInverseRemove(this, PetrinetPackage.TRANSITION__ARCS, Transition.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PetrinetPackage.ARC__WEIGHT:
return getWeight();
case PetrinetPackage.ARC__OUTGOING:
return isOutgoing();
case PetrinetPackage.ARC__PLACE:
if (resolve) return getPlace();
return basicGetPlace();
case PetrinetPackage.ARC__TRANSITION:
return getTransition();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PetrinetPackage.ARC__WEIGHT:
setWeight((Integer)newValue);
return;
case PetrinetPackage.ARC__OUTGOING:
setOutgoing((Boolean)newValue);
return;
case PetrinetPackage.ARC__PLACE:
setPlace((Place)newValue);
return;
case PetrinetPackage.ARC__TRANSITION:
setTransition((Transition)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PetrinetPackage.ARC__WEIGHT:
setWeight(WEIGHT_EDEFAULT);
return;
case PetrinetPackage.ARC__OUTGOING:
setOutgoing(OUTGOING_EDEFAULT);
return;
case PetrinetPackage.ARC__PLACE:
setPlace((Place)null);
return;
case PetrinetPackage.ARC__TRANSITION:
setTransition((Transition)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PetrinetPackage.ARC__WEIGHT:
return weight != WEIGHT_EDEFAULT;
case PetrinetPackage.ARC__OUTGOING:
return outgoing != OUTGOING_EDEFAULT;
case PetrinetPackage.ARC__PLACE:
return place != null;
case PetrinetPackage.ARC__TRANSITION:
return getTransition() != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (weight: ");
result.append(weight);
result.append(", outgoing: ");
result.append(outgoing);
result.append(')');
return result.toString();
}
} //ArcImpl

View file

@ -0,0 +1,237 @@
/**
*/
package petrinet.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
import petrinet.Network;
import petrinet.Node;
import petrinet.PetrinetPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Network</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link petrinet.impl.NetworkImpl#getName <em>Name</em>}</li>
* <li>{@link petrinet.impl.NetworkImpl#getNodes <em>Nodes</em>}</li>
* </ul>
*
* @generated
*/
public class NetworkImpl extends MinimalEObjectImpl.Container implements Network {
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getNodes() <em>Nodes</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getNodes()
* @generated
* @ordered
*/
protected EList<Node> nodes;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected NetworkImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PetrinetPackage.Literals.NETWORK;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.NETWORK__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Node> getNodes() {
if (nodes == null) {
nodes = new EObjectContainmentWithInverseEList<Node>(Node.class, this, PetrinetPackage.NETWORK__NODES, PetrinetPackage.NODE__NETWORK);
}
return nodes;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PetrinetPackage.NETWORK__NODES:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getNodes()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PetrinetPackage.NETWORK__NODES:
return ((InternalEList<?>)getNodes()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PetrinetPackage.NETWORK__NAME:
return getName();
case PetrinetPackage.NETWORK__NODES:
return getNodes();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PetrinetPackage.NETWORK__NAME:
setName((String)newValue);
return;
case PetrinetPackage.NETWORK__NODES:
getNodes().clear();
getNodes().addAll((Collection<? extends Node>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PetrinetPackage.NETWORK__NAME:
setName(NAME_EDEFAULT);
return;
case PetrinetPackage.NETWORK__NODES:
getNodes().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PetrinetPackage.NETWORK__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case PetrinetPackage.NETWORK__NODES:
return nodes != null && !nodes.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //NetworkImpl

View file

@ -0,0 +1,264 @@
/**
*/
package petrinet.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import petrinet.Network;
import petrinet.Node;
import petrinet.PetrinetPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Node</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link petrinet.impl.NodeImpl#getName <em>Name</em>}</li>
* <li>{@link petrinet.impl.NodeImpl#getNetwork <em>Network</em>}</li>
* </ul>
*
* @generated
*/
public abstract class NodeImpl extends MinimalEObjectImpl.Container implements Node {
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected NodeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PetrinetPackage.Literals.NODE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.NODE__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Network getNetwork() {
if (eContainerFeatureID() != PetrinetPackage.NODE__NETWORK) return null;
return (Network)eInternalContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetNetwork(Network newNetwork, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newNetwork, PetrinetPackage.NODE__NETWORK, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setNetwork(Network newNetwork) {
if (newNetwork != eInternalContainer() || (eContainerFeatureID() != PetrinetPackage.NODE__NETWORK && newNetwork != null)) {
if (EcoreUtil.isAncestor(this, newNetwork))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newNetwork != null)
msgs = ((InternalEObject)newNetwork).eInverseAdd(this, PetrinetPackage.NETWORK__NODES, Network.class, msgs);
msgs = basicSetNetwork(newNetwork, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.NODE__NETWORK, newNetwork, newNetwork));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PetrinetPackage.NODE__NETWORK:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetNetwork((Network)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PetrinetPackage.NODE__NETWORK:
return basicSetNetwork(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case PetrinetPackage.NODE__NETWORK:
return eInternalContainer().eInverseRemove(this, PetrinetPackage.NETWORK__NODES, Network.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PetrinetPackage.NODE__NAME:
return getName();
case PetrinetPackage.NODE__NETWORK:
return getNetwork();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PetrinetPackage.NODE__NAME:
setName((String)newValue);
return;
case PetrinetPackage.NODE__NETWORK:
setNetwork((Network)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PetrinetPackage.NODE__NAME:
setName(NAME_EDEFAULT);
return;
case PetrinetPackage.NODE__NETWORK:
setNetwork((Network)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PetrinetPackage.NODE__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case PetrinetPackage.NODE__NETWORK:
return getNetwork() != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //NodeImpl

View file

@ -0,0 +1,128 @@
/**
*/
package petrinet.impl;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
import petrinet.*;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class PetrinetFactoryImpl extends EFactoryImpl implements PetrinetFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static PetrinetFactory init() {
try {
PetrinetFactory thePetrinetFactory = (PetrinetFactory)EPackage.Registry.INSTANCE.getEFactory(PetrinetPackage.eNS_URI);
if (thePetrinetFactory != null) {
return thePetrinetFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new PetrinetFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case PetrinetPackage.NETWORK: return createNetwork();
case PetrinetPackage.PLACE: return createPlace();
case PetrinetPackage.ARC: return createArc();
case PetrinetPackage.TRANSITION: return createTransition();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Network createNetwork() {
NetworkImpl network = new NetworkImpl();
return network;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Place createPlace() {
PlaceImpl place = new PlaceImpl();
return place;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Arc createArc() {
ArcImpl arc = new ArcImpl();
return arc;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Transition createTransition() {
TransitionImpl transition = new TransitionImpl();
return transition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetPackage getPetrinetPackage() {
return (PetrinetPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static PetrinetPackage getPackage() {
return PetrinetPackage.eINSTANCE;
}
} //PetrinetFactoryImpl

View file

@ -0,0 +1,374 @@
/**
*/
package petrinet.impl;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import petrinet.Arc;
import petrinet.Network;
import petrinet.Node;
import petrinet.PetrinetFactory;
import petrinet.PetrinetPackage;
import petrinet.Place;
import petrinet.Transition;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Package</b>.
* <!-- end-user-doc -->
* @generated
*/
public class PetrinetPackageImpl extends EPackageImpl implements PetrinetPackage {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass networkEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass nodeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass placeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass arcEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass transitionEClass = null;
/**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
* <p>Note: the correct way to create the package is via the static
* factory method {@link #init init()}, which also performs
* initialization of the package, or returns the registered package,
* if one already exists.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.emf.ecore.EPackage.Registry
* @see petrinet.PetrinetPackage#eNS_URI
* @see #init()
* @generated
*/
private PetrinetPackageImpl() {
super(eNS_URI, PetrinetFactory.eINSTANCE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static boolean isInited = false;
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>This method is used to initialize {@link PetrinetPackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #eNS_URI
* @see #createPackageContents()
* @see #initializePackageContents()
* @generated
*/
public static PetrinetPackage init() {
if (isInited) return (PetrinetPackage)EPackage.Registry.INSTANCE.getEPackage(PetrinetPackage.eNS_URI);
// Obtain or create and register package
Object registeredPetrinetPackage = EPackage.Registry.INSTANCE.get(eNS_URI);
PetrinetPackageImpl thePetrinetPackage = registeredPetrinetPackage instanceof PetrinetPackageImpl ? (PetrinetPackageImpl)registeredPetrinetPackage : new PetrinetPackageImpl();
isInited = true;
// Create package meta-data objects
thePetrinetPackage.createPackageContents();
// Initialize created meta-data
thePetrinetPackage.initializePackageContents();
// Mark meta-data to indicate it can't be changed
thePetrinetPackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(PetrinetPackage.eNS_URI, thePetrinetPackage);
return thePetrinetPackage;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getNetwork() {
return networkEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getNetwork_Name() {
return (EAttribute)networkEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getNetwork_Nodes() {
return (EReference)networkEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getNode() {
return nodeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getNode_Name() {
return (EAttribute)nodeEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getNode_Network() {
return (EReference)nodeEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getPlace() {
return placeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getPlace_Tokens() {
return (EAttribute)placeEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getPlace_Arcs() {
return (EReference)placeEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getArc() {
return arcEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getArc_Weight() {
return (EAttribute)arcEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getArc_Outgoing() {
return (EAttribute)arcEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getArc_Place() {
return (EReference)arcEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getArc_Transition() {
return (EReference)arcEClass.getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getTransition() {
return transitionEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTransition_Arcs() {
return (EReference)transitionEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetFactory getPetrinetFactory() {
return (PetrinetFactory)getEFactoryInstance();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private boolean isCreated = false;
/**
* Creates the meta-model objects for the package. This method is
* guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void createPackageContents() {
if (isCreated) return;
isCreated = true;
// Create classes and their features
networkEClass = createEClass(NETWORK);
createEAttribute(networkEClass, NETWORK__NAME);
createEReference(networkEClass, NETWORK__NODES);
nodeEClass = createEClass(NODE);
createEAttribute(nodeEClass, NODE__NAME);
createEReference(nodeEClass, NODE__NETWORK);
placeEClass = createEClass(PLACE);
createEAttribute(placeEClass, PLACE__TOKENS);
createEReference(placeEClass, PLACE__ARCS);
arcEClass = createEClass(ARC);
createEAttribute(arcEClass, ARC__WEIGHT);
createEAttribute(arcEClass, ARC__OUTGOING);
createEReference(arcEClass, ARC__PLACE);
createEReference(arcEClass, ARC__TRANSITION);
transitionEClass = createEClass(TRANSITION);
createEReference(transitionEClass, TRANSITION__ARCS);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private boolean isInitialized = false;
/**
* Complete the initialization of the package and its meta-model. This
* method is guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void initializePackageContents() {
if (isInitialized) return;
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
placeEClass.getESuperTypes().add(this.getNode());
transitionEClass.getESuperTypes().add(this.getNode());
// Initialize classes, features, and operations; add parameters
initEClass(networkEClass, Network.class, "Network", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getNetwork_Name(), ecorePackage.getEString(), "name", null, 1, 1, Network.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getNetwork_Nodes(), this.getNode(), this.getNode_Network(), "nodes", null, 0, -1, Network.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(nodeEClass, Node.class, "Node", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getNode_Name(), ecorePackage.getEString(), "name", null, 1, 1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getNode_Network(), this.getNetwork(), this.getNetwork_Nodes(), "network", null, 1, 1, Node.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(placeEClass, Place.class, "Place", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getPlace_Tokens(), ecorePackage.getEInt(), "tokens", null, 1, 1, Place.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getPlace_Arcs(), this.getArc(), this.getArc_Place(), "arcs", null, 0, -1, Place.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(arcEClass, Arc.class, "Arc", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getArc_Weight(), ecorePackage.getEInt(), "weight", null, 1, 1, Arc.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getArc_Outgoing(), ecorePackage.getEBoolean(), "outgoing", null, 1, 1, Arc.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getArc_Place(), this.getPlace(), this.getPlace_Arcs(), "place", null, 1, 1, Arc.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getArc_Transition(), this.getTransition(), this.getTransition_Arcs(), "transition", null, 1, 1, Arc.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(transitionEClass, Transition.class, "Transition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getTransition_Arcs(), this.getArc(), this.getArc_Transition(), "arcs", null, 0, -1, Transition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);
}
} //PetrinetPackageImpl

View file

@ -0,0 +1,236 @@
/**
*/
package petrinet.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import petrinet.Arc;
import petrinet.PetrinetPackage;
import petrinet.Place;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Place</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link petrinet.impl.PlaceImpl#getTokens <em>Tokens</em>}</li>
* <li>{@link petrinet.impl.PlaceImpl#getArcs <em>Arcs</em>}</li>
* </ul>
*
* @generated
*/
public class PlaceImpl extends NodeImpl implements Place {
/**
* The default value of the '{@link #getTokens() <em>Tokens</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTokens()
* @generated
* @ordered
*/
protected static final int TOKENS_EDEFAULT = 0;
/**
* The cached value of the '{@link #getTokens() <em>Tokens</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTokens()
* @generated
* @ordered
*/
protected int tokens = TOKENS_EDEFAULT;
/**
* The cached value of the '{@link #getArcs() <em>Arcs</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArcs()
* @generated
* @ordered
*/
protected EList<Arc> arcs;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PlaceImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PetrinetPackage.Literals.PLACE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public int getTokens() {
return tokens;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTokens(int newTokens) {
int oldTokens = tokens;
tokens = newTokens;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PetrinetPackage.PLACE__TOKENS, oldTokens, tokens));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Arc> getArcs() {
if (arcs == null) {
arcs = new EObjectWithInverseResolvingEList<Arc>(Arc.class, this, PetrinetPackage.PLACE__ARCS, PetrinetPackage.ARC__PLACE);
}
return arcs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PetrinetPackage.PLACE__ARCS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getArcs()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PetrinetPackage.PLACE__ARCS:
return ((InternalEList<?>)getArcs()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PetrinetPackage.PLACE__TOKENS:
return getTokens();
case PetrinetPackage.PLACE__ARCS:
return getArcs();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PetrinetPackage.PLACE__TOKENS:
setTokens((Integer)newValue);
return;
case PetrinetPackage.PLACE__ARCS:
getArcs().clear();
getArcs().addAll((Collection<? extends Arc>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PetrinetPackage.PLACE__TOKENS:
setTokens(TOKENS_EDEFAULT);
return;
case PetrinetPackage.PLACE__ARCS:
getArcs().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PetrinetPackage.PLACE__TOKENS:
return tokens != TOKENS_EDEFAULT;
case PetrinetPackage.PLACE__ARCS:
return arcs != null && !arcs.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (tokens: ");
result.append(tokens);
result.append(')');
return result.toString();
}
} //PlaceImpl

View file

@ -0,0 +1,165 @@
/**
*/
package petrinet.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
import petrinet.Arc;
import petrinet.PetrinetPackage;
import petrinet.Transition;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Transition</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link petrinet.impl.TransitionImpl#getArcs <em>Arcs</em>}</li>
* </ul>
*
* @generated
*/
public class TransitionImpl extends NodeImpl implements Transition {
/**
* The cached value of the '{@link #getArcs() <em>Arcs</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getArcs()
* @generated
* @ordered
*/
protected EList<Arc> arcs;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TransitionImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PetrinetPackage.Literals.TRANSITION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Arc> getArcs() {
if (arcs == null) {
arcs = new EObjectContainmentWithInverseEList<Arc>(Arc.class, this, PetrinetPackage.TRANSITION__ARCS, PetrinetPackage.ARC__TRANSITION);
}
return arcs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PetrinetPackage.TRANSITION__ARCS:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getArcs()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case PetrinetPackage.TRANSITION__ARCS:
return ((InternalEList<?>)getArcs()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case PetrinetPackage.TRANSITION__ARCS:
return getArcs();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case PetrinetPackage.TRANSITION__ARCS:
getArcs().clear();
getArcs().addAll((Collection<? extends Arc>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case PetrinetPackage.TRANSITION__ARCS:
getArcs().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case PetrinetPackage.TRANSITION__ARCS:
return arcs != null && !arcs.isEmpty();
}
return super.eIsSet(featureID);
}
} //TransitionImpl

View file

@ -0,0 +1,192 @@
/**
*/
package petrinet.util;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
import org.eclipse.emf.ecore.EObject;
import petrinet.*;
/**
* <!-- begin-user-doc -->
* The <b>Adapter Factory</b> for the model.
* It provides an adapter <code>createXXX</code> method for each class of the model.
* <!-- end-user-doc -->
* @see petrinet.PetrinetPackage
* @generated
*/
public class PetrinetAdapterFactory extends AdapterFactoryImpl {
/**
* The cached model package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static PetrinetPackage modelPackage;
/**
* Creates an instance of the adapter factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetAdapterFactory() {
if (modelPackage == null) {
modelPackage = PetrinetPackage.eINSTANCE;
}
}
/**
* Returns whether this factory is applicable for the type of the object.
* <!-- begin-user-doc -->
* This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
* <!-- end-user-doc -->
* @return whether this factory is applicable for the type of the object.
* @generated
*/
@Override
public boolean isFactoryForType(Object object) {
if (object == modelPackage) {
return true;
}
if (object instanceof EObject) {
return ((EObject)object).eClass().getEPackage() == modelPackage;
}
return false;
}
/**
* The switch that delegates to the <code>createXXX</code> methods.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected PetrinetSwitch<Adapter> modelSwitch =
new PetrinetSwitch<Adapter>() {
@Override
public Adapter caseNetwork(Network object) {
return createNetworkAdapter();
}
@Override
public Adapter caseNode(Node object) {
return createNodeAdapter();
}
@Override
public Adapter casePlace(Place object) {
return createPlaceAdapter();
}
@Override
public Adapter caseArc(Arc object) {
return createArcAdapter();
}
@Override
public Adapter caseTransition(Transition object) {
return createTransitionAdapter();
}
@Override
public Adapter defaultCase(EObject object) {
return createEObjectAdapter();
}
};
/**
* Creates an adapter for the <code>target</code>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param target the object to adapt.
* @return the adapter for the <code>target</code>.
* @generated
*/
@Override
public Adapter createAdapter(Notifier target) {
return modelSwitch.doSwitch((EObject)target);
}
/**
* Creates a new adapter for an object of class '{@link petrinet.Network <em>Network</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see petrinet.Network
* @generated
*/
public Adapter createNetworkAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link petrinet.Node <em>Node</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see petrinet.Node
* @generated
*/
public Adapter createNodeAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link petrinet.Place <em>Place</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see petrinet.Place
* @generated
*/
public Adapter createPlaceAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link petrinet.Arc <em>Arc</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see petrinet.Arc
* @generated
*/
public Adapter createArcAdapter() {
return null;
}
/**
* Creates a new adapter for an object of class '{@link petrinet.Transition <em>Transition</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see petrinet.Transition
* @generated
*/
public Adapter createTransitionAdapter() {
return null;
}
/**
* Creates a new adapter for the default case.
* <!-- begin-user-doc -->
* This default implementation returns null.
* <!-- end-user-doc -->
* @return the new adapter.
* @generated
*/
public Adapter createEObjectAdapter() {
return null;
}
} //PetrinetAdapterFactory

View file

@ -0,0 +1,196 @@
/**
*/
package petrinet.util;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.Switch;
import petrinet.*;
/**
* <!-- begin-user-doc -->
* The <b>Switch</b> for the model's inheritance hierarchy.
* It supports the call {@link #doSwitch(EObject) doSwitch(object)}
* to invoke the <code>caseXXX</code> method for each class of the model,
* starting with the actual class of the object
* and proceeding up the inheritance hierarchy
* until a non-null result is returned,
* which is the result of the switch.
* <!-- end-user-doc -->
* @see petrinet.PetrinetPackage
* @generated
*/
public class PetrinetSwitch<T> extends Switch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static PetrinetPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public PetrinetSwitch() {
if (modelPackage == null) {
modelPackage = PetrinetPackage.eINSTANCE;
}
}
/**
* Checks whether this is a switch for the given package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param ePackage the package in question.
* @return whether this is a switch for the given package.
* @generated
*/
@Override
protected boolean isSwitchFor(EPackage ePackage) {
return ePackage == modelPackage;
}
/**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
@Override
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case PetrinetPackage.NETWORK: {
Network network = (Network)theEObject;
T result = caseNetwork(network);
if (result == null) result = defaultCase(theEObject);
return result;
}
case PetrinetPackage.NODE: {
Node node = (Node)theEObject;
T result = caseNode(node);
if (result == null) result = defaultCase(theEObject);
return result;
}
case PetrinetPackage.PLACE: {
Place place = (Place)theEObject;
T result = casePlace(place);
if (result == null) result = caseNode(place);
if (result == null) result = defaultCase(theEObject);
return result;
}
case PetrinetPackage.ARC: {
Arc arc = (Arc)theEObject;
T result = caseArc(arc);
if (result == null) result = defaultCase(theEObject);
return result;
}
case PetrinetPackage.TRANSITION: {
Transition transition = (Transition)theEObject;
T result = caseTransition(transition);
if (result == null) result = caseNode(transition);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Network</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Network</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNetwork(Network object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Node</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Node</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNode(Node object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Place</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Place</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePlace(Place object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Arc</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Arc</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseArc(Arc object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Transition</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Transition</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTransition(Transition object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch, but this is the last case anyway.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>EObject</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
* @generated
*/
@Override
public T defaultCase(EObject object) {
return null;
}
} //PetrinetSwitch

View file

@ -0,0 +1,2 @@
/game/
/xtext/

Some files were not shown because too many files have changed in this diff Show more