TM3PetriNetPackage.tom 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. %typeterm PNScenario extends EObject {
  2. implement { petrinetsemantics.TM3PetriNet.PNScenario }
  3. is_sort(t) { $t instanceof petrinetsemantics.TM3PetriNet.PNScenario }
  4. equals(l1,l2) { $l1.equals($l2) }
  5. }
  6. %typeterm PNTrace extends EObject {
  7. implement { petrinetsemantics.TM3PetriNet.PNTrace }
  8. is_sort(t) { $t instanceof petrinetsemantics.TM3PetriNet.PNTrace }
  9. equals(l1,l2) { $l1.equals($l2) }
  10. }
  11. %op PNTrace PNTrace(scenario : PNScenario) {
  12. is_fsym(t) { $t instanceof petrinetsemantics.TM3PetriNet.PNTrace }
  13. get_slot(scenario, t) { (petrinetsemantics.TM3PetriNet.PNScenario)$t.eGet($t.eClass().getEStructuralFeature("scenario")) }
  14. make(scenario) { constructPNTrace((petrinetsemantics.TM3PetriNet.PNTrace)petrinetsemantics.TM3PetriNet.TM3PetriNetFactory.eINSTANCE.create((EClass)petrinetsemantics.TM3PetriNet.TM3PetriNetPackage.eINSTANCE.getEClassifier("PNTrace")), new Object[]{ $scenario }) }
  15. implement() { petrinetsemantics.TM3PetriNet.impl.PNTraceImpl }
  16. }
  17. public static <O extends org.eclipse.emf.ecore.EObject> O constructPNTrace(O o, Object[] objs) {
  18. int i=0;
  19. EList<EStructuralFeature> sfes = o.eClass().getEAllStructuralFeatures();
  20. for(EStructuralFeature esf : sfes) {
  21. if(esf.isChangeable()) {
  22. o.eSet(esf, objs[i]);
  23. i++;
  24. }
  25. }
  26. return o;
  27. }
  28. %typeterm PNTraceEList {
  29. implement { org.eclipse.emf.common.util.EList<petrinetsemantics.TM3PetriNet.PNTrace> }
  30. is_sort(t) { $t instanceof org.eclipse.emf.common.util.EList<?> && (((org.eclipse.emf.common.util.EList<petrinetsemantics.TM3PetriNet.PNTrace>)$t).size() == 0 || (((org.eclipse.emf.common.util.EList<petrinetsemantics.TM3PetriNet.PNTrace>)$t).size()>0 && ((org.eclipse.emf.common.util.EList<petrinetsemantics.TM3PetriNet.PNTrace>)$t).get(0) instanceof petrinetsemantics.TM3PetriNet.PNTrace)) }
  31. equals(l1,l2) { $l1.equals($l2) }
  32. }
  33. %oparray PNTraceEList PNTraceEList ( PNTrace* ) {
  34. is_fsym(t) { $t instanceof org.eclipse.emf.common.util.EList<?> && ($t.size() == 0 || ($t.size()>0 && $t.get(0) instanceof petrinetsemantics.TM3PetriNet.PNTrace)) }
  35. make_empty(n) { new org.eclipse.emf.common.util.BasicEList<petrinetsemantics.TM3PetriNet.PNTrace>($n) }
  36. make_append(e,l) { appendPNTraceEList($e,$l) }
  37. get_element(l,n) { $l.get($n) }
  38. get_size(l) { $l.size() }
  39. }
  40. private static <O> org.eclipse.emf.common.util.EList<O> appendPNTraceEList(O e,org.eclipse.emf.common.util.EList<O> l) {
  41. l.add(e);
  42. return l;
  43. }
  44. %typeterm PNSimEvent extends EObject {
  45. implement { petrinetsemantics.TM3PetriNet.PNSimEvent }
  46. is_sort(t) { $t instanceof petrinetsemantics.TM3PetriNet.PNSimEvent }
  47. equals(l1,l2) { $l1.equals($l2) }
  48. }
  49. %op PNSimEvent PNSimEvent(internal : boolean, date : int, name : String) {
  50. is_fsym(t) { $t instanceof petrinetsemantics.TM3PetriNet.PNSimEvent }
  51. get_slot(internal, t) { (java.lang.Boolean)$t.eGet($t.eClass().getEStructuralFeature("internal")) }
  52. get_slot(date, t) { (java.lang.Integer)$t.eGet($t.eClass().getEStructuralFeature("date")) }
  53. get_slot(name, t) { (java.lang.String)$t.eGet($t.eClass().getEStructuralFeature("name")) }
  54. get_default(internal) { false }
  55. get_default(date) { 0 }
  56. get_default(name) { "" }
  57. make(internal, date, name) { constructPNSimEvent((petrinetsemantics.TM3PetriNet.PNSimEvent)petrinetsemantics.TM3PetriNet.TM3PetriNetFactory.eINSTANCE.create((EClass)petrinetsemantics.TM3PetriNet.TM3PetriNetPackage.eINSTANCE.getEClassifier("PNSimEvent")), new Object[]{ $internal, $date, $name }) }
  58. implement() { petrinetsemantics.TM3PetriNet.impl.PNSimEventImpl }
  59. }
  60. public static <O extends org.eclipse.emf.ecore.EObject> O constructPNSimEvent(O o, Object[] objs) {
  61. int i=0;
  62. EList<EStructuralFeature> sfes = o.eClass().getEAllStructuralFeatures();
  63. for(EStructuralFeature esf : sfes) {
  64. if(esf.isChangeable()) {
  65. o.eSet(esf, objs[i]);
  66. i++;
  67. }
  68. }
  69. return o;
  70. }
  71. %typeterm PNSimEventEList {
  72. implement { org.eclipse.emf.common.util.EList<petrinetsemantics.TM3PetriNet.PNSimEvent> }
  73. is_sort(t) { $t instanceof org.eclipse.emf.common.util.EList<?> && (((org.eclipse.emf.common.util.EList<petrinetsemantics.TM3PetriNet.PNSimEvent>)$t).size() == 0 || (((org.eclipse.emf.common.util.EList<petrinetsemantics.TM3PetriNet.PNSimEvent>)$t).size()>0 && ((org.eclipse.emf.common.util.EList<petrinetsemantics.TM3PetriNet.PNSimEvent>)$t).get(0) instanceof petrinetsemantics.TM3PetriNet.PNSimEvent)) }
  74. equals(l1,l2) { $l1.equals($l2) }
  75. }
  76. %oparray PNSimEventEList PNSimEventEList ( PNSimEvent* ) {
  77. is_fsym(t) { $t instanceof org.eclipse.emf.common.util.EList<?> && ($t.size() == 0 || ($t.size()>0 && $t.get(0) instanceof petrinetsemantics.TM3PetriNet.PNSimEvent)) }
  78. make_empty(n) { new org.eclipse.emf.common.util.BasicEList<petrinetsemantics.TM3PetriNet.PNSimEvent>($n) }
  79. make_append(e,l) { appendPNSimEventEList($e,$l) }
  80. get_element(l,n) { $l.get($n) }
  81. get_size(l) { $l.size() }
  82. }
  83. private static <O> org.eclipse.emf.common.util.EList<O> appendPNSimEventEList(O e,org.eclipse.emf.common.util.EList<O> l) {
  84. l.add(e);
  85. return l;
  86. }
  87. %op PNScenario PNScenario(traces : PNTraceEList, simEvents : PNSimEventEList) {
  88. is_fsym(t) { $t instanceof petrinetsemantics.TM3PetriNet.PNScenario }
  89. get_slot(traces, t) { (org.eclipse.emf.common.util.EList<petrinetsemantics.TM3PetriNet.PNTrace>)$t.eGet($t.eClass().getEStructuralFeature("traces")) }
  90. get_slot(simEvents, t) { (org.eclipse.emf.common.util.EList<petrinetsemantics.TM3PetriNet.PNSimEvent>)$t.eGet($t.eClass().getEStructuralFeature("simEvents")) }
  91. make(traces, simEvents) { constructPNScenario((petrinetsemantics.TM3PetriNet.PNScenario)petrinetsemantics.TM3PetriNet.TM3PetriNetFactory.eINSTANCE.create((EClass)petrinetsemantics.TM3PetriNet.TM3PetriNetPackage.eINSTANCE.getEClassifier("PNScenario")), new Object[]{ $traces, $simEvents }) }
  92. implement() { petrinetsemantics.TM3PetriNet.impl.PNScenarioImpl }
  93. }
  94. public static <O extends org.eclipse.emf.ecore.EObject> O constructPNScenario(O o, Object[] objs) {
  95. int i=0;
  96. EList<EStructuralFeature> sfes = o.eClass().getEAllStructuralFeatures();
  97. for(EStructuralFeature esf : sfes) {
  98. if(esf.isChangeable()) {
  99. o.eSet(esf, objs[i]);
  100. i++;
  101. }
  102. }
  103. return o;
  104. }