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


Java DFAgentDescription.setName方法代码示例

本文整理汇总了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);
        }
    }
}
 
开发者ID:nickrfer,项目名称:code-sentinel,代码行数:21,代码来源:JadeAgArch.java

示例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);
}
 
开发者ID:ohvitorino,项目名称:auctions,代码行数:23,代码来源:BidderAgent.java

示例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();
		}
	}
 
开发者ID:gseteamproject,项目名称:gseproject,代码行数:18,代码来源:RobotAgent.java

示例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);
}
 
开发者ID:0xC70FF3,项目名称:java-gems,代码行数:17,代码来源:DFServiceHelper.java

示例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");
}
 
开发者ID:JordiCorbilla,项目名称:DDM,代码行数:24,代码来源:RegisterInDFBehaviour.java

示例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() );	
	
}
 
开发者ID:hukewei,项目名称:leapband,代码行数:18,代码来源:MoveToSoundAgent.java

示例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);
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:25,代码来源:OrderAgent.java

示例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());
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:18,代码来源:WarehouseAgent.java

示例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);
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:27,代码来源:OrderPicker.java

示例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");
	
}
 
开发者ID:autarchprinceps,项目名称:Multiagent-Warehouse,代码行数:21,代码来源:RobotAgent.java

示例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));
}
 
开发者ID:overheadhunter,项目名称:jade-factory,代码行数:23,代码来源:AbstractStation.java

示例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);
	}
}
 
开发者ID:dozed,项目名称:align-api-project,代码行数:17,代码来源:JadeFIPAAServiceAgent.java

示例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);
}
 
开发者ID:gsi-upm,项目名称:BeastTool,代码行数:33,代码来源:AgentRegistration.java

示例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));
}
 
开发者ID:gsi-upm,项目名称:BeastTool,代码行数:25,代码来源:ReporterAgent.java

示例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));
	
}
 
开发者ID:gsi-upm,项目名称:BeastTool,代码行数:26,代码来源:HelpDeskAgent.java


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