diff --git a/app/src/main/java/de/uni_marburg/powersort/data/AscendingIntegers.java b/app/src/main/java/de/uni_marburg/powersort/data/AscendingIntegers.java index c660f84..8050a21 100644 --- a/app/src/main/java/de/uni_marburg/powersort/data/AscendingIntegers.java +++ b/app/src/main/java/de/uni_marburg/powersort/data/AscendingIntegers.java @@ -3,11 +3,9 @@ package de.uni_marburg.powersort.data; import de.uni_marburg.powersort.benchmark.IntegerArray; import de.uni_marburg.powersort.benchmark.LongFormatter; -import static de.uni_marburg.powersort.data.DataArraySizes.SIZE_ASC; - public class AscendingIntegers extends IntegerSupplier { - public AscendingIntegers() { - super(IntegerArray.ascending( 1, SIZE_ASC)); + public AscendingIntegers(int size) { + super(IntegerArray.ascending( 1, size)); } @Override diff --git a/app/src/main/java/de/uni_marburg/powersort/data/DataArraySizes.java b/app/src/main/java/de/uni_marburg/powersort/data/DataArraySizes.java deleted file mode 100644 index 627a63e..0000000 --- a/app/src/main/java/de/uni_marburg/powersort/data/DataArraySizes.java +++ /dev/null @@ -1,7 +0,0 @@ -package de.uni_marburg.powersort.data; - -public interface DataArraySizes { - int SIZE_RAND = 50_000_000; - int SIZE_ASC = 50_000_000; - int SIZE_DESC = 50_000_000; -} diff --git a/app/src/main/java/de/uni_marburg/powersort/data/DataEnum.java b/app/src/main/java/de/uni_marburg/powersort/data/DataEnum.java index af0fa35..ff9de0a 100644 --- a/app/src/main/java/de/uni_marburg/powersort/data/DataEnum.java +++ b/app/src/main/java/de/uni_marburg/powersort/data/DataEnum.java @@ -4,18 +4,23 @@ public enum DataEnum { RANDOM_INTEGERS, ASCENDING_INTEGERS, DESCENDING_INTEGERS, - ASCENDING_RUNS; + ASCENDING_RUNS, + ASCENDING_RUNS_WITH_OVERLAP; public ObjectSupplier get() { // We use a seed to get the same random list every time -> Repeatable benchmarks on same input data! // final long seed = 3651660232967549736L; // System.nanoTime() ++ Math.random() final long seed = 140506881906827520L; // (long) 'P' * (long) 'O' *(long) 'W' * (long) 'E' * (long) 'R' * (long) 'S' * (long) 'O' * (long) 'R' * (long) 'T'; + int longListSize = 50_000_000; + return switch (this) { - case RANDOM_INTEGERS -> new RandomIntegers(seed); - case ASCENDING_INTEGERS -> new AscendingIntegers(); - case DESCENDING_INTEGERS -> new DescendingIntegers(); - case ASCENDING_RUNS -> AscendingRuns.newAscendingRuns(10000, 10000, -10000); + case RANDOM_INTEGERS -> new RandomIntegers(longListSize, seed); + case ASCENDING_INTEGERS -> new AscendingIntegers(longListSize); + case DESCENDING_INTEGERS -> new DescendingIntegers(longListSize); + + case ASCENDING_RUNS -> AscendingRuns.newAscendingRuns(10_000, 10_000, -10_000); + case ASCENDING_RUNS_WITH_OVERLAP -> AscendingRuns.newAscendingRuns(10_000, 10_000, -5_000); }; } } diff --git a/app/src/main/java/de/uni_marburg/powersort/data/DescendingIntegers.java b/app/src/main/java/de/uni_marburg/powersort/data/DescendingIntegers.java index 901b08b..70a8f15 100644 --- a/app/src/main/java/de/uni_marburg/powersort/data/DescendingIntegers.java +++ b/app/src/main/java/de/uni_marburg/powersort/data/DescendingIntegers.java @@ -3,11 +3,9 @@ package de.uni_marburg.powersort.data; import de.uni_marburg.powersort.benchmark.IntegerArray; import de.uni_marburg.powersort.benchmark.LongFormatter; -import static de.uni_marburg.powersort.data.DataArraySizes.SIZE_DESC; - public class DescendingIntegers extends IntegerSupplier { - public DescendingIntegers() { - super(IntegerArray.descending(SIZE_DESC, 1)); + public DescendingIntegers(int size) { + super(IntegerArray.descending(size, 1)); } @Override diff --git a/app/src/main/java/de/uni_marburg/powersort/data/RandomIntegers.java b/app/src/main/java/de/uni_marburg/powersort/data/RandomIntegers.java index 40c46f6..f7b85ee 100644 --- a/app/src/main/java/de/uni_marburg/powersort/data/RandomIntegers.java +++ b/app/src/main/java/de/uni_marburg/powersort/data/RandomIntegers.java @@ -3,11 +3,9 @@ package de.uni_marburg.powersort.data; import de.uni_marburg.powersort.benchmark.IntegerArray; import de.uni_marburg.powersort.benchmark.LongFormatter; -import static de.uni_marburg.powersort.data.DataArraySizes.SIZE_RAND; - public class RandomIntegers extends IntegerSupplier { - public RandomIntegers(final long seed) { - super(IntegerArray.random(SIZE_RAND, seed)); + public RandomIntegers(final int size, final long seed) { + super(IntegerArray.random(size, seed)); } @Override diff --git a/app/src/main/java/de/uni_marburg/powersort/sort/SortEnum.java b/app/src/main/java/de/uni_marburg/powersort/sort/SortEnum.java index 151fb55..58b2397 100644 --- a/app/src/main/java/de/uni_marburg/powersort/sort/SortEnum.java +++ b/app/src/main/java/de/uni_marburg/powersort/sort/SortEnum.java @@ -1,17 +1,20 @@ package de.uni_marburg.powersort.sort; +import de.uni_marburg.powersort.FinnSort.FinnSort; import de.uni_marburg.powersort.benchmark.NaturalOrder; public enum SortEnum { // BUBBLE_SORT, MERGE_SORT, - TIM_SORT; + TIM_SORT, + FIN_SORT; public SimpleSort get() { return switch (this) { // case BUBBLE_SORT -> array -> BubbleSort.sort(array, NaturalOrder.INSTANCE); case MERGE_SORT -> array -> MergeSort.legacyMergeSort(array, NaturalOrder.INSTANCE); case TIM_SORT -> array -> TimSort.sort(array, 0, array.length, NaturalOrder.INSTANCE, null, 0, 0); + case FIN_SORT -> array -> FinnSort.sort(array, NaturalOrder.INSTANCE); }; } }