List of usage examples for org.apache.commons.configuration Configuration containsKey
boolean containsKey(String key);
From source file:es.udc.gii.common.eaf.algorithm.operator.selection.LinearRankingSelection.java
@Override public void configure(Configuration conf) { super.configure(conf); if (conf.containsKey("Max")) { this.max = conf.getDouble("Max"); } else {//from w w w. j a v a 2 s .c om ConfWarning w = new ConfWarning("Max", this.max); } }
From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.mutation.de.mutationStrategy.DEMutationStrategy.java
public void configure(Configuration conf) { try {// www . ja v a 2s. c om if (conf.containsKey("F.Class")) { this.F_plugin = (Parameter) Class.forName(conf.getString("F.Class")).newInstance(); this.F_plugin.configure(conf.subset("F")); } else { ConfWarning w = new ConfWarning(this.getClass().getSimpleName() + ".F", this.F_plugin.getClass().getSimpleName()); w.warn(); } if (conf.containsKey("DiffVector")) { this.diffVector = conf.getInt("DiffVector"); } else { ConfWarning w = new ConfWarning(this.getClass().getSimpleName() + ".DiffVector", this.diffVector); w.warn(); } } catch (Exception ex) { throw new ConfigurationException(this.getClass(), ex); } }
From source file:com.linkedin.pinot.transport.config.ConnectionPoolConfig.java
public void init(Configuration cfg) { if (cfg.containsKey(THREAD_POOL_KEY)) { _threadPool.init(cfg.subset(THREAD_POOL_KEY)); }/* w w w .java2 s . c o m*/ if (cfg.containsKey(IDLE_TIMEOUT_MS_KEY)) { _idleTimeoutMs = cfg.getLong(IDLE_TIMEOUT_MS_KEY); } if (cfg.containsKey(MIN_CONNECTIONS_PER_SERVER_KEY)) { _minConnectionsPerServer = cfg.getInt(MIN_CONNECTIONS_PER_SERVER_KEY); } if (cfg.containsKey(MAX_CONNECTIONS_PER_SERVER_KEY)) { _maxConnectionsPerServer = cfg.getInt(MAX_CONNECTIONS_PER_SERVER_KEY); } if (cfg.containsKey(MAX_BACKLOG_PER_SERVER_KEY)) { _maxBacklogPerServer = cfg.getInt(MAX_BACKLOG_PER_SERVER_KEY); } if (_minConnectionsPerServer > _maxConnectionsPerServer || _maxConnectionsPerServer <= 0 || _minConnectionsPerServer < 1) { LOGGER.warn( "Invalid values for " + MIN_CONNECTIONS_PER_SERVER_KEY + "({}) and " + MAX_CONNECTIONS_PER_SERVER_KEY + "({}). Resetting to defaults:", _minConnectionsPerServer, _maxConnectionsPerServer); _minConnectionsPerServer = DEFAULT_MIN_CONNECTIONS_PER_SERVER; _maxConnectionsPerServer = DEFAULT_MAX_CONNECTIONS_PER_SERVER; } if (_idleTimeoutMs < 0) { LOGGER.warn("Invalid value for " + IDLE_TIMEOUT_MS_KEY + "({}). Resetting to default."); _idleTimeoutMs = DEFAULT_IDLE_TIMEOUT_MS; } if (_maxBacklogPerServer < 0) { LOGGER.warn("Invalid value for " + MAX_BACKLOG_PER_SERVER_KEY + "({}). Resetting to default."); _maxBacklogPerServer = DEFAULT_MAX_BACKLOG_PER_SERVER; } LOGGER.info(toString()); }
From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.mutation.PolynomialMutation.java
@Override public void configure(Configuration conf) { super.configure(conf); if (conf.containsKey("N")) { this.N = conf.getInt("N"); } else {/*from w w w . j a v a 2 s.c om*/ this.N = 1; ConfWarning w = new ConfWarning("PolynomialMutation.N", this.N); w.warn(); } }
From source file:es.udc.gii.common.eaf.log.LogTool.java
@Override public void configure(Configuration conf) { if (conf.containsKey("Folder")) { this.folder = conf.getString("Folder"); } else {/*w ww . j a v a2 s . c o m*/ ConfWarning w = new ConfWarning("Folder", this.folder); w.warn(); } if (conf.containsKey("Name")) { this.name = conf.getString("Name"); } else { ConfWarning w = new ConfWarning("Name", this.name); w.warn(); } }
From source file:es.udc.gii.common.eaf.algorithm.evaluate.SerialEvaluationStrategy.java
@Override public void configure(Configuration conf) { try {//from w ww .j a va2 s. co m if (conf.containsKey("ConstraintMethod.Class")) { this.contraintMethod = ((ConstraintMethod) Class.forName(conf.getString("ConstraintMethod.Class")) .newInstance()); this.contraintMethod.configure(conf.subset("ConstraintMethod")); } else { ConfWarning w = new ConfWarning("ConstraintMethod.Class", this.contraintMethod.getClass().getName()); w.warn(); } } catch (Exception ex) { throw new ConfigurationException(this.getClass(), ex); } }
From source file:cross.io.InputDataFactory.java
@Override public void configure(final Configuration cfg) { if (cfg.containsKey("input.dataInfo")) { this.input = cfg.getStringArray("input.dataInfo"); }/*w w w.j a v a 2 s . c o m*/ this.basedir = cfg.getString("input.basedir", ""); if (this.basedir.isEmpty() || this.basedir.equals(".")) { log.debug("Configuration has no value for input.basedir! {}", this.basedir); this.basedir = System.getProperty("user.dir"); } this.recurse = cfg.getBoolean("input.basedir.recurse", false); }
From source file:es.udc.gii.common.eaf.problem.Problem.java
/** * Configures the current problem.//from w w w . j a v a 2 s . c o m * @param conf a Configuration object with the configuration of this problem. */ @Override public void configure(Configuration conf) { this.checkBounds = conf.containsKey("CheckBounds"); setObjectiveFunctions(createObjectiveFunctions(conf)); setConstraints(createConstraints(conf)); }
From source file:es.udc.gii.common.eaf.algorithm.operator.replace.NSGA2ReplaceOperator.java
@Override public void configure(Configuration conf) { super.configure(conf); try {//www . j a va 2 s . c o m if (conf.containsKey("RemainingFrontSelectionPlugin.Class")) { this.remainingFrontPlugin = (RemainingFrontSelectionPlugin) Class .forName(conf.getString("RemainingFrontSelectionPlugin.Class")).newInstance(); this.remainingFrontPlugin.configure(conf.subset("RemainingFrontSelectionPlugin")); } else { ConfWarning w = new ConfWarning("RemainingFrontSelectionPlugin", this.getClass().getSimpleName()); w.warn(); } } catch (Exception ex) { throw new ConfigurationException(this.getClass(), ex); } }
From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.mutation.de.DEMutationOperator.java
@Override public void configure(Configuration conf) { try {/* w ww.j a va 2s. co m*/ if (conf.containsKey("MutationStrategy.Class")) { this.mutationStrategy = (DEMutationStrategy) Class.forName(conf.getString("MutationStrategy.Class")) .newInstance(); this.mutationStrategy.configure(conf.subset("MutationStrategy")); } else { ConfWarning w = new ConfWarning("MutationStrategy", this.getClass().getSimpleName()); w.warn(); } if (conf.containsKey("CrossOverScheme.Class")) { this.crossOverScheme = (CrossOverScheme) Class.forName(conf.getString("CrossOverScheme.Class")) .newInstance(); this.crossOverScheme.configure(conf.subset("CrossOverScheme")); } else { ConfWarning w = new ConfWarning("CrossOverScheme", this.crossOverScheme.getClass().getSimpleName()); w.warn(); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) { throw new ConfigurationException(this.getClass(), ex); } }