Config (Lucene 10.5.0 benchmark API)
Description: declaration: package: org.apache.lucene.benchmark.byTask.utils, class: Config

Package org.apache.lucene.benchmark.byTask.utils

# Class Config

java.lang.Object
org.apache.lucene.benchmark.byTask.utils.Config

public class Config extends Object
Perf run configuration properties.

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

The config property "work.dir" tells where is the root of docs data dirs and indexes dirs. It is set to either of:

- value supplied for it in the alg file;
- otherwise, value of System property "benchmark.work.dir";
- otherwise, "work".

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Config(Reader algReader)`
  Read both algorithm and config properties.
  `Config(Properties props)`
  Create config without algorithm - useful for a programmatic perf test.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `get(String name, boolean dflt)`
  Return a boolean property.
  `double`
  `get(String name, double dflt)`
  Return a double property.
  `int`
  `get(String name, int dflt)`
  Return an int property.
  `String`
  `get(String name, String dflt)`
  Return a string property.
  `String`
  `getAlgorithmText()`
  `String`
  `getColsNamesForValsByRound()`
  `String`
  `getColsValuesForValsByRound(int roundNum)`
  `int`
  `getNumThreads()`
  `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.
  `void`
  `setNumThreads(int numThreads)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Config

    public Config(Reader algReader) throws IOException
    Read both algorithm and config properties.
    Parameters:
      `algReader` - from where to read algorithm and config properties.
    Throws:
      `IOException` - If there is a low-level I/O error.

  - ### Config

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

- ## Method Details

  - ### setNumThreads

    public void setNumThreads(int numThreads)

  - ### getNumThreads

    public int getNumThreads()

  - ### get

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

  - ### 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 property value (multiple values are separated by ":")
    Throws:
      `Exception`

  - ### 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.

  - ### get

    public double get(String name, double dflt)
    Return a double property. If the property contain ":", e.g. "10:100:5", it is interpreted as array of doubles. 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 double 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 booleans. 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.

  - ### newRound

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

  - ### 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.

  - ### getAlgorithmText

    public String getAlgorithmText()
    Returns:
      Returns the algorithmText.