org.apache.lucene.benchmark.byTask.utils

Class Config


public class Config
extends Object

Perf run configuration properties. Numeric peroperty containing ":", e.g. "10:100:5" is interpreted as array of numeric values. It is extracted once, on first use, and maintain an round number to return the appropriate value.

Constructor Summary

Config(File algFile)
Read config from file containing both algorithm and config properties.
Config(Properties props)
Create config without algorithm - usefull for a programmatic perf test.

Method Summary

String
get(String name, String dflt)
Return a string property.
boolean
get(String name, boolean dflt)
Return a boolean property.
int
get(String name, int dflt)
Return an int property.
String
getAlgorithmText()
String
getColsNamesForValsByRound()
String
getColsValuesForValsByRound(int roundNum)
int
getRoundNumber()
int
newRound()
Increment the round number, for config values that are extracted by round number.
void
set(String name, String value)
Set a property.

Constructor Details

Config

public Config(File algFile)
            throws IOException
Read config from file containing both algorithm and config properties.
Parameters:
algFile - file containing both algorithm and config properties.

Config

public Config(Properties props)
Create config without algorithm - usefull for a programmatic perf test.
Parameters:
props - - configuration properties.

Method Details

get

public String get(String name,
                  String dflt)
Return a string property.
Parameters:
name - name of property.
dflt - default value.
Returns:
a string property.

get

public boolean get(String name,
                   boolean dflt)
Return a boolean property. If the property contain ":", e.g. "true.true.false", it is interpreted as array of boleans. It is extracted once, on first call to get() it, and a by-round-value is returned.
Parameters:
name - name of property
dflt - default value
Returns:
a int property.

get

public int get(String name,
               int dflt)
Return an int property. If the property contain ":", e.g. "10:100:5", it is interpreted as array of ints. It is extracted once, on first call to get() it, and a by-round-value is returned.
Parameters:
name - name of property
dflt - default value
Returns:
a int property.

getAlgorithmText

public String getAlgorithmText()
Returns:
Returns the algorithmText.

getColsNamesForValsByRound

public String getColsNamesForValsByRound()
Returns:
names of params set by round, for reports title

getColsValuesForValsByRound

public String getColsValuesForValsByRound(int roundNum)
Returns:
values of params set by round, for reports lines.

getRoundNumber

public int getRoundNumber()
Returns:
the round number.

newRound

public int newRound()
Increment the round number, for config values that are extracted by round number.
Returns:
the new round number.

set

public void set(String name,
                String value)
            throws Exception
Set a property. Note: once a multiple values property is set, it can no longer be modified.
Parameters:
name - name of property.
value - either single or multiple propery value (multple values are separated by ":")

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.