Package it.unito.di.logic.expression

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


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

    initiator.start();
  }
 
  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

    initiator.start();
  }
 
  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

      // poiche siamo in un ambiente distribuito. Quindi ci vanno meccanismi di matching sullo stato sociale:
      // 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) {
View Full Code Here

public class TypeInitiator extends Type {

  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

    if (acceptingProposals) {
      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

     reject.setRoleReceiver(dest);
     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();
View Full Code Here

TOP

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

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.