-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: add new intention at the design level
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ( | ||
<Event type={type} description={description} timestamp={props.event.timestamp} filter={props.filter} | ||
log={props.log} level={Level.DESIGN} explanation={explanation}/> | ||
) | ||
} | ||
} | ||
|
||
export default BDIIntentionCreated; |