SDMMSimplePDLPackage.tom 5.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. %typeterm DynamicWorkDefinition extends WorkDefinition {
  2. implement { SimplePDLSemantics.SDMMSimplePDL.DynamicWorkDefinition }
  3. is_sort(t) { $t instanceof SimplePDLSemantics.SDMMSimplePDL.DynamicWorkDefinition }
  4. equals(l1,l2) { $l1.equals($l2) }
  5. }
  6. %typeterm ExecutionState {
  7. implement { SimplePDLSemantics.SDMMSimplePDL.ExecutionState }
  8. is_sort(t) { $t instanceof SimplePDLSemantics.SDMMSimplePDL.ExecutionState }
  9. equals(l1,l2) { $l1.equals($l2) }
  10. }
  11. %op ExecutionState ExecutionStatenotStarted() {
  12. is_fsym(t) { t == SimplePDLSemantics.SDMMSimplePDL.ExecutionState.get("notStarted") }
  13. make() { (SimplePDLSemantics.SDMMSimplePDL.ExecutionState)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLFactory.eINSTANCE.createFromString((EDataType)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLPackage.eINSTANCE.getExecutionState(), "notStarted") }
  14. }
  15. %op ExecutionState ExecutionStaterunning() {
  16. is_fsym(t) { t == SimplePDLSemantics.SDMMSimplePDL.ExecutionState.get("running") }
  17. make() { (SimplePDLSemantics.SDMMSimplePDL.ExecutionState)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLFactory.eINSTANCE.createFromString((EDataType)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLPackage.eINSTANCE.getExecutionState(), "running") }
  18. }
  19. %op ExecutionState ExecutionStatefinished() {
  20. is_fsym(t) { t == SimplePDLSemantics.SDMMSimplePDL.ExecutionState.get("finished") }
  21. make() { (SimplePDLSemantics.SDMMSimplePDL.ExecutionState)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLFactory.eINSTANCE.createFromString((EDataType)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLPackage.eINSTANCE.getExecutionState(), "finished") }
  22. }
  23. %typeterm TimeState {
  24. implement { SimplePDLSemantics.SDMMSimplePDL.TimeState }
  25. is_sort(t) { $t instanceof SimplePDLSemantics.SDMMSimplePDL.TimeState }
  26. equals(l1,l2) { $l1.equals($l2) }
  27. }
  28. %op TimeState TimeStatetooEarly() {
  29. is_fsym(t) { t == SimplePDLSemantics.SDMMSimplePDL.TimeState.get("tooEarly") }
  30. make() { (SimplePDLSemantics.SDMMSimplePDL.TimeState)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLFactory.eINSTANCE.createFromString((EDataType)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLPackage.eINSTANCE.getTimeState(), "tooEarly") }
  31. }
  32. %op TimeState TimeStateinTime() {
  33. is_fsym(t) { t == SimplePDLSemantics.SDMMSimplePDL.TimeState.get("inTime") }
  34. make() { (SimplePDLSemantics.SDMMSimplePDL.TimeState)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLFactory.eINSTANCE.createFromString((EDataType)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLPackage.eINSTANCE.getTimeState(), "inTime") }
  35. }
  36. %op TimeState TimeStatetooLate() {
  37. is_fsym(t) { t == SimplePDLSemantics.SDMMSimplePDL.TimeState.get("tooLate") }
  38. make() { (SimplePDLSemantics.SDMMSimplePDL.TimeState)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLFactory.eINSTANCE.createFromString((EDataType)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLPackage.eINSTANCE.getTimeState(), "tooLate") }
  39. }
  40. %include { float.tom }
  41. %op DynamicWorkDefinition DynamicWorkDefinition(parent : Process, linksToPredecessors : WorkSequenceEList, linksToSuccessors : WorkSequenceEList, name : String, process : Process, state : ExecutionState, time : TimeState, timeElapsed : float) {
  42. is_fsym(t) { $t instanceof SimplePDLSemantics.SDMMSimplePDL.DynamicWorkDefinition }
  43. get_slot(parent, t) { (SimplePDLSemantics.DDMMSimplePDL.Process)$t.eGet($t.eClass().getEStructuralFeature("parent")) }
  44. get_slot(linksToPredecessors, t) { (org.eclipse.emf.common.util.EList<SimplePDLSemantics.DDMMSimplePDL.WorkSequence>)$t.eGet($t.eClass().getEStructuralFeature("linksToPredecessors")) }
  45. get_slot(linksToSuccessors, t) { (org.eclipse.emf.common.util.EList<SimplePDLSemantics.DDMMSimplePDL.WorkSequence>)$t.eGet($t.eClass().getEStructuralFeature("linksToSuccessors")) }
  46. get_slot(name, t) { (java.lang.String)$t.eGet($t.eClass().getEStructuralFeature("name")) }
  47. get_slot(process, t) { (SimplePDLSemantics.DDMMSimplePDL.Process)$t.eGet($t.eClass().getEStructuralFeature("process")) }
  48. get_slot(state, t) { (SimplePDLSemantics.SDMMSimplePDL.ExecutionState)$t.eGet($t.eClass().getEStructuralFeature("state")) }
  49. get_slot(time, t) { (SimplePDLSemantics.SDMMSimplePDL.TimeState)$t.eGet($t.eClass().getEStructuralFeature("time")) }
  50. get_slot(timeElapsed, t) { (java.lang.Float)$t.eGet($t.eClass().getEStructuralFeature("timeElapsed")) }
  51. get_default(state) { `ExecutionStatenotStarted() }
  52. get_default(time) { `TimeStatetooEarly() }
  53. get_default(timeElapsed) { 0.0 }
  54. make(parent, linksToPredecessors, linksToSuccessors, name, process, state, time, timeElapsed) { constructDynamicWorkDefinition((SimplePDLSemantics.SDMMSimplePDL.DynamicWorkDefinition)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLFactory.eINSTANCE.create((EClass)SimplePDLSemantics.SDMMSimplePDL.SDMMSimplePDLPackage.eINSTANCE.getEClassifier("DynamicWorkDefinition")), new Object[]{ $parent, $linksToPredecessors, $linksToSuccessors, $name, $process, $state, $time, $timeElapsed }) }
  55. implement() { SimplePDLSemantics.SDMMSimplePDL.impl.DynamicWorkDefinitionImpl }
  56. }
  57. public static <O extends org.eclipse.emf.ecore.EObject> O constructDynamicWorkDefinition(O o, Object[] objs) {
  58. int i=0;
  59. EList<EStructuralFeature> sfes = o.eClass().getEAllStructuralFeatures();
  60. for(EStructuralFeature esf : sfes) {
  61. if(esf.isChangeable()) {
  62. o.eSet(esf, objs[i]);
  63. i++;
  64. }
  65. }
  66. return o;
  67. }