本文整理汇总了Java中jason.runtime.Settings类的典型用法代码示例。如果您正苦于以下问题:Java Settings类的具体用法?Java Settings怎么用?Java Settings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Settings类属于jason.runtime包,在下文中一共展示了Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryToIncludeMindInspectorForAg
import jason.runtime.Settings; //导入依赖的package包/类
private boolean tryToIncludeMindInspectorForAg(String path) {
try {
Agent ag = registeredAgents.get(getAgNameFromPath(path));
if (ag != null) {
AgArch arch = ag.getTS().getUserAgArch();
if (arch != null) {
// should add a new conf for mindinspector, otherwise will start a new gui for the agent
arch.getTS().getSettings().addOption(Settings.MIND_INSPECTOR,"web(cycle,html,no_history)");
MindInspectorAgArch miArch = new MindInspectorAgArch();
arch.insertAgArch(miArch);
miArch.init();
miArch.addAgState();
return true;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
示例2: changeToDebugMode
import jason.runtime.Settings; //导入依赖的package包/类
/** change the current running MAS to debug mode */
void changeToDebugMode() {
try {
if (control == null) {
control = new CentralisedExecutionControl(new ClassParameters(ExecutionControlGUI.class.getName()), this);
for (CentralisedAgArch ag : ags.values()) {
ag.setControlInfraTier(control);
Settings stts = ag.getTS().getSettings();
stts.setVerbose(2);
stts.setSync(true);
ag.getLogger().setLevel(Level.FINE);
ag.getTS().getLogger().setLevel(Level.FINE);
ag.getTS().getAg().getLogger().setLevel(Level.FINE);
}
}
} catch (Exception e) {
logger.log(Level.SEVERE, "Error entering in debug mode", e);
}
}
示例3: createArchs
import jason.runtime.Settings; //导入依赖的package包/类
/**
* Creates the user agent architecture, default architecture is
* jason.architecture.AgArch. The arch will create the agent that creates
* the TS.
*/
public void createArchs(List<String> agArchClasses, String agClass, ClassParameters bbPars, String asSrc, Settings stts, RunCentralisedMAS masRunner) throws JasonException {
try {
this.masRunner = masRunner;
Agent.create(this, agClass, bbPars, asSrc, stts);
insertAgArch(this);
createCustomArchs(agArchClasses);
// mind inspector arch
if (stts.getUserParameter(Settings.MIND_INSPECTOR) != null) {
insertAgArch( (AgArch)Class.forName( Config.get().getMindInspectorArchClassName()).newInstance() );
getFirstAgArch().init();
}
setLogger();
} catch (Exception e) {
running = false;
throw new JasonException("as2j: error creating the agent class! - "+e.getMessage(), e);
}
}
示例4: addInitialGoalsFromProjectInBB
import jason.runtime.Settings; //导入依赖的package包/类
protected void addInitialGoalsFromProjectInBB() {
String sGoals = getTS().getSettings().getUserParameter(Settings.INIT_GOALS);
if (sGoals != null) {
try {
for (Term t: ASSyntax.parseList("["+sGoals+"]")) {
Literal g = ((Literal)t).forceFullLiteralImpl();
g.makeVarsAnnon();
if (! g.hasSource())
g.addAnnot(BeliefBase.TSelf);
getTS().getC().addAchvGoal(g,Intention.EmptyInt);
}
} catch (Exception e) {
logger.log(Level.WARNING, "Initial goals from project '["+sGoals+"]' is not a list of literals.");
}
}
}
示例5: initAg
import jason.runtime.Settings; //导入依赖的package包/类
@Override
public void initAg(String agClass, ClassParameters bbPars, String asSrc, Settings stts) throws JasonException {
super.initAg(agClass, bbPars, asSrc, stts);
logger = Logger.getLogger(ACArchitecture.class.getName()+"."+getAgName());
String username = stts.getUserParameter("username");
if (username.startsWith("\"")) username = username.substring(1,username.length()-1);
String password = stts.getUserParameter("password");
if (password.startsWith("\"")) password = password.substring(1,password.length()-1);
proxy = new ACProxy( this,
stts.getUserParameter("host"),
Integer.parseInt(stts.getUserParameter("port")),
username,
password);
proxy.start();
}
示例6: initAg
import jason.runtime.Settings; //导入依赖的package包/类
@Override
public void initAg(String agClass, ClassParameters bbPars, String asSrc, Settings stts) throws JasonException {
super.initAg(agClass, bbPars, asSrc, stts);
logger = Logger.getLogger(ACArchitecture.class.getName()+"."+getAgName());
String username = stts.getUserParameter("username");
if (username.startsWith("\"")) username = username.substring(1,username.length()-1);
//if (username.startsWith("#nid")) username = ""+(getAgId(getAgName())+1);
username = username.replaceAll("#nid", ""+(getAgId(getAgName())+1));
String password = stts.getUserParameter("password");
if (password.startsWith("\"")) password = password.substring(1,password.length()-1);
waitSleepThread = new WaitSleep();
waitSleepThread.start();
proxy = new ACProxy( this,
stts.getUserParameter("host"),
Integer.parseInt(stts.getUserParameter("port")),
username,
password);
new Thread(proxy,"AgentProxy"+username).start();
}
示例7: initAg
import jason.runtime.Settings; //导入依赖的package包/类
@Override
public void initAg(String agClass, ClassParameters bbPars, String asSrc, Settings stts) throws JasonException {
super.initAg(agClass, bbPars, asSrc, stts);
logger = Logger.getLogger(ACArchitecture.class.getName()+"."+getAgName());
String username = stts.getUserParameter("username");
if (username.startsWith("\"")) username = username.substring(1,username.length()-1);
//if (username.startsWith("#nid")) username = ""+(getAgId(getAgName())+1);
username = username.replaceAll("#nid", ""+(getAgId(getAgName())+1));
String password = stts.getUserParameter("password");
if (password.startsWith("\"")) password = password.substring(1,password.length()-1);
waitSleepThread = new WaitSleep();
waitSleepThread.start();
proxy = new ACProxy( this,
stts.getUserParameter("host"),
Integer.parseInt(stts.getUserParameter("port")),
username,
password);
new Thread(proxy,"AgentProxy"+username).start();
}
示例8: initAg
import jason.runtime.Settings; //导入依赖的package包/类
public void initAg(String agClass, String asSrc, Settings stts) throws JasonException {
super.initAg(agClass, asSrc, stts);
logger = Logger.getLogger(ClimaArchitecture.class.getName()+"."+getAgName());
String username = stts.getUserParameter("username");
if (username.startsWith("\"")) username = username.substring(1,username.length()-1);
String password = stts.getUserParameter("password");
if (password.startsWith("\"")) password = password.substring(1,password.length()-1);
boolean gui = true;
if ("no".equals(stts.getUserParameter("gui"))) {
gui = false;
}
clima = new ClimaProxy(this,
stts.getUserParameter("host"),
Integer.parseInt(stts.getUserParameter("port")),
username,
password,
gui);
//launch proxy agent
try {
// try to discover the ag id
int id = Integer.parseInt(getAgName().substring(5));
clima.setAgId(id-1);
} catch (Exception e) {}
clima.start();
}
示例9: initAg
import jason.runtime.Settings; //导入依赖的package包/类
@Override
public void initAg(String agClass, ClassParameters bbPars, String asSrc, Settings stts) throws JasonException {
super.initAg(agClass, bbPars, asSrc, stts);
logger = Logger.getLogger(ACArchitecture.class.getName()+"."+getAgName());
String username = stts.getUserParameter("username");
if (username.startsWith("\"")) username = username.substring(1,username.length()-1);
String password = stts.getUserParameter("password");
if (password.startsWith("\"")) password = password.substring(1,password.length()-1);
waitSleepThread = new WaitSleep();
waitSleepThread.start();
proxy = new ACProxy( this,
stts.getUserParameter("host"),
Integer.parseInt(stts.getUserParameter("port")),
username,
password);
new Thread(proxy,"AgentProxy"+username).start();
}
示例10: initAg
import jason.runtime.Settings; //导入依赖的package包/类
@Override
public void initAg(String agClass, ClassParameters bbPars, String asSrc, Settings stts) throws JasonException {
super.initAg(agClass, bbPars, asSrc, stts);
model = new LocalWorldModel(10,10, WorldModel.agsByTeam, getTS().getAg().getBB()); // just to have a default model
gui = "yes".equals(stts.getUserParameter("gui"));
if ("yes".equals(stts.getUserParameter("write_status"))) {
writeStatusThread = WriteStatusThread.create(this);
}
WriteStatusThread.registerAgent(getAgName(), this);
// create the viewer for contest simulator
massimBackDir = stts.getUserParameter("ac_sim_back_dir");
if (massimBackDir != null && massimBackDir.startsWith("\""))
massimBackDir = massimBackDir.substring(1,massimBackDir.length()-1);
logger = Logger.getLogger(CowboyArch.class.getName() + ".CA-" + getAgName());
setCheckCommunicationLink(false);
}
示例11: createReplAg
import jason.runtime.Settings; //导入依赖的package包/类
@Override
protected void createReplAg(String n) {
CentralisedAgArch agArch = new CentralisedAgArch();
try {
agArch.setAgName(n);
List<String> archs = new ArrayList<String>();
archs.add(CAgentArch.class.getName());
archs.add(JaCaMoAgArch.class.getName());
agArch.createArchs(archs, ReplAgGUI.class.getName(), null, null, new Settings(), JaCaMoLauncher.this);
Thread agThread = new Thread(agArch);
agArch.setThread(agThread);
agThread.start();
} catch (JasonException e1) {
e1.printStackTrace();
}
addAg(agArch);
}
示例12: tryToIncludeMindInspectorForAg
import jason.runtime.Settings; //导入依赖的package包/类
private boolean tryToIncludeMindInspectorForAg(String path) {
try {
Agent ag = registeredAgents.get(getAgNameFromPath(path));
if (ag != null) {
AgArch arch = ag.getTS().getUserAgArch();
if (arch != null) {
// should add a new conf for mindinspector, otherwise will start a new gui for the agent
arch.getTS().getSettings().addOption(Settings.MIND_INSPECTOR,"web(cycle,html,no_history)");
MindInspectorAgArch miArch = new MindInspectorAgArch();
arch.insertAgArch(miArch);
miArch.init();
miArch.addAgState();
return true;
}
}
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
示例13: changeToDebugMode
import jason.runtime.Settings; //导入依赖的package包/类
/** change the current running MAS to debug mode */
protected void changeToDebugMode() {
try {
if (control == null) {
control = new CentralisedExecutionControl(new ClassParameters(ExecutionControlGUI.class.getName()), this);
for (CentralisedAgArch ag : ags.values()) {
ag.setControlInfraTier(control);
Settings stts = ag.getTS().getSettings();
stts.setVerbose(2);
stts.setSync(true);
ag.getLogger().setLevel(Level.FINE);
ag.getTS().getLogger().setLevel(Level.FINE);
ag.getTS().getAg().getLogger().setLevel(Level.FINE);
}
}
} catch (Exception e) {
logger.log(Level.SEVERE, "Error entering in debug mode", e);
}
}
示例14: createArchs
import jason.runtime.Settings; //导入依赖的package包/类
/**
* Creates the user agent architecture, default architecture is
* jason.architecture.AgArch. The arch will create the agent that creates
* the TS.
*/
public void createArchs(List<String> agArchClasses, String agClass, ClassParameters bbPars, String asSrc, Settings stts, BaseCentralisedMAS masRunner) throws JasonException {
try {
this.masRunner = masRunner;
Agent.create(this, agClass, bbPars, asSrc, stts);
insertAgArch(this);
createCustomArchs(agArchClasses);
// mind inspector arch
if (stts.getUserParameter(Settings.MIND_INSPECTOR) != null) {
insertAgArch( (AgArch)Class.forName( Config.get().getMindInspectorArchClassName()).newInstance() );
getFirstAgArch().init();
}
setLogger();
} catch (Exception e) {
running = false;
throw new JasonException("as2j: error creating the agent class! - "+e.getMessage(), e);
}
}
示例15: addInitialGoalsFromProjectInBB
import jason.runtime.Settings; //导入依赖的package包/类
protected void addInitialGoalsFromProjectInBB() {
String sGoals = getTS().getSettings().getUserParameter(Settings.INIT_GOALS);
if (sGoals != null) {
try {
for (Term t: ASSyntax.parseList("["+sGoals+"]")) {
Literal g = ((Literal)t).forceFullLiteralImpl();
g.makeVarsAnnon();
if (! g.hasSource())
g.addAnnot(BeliefBase.TSelf);
getTS().getC().addAchvGoal(g,Intention.EmptyInt);
}
} catch (Exception e) {
logger.log(Level.WARNING, "Initial goals from project '["+sGoals+"]' is not a list of literals.");
}
}
}