Package it.unito.di.logic.expression

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


     accept.setRoleReceiver(dest);
     accept.setPerformative(ACLMessage.ACCEPT_PROPOSAL);
    send(accept);
   
    try {
      assertFact(new Fact("accept"));
      //**** DEBUG: CAMBIO STATO DI VITA A COMMITMENT GIUSTO, SARA' IL SOCIAL STATE CHE DOVRA' GESTIRLO
      ArrayList<Commitment> arrComm = new ArrayList<Commitment>();
      for (Commitment com : interactionState.retrieveCommitmentsByCreditorRoleId(initiator)) {
        if (com.getAntecedent().equals(new Fact("accept")) && com.getLifeCycleStatus().equals(LifeCycleState.CONDITIONAL)) {
          arrComm.add(com);
        }
      }
      Commitment cToAdd;
      for (Commitment com : arrComm) {
        cToAdd = new Commitment(com.getDebtor(), com.getCreditor(), new Fact("true"), com.getConsequent(), LifeCycleState.DETACHED)
        interactionState.removeCommitment(com);
        logger.debug("Commitment da rimuovere: "+com);
        createCommitment(cToAdd);
      }
      logger.trace("OPERATION PERFORMED: ACCEPT by "+initiator);
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.setRoleReceiver(initiator);
     proposal.setPerformative(ACLMessage.PROPOSE);
    send(proposal);
   
    try {
      assertFact(new Fact("propose", participant, prop));
      createCommitment(new Commitment(participant, initiator, new Fact("accept"), new CompositeExpression(
          LogicalOperatorType.OR, new Fact("done"), new Fact("failure"))));
      //**** 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)) {
          Commitment cToAdd = new Commitment(com.getDebtor(), com.getCreditor(), new Fact("true"), com.getConsequent(), LifeCycleState.DETACHED)
          interactionState.removeCommitment(com);
          logger.debug("Commitment da rimuovere: "+com);
          createCommitment(cToAdd)
          actualProposals++;           
        }
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

    send(done);
   
    try {
      ArrayList<Commitment> arrComm = new ArrayList<Commitment>();
      for (Commitment com : interactionState.retrieveCommitmentsByDebtorRoleId(participant)) {
        if (com.getConsequent().equals(new CompositeExpression(LogicalOperatorType.OR, new Fact("done"), new Fact("failure")))) {
          arrComm.add(com);
        }
      }
      for (Commitment com :arrComm) {
        if (com.getConsequent().equals(new CompositeExpression(LogicalOperatorType.OR, new Fact("done"), new Fact("failure")))) {
          Commitment cToAdd = new Commitment(com.getDebtor(), com.getCreditor(), com.getAntecedent(), com.getConsequent(), LifeCycleState.DISCHARGED)
          interactionState.removeCommitment(com);
          logger.debug("Commitment da rimuovere: "+com);
          createCommitment(cToAdd);       
        }
      }   
     
      assertFact(new Fact("done"));
      logger.trace("OPERATION PERFORMED: DONE by "+participant);
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (WrongOperandsNumberException e) {
View Full Code Here

    failure.setPerformative(ACLMessage.FAILURE);
    send(failure);
    try {
      ArrayList<Commitment> arrComm = new ArrayList<Commitment>();
      for (Commitment com : interactionState.retrieveCommitmentsByDebtorRoleId(participant)) {
        if (com.getConsequent().equals(new CompositeExpression(LogicalOperatorType.OR, new Fact("done"), new Fact("failure")))) {
          arrComm.add(com);
        }
      }
      for (Commitment com :arrComm) {
        if (com.getConsequent().equals(new CompositeExpression(LogicalOperatorType.OR, new Fact("done"), new Fact("failure")))) {
          Commitment cToAdd = new Commitment(com.getDebtor(), com.getCreditor(), com.getAntecedent(), com.getConsequent(), LifeCycleState.DISCHARGED)
          interactionState.removeCommitment(com);
          logger.debug("Commitment da rimuovere: "+com);
          createCommitment(cToAdd);       
        }
      } 
      assertFact(new Fact("failure"));
      logger.trace("OPERATION PERFORMED: FAILURE by "+participant);
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (WrongOperandsNumberException e) {
View Full Code Here

                        CNPArtifactTimerMaxPart.INITIATOR_ROLE,
                        RoleId.GENERIC_ROLE))
                && c.getConsequent().equals(
                    new CompositeExpression(
                        LogicalOperatorType.OR,
                        new Fact("accept"), new Fact(
                            "reject")))) {
              myAgent.addBehaviour(new CommitToDoneOrFailureIfAccept(participant, this));
            }
          } catch (MissingOperandException
              | WrongOperandsNumberException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
          }
        }

        else if (c.getLifeCycleStatus() == LifeCycleState.DETACHED) {
          try {
            if (c.getDebtor().equals(participant.getRoleId())
                && c.getCreditor().equals(
                    new RoleId(
                        CNPArtifactTimerMaxPart.INITIATOR_ROLE,
                        RoleId.GENERIC_ROLE))
                && c.getConsequent().equals(
                    new CompositeExpression(
                        LogicalOperatorType.OR,
                        new Fact("done"), new Fact(
                            "failure")))) {
              myAgent.addBehaviour(new FulfilledCommitToAcceptOrReject(
                  participant, t));
            }
          } catch (MissingOperandException
View Full Code Here

     proposal.setRoleReceiver(initiator);
     proposal.setPerformative(ACLMessage.PROPOSE);
    send(proposal);
   
    try {
      assertFact(new Fact("propose", participant, prop));
      createCommitment(new Commitment(participant, initiator, new Fact("accept"), new CompositeExpression(
          LogicalOperatorType.OR, new Fact("done"), new Fact("failure"))));
      //**** 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)) {
          Commitment cToAdd = new Commitment(com.getDebtor(), com.getCreditor(), new Fact("true"), com.getConsequent(), LifeCycleState.DETACHED)
          interactionState.removeCommitment(com);
          logger.debug("Commitment da rimuovere: "+com);
          createCommitment(cToAdd)
          actualProposals++;           
        }
      }
      if (actualProposals == numberMaxProposals) {
        acceptingProposals = false;
        RoleId groupParticipant = new RoleId(PARTICIPANT_ROLE, RoleId.GROUP_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");
       
      }
//        defineObsProperty("cc", initiator.getCanonicalName(), "GroupParticipant",
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

    send(done);
   
    try {
      ArrayList<Commitment> arrComm = new ArrayList<Commitment>();
      for (Commitment com : interactionState.retrieveCommitmentsByDebtorRoleId(participant)) {
        if (com.getConsequent().equals(new CompositeExpression(LogicalOperatorType.OR, new Fact("done"), new Fact("failure")))) {
          arrComm.add(com);
        }
      }
      for (Commitment com :arrComm) {
        if (com.getConsequent().equals(new CompositeExpression(LogicalOperatorType.OR, new Fact("done"), new Fact("failure")))) {
          Commitment cToAdd = new Commitment(com.getDebtor(), com.getCreditor(), com.getAntecedent(), com.getConsequent(), LifeCycleState.DISCHARGED)
          interactionState.removeCommitment(com);
          logger.debug("Commitment da rimuovere: "+com);
          createCommitment(cToAdd);       
        }
      }   
     
      assertFact(new Fact("done"));
      logger.trace("OPERATION PERFORMED: DONE by "+participant);
    } 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.