@Override protected void processRemoteAction(MindAction remoteAction) { if (remoteAction.getSubject().equals("User") && remoteAction.getName().equals("Reply") && (remoteAction.getParameters() != null) && (remoteAction.getParameters().size() > 0)) { String userChoice = remoteAction.getParameters().get(0); if (userChoice.toLowerCase().equals("yes")) { emotionalState = "joy"; executeAction(getEmotionAction(emotionalState)); executeAction(getTalkAction("When can you meet with Michael?")); } else if (userChoice.toLowerCase().equals("no")) { replyToMigrate = userChoice; emotionalState = "sadness"; executeAction(getEmotionAction(emotionalState)); executeAction(getTalkAction("Ok, sorry to bother you.")); } else { // this was an answer to the question of when to meet the student if (userChoice.equals("I can't say now")) { emotionalState = "sadness"; executeAction(getEmotionAction(emotionalState)); } replyToMigrate = userChoice; executeAction(getTalkAction("Thank you, I will let him know.")); } } }
@Override protected void processActionSuccess(MindAction a) { // unlock if (a.equals(lockAction)) lockAction = null; if (a.getSubject().equals("Sarah") && (a.getName().equals("Talk")) && (a.getParameters() != null) && (a.getParameters().size() > 0)) { String utterance = a.getParameters().get(0); if (utterance.toLowerCase().contains("hello")) executeAction(getTalkAction("Can I ask you a question?")); else if (utterance.toLowerCase().contains("sorry")) executeAction(getTalkAction("Migrating back, have a nice day.")); else if (utterance.toLowerCase().contains("thank you")) executeAction(getTalkAction("Migrating back, have a nice day.")); else if (utterance.toLowerCase().contains("migrating")) { executeAction(getEmotionAction("sleep")); executeAction(getMigrationAction("Screen")); } } }