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

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

Introduction

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

Prototype

double getDouble(String key);

Source Link

Document

Get a double associated with the given configuration key.

Usage

From source file:com.boozallen.cognition.ingest.storm.topology.ConfigurableIngestTopology.java

protected void configureStorm(Configuration conf, Config stormConf) throws IllegalAccessException {
    stormConf.registerSerialization(LogRecord.class);
    //stormConf.registerSerialization(Entity.class);
    stormConf.registerMetricsConsumer(LoggingMetricsConsumer.class);

    for (Iterator<String> iter = conf.getKeys(); iter.hasNext();) {
        String key = iter.next();

        String keyString = key.toString();
        String cleanedKey = keyString.replaceAll("\\.\\.", ".");

        String schemaFieldName = cleanedKey.replaceAll("\\.", "_").toUpperCase() + "_SCHEMA";
        Field field = FieldUtils.getField(Config.class, schemaFieldName);
        Object fieldObject = field.get(null);

        if (fieldObject == Boolean.class)
            stormConf.put(cleanedKey, conf.getBoolean(keyString));
        else if (fieldObject == String.class)
            stormConf.put(cleanedKey, conf.getString(keyString));
        else if (fieldObject == ConfigValidation.DoubleValidator)
            stormConf.put(cleanedKey, conf.getDouble(keyString));
        else if (fieldObject == ConfigValidation.IntegerValidator)
            stormConf.put(cleanedKey, conf.getInt(keyString));
        else if (fieldObject == ConfigValidation.PowerOf2Validator)
            stormConf.put(cleanedKey, conf.getLong(keyString));
        else if (fieldObject == ConfigValidation.StringOrStringListValidator)
            stormConf.put(cleanedKey, Arrays.asList(conf.getStringArray(keyString)));
        else if (fieldObject == ConfigValidation.StringsValidator)
            stormConf.put(cleanedKey, Arrays.asList(conf.getStringArray(keyString)));
        else {/*from ww w . j  a  v a 2  s  .  c  o m*/
            logger.error(
                    "{} cannot be configured from XML. Consider configuring in navie storm configuration.");
            throw new UnsupportedOperationException(cleanedKey + " cannot be configured from XML");
        }
    }
}

From source file:eu.socialsensor.main.BenchmarkConfiguration.java

public BenchmarkConfiguration(Configuration appconfig) {
    if (appconfig == null) {
        throw new IllegalArgumentException("appconfig may not be null");
    }/*from w ww  .  j  av  a 2 s.  co  m*/

    Configuration eu = appconfig.subset("eu");
    Configuration socialsensor = eu.subset("socialsensor");

    //metrics
    final Configuration metrics = socialsensor.subset(GraphDatabaseConfiguration.METRICS_NS.getName());

    final Configuration graphite = metrics.subset(GRAPHITE);
    this.graphiteHostname = graphite.getString(GRAPHITE_HOSTNAME, null);
    this.graphiteReportingInterval = graphite.getLong(GraphDatabaseConfiguration.GRAPHITE_INTERVAL.getName(),
            1000 /*default 1sec*/);

    final Configuration csv = metrics.subset(CSV);
    this.csvReportingInterval = metrics.getLong(CSV_INTERVAL, 1000 /*ms*/);
    this.csvDir = csv.containsKey(CSV_DIR)
            ? new File(csv.getString(CSV_DIR, System.getProperty("user.dir") /*default*/))
            : null;

    Configuration dynamodb = socialsensor.subset("dynamodb");
    this.dynamodbWorkerThreads = dynamodb.getInt("workers", 25);
    Configuration credentials = dynamodb.subset(CREDENTIALS);
    this.dynamodbPrecreateTables = dynamodb.getBoolean("precreate-tables", Boolean.FALSE);
    this.dynamodbTps = Math.max(1, dynamodb.getLong(TPS, 750 /*default*/));
    this.dynamodbConsistentRead = dynamodb.containsKey(CONSISTENT_READ) ? dynamodb.getBoolean(CONSISTENT_READ)
            : false;
    this.dynamodbDataModel = dynamodb.containsKey("data-model")
            ? BackendDataModel.valueOf(dynamodb.getString("data-model"))
            : null;
    this.dynamodbCredentialsFqClassName = credentials.containsKey(CLASS_NAME)
            ? credentials.getString(CLASS_NAME)
            : null;
    this.dynamodbCredentialsCtorArguments = credentials.containsKey(CONSTRUCTOR_ARGS)
            ? credentials.getString(CONSTRUCTOR_ARGS)
            : null;
    this.dynamodbEndpoint = dynamodb.containsKey(ENDPOINT) ? dynamodb.getString(ENDPOINT) : null;
    this.dynamodbTablePrefix = dynamodb.containsKey(TABLE_PREFIX) ? dynamodb.getString(TABLE_PREFIX)
            : Constants.DYNAMODB_TABLE_PREFIX.getDefaultValue();

    Configuration orient = socialsensor.subset("orient");
    orientLightweightEdges = orient.containsKey(LIGHTWEIGHT_EDGES) ? orient.getBoolean(LIGHTWEIGHT_EDGES)
            : null;

    Configuration sparksee = socialsensor.subset("sparksee");
    sparkseeLicenseKey = sparksee.containsKey(LICENSE_KEY) ? sparksee.getString(LICENSE_KEY) : null;

    Configuration titan = socialsensor.subset(TITAN); //TODO(amcp) move dynamodb ns into titan
    bufferSize = titan.getInt(BUFFER_SIZE, GraphDatabaseConfiguration.BUFFER_SIZE.getDefaultValue());
    blocksize = titan.getInt(IDS_BLOCKSIZE, GraphDatabaseConfiguration.IDS_BLOCK_SIZE.getDefaultValue());
    pageSize = titan.getInt(PAGE_SIZE, GraphDatabaseConfiguration.PAGE_SIZE.getDefaultValue());

    // database storage directory
    if (!socialsensor.containsKey(DATABASE_STORAGE_DIRECTORY)) {
        throw new IllegalArgumentException("configuration must specify database-storage-directory");
    }
    dbStorageDirectory = new File(socialsensor.getString(DATABASE_STORAGE_DIRECTORY));
    dataset = validateReadableFile(socialsensor.getString(DATASET), DATASET);

    // load the dataset
    DatasetFactory.getInstance().getDataset(dataset);

    if (!socialsensor.containsKey(PERMUTE_BENCHMARKS)) {
        throw new IllegalArgumentException("configuration must set permute-benchmarks to true or false");
    }
    permuteBenchmarks = socialsensor.getBoolean(PERMUTE_BENCHMARKS);

    List<?> benchmarkList = socialsensor.getList("benchmarks");
    benchmarkTypes = new ArrayList<BenchmarkType>();
    for (Object str : benchmarkList) {
        benchmarkTypes.add(BenchmarkType.valueOf(str.toString()));
    }

    selectedDatabases = new TreeSet<GraphDatabaseType>();
    for (Object database : socialsensor.getList("databases")) {
        if (!GraphDatabaseType.STRING_REP_MAP.keySet().contains(database.toString())) {
            throw new IllegalArgumentException(
                    String.format("selected database %s not supported", database.toString()));
        }
        selectedDatabases.add(GraphDatabaseType.STRING_REP_MAP.get(database));
    }
    scenarios = permuteBenchmarks ? Ints.checkedCast(CombinatoricsUtils.factorial(selectedDatabases.size()))
            : 1;

    resultsPath = new File(System.getProperty("user.dir"), socialsensor.getString("results-path"));
    if (!resultsPath.exists() && !resultsPath.mkdirs()) {
        throw new IllegalArgumentException("unable to create results directory");
    }
    if (!resultsPath.canWrite()) {
        throw new IllegalArgumentException("unable to write to results directory");
    }

    randomNodes = socialsensor.getInteger(RANDOM_NODES, new Integer(100));

    if (this.benchmarkTypes.contains(BenchmarkType.CLUSTERING)) {
        if (!socialsensor.containsKey(NODES_COUNT)) {
            throw new IllegalArgumentException("the CW benchmark requires nodes-count integer in config");
        }
        nodesCount = socialsensor.getInt(NODES_COUNT);

        if (!socialsensor.containsKey(RANDOMIZE_CLUSTERING)) {
            throw new IllegalArgumentException("the CW benchmark requires randomize-clustering bool in config");
        }
        randomizedClustering = socialsensor.getBoolean(RANDOMIZE_CLUSTERING);

        if (!socialsensor.containsKey(ACTUAL_COMMUNITIES)) {
            throw new IllegalArgumentException("the CW benchmark requires a file with actual communities");
        }
        actualCommunities = validateReadableFile(socialsensor.getString(ACTUAL_COMMUNITIES),
                ACTUAL_COMMUNITIES);

        final boolean notGenerating = socialsensor.containsKey(CACHE_VALUES);
        if (notGenerating) {
            List<?> objects = socialsensor.getList(CACHE_VALUES);
            cacheValues = new ArrayList<Integer>(objects.size());
            cacheValuesCount = null;
            cacheIncrementFactor = null;
            for (Object o : objects) {
                cacheValues.add(Integer.valueOf(o.toString()));
            }
        } else if (socialsensor.containsKey(CACHE_VALUES_COUNT)
                && socialsensor.containsKey(CACHE_INCREMENT_FACTOR)) {
            cacheValues = null;
            // generate the cache values with parameters
            if (!socialsensor.containsKey(CACHE_VALUES_COUNT)) {
                throw new IllegalArgumentException(
                        "the CW benchmark requires cache-values-count int in config when cache-values not specified");
            }
            cacheValuesCount = socialsensor.getInt(CACHE_VALUES_COUNT);

            if (!socialsensor.containsKey(CACHE_INCREMENT_FACTOR)) {
                throw new IllegalArgumentException(
                        "the CW benchmark requires cache-increment-factor int in config when cache-values not specified");
            }
            cacheIncrementFactor = socialsensor.getDouble(CACHE_INCREMENT_FACTOR);
        } else {
            throw new IllegalArgumentException(
                    "when doing CW benchmark, must provide cache-values or parameters to generate them");
        }
    } else {
        randomizedClustering = null;
        nodesCount = null;
        cacheValuesCount = null;
        cacheIncrementFactor = null;
        cacheValues = null;
        actualCommunities = null;
    }
}

From source file:keel.Algorithms.Neural_Networks.NNEP_Common.algorithm.NeuralNetAlgorithm.java

/**
 * <p>/* w  ww. j a  va 2 s  .  com*/
 * Configuration parameters for NeuralNetAlgorithm class are:
 * 
 * <ul>
 * <li>
 * <code>species: ISpecies (complex)</code></p>
 * Individual species
 * </li><li>
 * <code>evaluator IEvaluator (complex)</code></p>
 * Individuals evaluator
 * </li><li>
 * <code>population-size (int)</code></p>
 * Population size
 * </li><li>
 * <code>max-of-generations (int)</code></p>
 * Maximum number of generations
 * </li>
 * <li>
 * <code>provider: IProvider (complex)</code></p>
 * Individuals provider
 * </li>
 * <li>
 * <code>mutator1: IMutator<I> (complex)</code></p>
 * Individuals mutator1
 * </li>
 * <li>
 * <code>mutator2: IMutator<I> (complex)</code></p>
 * Individuals mutator2
 * </li>
 * <li>
 * <code>creation-ratio (double)</code></p>
 * Ratio "elements created"/"elements remaining"
 * </li>
 * <li>
 * <code>percentage-second-mutator (int)</code></p>
 * Percentage of individuals mutated with second mutator
 * </li>
 * <li>
 * <code>max-generations-without-improving-mean (int)</code></p>
 * Maximum number of generations without improving mean fitness
 * </li>
 * <li>
 * <code>max-generations-without-improving-best (int)</code></p>
 * Maximum number of generations without improving best fitness
 * </li>
 * <li>
 * <code>fitness-difference (double)</code></p>
 * Difference between two fitness that we consider
  * enough to say that the fitness has improved
 * </li>
 * </ul>
 * </p>
 * @param configuration Configuration object to obtain the parameters
 */
@SuppressWarnings("unchecked")
public void configure(Configuration configuration) {

    // Random generators factory
    try {
        // Species classname
        String randGenFactoryClassname = configuration.getString("rand-gen-factory[@type]");
        // Species class
        Class<? extends IRandGenFactory> randGenFactoryClass = (Class<? extends IRandGenFactory>) Class
                .forName(randGenFactoryClassname);
        // Species instance
        IRandGenFactory randGenFactory = randGenFactoryClass.newInstance();
        // Configure species
        if (randGenFactory instanceof IConfigure) {
            ((IConfigure) randGenFactory).configure(configuration.subset("rand-gen-factory"));
        }
        // Set species
        setRandGenFactory(randGenFactory);
    } catch (ClassNotFoundException e) {
        throw new ConfigurationRuntimeException("Illegal random generators factory classname");
    } catch (InstantiationException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of random generators factory",
                e);
    } catch (IllegalAccessException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of random generators factory",
                e);
    }
    // Individual species
    try {
        // Species classname
        String speciesClassname = configuration.getString("species[@type]");
        // Species class
        Class<ISpecies<I>> speciesClass = (Class<ISpecies<I>>) Class.forName(speciesClassname);
        // Species instance
        ISpecies<I> species = speciesClass.newInstance();
        // Configure species if neccesary
        if (species instanceof IConfigure) {
            // Extract species configuration
            Configuration speciesConfiguration = configuration.subset("species");
            // Configure species
            ((IConfigure) species).configure(speciesConfiguration);
        }
        // Set species
        setSpecies(species);
    } catch (ClassNotFoundException e) {
        throw new ConfigurationRuntimeException("Illegal species classname");
    } catch (InstantiationException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of species", e);
    } catch (IllegalAccessException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of species", e);
    }
    // Individuals evaluator
    try {
        // Evaluator classname
        String evaluatorClassname = configuration.getString("evaluator[@type]");
        // Evaluator class
        Class<IEvaluator<I>> evaluatorClass = (Class<IEvaluator<I>>) Class.forName(evaluatorClassname);
        // Evaluator instance
        IEvaluator<I> evaluator = evaluatorClass.newInstance();
        // Configure evaluator if neccesary
        if (evaluator instanceof IConfigure) {
            // Extract species configuration
            Configuration evaluatorConfiguration = configuration.subset("evaluator");
            // Configure evaluator
            ((IConfigure) evaluator).configure(evaluatorConfiguration);
        }
        // Set species
        setEvaluator(evaluator);
    } catch (ClassNotFoundException e) {
        throw new ConfigurationRuntimeException("Illegal evaluator classname");
    } catch (InstantiationException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of evaluator", e);
    } catch (IllegalAccessException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of evaluator", e);
    }
    // Population size
    int populationSize = configuration.getInt("population-size");
    setPopulationSize(populationSize);
    // Maximum of generations
    int maxOfGenerations = configuration.getInt("max-of-generations");
    setMaxOfGenerations(maxOfGenerations);
    // Individuals provider
    try {
        // Provider classname
        String providerClassname = configuration.getString("provider[@type]");
        // Provider class
        Class<IProvider<I>> providerClass = (Class<IProvider<I>>) Class.forName(providerClassname);
        // Provider instance
        IProvider<I> provider = providerClass.newInstance();
        // Configure provider if neccesary
        if (provider instanceof IConfigure) {
            // Extract provider configuration
            Configuration providerConfiguration = configuration.subset("provider");
            // Configure provider
            ((IConfigure) provider).configure(providerConfiguration);
        }
        // Set provider
        setProvider(provider);
    } catch (ClassNotFoundException e) {
        throw new ConfigurationRuntimeException("Illegal provider classname");
    } catch (InstantiationException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of provider", e);
    } catch (IllegalAccessException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of provider", e);
    }
    // Individuals mutator1
    try {
        // Mutator1 classname
        String mutator1Classname = configuration.getString("mutator1[@type]");
        // Mutator1 classe
        Class<IMutator<I>> mutator1Class = (Class<IMutator<I>>) Class.forName(mutator1Classname);
        // Mutator1 instance
        IMutator<I> mutator1 = mutator1Class.newInstance();
        // Configure mutator1 if neccesary
        if (mutator1 instanceof IConfigure) {
            // Extract mutator1 configuration
            Configuration mutator1Configuration = configuration.subset("mutator1");
            // Configure mutator1
            ((IConfigure) mutator1).configure(mutator1Configuration);
        }
        // Set mutator1
        setMutator1(mutator1);
    } catch (ClassNotFoundException e) {
        throw new ConfigurationRuntimeException("Illegal mutator1 classname");
    } catch (InstantiationException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of mutator1", e);
    } catch (IllegalAccessException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of mutator1", e);
    }
    // Individuals mutator2
    try {
        // Mutator2 classname
        String mutator2Classname = configuration.getString("mutator2[@type]");
        // Mutator2 class
        Class<IMutator<I>> mutator2Class = (Class<IMutator<I>>) Class.forName(mutator2Classname);
        // Mutator2 instance
        IMutator<I> mutator2 = mutator2Class.newInstance();
        // Configure mutator2 if neccesary
        if (mutator2 instanceof IConfigure) {
            // Extract mutator2 configuration
            Configuration mutator2Configuration = configuration.subset("mutator2");
            // Configure mutator2 
            ((IConfigure) mutator2).configure(mutator2Configuration);
        }
        // Set mutator2
        setMutator2(mutator2);
    } catch (ClassNotFoundException e) {
        throw new ConfigurationRuntimeException("Illegal mutator2 classname");
    } catch (InstantiationException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of mutator2", e);
    } catch (IllegalAccessException e) {
        throw new ConfigurationRuntimeException("Problems creating an instance of mutator2", e);
    }
    // Creation ratio
    double cratio = configuration.getDouble("creation-ratio");
    setCratio(cratio);
    // Percentage of individuals mutated with second mutator
    int percenageMutator2 = configuration.getInt("percentage-second-mutator");
    setPercentageSecondMutator(percenageMutator2);
    // Maximum of generations without improving mean fitness
    int mogmean = configuration.getInt("max-generations-without-improving-mean");
    setMogmean(mogmean);
    // Maximum of generations without improving best fitness
    int mogbest = configuration.getInt("max-generations-without-improving-best");
    setMogbest(mogbest);
    // Significative fitness difference
    double fitDif = configuration.getDouble("fitness-difference");
    setFitDif(fitDif);
}

From source file:nl.tudelft.graphalytics.configuration.ConfigurationUtil.java

public static double getDouble(Configuration config, String property) throws InvalidConfigurationException {
    ensureConfigurationKeyExists(config, property);
    try {//from  w w  w  .  j ava  2 s .c o  m
        return config.getDouble(property);
    } catch (ConversionException ignore) {
        throw new InvalidConfigurationException("Invalid value for property \"" + resolve(config, property)
                + "\": \"" + config.getString(property) + "\", expected a double value.");
    }
}

From source file:org.bhave.sweeper.DoubleSequenceSweepTest.java

@Test
public void testPrecision() {

    DoubleSequenceSweep seq = new DoubleSequenceSweep("p1", 0, 1, 0.05);

    double[] expectedValues = new double[] { 0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55,
            0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1 };

    Iterator<Configuration> it = seq.iterator();
    for (double expected : expectedValues) {
        Configuration config = it.next();
        double generated = config.getDouble("p1");
        assertTrue(generated == expected);
    }/*from   w  w w.j  a v a  2  s . com*/

}

From source file:org.bhave.sweeper.DoubleSequenceSweepTest.java

@Test
public void testReverse() {

    DoubleSequenceSweep seq = new DoubleSequenceSweep("p1", 1, 0.90, -0.05);

    double[] expectedValues = new double[] { 1, 0.95, 0.90 };

    Iterator<Configuration> it = seq.iterator();
    for (double expected : expectedValues) {
        Configuration config = it.next();
        double generated = config.getDouble("p1");
        System.out.println(generated);
        assertTrue(generated == expected);
    }//from   w w  w .ja v  a  2 s.  co  m

}

From source file:org.bhave.sweeper.DoubleSequenceSweepTest.java

@Test
public void testAdditionalDecimalPlaces() {
    DoubleSequenceSweep seq = new DoubleSequenceSweep("p1", 0, 1, 0.05);

    for (Configuration config : seq) {
        System.out.println(config.getDouble("p1"));
    }// w  w w. j a va2s.c om
}

From source file:org.lable.oss.dynamicconfig.core.commonsconfiguration.ConcurrentConfigurationTest.java

@Test
public void testMethodWrappers() {
    CombinedConfiguration mockConfiguration = mock(CombinedConfiguration.class);
    Configuration concurrentConfiguration = new ConcurrentConfiguration(mockConfiguration, null);

    concurrentConfiguration.subset("subset");
    concurrentConfiguration.isEmpty();//from   w  w  w . java 2s .co m
    concurrentConfiguration.containsKey("key");
    concurrentConfiguration.getProperty("getprop");
    concurrentConfiguration.getKeys("getkeys");
    concurrentConfiguration.getKeys();
    concurrentConfiguration.getProperties("getprops");
    concurrentConfiguration.getBoolean("getboolean1");
    concurrentConfiguration.getBoolean("getboolean2", true);
    concurrentConfiguration.getBoolean("getboolean3", Boolean.FALSE);
    concurrentConfiguration.getByte("getbyte1");
    concurrentConfiguration.getByte("getbyte2", (byte) 0);
    concurrentConfiguration.getByte("getbyte3", Byte.valueOf((byte) 0));
    concurrentConfiguration.getDouble("getdouble1");
    concurrentConfiguration.getDouble("getdouble2", 0.2);
    concurrentConfiguration.getDouble("getdouble3", Double.valueOf(0.2));
    concurrentConfiguration.getFloat("getfloat1");
    concurrentConfiguration.getFloat("getfloat2", 0f);
    concurrentConfiguration.getFloat("getfloat3", Float.valueOf(0f));
    concurrentConfiguration.getInt("getint1");
    concurrentConfiguration.getInt("getint2", 0);
    concurrentConfiguration.getInteger("getint3", 0);
    concurrentConfiguration.getLong("getlong1");
    concurrentConfiguration.getLong("getlong2", 0L);
    concurrentConfiguration.getLong("getlong3", Long.valueOf(0L));
    concurrentConfiguration.getShort("getshort1");
    concurrentConfiguration.getShort("getshort2", (short) 0);
    concurrentConfiguration.getShort("getshort3", Short.valueOf((short) 0));
    concurrentConfiguration.getBigDecimal("getbigd1");
    concurrentConfiguration.getBigDecimal("getbigd2", BigDecimal.valueOf(0.4));
    concurrentConfiguration.getBigInteger("getbigi1");
    concurrentConfiguration.getBigInteger("getbigi2", BigInteger.valueOf(2L));
    concurrentConfiguration.getString("getstring1");
    concurrentConfiguration.getString("getstring2", "def");
    concurrentConfiguration.getStringArray("stringarray");
    concurrentConfiguration.getList("getlist1");
    concurrentConfiguration.getList("getlist2", Arrays.asList("a", "b"));

    verify(mockConfiguration, times(1)).subset("subset");
    verify(mockConfiguration, times(1)).isEmpty();
    verify(mockConfiguration, times(1)).containsKey("key");
    verify(mockConfiguration, times(1)).getProperty("getprop");
    verify(mockConfiguration, times(1)).getKeys("getkeys");
    verify(mockConfiguration, times(1)).getKeys();
    verify(mockConfiguration, times(1)).getProperties("getprops");
    verify(mockConfiguration, times(1)).getBoolean("getboolean1");
    verify(mockConfiguration, times(1)).getBoolean("getboolean2", true);
    verify(mockConfiguration, times(1)).getBoolean("getboolean3", Boolean.FALSE);
    verify(mockConfiguration, times(1)).getByte("getbyte1");
    verify(mockConfiguration, times(1)).getByte("getbyte2", (byte) 0);
    verify(mockConfiguration, times(1)).getByte("getbyte3", Byte.valueOf((byte) 0));
    verify(mockConfiguration, times(1)).getDouble("getdouble1");
    verify(mockConfiguration, times(1)).getDouble("getdouble2", 0.2);
    verify(mockConfiguration, times(1)).getDouble("getdouble3", Double.valueOf(0.2));
    verify(mockConfiguration, times(1)).getFloat("getfloat1");
    verify(mockConfiguration, times(1)).getFloat("getfloat2", 0f);
    verify(mockConfiguration, times(1)).getFloat("getfloat3", Float.valueOf(0f));
    verify(mockConfiguration, times(1)).getInt("getint1");
    verify(mockConfiguration, times(1)).getInt("getint2", 0);
    verify(mockConfiguration, times(1)).getInteger("getint3", Integer.valueOf(0));
    verify(mockConfiguration, times(1)).getLong("getlong1");
    verify(mockConfiguration, times(1)).getLong("getlong2", 0L);
    verify(mockConfiguration, times(1)).getLong("getlong3", Long.valueOf(0L));
    verify(mockConfiguration, times(1)).getShort("getshort1");
    verify(mockConfiguration, times(1)).getShort("getshort2", (short) 0);
    verify(mockConfiguration, times(1)).getShort("getshort3", Short.valueOf((short) 0));
    verify(mockConfiguration, times(1)).getBigDecimal("getbigd1");
    verify(mockConfiguration, times(1)).getBigDecimal("getbigd2", BigDecimal.valueOf(0.4));
    verify(mockConfiguration, times(1)).getBigInteger("getbigi1");
    verify(mockConfiguration, times(1)).getBigInteger("getbigi2", BigInteger.valueOf(2L));
    verify(mockConfiguration, times(1)).getString("getstring1");
    verify(mockConfiguration, times(1)).getString("getstring2", "def");
    verify(mockConfiguration, times(1)).getStringArray("stringarray");
    verify(mockConfiguration, times(1)).getList("getlist1");
    verify(mockConfiguration, times(1)).getList("getlist2", Arrays.asList("a", "b"));
}

From source file:org.matsim.contrib.taxi.optimizer.rules.RuleBasedTaxiOptimizerParams.java

public RuleBasedTaxiOptimizerParams(Configuration optimizerConfig) {
    super(optimizerConfig, false, false);

    goal = Goal.valueOf(optimizerConfig.getString(GOAL));

    nearestRequestsLimit = optimizerConfig.getInt(NEAREST_REQUESTS_LIMIT);
    nearestVehiclesLimit = optimizerConfig.getInt(NEAREST_VEHICLES_LIMIT);

    cellSize = optimizerConfig.getDouble(CELL_SIZE);// 1000 m tested for Berlin
}

From source file:org.matsim.contrib.taxi.optimizer.zonal.ZonalTaxiOptimizerParams.java

public ZonalTaxiOptimizerParams(Configuration optimizerConfig) {
    super(optimizerConfig);

    zonesXmlFile = optimizerConfig.getString(ZONES_XML_FILE);
    zonesShpFile = optimizerConfig.getString(ZONES_SHP_FILE);
    expansionDistance = optimizerConfig.getDouble(EXPANSION_DISTANCE);
}