Skip to content

Commit

Permalink
fix: intention name
Browse files Browse the repository at this point in the history
  • Loading branch information
yan-elena committed Nov 26, 2023
1 parent a1cd708 commit ec7c21a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/component/event/bdi/BeliefRemoved.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function BDIBeliefRemoved(props) {

if (intention) {
const intentionInfo = intention.message.event.intentionInfo
reason = " because of intention " + intentionInfo.intendedMeansInfo[0].trigger + "/" + intentionInfo.id
reason = " because of intention " + intentionInfo.id + " " + intentionInfo.intendedMeansInfo[0].trigger
}

if (!beliefAdded && !(beliefDeed && beliefDeed.message.type === "ExecutedDeed" && beliefDeed.message.event.deedInfo.type === "delAddBel" && beliefDeed.message.event.deedInfo.term.includes(beliefEvent.functor))) {
Expand Down
4 changes: 2 additions & 2 deletions src/component/event/bdi/DesireCommitted.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ function DesireCommitted(props) {
const body = selectedPlan.body ? "Plan body: " + selectedPlan.body : ""
const im = intention.message.event.intentionInfo.intendedMeansInfo
const id = intention.message.event.intentionInfo.id
const description = "I committed to desire " + desire + context + ", and it became a new intention " + im[0].trigger + "/" + id
const description = "I committed to desire " + desire + context + ", and it became a new intention " + id + " " + im[0].trigger

let reason = getIntentionReason(desire, intention.message.event.intentionInfo)
let parentDesire = reason ? ["Intention " + im[0].trigger + "/" + id + " is an intention" + reason, <br/>] : []
let parentDesire = reason ? ["Intention " + id + " " + im[0].trigger + " is an intention" + reason, <br/>] : []

if (agentState.intention[id]) {
agentState.intention[id].push(desire)
Expand Down
4 changes: 2 additions & 2 deletions src/component/event/bdi/DesireRemoved.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ function DesireRemoved(props) {

if (im.length > 0) {
let reason = getIntentionReason(functor, intention)
parentDesire = reason ? ["Intention " + functor + "/" + id + " is an intention" + reason, <br/>] : []
parentDesire = reason ? ["Intention " + id + " " + functor + " is an intention" + reason, <br/>] : []
}
} else {
id = Object.keys(agentState.intention).find(key => agentState.intention[key].includes(functor))
}

let intentionInfo = "intention " + functor.split('(')[0] + "/" + id
let intentionInfo = "intention " + id + " " + functor.split('(')[0]
if (result === "achieved") {
type = "Desire satisfied";
description = "I have satisfied my desire " + functor + " because its " + intentionInfo + " has finished"
Expand Down
2 changes: 1 addition & 1 deletion src/component/event/bdi/ExecutedAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function ExecutedAction(props) {
break;
}

intention = "intention " + intentionTrigger + "/" + intentionId
intention = "intention " + intentionId + " " + intentionTrigger
description = description + deed.term + " because of " + intention
info = info + deed.type

Expand Down
4 changes: 2 additions & 2 deletions src/component/event/bdi/NewBelief.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ function NewBelief(props) {
if (beliefDeed) {
const intentionInfo = beliefDeed.message.event.intentionInfo.value
if (intentionInfo) {
intention = intentionInfo.intendedMeansInfo[0].trigger + "/" + intentionInfo.id
intention = intentionInfo.id + " " + intentionInfo.intendedMeansInfo[0].trigger
} else {
const intentionEvent = props.log.slice(0, props.log.indexOf(props.event)).find(e => e.message.type === "IntentionCreated" && e.message.event.intentionInfo.intendedMeansInfo[0].plan.body.includes(belief)).message.event.intentionInfo;
intention = intentionEvent.intendedMeansInfo[0].trigger + "/" + intentionEvent.id
intention = intentionEvent.id + " " + intentionEvent.intendedMeansInfo[0].trigger
}
reason = " because of intention " + intention
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/model/agentState.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export function getIntentionReason(desire, intentionInfo) {
} else if (agentState.speechAct.tell.includes(parent)) {
reason = " created from " + parent + " message"
} else if (agentState.speechAct.achieve.includes(parent)) {
reason = " created from intention " + parent + "/" + id
reason = " created from intention " + id + " " + parent
} else if (agentState.belief.self.includes(parent)) {
reason = " formed from the belief " + parent
} else if (agentState.belief.percept.includes(parent)) {
reason = " created from the perception of " + parent
} else if (agentState.intention[id] && agentState.intention[id].includes(parent)) {
reason = " created from intention " + parent + "/" + id
reason = " created from intention " + id + " " + parent

}
}
Expand Down

0 comments on commit ec7c21a

Please sign in to comment.