Package it.unito.di.logic.expression

Examples of it.unito.di.logic.expression.Fact


    super();
    this.elType = SocialStateElementType.COMMITMENT;
    debtor = d;
    creditor = c;
    try {
      antecedent = new Fact("true");
      consequent = new Fact(o);
    }
    catch (Exception e) {
      logger.error("Error in creating a commitment with true antecedend"+e.getCause());
      e.printStackTrace();
    }
View Full Code Here


          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();
              }
            }
View Full Code Here

      // la release ad es. viene fatta creando un nuovo commitment, quello che si vuole porre in stato released.
     
      // togliere new commitment e mettere i singoli paramtri di costruzione
     
      createCommitment(new Commitment(initiator, dest, "propose", new CompositeExpression(
          LogicalOperatorType.OR, new Fact("accept"), new Fact("reject"))));
      assertFact(new Fact("cfp", initiator, task));
      logger.trace("OPERATION PERFORMED: CFP by "+initiator);
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (WrongOperandsNumberException e) {
View Full Code Here

     accept.setRoleReceiver(dest);
     accept.setPerformative(ACLMessage.ACCEPT_PROPOSAL);
    send(accept);
   
    try {
      assertFact(new Fact("accept"));
      logger.trace("OPERATION PERFORMED: ACCEPT by "+initiator);
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

     reject.setPerformative(ACLMessage.REJECT_PROPOSAL);
    send(reject);
   
    try {
      releaseCommitment(new Commitment(proposal.getRoleId(), initiator, "accept", new CompositeExpression(
          LogicalOperatorType.OR, new Fact("done"), new Fact("failure"))));
      logger.trace("OPERATION PERFORMED: REJECT by "+initiator);
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (WrongOperandsNumberException e) {
View Full Code Here

     proposal.setPerformative(ACLMessage.PROPOSE);
    send(proposal);
   
    try {
      createCommitment(new Commitment(participant, new RoleId(INITIATOR_ROLE, RoleId.GENERIC_ROLE), "accept", new CompositeExpression(
          LogicalOperatorType.OR, new Fact("done"), new Fact("failure"))));
      assertFact(new Fact("propose", participant, prop));
      logger.trace("OPERATION PERFORMED: PROPOSE by "+participant);
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (WrongOperandsNumberException e) {
View Full Code Here

    refusal.setPerformative(ACLMessage.REFUSE);
    send(refusal);
   
    try {
      releaseCommitment(new Commitment(initiator, participant, "propose", new CompositeExpression(
          LogicalOperatorType.OR, new Fact("accept"), new Fact("reject"))));
      assertFact(new Fact("refuse", participant));
      logger.trace("OPERATION PERFORMED: REFUSE by "+participant);
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (WrongOperandsNumberException e) {
View Full Code Here

     done.setRoleReceiver(initiator);
     done.setPerformative(ACLMessage.INFORM);
    send(done);
   
    try {
      assertFact(new Fact("done", initiator, task));
      logger.trace("OPERATION PERFORMED: DONE by "+participant);
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

    failure.setRoleSender(participant);
    failure.setRoleReceiver(initiator);
    failure.setPerformative(ACLMessage.FAILURE);
    send(failure);
    try {
      assertFact(new Fact("failure"));
      logger.trace("OPERATION PERFORMED: FAILURE by "+participant);
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

      // la release ad es. viene fatta creando un nuovo commitment, quello che si vuole porre in stato released.
     
      // togliere new commitment e mettere i singoli paramtri di costruzione
     
      createAllCommitments(new Commitment(initiator, dest, "propose", new CompositeExpression(
          LogicalOperatorType.OR, new Fact("accept"), new Fact("reject"))));
      assertFact(new Fact("cfp", initiator, task));
      logger.trace("OPERATION PERFORMED: CFP by "+initiator);
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (WrongOperandsNumberException e) {
View Full Code Here

TOP

Related Classes of it.unito.di.logic.expression.Fact

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.