Package it.unito.di.logic.expression

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


  }
 
  private static void testExpressionTree() throws MissingOperandException, WrongOperandsNumberException, CartagoException {
   
    CompositeExpression le1 =
        CompositeExpression.and(new Fact("pippo", new Fact("pippoInside")),
            CompositeExpression.or(new Fact("ripippo"),
              CompositeExpression.not(new Fact("ripippo")))
            );
   
    logger.info(le1.toString());   
    logger.error("pippo");
       
View Full Code Here


  }
 
  private static void testExpressionTree() throws MissingOperandException, WrongOperandsNumberException, CartagoException {
   
    CompositeExpression le1 =
        CompositeExpression.and(new Fact("pippo", new Fact("pippoInside")),
            CompositeExpression.or(new Fact("ripippo"),
              CompositeExpression.not(new Fact("ripippo")))
            );
   
    logger.info(le1.toString());   
    logger.error("pippo");
       
View Full Code Here

public class InitiatorRequirements extends Type {
 
  public InitiatorRequirements() throws MissingOperandException, WrongOperandsNumberException {
    super(new Commitment[]{
      new Commitment(CNPArtifact.INITIATOR_ROLE, CNPArtifact.PARTICIPANT_ROLE, "propose", new CompositeExpression(
          LogicalOperatorType.OR, new Fact("accept"), new Fact("reject")))
    });
 
View Full Code Here

  public TypeInitiator() throws MissingOperandException, WrongOperandsNumberException {
   
    super(new Commitment[]
        {new Commitment(CNPArtifact.INITIATOR_ROLE, CNPArtifact.PARTICIPANT_ROLE, "propose", new CompositeExpression(
          LogicalOperatorType.OR, new Fact("accept"), new Fact("reject")))
        });
  }
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);
      execInternalOp("startTiming");
    } catch (MissingOperandException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

      acceptingProposals = false;
      logger.debug("Not accepting proposals anymore");
      RoleId groupParticipant = new RoleId(PARTICIPANT_ROLE, RoleId.GROUP_ROLE);
      try {
        createCommitment(new Commitment(initiatorId, groupParticipant, new CompositeExpression(
            LogicalOperatorType.OR, new Fact("accept"), new Fact("reject"))));
      } catch (MissingOperandException | WrongOperandsNumberException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
View Full Code Here

     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

  public TypeOneParticipant() throws MissingOperandException, WrongOperandsNumberException {
 
    super(new Commitment[]{
        new Commitment(CNPArtifact.PARTICIPANT_ROLE, CNPArtifact.INITIATOR_ROLE, "accept", new CompositeExpression(
              LogicalOperatorType.OR, new Fact("done"), new Fact("failure")))
    });
  }
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++;           
        }
      }
      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

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.