Java Code Examples for org.apache.commons.configuration.Configuration#getDouble()

The following examples show how to use org.apache.commons.configuration.Configuration#getDouble() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BitsyGraph.java    From bitsy with Apache License 2.0 6 votes vote down vote up
/**
 * Constructor with a Configuration object with String dbPath, boolean allowFullGraphScans, long txLogThreshold and double reorgFactor
 */
public BitsyGraph(Configuration configuration) {
    this(Paths.get(configuration.getString(DB_PATH_KEY)),
            configuration.getBoolean(ALLOW_FULL_GRAPH_SCANS_KEY, Boolean.TRUE),
            configuration.getLong(TX_LOG_THRESHOLD_KEY, DEFAULT_TX_LOG_THRESHOLD),
            configuration.getDouble(REORG_FACTOR_KEY, DEFAULT_REORG_FACTOR),
            configuration.getBoolean(CREATE_DIR_IF_MISSING_KEY, false));
    String isoLevelStr = configuration.getString(DEFAULT_ISOLATION_LEVEL_KEY);
    if (isoLevelStr != null) {
            setDefaultIsolationLevel(BitsyIsolationLevel.valueOf(isoLevelStr));
    }
    String vertexIndices = configuration.getString(VERTEX_INDICES_KEY);
    if (vertexIndices != null) {
            createIndices(Vertex.class, vertexIndices);
    }
    String edgeIndices = configuration.getString(EDGE_INDICES_KEY);
    if (edgeIndices != null) {
            createIndices(Edge.class, edgeIndices);
    }
    this.origConfig = configuration;
}
 
Example 2
Source File: MarketMakerConfiguration.java    From java-market-maker with Apache License 2.0 5 votes vote down vote up
public static MarketMakerConfiguration fromPropertiesFile(final String fileName) throws ConfigurationException {
    final Configuration configuration = new PropertiesConfiguration(fileName);
    return new MarketMakerConfiguration(
        configuration.getInt(ConfigKey.TIME_SLEEP_SECONDS.getKey()),
        configuration.getInt(ConfigKey.MAX_BATCH_SIZE.getKey()),
        new BigDecimal(configuration.getString(ConfigKey.SPREAD_FRACTION.getKey())),
        configuration.getDouble(ConfigKey.FAIR_VOLATILITY.getKey()),
        configuration.getDouble(ConfigKey.VOLATILITY_SPREAD_FRACTION.getKey()),
        configuration.getInt(ConfigKey.NUM_LEVELS.getKey()),
        configuration.getInt(ConfigKey.QUANTITY_ON_LEVEL.getKey()),
        configuration.getDouble(ConfigKey.DELTA_LIMIT.getKey()),
        configuration.getDouble(ConfigKey.VEGA_LIMIT.getKey())
    );
}
 
Example 3
Source File: DefaultRoundStrategy.java    From keyword-optimizer with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new {@link DefaultRoundStrategy} and takes its parameters from a property file.
 */
public DefaultRoundStrategy(OptimizationContext context) {
  Configuration config = context.getConfiguration();

  maxNumberOfSteps = config.getInt(KeywordOptimizerProperty.RoundStrategyMaxSteps.getName(), 10);
  minImprovementBetweenSteps = config.getDouble(
      KeywordOptimizerProperty.RoundStrategyMinImprovementBetweenSteps.getName(), 0);
  maxPopulationSize =
      config.getInt(KeywordOptimizerProperty.RoundStrategyMaxPopulation.getName(), 100);
  maxNumberOfAlternatives =
      config.getInt(KeywordOptimizerProperty.RoundStrategyReplicateBest.getName(), 10);

  lastAvgScore = null;
}
 
Example 4
Source File: LogRecordDateBolt.java    From cognition with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(Configuration conf) throws ConfigurationException {
  super.configure(conf);

  dateFormat = conf.getString(DATE_FORMAT, "yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
  sample = conf.getDouble(SAMPLE, 0.01);

  Validate.notBlank(dateFormat);

  validateDateFormat();
}
 
Example 5
Source File: SafetyZoneService.java    From AisAbnormal with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Inject
public SafetyZoneService(Configuration configuration) {
    safetyEllipseLength = configuration.getDouble(CONFKEY_SAFETYZONES_SAFETY_ELLIPSE_LENGTH);
    safetyEllipseBreadth = configuration.getDouble(CONFKEY_SAFETYZONES_SAFETY_ELLIPSE_BREADTH);
    safetyEllipseBehind = configuration.getDouble(CONFKEY_SAFETYZONES_SAFETY_ELLIPSE_BEHIND);

    LOG.debug("Using safetyEllipseLength = " + safetyEllipseLength);
    LOG.debug("Using safetyEllipseBreadth = " + safetyEllipseBreadth);
    LOG.debug("Using safetyEllipseBehind = " + safetyEllipseBehind);
}
 
Example 6
Source File: PageRankVertexProgram.java    From titan1withtp3.1 with Apache License 2.0 4 votes vote down vote up
@Override
public void loadState(final Graph graph, final Configuration configuration) {
    dampingFactor = configuration.getDouble(DAMPING_FACTOR, 0.85D);
    maxIterations = configuration.getInt(MAX_ITERATIONS, 10);
    vertexCount = configuration.getLong(VERTEX_COUNT, 1L);
}
 
Example 7
Source File: ParametricMutator.java    From KEEL with GNU General Public License v3.0 4 votes vote down vote up
/**
 * <p>
 * Configuration parameters for ParametricMutator are:
 * </p>
 * <ul>
 * <li>
 * <code>[@selective] boolean (default=false)</code>
 * If this parameter is set to <code>true</code> only certain randomly
 * selected nodes are parametrically mutated.
 * </li>
 * <li>
 * <code>temperature-exponent[@value] double (default=1)</code>
 * Temperature exponent to be used for obtaining temperature
 * of each indivual mutated.
 * </li>
 * <li>
 * <code>amplitude[@value] double (default=5)</code>
 * Amplitude factor to increase the range of parametric variations
 * of mutated weights.
 * </li>
 * <li>
 * <code>fitness-difference[@value] double (default=0.0000001)</code>
 * Difference between two fitnesses that we consider
    * enoung to say that the fitness has improved
 * </li>
 * <li>
 * <code>initial-alpha-values: complex</code>
 * Initial values of alpha parameters.
 * <ul>
 * 		<li>
 * 		<code>initial-alpha-values[@input] double (default=0.5)</code>
 * 		Initial value of alpha parameter used for input weights.
 * 		</li>
 * 		<li>
 * 		<code>initial-alpha-values[@ouput] double (default=1)</code>
 * 		Initial value of alpha parameter used for output weights.
 * 		</li>
 * </ul> 
 * </li>
 * </ul>
        * @param settings configuration settings for the mutator.
 */

public void configure(Configuration settings)
{
	// Setup selective
	selective = settings.getBoolean("[@selective]", false);
	
	// Setup temperExponent
	temperExponent = settings.getDouble("temperature-exponent[@value]", 1);
	
	// Setup amplitude
	amplitude = settings.getDouble("amplitude[@value]", 5);
	
	// Setup fitDif
	fitDif = settings.getDouble("fitness-difference[@value]", 0.0000001);
	
	// Setup alphaInput
	initialAlphaInput = settings.getDouble("initial-alpha-values[@input]", 0.5);
	
	// Setup alphaOutput
	initialAlphaOutput = settings.getDouble("initial-alpha-values[@output]", 1);		
	
}
 
Example 8
Source File: StormKafkaSpout.java    From cognition with Apache License 2.0 4 votes vote down vote up
@Override
public void configure(Configuration conf) {
  spoutConfig = getSpoutConfig(conf);
  permitsPerSecond = conf.getDouble(PERMITS_PER_SECOND, DEFAULT_PERMITS_PER_SECOND);
}
 
Example 9
Source File: IRPropPlus.java    From KEEL with GNU General Public License v3.0 3 votes vote down vote up
/**
 * <p>
 * @param settings Settings Configuration
 * </p>
 */
public void configure(Configuration settings)
{		
	initialStepSize = settings.getDouble("initial-step-size[@value]", 0.0125);		
	
	minimumDelta = settings.getDouble("minimum-delta[@value]", 0.0);
	
	maximumDelta = settings.getDouble("maximum-delta[@value]", 50.0);
	
	positiveEta = settings.getDouble("positive-eta[@value]", 1.2);
	
	negativeEta = settings.getDouble("negative-eta[@value]", 0.2);
	
	epochs = settings.getInt("cycles[@value]", 25);
}