// Path: src/main/java/io/usethesource/criterion/BenchmarkUtils.java
// public static int seedFromSizeAndRun(int size, int run) {
//   return mix(size) ^ mix(run);
// }
// 
// Path: src/main/java/io/usethesource/criterion/api/JmhValue.java
// @CompilerControl(Mode.DONT_INLINE)
// public interface JmhValue {
// 
//   /**
//    * Removes the JmhValue delegation object to reveal its internal representation.
//    *
//    * @return internal representation
//    */
//   Object unwrap();
// 
// }
// 
// Path: src/main/java/io/usethesource/criterion/generators/JmhIntegerGenerator.java
// public class JmhIntegerGenerator extends Generator<JmhValue> {
// 
//   public JmhIntegerGenerator() {
//     super(JmhValue.class);
//   }
// 
//   @Override
//   public JmhValue generate(SourceOfRandomness random, GenerationStatus status) {
//     return new PureInteger(random.nextInt());
//   }
// 
// }


import static io.usethesource.criterion.BenchmarkUtils.seedFromSizeAndRun;
import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Stream;
import com.pholser.junit.quickcheck.generator.GenerationStatus;
import com.pholser.junit.quickcheck.generator.Generator;
import com.pholser.junit.quickcheck.internal.GeometricDistribution;
import com.pholser.junit.quickcheck.internal.generator.SimpleGenerationStatus;
import com.pholser.junit.quickcheck.random.SourceOfRandomness;
import io.usethesource.capsule.Set;
import io.usethesource.capsule.api.TernaryRelation;
import io.usethesource.capsule.api.Triple;
import io.usethesource.capsule.generators.SingletonToTripleGenerator;
import io.usethesource.capsule.generators.relation.AbstractTernaryRelationGenerator;
import io.usethesource.capsule.generators.relation.TernaryTrieSetMultimapGenerator;
import io.usethesource.capsule.util.stream.CapsuleCollectors;
import io.usethesource.criterion.api.JmhValue;
import io.usethesource.criterion.generators.JmhIntegerGenerator;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OperationsPerInvocation;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;
/**
 * Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
 * All rights reserved.
 *
 * This file is licensed under the BSD 2-Clause License, which accompanies this project
 * and is available under https://opensource.org/licenses/BSD-2-Clause.
 */
package io.usethesource.criterion;




@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@State(Scope.Thread)
public class JmhTernaryRelationBenchmarks {

  public static final Class<? extends AbstractTernaryRelationGenerator<? extends TernaryRelation.Immutable>> generatorClass = TernaryTrieSetMultimapGenerator.class;

  /*
   * val l = (for (i <- 0 to 23) yield s"'${Math.pow(2, i).toInt}'") val r = (for (i <- 0 to 23)
   * yield s"'${Math.pow(2, i-1).toInt + Math.pow(2, i).toInt}'") val zipped = l zip r flatMap {
   * case (x,y) => List(x,y) }
   *
   * val all = zipped.drop(1).take(zipped.size - 2) all.mkString(", ").replace("'", "\"")
   */
  @Param({"1", "2", "3", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128", "192",
      "256", "384", "512", "768", "1024", "1536", "2048", "3072", "4096", "6144", "8192", "12288",
      "16384", "24576", "32768", "49152", "65536", "98304", "131072", "196608", "262144", "393216",
      "524288", "786432", "1048576", "1572864", "2097152", "3145728", "4194304", "6291456",
      "8388608"})
  protected int size;

  @Param({"0"}) // "1", "2", "3", "4", "5", "6", "7", "8", "9"
  protected int run;

// Path: src/main/java/io/usethesource/criterion/BenchmarkUtils.java
// public static int seedFromSizeAndRun(int size, int run) {
//   return mix(size) ^ mix(run);
// }
// 
// Path: src/main/java/io/usethesource/criterion/api/JmhValue.java
// @CompilerControl(Mode.DONT_INLINE)
// public interface JmhValue {
// 
//   /**
//    * Removes the JmhValue delegation object to reveal its internal representation.
//    *
//    * @return internal representation
//    */
//   Object unwrap();
// 
// }
// 
// Path: src/main/java/io/usethesource/criterion/generators/JmhIntegerGenerator.java
// public class JmhIntegerGenerator extends Generator<JmhValue> {
// 
//   public JmhIntegerGenerator() {
//     super(JmhValue.class);
//   }
// 
//   @Override
//   public JmhValue generate(SourceOfRandomness random, GenerationStatus status) {
//     return new PureInteger(random.nextInt());
//   }
// 
// }


// Path: src/main/java/io/usethesource/criterion/JmhTernaryRelationBenchmarks.java
import static io.usethesource.criterion.BenchmarkUtils.seedFromSizeAndRun;
import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Stream;
import com.pholser.junit.quickcheck.generator.GenerationStatus;
import com.pholser.junit.quickcheck.generator.Generator;
import com.pholser.junit.quickcheck.internal.GeometricDistribution;
import com.pholser.junit.quickcheck.internal.generator.SimpleGenerationStatus;
import com.pholser.junit.quickcheck.random.SourceOfRandomness;
import io.usethesource.capsule.Set;
import io.usethesource.capsule.api.TernaryRelation;
import io.usethesource.capsule.api.Triple;
import io.usethesource.capsule.generators.SingletonToTripleGenerator;
import io.usethesource.capsule.generators.relation.AbstractTernaryRelationGenerator;
import io.usethesource.capsule.generators.relation.TernaryTrieSetMultimapGenerator;
import io.usethesource.capsule.util.stream.CapsuleCollectors;
import io.usethesource.criterion.api.JmhValue;
import io.usethesource.criterion.generators.JmhIntegerGenerator;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OperationsPerInvocation;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import org.openjdk.jmh.runner.options.TimeValue;

/**
 * Copyright (c) Michael Steindorfer <Centrum Wiskunde & Informatica> and Contributors.
 * All rights reserved.
 *
 * This file is licensed under the BSD 2-Clause License, which accompanies this project
 * and is available under https://opensource.org/licenses/BSD-2-Clause.
 */
package io.usethesource.criterion;




@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@State(Scope.Thread)
public class JmhTernaryRelationBenchmarks {

  public static final Class<? extends AbstractTernaryRelationGenerator<? extends TernaryRelation.Immutable>> generatorClass = TernaryTrieSetMultimapGenerator.class;

  /*
   * val l = (for (i <- 0 to 23) yield s"'${Math.pow(2, i).toInt}'") val r = (for (i <- 0 to 23)
   * yield s"'${Math.pow(2, i-1).toInt + Math.pow(2, i).toInt}'") val zipped = l zip r flatMap {
   * case (x,y) => List(x,y) }
   *
   * val all = zipped.drop(1).take(zipped.size - 2) all.mkString(", ").replace("'", "\"")
   */
  @Param({"1", "2", "3", "4", "6", "8", "12", "16", "24", "32", "48", "64", "96", "128", "192",
      "256", "384", "512", "768", "1024", "1536", "2048", "3072", "4096", "6144", "8192", "12288",
      "16384", "24576", "32768", "49152", "65536", "98304", "131072", "196608", "262144", "393216",
      "524288", "786432", "1048576", "1572864", "2097152", "3145728", "4194304", "6291456",
      "8388608"})
  protected int size;

  @Param({"0"}) // "1", "2", "3", "4", "5", "6", "7", "8", "9"
  protected int run;

  private TernaryRelation.Immutable<JmhValue, JmhValue, JmhValue, Triple<JmhValue, JmhValue, JmhValue>> testMap;