p.setRoleId(participant);
// VERSIONE CON SIGNAL PARTICOLARE
// signal(initiator.getPlayerAgentId(), "proposal", p.getProposalContent(), p.getCost(), participant.getCanonicalName());
defineObsProperty("proposal", p.getProposalContent(), p.getCost(), participant.getCanonicalName());
try {
createCommitment(new Commitment(participant, initiator, "accept", new CompositeExpression(
LogicalOperatorType.OR, new Fact("done"), new Fact("failure"))));
assertFact(new Fact("propose", participant, prop));
//**** DEBUG: CAMBIO STATO DI VITA A COMMITMENT GIUSTO, SARA' IL SOCIAL STATE CHE DOVRA' GESTIRLO
for (Commitment com : interactionState.retrieveCommitmentsByCreditorRoleId(participant)) {
if (com.getAntecedent().equals(new Fact("propose")) && com.getLifeCycleStatus().equals(LifeCycleState.CONDITIONAL)) {
removeObsPropertyByTemplate("cc", com.getDebtor().getCanonicalName(), com.getCreditor().getCanonicalName(),
com.getAntecedent().toString(), com.getConsequent().toString(), com.getLifeCycleStatus().toString());
com.setStatus(LifeCycleState.DETACHED);
com.setAntecedent(new Fact("true"));
actualProposals++;
defineObsProperty("cc", com.getDebtor().getCanonicalName(), com.getCreditor().getCanonicalName(),
com.getAntecedent().toString(), com.getConsequent().toString(), com.getLifeCycleStatus().toString());
}
}
if (actualProposals == numberMaxProposals) {
RoleId groupParticipant = new RoleId(PARTICIPANT_ROLE);
createCommitment(new Commitment(initiator, groupParticipant, new CompositeExpression(
LogicalOperatorType.OR, new Fact("accept"), new Fact("reject"))));
// defineObsProperty("cc", initiator.getCanonicalName(), "GroupParticipant",
// "true", "(accept OR reject)", "DETACHED");
}