Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jwalgemoed committed Oct 1, 2024
1 parent f7f0f94 commit 1d31584
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ object RecipeCompiler {
)
recipe.interactions.map(copyInteraction).toSet ++
recipe.sieves.map(convertSieveToInteraction) ++
recipe.subRecipes.flatMap(flattenSubRecipesToInteraction) ++
recipe.checkpointEvents.map(convertCheckpointEventToInteraction)
recipe.checkpointEvents.map(convertCheckpointEventToInteraction) ++
recipe.subRecipes.flatMap(flattenSubRecipesToInteraction)
}

def flattenSensoryEvents(recipe: Recipe): Set[com.ing.baker.recipe.common.Event] = {
Expand All @@ -240,15 +240,15 @@ object RecipeCompiler {
// Extend the interactions with the checkpoint event interactions and sub-recipes
val actionDescriptors: Seq[InteractionDescriptor] = recipe.interactions ++
recipe.checkpointEvents.map(convertCheckpointEventToInteraction) ++
recipe.subRecipes.flatMap(flattenSubRecipesToInteraction) ++
recipe.sieves.map(convertSieveToInteraction)
recipe.sieves.map(convertSieveToInteraction) ++
recipe.subRecipes.flatMap(flattenSubRecipesToInteraction)

// Flatten all sensory events from sub recipes
val sensoryEvents = flattenSensoryEvents(recipe)

//All ingredient names provided by sensory events or by interactions
val allIngredientNames: Set[String] =
(sensoryEvents).flatMap(e => e.providedIngredients.map(i => i.name)) ++
sensoryEvents.flatMap(e => e.providedIngredients.map(i => i.name)) ++
actionDescriptors.flatMap(i => i.output.flatMap { e =>
// check if the event was renamed (check if there is a transformer for this event)
i.eventOutputTransformers.get(e) match {
Expand All @@ -265,7 +265,7 @@ object RecipeCompiler {
val allInteractionTransitions: Seq[InteractionTransition] = interactionTransitions

// events provided from outside
val sensoryEventTransitions: Seq[EventTransition] = (sensoryEvents).map {
val sensoryEventTransitions: Seq[EventTransition] = sensoryEvents.map {
event => EventTransition(eventToCompiledEvent(event), isSensoryEvent = true, event.maxFiringLimit)
}.toIndexedSeq

Expand Down

0 comments on commit 1d31584

Please sign in to comment.