for (Commitment condComm : detachedCommits) {
if (condComm.getAntecedent().equals(c)) {
logger.debug("Commitment "+condComm+" has to change its state. Now is\n "+condComm.getLifeCycleStatus()+", setting to DISCHARGED.");
condComm.setStatus(LifeCycleState.DISCHARGED);
try {
condComm.setAntecedent(new Fact("true"));
} catch (MissingOperandException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
break;
case LOGICAL_EXPRESSION:
logger.trace("Just added a FACT, reasoning on interaction state after adding "+elAdded);
LogicalExpression el = (LogicalExpression)elAdded;
if (condCommits != null) {
logger.trace("Parsing CONDITIONAL commitments");
for (Commitment condComm : condCommits) {
logger.debug("Commitment antecedent: "+condComm.getAntecedent());
if (condComm.getAntecedent().equals(el)) {
logger.debug("Commitment "+condComm+" has to change its state. Now is\n "+condComm.getLifeCycleStatus()+", setting to DETACHED.");
condComm.setStatus(LifeCycleState.DETACHED);
// try {
// condComm.setAntecedent(new Fact("true"));
// } catch (MissingOperandException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
}
}
// search in detached commitment set
if (detachedCommits != null) {
logger.trace("Parsing DETACHED commitments");
for (Commitment condComm : detachedCommits) {
if (condComm.getAntecedent().equals(el)) {
logger.debug("Commitment "+condComm+" has to change its state. Now is\n "+condComm.getLifeCycleStatus()+", setting to DISCHARGED.");
condComm.setStatus(LifeCycleState.DISCHARGED);
try {
condComm.setAntecedent(new Fact("true"));
} catch (MissingOperandException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}