/** * Create a df service description. * @param name The name. * @param type The type. * @param ownership The ownership. * @return The service description. */ public IDFServiceDescription createDFServiceDescription(String name, String type, String ownership) { return new DFServiceDescription(name, type, ownership); }
/** * Create a df service description. * @param name The name. * @param type The type. * @param ownership The ownership. * @return The service description. */ public IDFServiceDescription createDFServiceDescription(String name, String type, String ownership) { return new DFServiceDescription(name, type, ownership); }
/** * Create a df service description. * @param name The name. * @param type The type. * @param ownership The ownership. * @return The service description. */ public IDFServiceDescription createDFServiceDescription(String name, String type, String ownership) { return new DFServiceDescription(name, type, ownership); }
/** * Create a df service description. * @param name The name. * @param type The type. * @param ownership The ownership. * @param languages The languages. * @param ontologies The ontologies. * @param protocols The protocols. * @param properties The properties. * @return The service description. */ public IDFServiceDescription createDFServiceDescription(String name, String type, String ownership, String[] languages, String[] ontologies, String[] protocols, IProperty[] properties) { DFServiceDescription ret = new DFServiceDescription(name, type, ownership); for(int i=0; languages!=null && i<languages.length; i++) ret.addLanguage(languages[i]); for(int i=0; ontologies!=null && i<ontologies.length; i++) ret.addOntology(ontologies[i]); for(int i=0; protocols!=null && i<protocols.length; i++) ret.addProtocol(protocols[i]); for(int i=0; properties!=null && i<properties.length; i++) ret.addProperty(properties[i]); return ret; }
/** * Create a df service description. * @param name The name. * @param type The type. * @param ownership The ownership. * @param languages The languages. * @param ontologies The ontologies. * @param protocols The protocols. * @param properties The properties. * @return The service description. */ public IDFServiceDescription createDFServiceDescription(String name, String type, String ownership, String[] languages, String[] ontologies, String[] protocols, IProperty[] properties) { DFServiceDescription ret = new DFServiceDescription(name, type, ownership); for(int i=0; languages!=null && i<languages.length; i++) ret.addLanguage(languages[i]); for(int i=0; ontologies!=null && i<ontologies.length; i++) ret.addOntology(ontologies[i]); for(int i=0; protocols!=null && i<protocols.length; i++) ret.addProtocol(protocols[i]); for(int i=0; properties!=null && i<properties.length; i++) ret.addProperty(properties[i]); return ret; }
/** * Create a df service description. * @param name The name. * @param type The type. * @param ownership The ownership. * @param languages The languages. * @param ontologies The ontologies. * @param protocols The protocols. * @param properties The properties. * @return The service description. */ public IDFServiceDescription createDFServiceDescription(String name, String type, String ownership, String[] languages, String[] ontologies, String[] protocols, IProperty[] properties) { DFServiceDescription ret = new DFServiceDescription(name, type, ownership); for(int i=0; languages!=null && i<languages.length; i++) ret.addLanguage(languages[i]); for(int i=0; ontologies!=null && i<ontologies.length; i++) ret.addOntology(ontologies[i]); for(int i=0; protocols!=null && i<protocols.length; i++) ret.addProtocol(protocols[i]); for(int i=0; properties!=null && i<properties.length; i++) ret.addProperty(properties[i]); return ret; }
/** * First the player searches a dealer, then sends a join-request to this * dealer. */ public void body() { //System.out.println("Searching dealer..."); // Create a service description to search for. IDF df = (IDF)SServiceProvider.getService(getAgent(), IDF.class, RequiredServiceInfo.SCOPE_PLATFORM).get(); IDFServiceDescription sd = new DFServiceDescription(null, "blackjack", null); IDFComponentDescription ad = new DFComponentDescription(null, sd); ISearchConstraints sc = new SearchConstraints(-1, 0); IDFComponentDescription[] result = df.search(ad, sc).get(); if(result==null || result.length==0) { getLogger().warning("No blackjack-dealer found."); fail(); } else { // at least one matching description found, getLogger().info(result.length + " blackjack-dealer found"); // choose one dealer randomly out of all the dealer-agents IComponentIdentifier dealer = result[new Random().nextInt(result.length)].getName(); getBeliefbase().getBelief("dealer").setFact(dealer); } }
/** * Search the environent agent and store its AID in the beliefbase. */ protected void searchEnvironmentAgent() { try { IDF df = (IDF)SServiceProvider.getService(getAgent(), IDF.class, RequiredServiceInfo.SCOPE_PLATFORM).get(); IDFServiceDescription sd = new DFServiceDescription(null, "dispatch vision", null); IDFComponentDescription ad = new DFComponentDescription(null, sd); IDFComponentDescription[] tas = df.search(ad, null).get(); if(tas.length!=0) { getBeliefbase().getBelief("environmentagent").setFact(tas[0].getName()); if(tas.length>1) System.out.println("WARNING: more than environment agent found."); } } catch(GoalFailureException gfe) { getLogger().warning("DF search failed: "+gfe); } } }
/** * Search the environent agent and store its AID in the beliefbase. */ protected IComponentIdentifier searchEnvironmentAgent() { IComponentIdentifier res = (IComponentIdentifier)getBeliefbase().getBelief("environmentagent").getFact(); if(res==null) { IDF df = (IDF)SServiceProvider.getService(getAgent(), IDF.class, RequiredServiceInfo.SCOPE_PLATFORM).get(); IDFServiceDescription sd = new DFServiceDescription(null, "dispatch vision", null); IDFComponentDescription ad = new DFComponentDescription(null, sd); IDFComponentDescription[] tas = df.search(ad, null).get(); if(tas.length!=0) { // Found. res = tas[0].getName(); getBeliefbase().getBelief("environmentagent").setFact(res); if(tas.length>1) getLogger().warning("More than environment agent found."); } else { // Not found. throw new PlanFailureException(); } } return res; }
/** * Search the environent agent and store its AID in the beliefbase. */ protected IComponentIdentifier searchEnvironmentAgent() { IComponentIdentifier res = (IComponentIdentifier)getBeliefbase().getBelief("environmentagent").getFact(); if(res==null) { IDF df = (IDF)SServiceProvider.getService(getAgent(), IDF.class, RequiredServiceInfo.SCOPE_PLATFORM).get(); IDFServiceDescription sd = new DFServiceDescription(null, "hunter-prey environment", null); IDFComponentDescription ad = new DFComponentDescription(null, sd); IDFComponentDescription[] tas = df.search(ad, null).get(); if(tas.length!=0) { // Found. res = tas[0].getName(); getBeliefbase().getBelief("environmentagent").setFact(res); if(tas.length>1) getLogger().warning("More than environment agent found."); } else { // Not found. throw new PlanFailureException(); } } return res; }
IDFServiceDescription sd = new DFServiceDescription("service_produce", null, null); IDFComponentDescription dfadesc = new DFComponentDescription(null, sd);
IDFServiceDescription sd = new DFServiceDescription("service_sentry", null, null); IDFComponentDescription dfadesc = new DFComponentDescription(null, sd);
IDFServiceDescription sd = new DFServiceDescription("service_sentry", null, null); IDFComponentDescription dfadesc = new DFComponentDescription(null, sd);
IDFServiceDescription sd = new DFServiceDescription("service_carry", null, null); IDFComponentDescription dfadesc = new DFComponentDescription(null, sd);
IDFServiceDescription service = new DFServiceDescription(null, "service_seller", null); IDFComponentDescription desc = new DFComponentDescription(null, service); IDFComponentDescription[] result = df.search(desc, null).get();