// Path: generators-core/src/main/java/io/generators/core/Generators.java
// public static <T> Generator<T> ofInstance(T instance) {
//     return new GeneratorOfInstance<>(instance);
// }


import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static io.generators.core.Generators.ofInstance;
import static org.joda.time.DateTime.now;
import javax.annotation.Nonnull;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
package io.generators.core;




/**
 * Generates random {@link org.joda.time.DateTime} in the time zone of the from date.
 * <p/>
 * When no constructor parameters are provided DateTime are generated in range +- 100 years in the default time zone
 * It also supports generating random DateTime in custom range, future and past DateTimes in cases where from DateTime is not provided it uses default time zone.
 * Time zone can be explicitly set to desired time zone using {@link #withTimeZone(org.joda.time.DateTimeZone)}
 *
 *
 * @author Tomas Klubal
 */
public class RandomJodaDateTimeGenerator implements Generator<DateTime> {
    private static final int YEAR_BOUND = 100;
    private static final int ZERO_DURAION = 0;
    private final PositiveLongRandom random = new PositiveLongRandom();
    private final Generator<DateTime> from;
    private final Generator<DateTime> to;
    private final DateTimeZone timeZone;

    /**
     * Created instance generates DateTime in range -+ 100 years in the default time zone
     *
     * @see org.joda.time.DateTimeZone#getDefault()
     */
    public RandomJodaDateTimeGenerator() {
        this(new DurationFromNow(-YEAR_BOUND), new DurationFromNow(+YEAR_BOUND));
    }

    /**
     * Created instance generates DateTime in range <code>from</code> to <code>to</code>
     *
     * @throws IllegalArgumentException when {@code from} is after {@code to}
     */
    public RandomJodaDateTimeGenerator(@Nonnull DateTime from, @Nonnull DateTime to) {
// Path: generators-core/src/main/java/io/generators/core/Generators.java
// public static <T> Generator<T> ofInstance(T instance) {
//     return new GeneratorOfInstance<>(instance);
// }


// Path: generators-core/src/main/java/io/generators/core/RandomJodaDateTimeGenerator.java
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static io.generators.core.Generators.ofInstance;
import static org.joda.time.DateTime.now;
import javax.annotation.Nonnull;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

package io.generators.core;




/**
 * Generates random {@link org.joda.time.DateTime} in the time zone of the from date.
 * <p/>
 * When no constructor parameters are provided DateTime are generated in range +- 100 years in the default time zone
 * It also supports generating random DateTime in custom range, future and past DateTimes in cases where from DateTime is not provided it uses default time zone.
 * Time zone can be explicitly set to desired time zone using {@link #withTimeZone(org.joda.time.DateTimeZone)}
 *
 *
 * @author Tomas Klubal
 */
public class RandomJodaDateTimeGenerator implements Generator<DateTime> {
    private static final int YEAR_BOUND = 100;
    private static final int ZERO_DURAION = 0;
    private final PositiveLongRandom random = new PositiveLongRandom();
    private final Generator<DateTime> from;
    private final Generator<DateTime> to;
    private final DateTimeZone timeZone;

    /**
     * Created instance generates DateTime in range -+ 100 years in the default time zone
     *
     * @see org.joda.time.DateTimeZone#getDefault()
     */
    public RandomJodaDateTimeGenerator() {
        this(new DurationFromNow(-YEAR_BOUND), new DurationFromNow(+YEAR_BOUND));
    }

    /**
     * Created instance generates DateTime in range <code>from</code> to <code>to</code>
     *
     * @throws IllegalArgumentException when {@code from} is after {@code to}
     */
    public RandomJodaDateTimeGenerator(@Nonnull DateTime from, @Nonnull DateTime to) {
        this(ofInstance(from), ofInstance(to));