// Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
// 
//     /**
//      * Returns true if data source can provide next value, otherwise false.
//      *
//      * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
//      *            dependent data source which can then return data with time stamps and/or data influenced by time in
//      *            any other way.
//      * @return True if data source can provide next value, otherwise false.
//      */
//     boolean hasNext(long time);
// 
//     /**
//      * Returns next value from this data source.
//      *
//      * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
//      *            dependent data source which can then return data with time stamps and/or data influenced by time in
//      *            any other way.
//      * @return Next value from this data source.
//      */
//     T getNext(long time);
// }
// 
// 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);
// }


import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.api.RateGenerator;
package io.smartcat.berserker;




/**
 * Load generator used to execute work tasks with data from provided data source.
 *
 * @param <T> Type of data which will be used.
 */
public class LoadGenerator<T> {

    private static final Logger LOGGER = LoggerFactory.getLogger(LoadGenerator.class);
    private static final long NANOS_IN_SECOND = TimeUnit.SECONDS.toNanos(1);
    private static final long TICK_PERIOD_IN_NANOS = 1000;

    private final DataSource<T> dataSource;
// Path: berserker-commons/src/main/java/io/smartcat/berserker/api/DataSource.java
// public interface DataSource<T> {
// 
//     /**
//      * Returns true if data source can provide next value, otherwise false.
//      *
//      * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
//      *            dependent data source which can then return data with time stamps and/or data influenced by time in
//      *            any other way.
//      * @return True if data source can provide next value, otherwise false.
//      */
//     boolean hasNext(long time);
// 
//     /**
//      * Returns next value from this data source.
//      *
//      * @param time Relative time in nanoseconds from starting load generator. Time can be used for implementing time
//      *            dependent data source which can then return data with time stamps and/or data influenced by time in
//      *            any other way.
//      * @return Next value from this data source.
//      */
//     T getNext(long time);
// }
// 
// 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/LoadGenerator.java
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.smartcat.berserker.api.DataSource;
import io.smartcat.berserker.api.RateGenerator;

package io.smartcat.berserker;




/**
 * Load generator used to execute work tasks with data from provided data source.
 *
 * @param <T> Type of data which will be used.
 */
public class LoadGenerator<T> {

    private static final Logger LOGGER = LoggerFactory.getLogger(LoadGenerator.class);
    private static final long NANOS_IN_SECOND = TimeUnit.SECONDS.toNanos(1);
    private static final long TICK_PERIOD_IN_NANOS = 1000;

    private final DataSource<T> dataSource;
    private final RateGenerator rateGenerator;