本文整理汇总了Java中jade.domain.FIPAException类的典型用法代码示例。如果您正苦于以下问题:Java FIPAException类的具体用法?Java FIPAException怎么用?Java FIPAException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FIPAException类属于jade.domain包,在下文中一共展示了FIPAException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAgentsByServiceType
import jade.domain.FIPAException; //导入依赖的package包/类
/**
* Find and returns agents by a service type.
*
* @param serviceType the service type
* @return the dF agent description[]
*/
protected DFAgentDescription[] findAgentsByServiceType(String serviceType) {
DFAgentDescription[] dfAgentDescriptions = null;
try {
DFAgentDescription agentDescription = new DFAgentDescription();
ServiceDescription serviceDescription = new ServiceDescription();
serviceDescription.setType(serviceType);
agentDescription.addServices(serviceDescription);
dfAgentDescriptions = DFService.search(this.myAgent, agentDescription);
} catch (FIPAException fe) {
//fe.printStackTrace();
System.err.println("DFService: Error while requesting the DFService!");
}
return dfAgentDescriptions;
}
示例2: findAgentsByServiceType
import jade.domain.FIPAException; //导入依赖的package包/类
/**
* Find and returns agents by a service type.
*
* @param serviceType the service type
* @return the dF agent description[]
*/
protected DFAgentDescription[] findAgentsByServiceType(String serviceType) {
DFAgentDescription[] dfAgentDescriptions = new DFAgentDescription[0];
try {
DFAgentDescription agentDescription = new DFAgentDescription();
ServiceDescription serviceDescription = new ServiceDescription();
serviceDescription.setType(serviceType);
agentDescription.addServices(serviceDescription);
dfAgentDescriptions = DFService.search(this, agentDescription);
} catch (FIPAException fe) {
//fe.printStackTrace();
System.err.println("DFService: Error while requesting the DFService!");
}
return dfAgentDescriptions;
}
示例3: registerAgInDF
import jade.domain.FIPAException; //导入依赖的package包/类
private void registerAgInDF() {
// DF register
DFAgentDescription dfa = new DFAgentDescription();
dfa.setName(getAID());
ServiceDescription vc = new ServiceDescription();
vc.setType("jason");
vc.setName(dfName);
dfa.addServices(vc);
try {
DFService.register(this,dfa);
} catch (FIPAException e) {
try {
DFService.deregister(this);
DFService.register(this,dfa);
} catch (Exception ex) {
logger.log(Level.SEVERE, "Error registering agent in DF", e);
logger.log(Level.SEVERE, "Error unregistering agent in DF", ex);
}
}
}
示例4: setup
import jade.domain.FIPAException; //导入依赖的package包/类
@Override
protected void setup() {
setRandomWallet();
addBehaviour(new BidRequestsServer());
// Register the auction-seller service in the yellow pages
DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(getAID());
ServiceDescription sd = new ServiceDescription();
sd.setType("auction-bidder");
sd.setName("MultiAgentSystem-auctions");
dfd.addServices(sd);
try {
DFService.register(this, dfd);
} catch (FIPAException e) {
e.printStackTrace();
}
System.out.println(getAID().getName() + " ready to buy some stuff. My wallet is $" + wallet);
}
示例5: findRobots
import jade.domain.FIPAException; //导入依赖的package包/类
private boolean findRobots() {
boolean found = false;
DFAgentDescription agentDescriptionTemplate = new DFAgentDescription();
ServiceDescription serviceTransport = new ServiceDescription();
serviceTransport.setType("Raw");
SearchConstraints searchConstraints = new SearchConstraints();
searchConstraints.setSearchId("Raw");
agentDescriptionTemplate.addServices(serviceTransport);
try {
DFAgentDescription[] foundRobots = DFService.search(this, agentDescriptionTemplate);
_broadcastAddr = new AID[foundRobots.length];
for (int i = 0; i < foundRobots.length; i++) {
found = true;
_broadcastAddr[i] = foundRobots[i].getName();
}
} catch (FIPAException exception) {
exception.printStackTrace();
}
return found;
}
示例6: registerDFRaw
import jade.domain.FIPAException; //导入依赖的package包/类
private void registerDFRaw() {
String agentServiceGroup = new String("Raw");
String agentServiceName = new String("Raw");
ServiceDescription serviceDescription = new ServiceDescription();
serviceDescription.setName(agentServiceGroup);
serviceDescription.setType(agentServiceName);
DFAgentDescription agentDescription = new DFAgentDescription();
agentDescription.setName(getAID());
agentDescription.addServices(serviceDescription);
try {
DFService.register(this, agentDescription);
} catch (FIPAException exception) {
exception.printStackTrace();
}
}
示例7: registerNeedWorker
import jade.domain.FIPAException; //导入依赖的package包/类
private void registerNeedWorker() {
DFAgentDescription dfServiceDescription = new DFAgentDescription();
if (this.floor instanceof CleaningFloor) {
ServiceDescription needClean = new ServiceDescription();
needClean.setName("needClean");
needClean.setType("needClean");
dfServiceDescription.addServices(needClean);
} else {
ServiceDescription needPaint = new ServiceDescription();
needPaint.setName("needPaint");
needPaint.setType("needPaint");
dfServiceDescription.addServices(needPaint);
}
try {
DFService.register(this.floorAgent, dfServiceDescription);
} catch (FIPAException e) {
e.printStackTrace();
}
}
示例8: register
import jade.domain.FIPAException; //导入依赖的package包/类
public static void register(Agent a, String service, Codec codec, String protocol, Ontology ontology) throws FIPAException {
DFAgentDescription dfad = new DFAgentDescription();
dfad.setName(a.getAID());
dfad.addLanguages(codec.getName());
dfad.addProtocols(protocol);
ServiceDescription sd = new ServiceDescription();
sd.setName(service + "-" + a.getLocalName());
sd.setType(service);
sd.addOntologies(ontology.getName());
sd.addLanguages(codec.getName());
sd.addProtocols(protocol);
dfad.addServices(sd);
DFService.register(a, dfad);
}
示例9: findAllByService
import jade.domain.FIPAException; //导入依赖的package包/类
public static ArrayList<AID> findAllByService(Agent a, String serviceName) throws FIPAException {
DFAgentDescription adTemplate = new DFAgentDescription();
ServiceDescription sd = new ServiceDescription();
sd.setType(serviceName);
adTemplate.addServices(sd);
DFAgentDescription[] dfAgentDescriptions = DFService.search(a, adTemplate);
if (dfAgentDescriptions.length <= 0) {
throw new FIPAException("Could not find proper service");
}
ArrayList<AID> aids = new ArrayList<AID>();
for (DFAgentDescription dfAgentDescription : dfAgentDescriptions) {
aids.add(dfAgentDescription.getName());
}
return aids;
}
示例10: getServerName
import jade.domain.FIPAException; //导入依赖的package包/类
public AID getServerName() {
if (server_name != null) {
return server_name;
}
DFAgentDescription template=new DFAgentDescription();
ServiceDescription sd=new ServiceDescription();
sd.setType("Organisation");
sd.setName("Multiplay");
template.addServices(sd);
try{
DFAgentDescription[] result=DFService.search(this, template);
if(result.length>0){
server_name = result[0].getName();
}
}catch(FIPAException fe){
fe.printStackTrace();
}
return server_name;
}
示例11: getNoteAgentName
import jade.domain.FIPAException; //导入依赖的package包/类
public AID getNoteAgentName() {
if (note_agent_name != null) {
return note_agent_name;
}
DFAgentDescription template=new DFAgentDescription();
ServiceDescription sd=new ServiceDescription();
sd.setType("Organisation");
sd.setName("MoveToNote");
template.addServices(sd);
try{
DFAgentDescription[] result=DFService.search(this, template);
if(result.length>0){
note_agent_name = result[0].getName();
}
}catch(FIPAException fe){
fe.printStackTrace();
}
return note_agent_name;
}
示例12: getMySoundAgent
import jade.domain.FIPAException; //导入依赖的package包/类
public AID getMySoundAgent() {
if (my_sound_name != null) {
return my_sound_name;
}
DFAgentDescription template=new DFAgentDescription();
ServiceDescription sd=new ServiceDescription();
sd.setType("Sound");
sd.setName("SoundPlay");
template.addServices(sd);
try{
DFAgentDescription[] result=DFService.search(this, template);
if(result.length>0){
for (int i = 0; i < result.length; i++) {
System.out.println("possible name = " + result[i].getName().getName());
if (result[i].getName().getName().contains(SoundPlayAgentNickName)) {
my_sound_name = result[i].getName();
break;
}
}
}
}catch(FIPAException fe){
fe.printStackTrace();
}
return my_sound_name;
}
示例13: setup
import jade.domain.FIPAException; //导入依赖的package包/类
protected void setup() {
DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(getAID());
ServiceDescription sd = new ServiceDescription();
sd.setType("Organisation");
sd.setName("MoveToNote");
dfd.addServices(sd);
try {
DFService.register(this, dfd);
}
catch (FIPAException fe) {
fe.printStackTrace();
}
this.addBehaviour(new SoundMessageDaemonBehaviour() );
}
示例14: action
import jade.domain.FIPAException; //导入依赖的package包/类
@Override
public void action() {
ACLMessage msg = new ACLMessage(ACLMessage.QUERY_IF);
msg.setLanguage("English");
msg.setContent("free");
DFAgentDescription orderPickerDesc = new DFAgentDescription();
ServiceDescription sd = new ServiceDescription();
sd.setType("pick");
sd.setName("pick");
orderPickerDesc.addServices(sd);
try {
for(DFAgentDescription desc : DFService.search(OrderAgent.this, orderPickerDesc)) {
msg.addReceiver(desc.getName());
}
} catch(FIPAException ex) {
ex.printStackTrace();
}
send(msg);
pick = new OrderPickerPicker();
addBehaviour(pick);
removeBehaviour(query);
query = null;
}
示例15: setup
import jade.domain.FIPAException; //导入依赖的package包/类
protected void setup() {
done = false;
items = new HashMap<>();
DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(getAID());
try {
DFService.register(this, dfd);
} catch(FIPAException ex) {
ex.printStackTrace();
}
Object[] args = this.getArguments();
if(args != null && args.length == 1 && args[0] instanceof List<?>) {
for(Pair<String, Integer> p : (List<Pair<String, Integer>>)args[0]) {
items.put(p, false);
}
} else {
System.err.println("[OrderAgent]: Argument Error");
}
query = new OrderPickerQuerier();
finish = new FinishChecker();
addBehaviour(query);
}