// Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
// 
//     /**
//      * Returns rate per second as a function of time.
//      *
//      * @param time Relative time in nanoseconds from starting load generator.
//      * @return Rate per second as a function of time.
//      */
//     double getRate(long time);
// }
// 
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java
// public class RateGeneratorConfigurationParser {
// 
//     private static final String OFFSET = "offset";
//     private static final String RATES = "rates";
//     private static final String OUTPUT = "output";
// 
//     private final Map<String, Object> rates;
//     private final Object outputExpression;
//     private Map<String, RateGeneratorProxy> proxyValues;
//     private RateGeneratorExpressionParser parser;
//     private ReportingParseRunner<RateGenerator> parseRunner;
// 
//     /**
//      * Constructs rate generator configuration parser with specified configuration.
//      *
//      * @param config Configuration to parse.
//      */
//     @SuppressWarnings("unchecked")
//     public RateGeneratorConfigurationParser(Map<String, Object> config) {
//         checkSectionExistence(config, RATES);
//         checkSectionExistence(config, OUTPUT);
//         this.rates = (Map<String, Object>) config.get(RATES);
//         this.outputExpression = config.get(OUTPUT);
//     }
// 
//     /**
//      * Creates an instance of {@link RateGenerator} based on provided configuration.
//      *
//      * @return An instance of {@link RateGenerator}.
//      */
//     @SuppressWarnings({ "unchecked" })
//     public RateGenerator build() {
//         buildModel();
//         return parseRateGeneratorExpression(outputExpression);
//     }
// 
//     private void buildModel() {
//         this.proxyValues = new HashMap<>();
//         this.parser = Parboiled.createParser(RateGeneratorExpressionParser.class, proxyValues);
//         this.parseRunner = new ReportingParseRunner<>(parser.rateGenerator());
//         if (rates != null) {
//             createProxies();
//             parseRateGenerators();
//         }
//     }
// 
//     private void checkSectionExistence(Map<String, Object> config, String name) {
//         if (!config.containsKey(name)) {
//             throw new RuntimeException("Configuration must contain '" + name + "' section.");
//         }
//     }
// 
//     private void createProxies() {
//         for (Map.Entry<String, Object> entry : rates.entrySet()) {
//             proxyValues.put(entry.getKey(), new RateGeneratorProxy());
//         }
//     }
// 
//     private void parseRateGenerators() {
//         for (Map.Entry<String, Object> entry : rates.entrySet()) {
//             RateGenerator rateGenerator = parseRateGeneratorExpression(entry.getValue());
//             RateGeneratorProxy proxy = proxyValues.get(entry.getKey());
//             proxy.setDelegate(rateGenerator);
//             entry.setValue(proxy);
//         }
//     }
// 
//     private RateGenerator parseRateGeneratorExpression(Object def) {
//         // handle String as expression and all other types as primitives
//         if (def instanceof String) {
//             ParsingResult<RateGenerator> result = parseRunner.run((String) def);
//             return result.valueStack.pop();
//         } else if (def instanceof Long) {
//             return new ConstantRateGenerator((long) def);
//         } else if (def instanceof Integer) {
//             return new ConstantRateGenerator(((Number) def).longValue());
//         } else {
//             throw new RuntimeException("Object type not supported: " + def.getClass().getName());
//         }
//     }
// }


import java.util.Map;
import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.configuration.rategenerator.RateGeneratorConfigurationParser;
package io.smartcat.berserker.configuration;



/**
 * Configuration to construct rate generator out of rate generator expressions.
 */
public class DefaultRateGeneratorConfiguration implements RateGeneratorConfiguration {

    @Override
    public String getName() {
        return "default";
    }

    @Override
// Path: berserker-commons/src/main/java/io/smartcat/berserker/api/RateGenerator.java
// public interface RateGenerator {
// 
//     /**
//      * Returns rate per second as a function of time.
//      *
//      * @param time Relative time in nanoseconds from starting load generator.
//      * @return Rate per second as a function of time.
//      */
//     double getRate(long time);
// }
// 
// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/rategenerator/RateGeneratorConfigurationParser.java
// public class RateGeneratorConfigurationParser {
// 
//     private static final String OFFSET = "offset";
//     private static final String RATES = "rates";
//     private static final String OUTPUT = "output";
// 
//     private final Map<String, Object> rates;
//     private final Object outputExpression;
//     private Map<String, RateGeneratorProxy> proxyValues;
//     private RateGeneratorExpressionParser parser;
//     private ReportingParseRunner<RateGenerator> parseRunner;
// 
//     /**
//      * Constructs rate generator configuration parser with specified configuration.
//      *
//      * @param config Configuration to parse.
//      */
//     @SuppressWarnings("unchecked")
//     public RateGeneratorConfigurationParser(Map<String, Object> config) {
//         checkSectionExistence(config, RATES);
//         checkSectionExistence(config, OUTPUT);
//         this.rates = (Map<String, Object>) config.get(RATES);
//         this.outputExpression = config.get(OUTPUT);
//     }
// 
//     /**
//      * Creates an instance of {@link RateGenerator} based on provided configuration.
//      *
//      * @return An instance of {@link RateGenerator}.
//      */
//     @SuppressWarnings({ "unchecked" })
//     public RateGenerator build() {
//         buildModel();
//         return parseRateGeneratorExpression(outputExpression);
//     }
// 
//     private void buildModel() {
//         this.proxyValues = new HashMap<>();
//         this.parser = Parboiled.createParser(RateGeneratorExpressionParser.class, proxyValues);
//         this.parseRunner = new ReportingParseRunner<>(parser.rateGenerator());
//         if (rates != null) {
//             createProxies();
//             parseRateGenerators();
//         }
//     }
// 
//     private void checkSectionExistence(Map<String, Object> config, String name) {
//         if (!config.containsKey(name)) {
//             throw new RuntimeException("Configuration must contain '" + name + "' section.");
//         }
//     }
// 
//     private void createProxies() {
//         for (Map.Entry<String, Object> entry : rates.entrySet()) {
//             proxyValues.put(entry.getKey(), new RateGeneratorProxy());
//         }
//     }
// 
//     private void parseRateGenerators() {
//         for (Map.Entry<String, Object> entry : rates.entrySet()) {
//             RateGenerator rateGenerator = parseRateGeneratorExpression(entry.getValue());
//             RateGeneratorProxy proxy = proxyValues.get(entry.getKey());
//             proxy.setDelegate(rateGenerator);
//             entry.setValue(proxy);
//         }
//     }
// 
//     private RateGenerator parseRateGeneratorExpression(Object def) {
//         // handle String as expression and all other types as primitives
//         if (def instanceof String) {
//             ParsingResult<RateGenerator> result = parseRunner.run((String) def);
//             return result.valueStack.pop();
//         } else if (def instanceof Long) {
//             return new ConstantRateGenerator((long) def);
//         } else if (def instanceof Integer) {
//             return new ConstantRateGenerator(((Number) def).longValue());
//         } else {
//             throw new RuntimeException("Object type not supported: " + def.getClass().getName());
//         }
//     }
// }


// Path: berserker-core/src/main/java/io/smartcat/berserker/configuration/DefaultRateGeneratorConfiguration.java
import java.util.Map;
import io.smartcat.berserker.api.RateGenerator;
import io.smartcat.berserker.configuration.rategenerator.RateGeneratorConfigurationParser;

package io.smartcat.berserker.configuration;



/**
 * Configuration to construct rate generator out of rate generator expressions.
 */
public class DefaultRateGeneratorConfiguration implements RateGeneratorConfiguration {

    @Override
    public String getName() {
        return "default";
    }

    @Override
    public RateGenerator getRateGenerator(Map<String, Object> configuration) throws ConfigurationParseException {