当前位置: 首页>>代码示例>>Java>>正文


Java ACLMessage.INFORM属性代码示例

本文整理汇总了Java中jade.lang.acl.ACLMessage.INFORM属性的典型用法代码示例。如果您正苦于以下问题:Java ACLMessage.INFORM属性的具体用法?Java ACLMessage.INFORM怎么用?Java ACLMessage.INFORM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在jade.lang.acl.ACLMessage的用法示例。


在下文中一共展示了ACLMessage.INFORM属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleGameEnd

private void handleGameEnd()
{
    // If the game still has remaining ghosts and collectibles,
    //  Pacman still didn't won the game
    int remainingGhosts = (int) board.getGhosts()
                                    .stream()
                                    .filter(ghost -> !ghost.isShouldDie())
                                    .count();
    
    if (0 < remainingGhosts && board.hasRemainingCollectibles())
    {
        return;
    }

    // Else, informs Game agent the game has been won (and should end)
    ACLMessage message = new ACLMessage(ACLMessage.INFORM);
    message.setOntology(GameVocabulary.ONTOLOGY);
    message.setContent(GameVocabulary.END_PACMAN_WINS);
    message.addReceiver(new AID(Constant.GAME_AGENT_NAME, AID.ISLOCALNAME));
    myAgent.send(message);
}
 
开发者ID:wguilen,项目名称:pacman-mas,代码行数:21,代码来源:PacmanMovementBehaviour.java

示例2: die

public void die()
{
    // Marks the ghost for dying
    setShouldDie(true);
    
    // Notifies other ghosts so they can run
    ACLMessage message = new ACLMessage(ACLMessage.INFORM);
    message.setOntology(GhostVocabulary.ONTOLOGY);
    message.setContent(GhostVocabulary.THE_MOTHERFUCKER_KILLED_ME);
    board.getGhosts()
            .stream()
            .filter(ghost -> !ghost.equals(this))
            .forEach(ghost -> message.addReceiver(ghost.getAID()));
    send(message);
    
    // Notifies GameAgent I'm dead
    message.clearAllReceiver();
    message.setOntology(GameVocabulary.ONTOLOGY);
    message.setContent(GameVocabulary.GHOST_KILLED);
    message.addReceiver(new AID(Constant.GAME_AGENT_NAME, AID.ISLOCALNAME));
    send(message);
    
    // Effectively dies
    doDelete();
}
 
开发者ID:wguilen,项目名称:pacman-mas,代码行数:25,代码来源:GhostAgent.java

示例3: informAgsEnvironmentChanged

public void informAgsEnvironmentChanged(Collection<String> agentsToNotify) {
    try {
        if (agentsToNotify == null) {
            informAgsEnvironmentChanged();
        } else {
            ACLMessage m = new ACLMessage(ACLMessage.INFORM);
            m.setContent("environmentChanged");
            for (String ag: agentsToNotify) {
                m.addReceiver(new AID(ag, AID.ISLOCALNAME));
            }
            send(m);
        }
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Error sending notifyEvents ", e);
    }
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:16,代码来源:JadeEnvironment.java

示例4: aclToKqml

public static String aclToKqml(ACLMessage m) {
    switch(m.getPerformative()) {
    case ACLMessage.INFORM: return "tell"; 
    case ACLMessage.QUERY_REF: return "askOne";
    case ACLMessage.REQUEST: return "achieve";
    /*case UNTELL: return "untell";
    case UNACHIEVE: return "unachieve";
    case ASKALL: return "askAll";
    case ASKHOW: return "askHow";
    case TELLHOW: return "tellHow";
    case UNTELLHOW: return "untellHow";*/
    case ACLMessage.INFORM_REF: 
        String kp = m.getUserDefinedParameter("kqml-performative");
        if (kp != null) {
            return kp;
        }
        break;
    }
    return ACLMessage.getPerformative(m.getPerformative()).toLowerCase().replaceAll("-", "_");    
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:20,代码来源:JadeAg.java

示例5: action

public void action() {
     ResultsAgent a = (ResultsAgent)myAgent;
     
      // Send result before closing down
     ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
     msg.setSender(a.getAID());
     msg.addReceiver(new AID(SendTo, false));
     try {
         Object[] oMsg=new Object[3];
         oMsg[0] = ID;
         oMsg[1] = bText1;
         oMsg[2] = bText2;
         
         msg.setContentObject(oMsg);
     } catch (IOException ex) {
         System.err.println("Cannot add result to message. Sending empty message.");
         ex.printStackTrace(System.err);
     }
     
     a.send(msg);        
}
 
开发者ID:ayushoriginal,项目名称:Ngram-Graphs,代码行数:21,代码来源:ResultsAgent.java

示例6: action

/** Actually sends the result to the dispatching agent.
  */
 public void action() {
     synchronized (myAgent) {
         NGramDocumentComparatorAgent a = (NGramDocumentComparatorAgent)myAgent;
     
          // Send result before closing down
         ACLMessage msg = new ACLMessage(ACLMessage.INFORM);
         msg.setSender(a.getAID());
         msg.addReceiver(a.ResultConsumer);
         try {
             msg.setContentObject(Result);
         } catch (IOException ex) {
             System.err.println("Cannot add result to message. Sending empty message.");
             ex.printStackTrace(System.err);
         }

         a.send(msg);
     }
     
}
 
开发者ID:ayushoriginal,项目名称:Ngram-Graphs,代码行数:21,代码来源:NGramDocumentComparatorAgent.java

示例7: kqmlToACL

public static ACLMessage kqmlToACL(String p) {
    if (p.equals("tell")) {
        return new ACLMessage(ACLMessage.INFORM);
    } else if (p.equals("askOne")) {
        return new ACLMessage(ACLMessage.QUERY_REF);
    } else if (p.equals("achieve")) {
        return new ACLMessage(ACLMessage.REQUEST);
    } else if (p.toLowerCase().equals("accept_proposal")) {
        return new ACLMessage(ACLMessage.ACCEPT_PROPOSAL);
    } else if (p.toLowerCase().equals("reject_proposal")) {
        return new ACLMessage(ACLMessage.REJECT_PROPOSAL);
    } else if (p.toLowerCase().equals("query_if")) {
        return new ACLMessage(ACLMessage.QUERY_IF);
    } else if (p.toLowerCase().equals("inform_if")) {
        return new ACLMessage(ACLMessage.INFORM_IF);            
    }
    int perf = ACLMessage.getInteger(p);
    if (perf == -1 || perf == ACLMessage.NOT_UNDERSTOOD) {
        ACLMessage m = new ACLMessage(ACLMessage.INFORM_REF);
        m.addUserDefinedParameter("kqml-performative", p);
        return m;
    }
    return new ACLMessage(perf);
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:24,代码来源:JadeAg.java

示例8: aclPerformativeToKqml

public static String aclPerformativeToKqml(ACLMessage m) {
    switch(m.getPerformative()) {
    case ACLMessage.INFORM:
        return "tell";
    case ACLMessage.QUERY_REF:
        return "askOne";
    case ACLMessage.REQUEST:
        return "achieve";
    case ACLMessage.INFORM_REF:
        String kp = m.getUserDefinedParameter("kqml-performative");
        if (kp != null) {
            return kp;
        }
        break;
    }
    return ACLMessage.getPerformative(m.getPerformative()).toLowerCase().replaceAll("-", "_");
}
 
开发者ID:jason-lang,项目名称:jason,代码行数:17,代码来源:JadeAg.java

示例9: action

@Override
public void action() {
	DFAgentDescription[] cleanServices = findCleanServices();
	if (cleanServices != null) {
		if (!_controller.doWork()) {
			// failure
		} else {
			if(this.serviceName.equals("needClean")){
				_communicator.requestCleanBlock();
			} else {
				_communicator.requestPaintBlock();;
			}
			ACLMessage reply = _communicator.receiveReply();
			if (reply.getPerformative() == ACLMessage.INFORM) {
				System.out.println(this.myAgent.getAID().getLocalName() + ": performed working successfully");
			} else {
				System.out.println("working failed");
			}
		}
	}
	this.myAgent.doWait(1000);
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:22,代码来源:WorkerBehaviour.java

示例10: moveAndgetBlockFromSourcePalette

private void moveAndgetBlockFromSourcePalette() {
	// _controller.move(sourcePaletteColor);
	// _agent.broadCastColor(sourcePaletteColor);
	//this.sendPosition((byte) 2);
	_robotToStationCommunicator.requestDirtyBlock();
	ACLMessage reply = _robotToStationCommunicator.receiveReply();
	if (reply.getPerformative() == ACLMessage.INFORM) {
		try {
			_state.block = (Block) reply.getContentObject();
			_state.isCarryingBlock = true;
		} catch (UnreadableException e) {
			e.printStackTrace();
		}
	} else {
		// Exception handlung
	}
}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:17,代码来源:TransporterBehaviour.java

示例11: receiveMessage

@Override
public void receiveMessage(final FrameworkMessage msg, final String messageID,
		final String inReplyToMessageID, final JadeControllerMock jade_ControllerMock) {
	final ACLMessage aclMsg = new ACLMessage(ACLMessage.INFORM);
	aclMsg.addReceiver(aid);
	aclMsg.setContent(msg.toPrettyPrintedXMLString());
	aclMsg.setConversationId("jade-controller");
	aclMsg.setReplyWith(UUID.randomUUID().toString());

	System.out
			.println("[JADE Controller Agent ] Sending message to distributed JADE Agent: "
					+ distributedSystemID
					+ " "
					+ distributedAutonomousAgentID
					+ " "
					+ distAutAgentModelID);
	jadeControllerAgent.send(aclMsg);

}
 
开发者ID:OpenSimulationSystems,项目名称:CABSF_Java,代码行数:19,代码来源:CsfDistributedJADEagentWrapper.java

示例12: action

@Override
public void action() {
	ACLMessage message = receive();

	if (message != null && message.getPerformative() == ACLMessage.INFORM) {
		AID sender = message.getSender();

		if (message.getContent().equals(Message.FINISH_SIMULATION)){
			countSoundSourcesFinished++;
			if(countSoundSourcesFinished==ambient.getSoundSources().size()){
				finishSimulation();
				System.out.println("Simulation finished.");
				countSoundSourcesFinished=0;
			}
		}
		else {
			send(Message.getAnswerOfANotUnderstoodMessage(sender));					
		}
	}
}
 
开发者ID:gabriel-augusto,项目名称:AcSimus,代码行数:20,代码来源:Ambient.java

示例13: action

@Override
public void action() {
	ACLMessage message = new ACLMessage(ACLMessage.INFORM);
	message.setConversationId("BACKGROUND");
	message.addReceiver(myAgent.getSoundAgentName());
	my_data.setAction(type);
	my_data.setPath(path);

	ObjectMapper mapper = new ObjectMapper();
	StringWriter sw = new StringWriter();
	try {			
		mapper.writeValue(sw, my_data);
		message.setContent(sw.toString());				
	} catch (Exception e) {
		e.printStackTrace();
	}
	myAgent.send(message);
	System.out.println("bg message sent");
}
 
开发者ID:hukewei,项目名称:leapband,代码行数:19,代码来源:SendBgMusicBehaviour.java

示例14: action

@Override
public void action() {
	ObjectMapper mapper = new ObjectMapper();
	StringWriter sw = new StringWriter();
	ACLMessage message = new ACLMessage(ACLMessage.INFORM);
	try {			

		mapper.writeValue(sw, inform);
		
		message.addReceiver(aid);
		//message.setConversationId(id.toString());
		message.setConversationId("NOTE");
		message.setContent(sw.toString());				
		myAgent.send(message);
	} catch (Exception e) {

		e.printStackTrace();
	}			
}
 
开发者ID:hukewei,项目名称:leapband,代码行数:19,代码来源:SenderInformBehaviour.java

示例15: action

@Override
public void action() {
	ACLMessage recMsg = receive(MessageTemplate.MatchPerformative(ACLMessage.INFORM));
	if(recMsg != null) {
		ACLMessage response = new ACLMessage(ACLMessage.INFORM);
		Order ordr = unfinishedOrders.get(recMsg.getSender());
		for(AID rec : ordr.requestingAgents) {
			response.addReceiver(rec);
		}
		response.setLanguage("JSON");
		StringBuilder sb = new StringBuilder("{id:");
		sb.append(ordr.id).append(",list:[");
		for(Pair<String, Integer> p : ordr.items) {
			sb.append(p.getFirst()).append(":").append(p.getSecond()).append(",");
		}
		sb.deleteCharAt(sb.length() - 1);
		sb.append("]}");
		response.setContent(sb.toString());
		System.out.println("WarehouseAgent: Sending completed order to customer: " + ordr.id);
		send(response);
	} else {
		block();
	}
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:24,代码来源:WarehouseAgent.java


注:本文中的jade.lang.acl.ACLMessage.INFORM属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。