Package it.unito.di.artifact

Examples of it.unito.di.artifact.RoleId


      Commitment c = (Commitment) e.getElementChanged();
      if (c.getLifeCycleStatus() == LifeCycleState.DETACHED) {
        try {
          if (c.getDebtor().equals(initiator.getRoleId())
              && c.getCreditor().equals(
                  new RoleId(
                      CNPArtifactTimerMaxPart.PARTICIPANT_ROLE,
                      RoleId.GROUP_ROLE))
              && c.getConsequent().equals(
                  new CompositeExpression(
                      LogicalOperatorType.OR,
                      new Fact("accept"), new Fact(
                          "reject")))) {
            myAgent.addBehaviour(satisfyCommitToAcceptOrReject());
            logger.debug("SatisfyCommitToAcceptOrReject: "+(++satisfiedCommitToAcceptOrReject));
          }
        } catch (MissingOperandException
            | WrongOperandsNumberException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
      }

      else if (c.getLifeCycleStatus() == LifeCycleState.DISCHARGED) {
        try {
          if (c.getCreditor().equals(initiator.getRoleId())
              && c.getDebtor().equals(
                  new RoleId(
                      CNPArtifactTimerMaxPart.PARTICIPANT_ROLE,
                      RoleId.GENERIC_ROLE))
              && c.getConsequent().equals(
                  new CompositeExpression(
                      LogicalOperatorType.OR,
View Full Code Here


 
  @OPERATION
  public void cfp(Task task, RoleId initiator) {
   
     RoleMessage cfp = new RoleMessage();
     RoleId dest = new RoleId(PARTICIPANT_ROLE, RoleId.GENERIC_ROLE);
    cfp.setContents(task);
    cfp.setRoleSender(initiator);
    cfp.setRoleReceiver(dest);
    cfp.setPerformative(ACLMessage.CFP);
    send(cfp);
View Full Code Here

 
  @OPERATION
  public void accept(Proposal proposal, RoleId initiator) {
   
    RoleMessage accept = new RoleMessage();
     RoleId dest = proposal.getRoleId();
     accept.setRoleSender(initiator);
     accept.setRoleReceiver(dest);
     accept.setPerformative(ACLMessage.ACCEPT_PROPOSAL);
    send(accept);
   
View Full Code Here

 
  @OPERATION
  public void reject(Proposal proposal, RoleId initiator) {
   
    RoleMessage reject = new RoleMessage();
     RoleId dest = proposal.getRoleId();
     reject.setRoleSender(initiator);
     reject.setRoleReceiver(dest);
     reject.setPerformative(ACLMessage.REJECT_PROPOSAL);
    send(reject);
   
View Full Code Here

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

 
  @OPERATION
  public void cfp(Task task, RoleId initiator) {
   
     RoleMessage cfp = new RoleMessage();
     RoleId dest = new RoleId(PARTICIPANT_ROLE, RoleId.GENERIC_ROLE);
    cfp.setContents(task);
    cfp.setRoleSender(initiator);
    cfp.setRoleReceiver(dest);
    cfp.setPerformative(ACLMessage.CFP);
    send(cfp);
View Full Code Here

 
  @OPERATION
  public void accept(Proposal proposal, RoleId initiator) {
   
    RoleMessage accept = new RoleMessage();
     RoleId dest = proposal.getRoleId();
     accept.setRoleSender(initiator);
     accept.setRoleReceiver(dest);
     accept.setPerformative(ACLMessage.ACCEPT_PROPOSAL);
    send(accept);
   
View Full Code Here

 
  @OPERATION
  public void reject(Proposal proposal, RoleId initiator) {
   
    RoleMessage reject = new RoleMessage();
     RoleId dest = proposal.getRoleId();
     reject.setRoleSender(initiator);
     reject.setRoleReceiver(dest);
     reject.setPerformative(ACLMessage.REJECT_PROPOSAL);
    send(reject);
   
View Full Code Here

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

     
      @Override
      public void action() {
        ArtifactId art = Role.createArtifact(ARTIFACT_NAME, CommunicationArtifactImpl.class);
        CARole user = (CARole)(Role.enact(CommunicationArtifact.CA_ROLE, art, this, myAgent.getAID()));
        RoleId receiver = new RoleId(CommunicationArtifact.CA_ROLE, RoleId.GENERIC_ROLE);
        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
View Full Code Here

TOP

Related Classes of it.unito.di.artifact.RoleId

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.