From 1ea56d450da5dfd101f61d45986a841928762753 Mon Sep 17 00:00:00 2001 From: Elena Date: Tue, 4 Jun 2024 10:05:13 +0200 Subject: [PATCH] feature: add new intention at the design level --- src/component/event/EventMapping.js | 3 ++- .../event/design/BDIIntentionCreated.js | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/component/event/design/BDIIntentionCreated.js diff --git a/src/component/event/EventMapping.js b/src/component/event/EventMapping.js index 881fd8b..9b4c023 100644 --- a/src/component/event/EventMapping.js +++ b/src/component/event/EventMapping.js @@ -31,6 +31,7 @@ import NewBelief from "./design/NewBelief"; import SelectPlan from "./design/SelectPlan"; import BDIBeliefRemoved from "./design/BeliefRemoved"; import BDIGoalCreated from "./design/BDIGoalCreated"; +import BDIIntentionCreated from "./design/BDIIntentionCreated"; const EventMapping = { ExecutedDeed: {implementation: , design: }, @@ -45,7 +46,7 @@ const EventMapping = { GoalRemoved: {implementation: , design: }, GoalSuspended: {implementation: , design: <>}, PlanSelected: {implementation: , design: <>}, - IntentionCreated: {implementation: , design: <>}, //todo + IntentionCreated: {implementation: , design: }, IntentionRemoved: {implementation: , design: <>}, IntentionSuspended: {implementation: , design: <>}, IntentionWaiting: {implementation: , design: <>}, diff --git a/src/component/event/design/BDIIntentionCreated.js b/src/component/event/design/BDIIntentionCreated.js new file mode 100644 index 0000000..9a81526 --- /dev/null +++ b/src/component/event/design/BDIIntentionCreated.js @@ -0,0 +1,23 @@ +import Event from "../Event"; +import {Level} from "../../../model/Level"; +import React from "react"; + +function BDIIntentionCreated(props) { + const event = props.event + const type = "Intention Created" + const intention = event.message.event.intentionInfo + const goal = intention.intendedMeansInfo[0].plan.trigger + const id = "int-" + intention.id + "-" + goal + const explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && e.message.event.goalInfo.intention.value && e.message.event.goalInfo.intention.value.id === intention.id) + const selectPlan = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "PlanSelected" && e.message.event.goalInfo.goalFunctor === goal) + const description = "I have a new intention " + id + + if (selectPlan) { + return ( + + ) + } +} + +export default BDIIntentionCreated; \ No newline at end of file