本文整理汇总了Java中jade.domain.FIPAAgentManagement.DFAgentDescription.setName方法的典型用法代码示例。如果您正苦于以下问题:Java DFAgentDescription.setName方法的具体用法?Java DFAgentDescription.setName怎么用?Java DFAgentDescription.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jade.domain.FIPAAgentManagement.DFAgentDescription
的用法示例。
在下文中一共展示了DFAgentDescription.setName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerAgInDF
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的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);
}
}
}
示例2: setup
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的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);
}
示例3: registerDFRaw
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的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();
}
}
示例4: register
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的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);
}
示例5: action
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的package包/类
public void action() {
sm.Log("RegisterInDFBehaviour - start");
ServiceDescription sd = new ServiceDescription();
sd.setType(getType());
sd.setName(this.myAgent.getName());
sd.setOwnership(getOwner());
DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(this.myAgent.getAID());
dfd.addServices(sd);
try {
DFAgentDescription[] dfds = DFService.search(this.myAgent, dfd);
if (dfds.length > 0) {
DFService.deregister(this.myAgent, dfd);
}
DFService.register(this.myAgent, dfd);
sm.Log(this.myAgent.getLocalName() + " is ready.");
} catch (Exception ex) {
sm.Log("Failed registering with DF! Shutting down...");
ex.printStackTrace();
this.myAgent.doDelete();
}
sm.Log("RegisterInDFBehaviour - end");
}
示例6: setup
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的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() );
}
示例7: setup
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的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);
}
示例8: setup
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的package包/类
protected void setup() {
DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(getAID());
ServiceDescription sd = new ServiceDescription();
sd.setName("WarehouseAgent");
sd.setType("WA");
dfd.addServices(sd);
try {
DFService.register(this, dfd);
} catch(FIPAException ex) {
ex.printStackTrace();
}
this.addBehaviour(new OrderRequestReceiver());
this.addBehaviour(new FinishedOrderReceiver());
this.addBehaviour(new FailedOrderReceiver());
}
示例9: setup
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的package包/类
@Override
protected void setup()
{
DFAgentDescription agentDescription = new DFAgentDescription();
ServiceDescription serviceDescription = new ServiceDescription();
serviceDescription.setName(SERVICE_NAME);
serviceDescription.setType(SERVICE_NAME);
agentDescription.setName(getAID());
agentDescription.addServices(serviceDescription);
try
{
DFService.register(this, agentDescription);
}
catch (FIPAException e)
{
e.printStackTrace();
}
// System.out.println(getLocalName() + "available.");
this.isIdle = true;
this.idle = new IdleBehaviour();
this.orderReceiver = new OrderReceiver();
addBehaviour(this.idle);
addBehaviour(this.orderReceiver);
}
示例10: setup
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的package包/类
@Override
protected void setup() {
// REGISTER SERVICE
DFAgentDescription agentDesc = new DFAgentDescription();
ServiceDescription serviceDesc = new ServiceDescription();
serviceDesc.setType(SERVICE_TYPE);
serviceDesc.setName(SERVICE_TYPE);
agentDesc.setName(getAID());
agentDesc.addServices(serviceDesc);
try {
DFService.register(this, agentDesc);
} catch (FIPAException e) {
e.printStackTrace();
}
log("setup done");
}
示例11: setup
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的package包/类
@Override
protected void setup() {
super.setup();
// register service:
final DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(getAID());
final ServiceDescription sd = new ServiceDescription();
sd.setType(getServiceType().name());
sd.setName(getStationName());
dfd.addServices(sd);
try {
DFService.register(this, dfd);
LOG.info("Registered station " + getStationName() + " of type " + getServiceType().name());
} catch (FIPAException fe) {
LOG.error("Error during agent registration.", fe);
}
// add behaviours:
this.addBehaviour(new ProposingBehaviour(Constants.CONV_ID_PICKUP, this));
this.addBehaviour(new ProposingBehaviour(Constants.CONV_ID_DROPOFF, this));
}
示例12: registerWithDF
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的package包/类
private void registerWithDF() {
DFAgentDescription dfd = new DFAgentDescription();
dfd.setName(getAID());
ServiceDescription sd = new ServiceDescription();
sd.setName(getLocalName()+'-'+SERVICE_NAME);
sd.setType(SERVICE_TYPE);
dfd.addServices(sd);
try {
//myLogger.log(Logger.INFO, "Registering with DF...");
DFService.register(this, dfd);
//myLogger.log(Logger.INFO, "Registration OK.");
}
catch (FIPAException fe) {
myLogger.log(Logger.WARNING, "Error registering with DF.", fe);
}
}
示例13: registerAgent
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的package包/类
/**
* Register the agent in the platform
*
* @param agent_name
* The name of the agent to be registered
* @param agent
* The agent to register.
* @throws FIPAException
*/
public static void registerAgent(Agent agent, String serviceName, String serviceType) throws FIPAException{
DFAgentDescription dfd = new DFAgentDescription();
ServiceDescription sd = new ServiceDescription();
sd.setType(serviceType);
sd.setName(serviceName);
//NOTE El serviceType es un string que define el tipo de servicio publicado en el DF por el Agente X.
// He escogido crear nombres en clave en jade.common.Definitions para este campo.
//NOTE El serviceName es el nombre efectivo del servicio.
// Esto es lo que el usuario va a definir en MockConfiguration.DFNameService y no el tipo como estaba puesto.
// sd.setType(agentType);
// sd.setName(agent.getLocalName());
//Add services??
// Sets the agent description
dfd.setName(agent.getAID());
dfd.addServices(sd);
// Register the agent
DFService.register(agent, dfd);
}
示例14: setup
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的package包/类
public void setup() {
this.myIntrospector = JadeAgentIntrospector.getMyInstance((Agent) this);
LogActivator.logToFile(logger, this.getName(), Level.ALL);
// Register the service
try {
DFAgentDescription dfd = new DFAgentDescription();
ServiceDescription sd = new ServiceDescription();
sd.setType("server");
sd.setName("report-service");
// Sets the agent description
dfd.setName(this.getAID());
dfd.addServices(sd);
// Register the agent
DFService.register(this, dfd);
} catch (Exception e) {
logger.severe("Exception registering agent in DF. Agent: " + this.getName());
}
MessageTemplate t = MessageTemplate.MatchPerformative(ACLMessage.INFORM);
addBehaviour(new ReportServer(this,t));
}
示例15: setup
import jade.domain.FIPAAgentManagement.DFAgentDescription; //导入方法依赖的package包/类
public void setup() {
this.myIntrospector = JadeAgentIntrospector.getMyInstance((Agent) this);
LogActivator.logToFile(logger, this.getName(), Level.ALL);
// Register the service
try {
DFAgentDescription dfd = new DFAgentDescription();
ServiceDescription sd = new ServiceDescription();
sd.setType("server");
sd.setName("helpdesk-service");
// Sets the agent description
dfd.setName(this.getAID());
dfd.addServices(sd);
// Register the agent
DFService.register(this, dfd);
} catch (Exception e) {
logger.severe("Exception registering agent in DF. Agent: " + this.getName());
}
MessageTemplate t = MessageTemplate.MatchPerformative(ACLMessage.REQUEST);
addBehaviour(new HelpDeskServer(this,t));
}