Example usage for org.apache.commons.configuration Configuration containsKey

List of usage examples for org.apache.commons.configuration Configuration containsKey

Introduction

In this page you can find the example usage for org.apache.commons.configuration Configuration containsKey.

Prototype

boolean containsKey(String key);

Source Link

Document

Check if the configuration contains the specified key.

Usage

From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.mutation.de.crossover.CrossOverScheme.java

@Override
public void configure(Configuration conf) {

    try {//from  ww  w . j  a v  a 2s  . c o  m
        if (conf.containsKey("CR.Class")) {
            this.CR_plugin = (Parameter) Class.forName(conf.getString("CR.Class")).newInstance();
            this.CR_plugin.configure(conf.subset("CR"));
        }

    } catch (ClassNotFoundException | InstantiationException | IllegalAccessException ex) {
        throw new ConfigurationException(this.getClass(), ex);
    }
}

From source file:es.udc.gii.common.eaf.plugin.parameter.RandomValue.java

/**
 * Configures this class./*  w  ww . j  a  va2  s.  c  o m*/
 * @param conf
 */
@Override
public void configure(Configuration conf) {
    if (conf.containsKey("UpperBound")) {
        setUpperBound(conf.getDouble("UpperBound"));
    } else {
        setUpperBound(1);
    }

    if (conf.containsKey("LowerBound")) {
        setLowerBound(conf.getDouble("LowerBound"));
    } else {
        setLowerBound(-1);
    }
}

From source file:com.germinus.easyconf.ConfigurationLearningTest.java

public void testSubset() {
    Configuration conf = new PropertiesConfiguration();
    conf.setProperty("prefix.key", "value");
    Configuration subset = conf.subset("prefix");
    assertTrue("The subset functionality does not work", subset.containsKey("key"));
}

From source file:es.udc.gii.common.eaf.algorithm.operator.selection.TournamentSelection.java

@Override
public void configure(Configuration conf) {
    super.configure(conf);
    if (conf.containsKey("PoolSize")) {
        this.poolSize = conf.getInt("PoolSize");
    } else {/*from   ww  w  . jav  a 2s.  co  m*/
        ConfWarning w = new ConfWarning("PoolSize", this.poolSize);
    }
}

From source file:es.udc.gii.common.eaf.log.BestEverIndividualLogTool.java

@Override
public void configure(Configuration conf) {

    super.configure(conf);
    if (conf.containsKey("Fes_Prints")) {
        this.fes_prints = conf.getList("Fes_Prints");
    } else {/*w  w w .  j  a va  2s .  c o m*/
        ConfWarning w = new ConfWarning("Fes_Prints", "Empty List");
        w.warn();
    }
}

From source file:es.udc.gii.common.eaf.algorithm.operator.selection.DeterministicTournamentSelection.java

@Override
public void configure(Configuration conf) {
    if (conf.containsKey("PoolSize")) {
        this.poolSize = conf.getInt("PoolSize");
    } else {/*from   w  w  w  .j  av a 2  s. co m*/
        this.poolSize = 2;
        (new ConfWarning("DeterministicTournamentSelection.PoolSize", this.poolSize)).warn();
    }
}

From source file:es.udc.gii.common.eaf.algorithm.operator.replace.ElitismOperator.java

@Override
public void configure(Configuration conf) {
    super.configure(conf);
    if (conf.containsKey("Elitism")) {
        this.elitism = conf.getInt("Elitism");
    } else {//from  w  w w  .  ja  v a 2s.  c o m
        ConfWarning w = new ConfWarning("Elitism", this.elitism);
        w.warn();
    }
}

From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.crossover.RandomCrossOver.java

@Override
public void configure(Configuration conf) {
    super.configure(conf);
    if (conf.containsKey("Points")) {
        this.points = conf.getInt("Points");
    } else {//ww w .j  a  va 2s. c  o  m
        ConfWarning w = new ConfWarning("Points", this.points);
        w.warn();
    }
}

From source file:es.udc.gii.common.eaf.log.FEsToReachValueLogTool.java

@Override
public void configure(Configuration conf) {

    super.configure(conf);
    if (conf.containsKey("Value")) {
        this.value = conf.getDouble("Value");
        this.to_compare = new Individual();
        this.to_compare.setFitness(value);
    } else {/*from  ww  w. ja  v  a 2s.c o m*/
        ConfWarning w = new ConfWarning("Value", this.value);
        w.warn();
    }
}

From source file:es.udc.gii.common.eaf.algorithm.operator.reproduction.crossover.CrossOverOperator.java

@Override
public void configure(Configuration conf) {
    if (conf.containsKey("Probability")) {
        this.probability = conf.getDouble("Probability");
    } else {// www .j ava2s  .  c  o  m
        ConfWarning w = new ConfWarning("Probability", this.probability);
        w.warn();
    }
}