Skip to content

Commit

Permalink
Make Reactions routine generically typed with facade
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoKlare committed Aug 17, 2022
1 parent c606bd4 commit 6a54f95
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ import org.eclipse.xtend.lib.annotations.Accessors
import tools.vitruv.change.correspondence.view.EditableCorrespondenceModelView
import tools.vitruv.dsls.reactions.runtime.correspondence.ReactionsCorrespondence

abstract class AbstractRoutine extends CallHierarchyHaving implements Routine {
val AbstractRoutinesFacade routinesFacade
abstract class AbstractRoutine<T extends AbstractRoutinesFacade> extends CallHierarchyHaving implements Routine {
val T routinesFacade
@Accessors(PROTECTED_GETTER)
extension val ReactionExecutionState executionState

new(AbstractRoutinesFacade routinesFacade, ReactionExecutionState executionState, CallHierarchyHaving calledBy) {
new(T routinesFacade, ReactionExecutionState executionState, CallHierarchyHaving calledBy) {
super(calledBy)
this.routinesFacade = routinesFacade
this.executionState = executionState
}

// generic return type for convenience; the requested type has to match the type of the facade provided during construction
protected def <T extends AbstractRoutinesFacade> T getRoutinesFacade() {
return routinesFacade as T
protected def T getRoutinesFacade() {
return routinesFacade
}

override boolean execute() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class RoutineClassGenerator extends ClassGenerator {
val executeMethod = generateMethodExecuteRoutine()
generatedClass => [
documentation = getCommentWithoutMarkers(routine.documentation)
superTypes += typeRef(AbstractRoutine)
superTypes += typeRef(AbstractRoutine, typeRef(routinesFacadeQualifiedName))
if(hasInputValues) members += routine.toField(INPUT_VALUES_FIELD_NAME, typeRef(inputValuesClass))
members += if (!matchBlockClassGenerator.empty)
routine.toField(RETRIEVED_VALUES_FIELD_NAME,
Expand Down

0 comments on commit 6a54f95

Please sign in to comment.