SDMMPetriNetPackage.tom 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. %typeterm Node_dynamic extends EObject {
  2. implement { petrinetsemantics.SDMMPetriNet.Node_dynamic }
  3. is_sort(t) { $t instanceof petrinetsemantics.SDMMPetriNet.Node_dynamic }
  4. equals(l1,l2) { $l1.equals($l2) }
  5. }
  6. %typeterm Place_dynamic extends Node_dynamic {
  7. implement { petrinetsemantics.SDMMPetriNet.Place_dynamic }
  8. is_sort(t) { $t instanceof petrinetsemantics.SDMMPetriNet.Place_dynamic }
  9. equals(l1,l2) { $l1.equals($l2) }
  10. }
  11. %op Place_dynamic Place_dynamic(Node_static : Node, Place_static : Place, marking : int) {
  12. is_fsym(t) { $t instanceof petrinetsemantics.SDMMPetriNet.Place_dynamic }
  13. get_slot(Node_static, t) { (petrinetsemantics.DDMMPetriNet.Node)$t.eGet($t.eClass().getEStructuralFeature("Node_static")) }
  14. get_slot(Place_static, t) { (petrinetsemantics.DDMMPetriNet.Place)$t.eGet($t.eClass().getEStructuralFeature("Place_static")) }
  15. get_slot(marking, t) { (java.lang.Integer)$t.eGet($t.eClass().getEStructuralFeature("marking")) }
  16. get_default(marking) { 0 }
  17. make(Node_static, Place_static, marking) { constructPlace_dynamic((petrinetsemantics.SDMMPetriNet.Place_dynamic)petrinetsemantics.SDMMPetriNet.SDMMPetriNetFactory.eINSTANCE.create((EClass)petrinetsemantics.SDMMPetriNet.SDMMPetriNetPackage.eINSTANCE.getEClassifier("Place_dynamic")), new Object[]{ $Node_static, $Place_static, $marking }) }
  18. implement() { petrinetsemantics.SDMMPetriNet.impl.Place_dynamicImpl }
  19. }
  20. public static <O extends org.eclipse.emf.ecore.EObject> O constructPlace_dynamic(O o, Object[] objs) {
  21. int i=0;
  22. EList<EStructuralFeature> sfes = o.eClass().getEAllStructuralFeatures();
  23. for(EStructuralFeature esf : sfes) {
  24. if(esf.isChangeable()) {
  25. o.eSet(esf, objs[i]);
  26. i++;
  27. }
  28. }
  29. return o;
  30. }
  31. %typeterm PetriNet_dynamic extends EObject {
  32. implement { petrinetsemantics.SDMMPetriNet.PetriNet_dynamic }
  33. is_sort(t) { $t instanceof petrinetsemantics.SDMMPetriNet.PetriNet_dynamic }
  34. equals(l1,l2) { $l1.equals($l2) }
  35. }
  36. %typeterm Node_dynamicEList {
  37. implement { org.eclipse.emf.common.util.EList<petrinetsemantics.SDMMPetriNet.Node_dynamic> }
  38. is_sort(t) { $t instanceof org.eclipse.emf.common.util.EList<?> && (((org.eclipse.emf.common.util.EList<petrinetsemantics.SDMMPetriNet.Node_dynamic>)$t).size() == 0 || (((org.eclipse.emf.common.util.EList<petrinetsemantics.SDMMPetriNet.Node_dynamic>)$t).size()>0 && ((org.eclipse.emf.common.util.EList<petrinetsemantics.SDMMPetriNet.Node_dynamic>)$t).get(0) instanceof petrinetsemantics.SDMMPetriNet.Node_dynamic)) }
  39. equals(l1,l2) { $l1.equals($l2) }
  40. }
  41. %oparray Node_dynamicEList Node_dynamicEList ( Node_dynamic* ) {
  42. is_fsym(t) { $t instanceof org.eclipse.emf.common.util.EList<?> && ($t.size() == 0 || ($t.size()>0 && $t.get(0) instanceof petrinetsemantics.SDMMPetriNet.Node_dynamic)) }
  43. make_empty(n) { new org.eclipse.emf.common.util.BasicEList<petrinetsemantics.SDMMPetriNet.Node_dynamic>($n) }
  44. make_append(e,l) { appendNode_dynamicEList($e,$l) }
  45. get_element(l,n) { $l.get($n) }
  46. get_size(l) { $l.size() }
  47. }
  48. private static <O> org.eclipse.emf.common.util.EList<O> appendNode_dynamicEList(O e,org.eclipse.emf.common.util.EList<O> l) {
  49. l.add(e);
  50. return l;
  51. }
  52. %op PetriNet_dynamic PetriNet_dynamic(nodes : Node_dynamicEList, PetriNet_static : PetriNet) {
  53. is_fsym(t) { $t instanceof petrinetsemantics.SDMMPetriNet.PetriNet_dynamic }
  54. get_slot(nodes, t) { (org.eclipse.emf.common.util.EList<petrinetsemantics.SDMMPetriNet.Node_dynamic>)$t.eGet($t.eClass().getEStructuralFeature("nodes")) }
  55. get_slot(PetriNet_static, t) { (petrinetsemantics.DDMMPetriNet.PetriNet)$t.eGet($t.eClass().getEStructuralFeature("PetriNet_static")) }
  56. make(nodes, PetriNet_static) { constructPetriNet_dynamic((petrinetsemantics.SDMMPetriNet.PetriNet_dynamic)petrinetsemantics.SDMMPetriNet.SDMMPetriNetFactory.eINSTANCE.create((EClass)petrinetsemantics.SDMMPetriNet.SDMMPetriNetPackage.eINSTANCE.getEClassifier("PetriNet_dynamic")), new Object[]{ $nodes, $PetriNet_static }) }
  57. implement() { petrinetsemantics.SDMMPetriNet.impl.PetriNet_dynamicImpl }
  58. }
  59. public static <O extends org.eclipse.emf.ecore.EObject> O constructPetriNet_dynamic(O o, Object[] objs) {
  60. int i=0;
  61. EList<EStructuralFeature> sfes = o.eClass().getEAllStructuralFeatures();
  62. for(EStructuralFeature esf : sfes) {
  63. if(esf.isChangeable()) {
  64. o.eSet(esf, objs[i]);
  65. i++;
  66. }
  67. }
  68. return o;
  69. }