mirror of
https://gitlab.uni-marburg.de/langbeid/powersort.git
synced 2025-01-21 19:50:35 +01:00
benchmark: add input from competition
# Conflicts: # app/src/main/java/de/uni_marburg/powersort/benchmark/Main.java # app/src/main/java/de/uni_marburg/powersort/sort/SortEnum.java
This commit is contained in:
parent
4268315f06
commit
54f3ea6d42
@ -1,8 +1,10 @@
|
||||
package de.uni_marburg.powersort.benchmark;
|
||||
|
||||
import de.uni_marburg.powersort.data.DataEnum;
|
||||
import de.uni_marburg.powersort.data.IntegerSerializer;
|
||||
import de.uni_marburg.powersort.sort.SortEnum;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
|
||||
public class Filter {
|
||||
@ -11,7 +13,7 @@ public class Filter {
|
||||
}
|
||||
|
||||
public static boolean isFiltered(DataEnum d, SortEnum s) {
|
||||
// To skip some of the inputs for all inputs, uncomment it here.
|
||||
// To skip some of the inputs for all sort algorithms, uncomment them here.
|
||||
// if (List.of(
|
||||
// DataEnum.RANDOM_INTEGERS_300M,
|
||||
// DataEnum.ASCENDING_INTEGERS_300M,
|
||||
@ -22,13 +24,77 @@ public class Filter {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// Skip some sort algorithms for all competition input data.
|
||||
if(d.isCompetitionInput()){
|
||||
if(List.of(
|
||||
SortEnum.BUBBLE_SORT,
|
||||
SortEnum.MERGE_SORT
|
||||
).contains(s)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!Files.exists(IntegerSerializer.DATA_DIR)){
|
||||
System.err.println("Folder with inputs of competition missing: " + IntegerSerializer.DATA_DIR.toAbsolutePath());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Filter based on SortEnum values.
|
||||
//
|
||||
|
||||
if (s == SortEnum.QUICK_SORT) {
|
||||
return List.of(
|
||||
DataEnum.RANDOM_INTEGERS_300M,
|
||||
DataEnum.ASCENDING_INTEGERS_300M,
|
||||
DataEnum.DESCENDING_INTEGERS_250M,
|
||||
DataEnum.ASCENDING_RUNS_1M,
|
||||
DataEnum.ASCENDING_RUNS_WITH_OVERLAP_1M
|
||||
DataEnum.ASCENDING_RUNS_WITH_OVERLAP_1M,
|
||||
|
||||
DataEnum.COMPETITION_34,
|
||||
DataEnum.COMPETITION_35,
|
||||
DataEnum.COMPETITION_36,
|
||||
DataEnum.COMPETITION_37,
|
||||
DataEnum.COMPETITION_38,
|
||||
DataEnum.COMPETITION_39,
|
||||
DataEnum.COMPETITION_83,
|
||||
DataEnum.COMPETITION_85,
|
||||
DataEnum.COMPETITION_153,
|
||||
DataEnum.COMPETITION_163,
|
||||
DataEnum.COMPETITION_164,
|
||||
DataEnum.COMPETITION_165,
|
||||
DataEnum.COMPETITION_166,
|
||||
DataEnum.COMPETITION_167,
|
||||
DataEnum.COMPETITION_168,
|
||||
DataEnum.COMPETITION_169,
|
||||
DataEnum.COMPETITION_170,
|
||||
DataEnum.COMPETITION_171,
|
||||
DataEnum.COMPETITION_172,
|
||||
DataEnum.COMPETITION_173,
|
||||
DataEnum.COMPETITION_174,
|
||||
DataEnum.COMPETITION_181,
|
||||
DataEnum.COMPETITION_182,
|
||||
DataEnum.COMPETITION_183,
|
||||
DataEnum.COMPETITION_184,
|
||||
DataEnum.COMPETITION_185,
|
||||
DataEnum.COMPETITION_186,
|
||||
DataEnum.COMPETITION_187,
|
||||
DataEnum.COMPETITION_205,
|
||||
DataEnum.COMPETITION_206,
|
||||
DataEnum.COMPETITION_207,
|
||||
DataEnum.COMPETITION_213,
|
||||
DataEnum.COMPETITION_214,
|
||||
DataEnum.COMPETITION_216,
|
||||
DataEnum.COMPETITION_218,
|
||||
DataEnum.COMPETITION_220,
|
||||
DataEnum.COMPETITION_222,
|
||||
DataEnum.COMPETITION_225,
|
||||
DataEnum.COMPETITION_226,
|
||||
DataEnum.COMPETITION_228,
|
||||
DataEnum.COMPETITION_231,
|
||||
DataEnum.COMPETITION_232,
|
||||
DataEnum.COMPETITION_235,
|
||||
DataEnum.COMPETITION_236
|
||||
).contains(d);
|
||||
}
|
||||
|
||||
@ -52,7 +118,54 @@ public class Filter {
|
||||
if (s == SortEnum.FINN_SORT) {
|
||||
return List.of(
|
||||
DataEnum.DESCENDING_INTEGERS_250M,
|
||||
DataEnum.ASCENDING_RUNS_1M
|
||||
DataEnum.ASCENDING_RUNS_1M,
|
||||
|
||||
DataEnum.COMPETITION_83,
|
||||
DataEnum.COMPETITION_85,
|
||||
DataEnum.COMPETITION_153,
|
||||
DataEnum.COMPETITION_163,
|
||||
DataEnum.COMPETITION_164,
|
||||
DataEnum.COMPETITION_165,
|
||||
DataEnum.COMPETITION_166,
|
||||
DataEnum.COMPETITION_167,
|
||||
DataEnum.COMPETITION_168,
|
||||
DataEnum.COMPETITION_169,
|
||||
DataEnum.COMPETITION_170,
|
||||
DataEnum.COMPETITION_171,
|
||||
DataEnum.COMPETITION_172,
|
||||
DataEnum.COMPETITION_173,
|
||||
DataEnum.COMPETITION_174,
|
||||
DataEnum.COMPETITION_181,
|
||||
DataEnum.COMPETITION_182,
|
||||
DataEnum.COMPETITION_183,
|
||||
DataEnum.COMPETITION_184,
|
||||
DataEnum.COMPETITION_185,
|
||||
DataEnum.COMPETITION_186,
|
||||
DataEnum.COMPETITION_187,
|
||||
DataEnum.COMPETITION_198,
|
||||
DataEnum.COMPETITION_199,
|
||||
DataEnum.COMPETITION_205,
|
||||
DataEnum.COMPETITION_206,
|
||||
DataEnum.COMPETITION_207,
|
||||
DataEnum.COMPETITION_213,
|
||||
DataEnum.COMPETITION_214,
|
||||
DataEnum.COMPETITION_216,
|
||||
DataEnum.COMPETITION_218,
|
||||
DataEnum.COMPETITION_220,
|
||||
DataEnum.COMPETITION_222,
|
||||
DataEnum.COMPETITION_226,
|
||||
DataEnum.COMPETITION_228,
|
||||
DataEnum.COMPETITION_231,
|
||||
DataEnum.COMPETITION_232,
|
||||
DataEnum.COMPETITION_236
|
||||
).contains(d);
|
||||
}
|
||||
|
||||
// TODO: Remove this once performance of ASort improved
|
||||
if (s == SortEnum.ASORT) {
|
||||
return List.of(
|
||||
DataEnum.COMPETITION_173,
|
||||
DataEnum.COMPETITION_174
|
||||
).contains(d);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
package de.uni_marburg.powersort.benchmark;
|
||||
|
||||
import
|
||||
de.uni_marburg.powersort.data.DataEnum;
|
||||
import de.uni_marburg.powersort.data.DataEnum;
|
||||
import de.uni_marburg.powersort.sort.SortEnum;
|
||||
import de.uni_marburg.powersort.data.ObjectSupplier;
|
||||
|
||||
@ -18,11 +17,13 @@ public class Main {
|
||||
|
||||
System.out.println();
|
||||
for (DataEnum dataEnum : dataEnums) {
|
||||
System.out.println(" Creating object supplier " + dataEnum + " ");
|
||||
ObjectSupplier objectSupplier = dataEnum.getObjectSupplier();
|
||||
|
||||
ObjectSupplier objectSupplier = null;
|
||||
for (SortEnum sortImplementation : sortImplementations) {
|
||||
if(!Filter.isFiltered(dataEnum, sortImplementation)) {
|
||||
if(objectSupplier == null){
|
||||
System.out.println("⏳ Creating object supplier " + dataEnum + " ⏳");
|
||||
objectSupplier = dataEnum.getObjectSupplier();
|
||||
}
|
||||
benchmark(objectSupplier, sortImplementation);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,252 @@ public enum DataEnum {
|
||||
ASCENDING_INTEGERS_300M,
|
||||
DESCENDING_INTEGERS_250M,
|
||||
ASCENDING_RUNS_1M,
|
||||
ASCENDING_RUNS_WITH_OVERLAP_1M;
|
||||
ASCENDING_RUNS_WITH_OVERLAP_1M,
|
||||
|
||||
COMPETITION_1,
|
||||
COMPETITION_2,
|
||||
COMPETITION_3,
|
||||
// COMPETITION_4, // Invalid input file.
|
||||
COMPETITION_5,
|
||||
COMPETITION_6,
|
||||
COMPETITION_7,
|
||||
COMPETITION_8,
|
||||
COMPETITION_9,
|
||||
COMPETITION_10,
|
||||
COMPETITION_11,
|
||||
COMPETITION_12,
|
||||
COMPETITION_13,
|
||||
// COMPETITION_14, // Invalid input file.
|
||||
COMPETITION_15,
|
||||
COMPETITION_16,
|
||||
COMPETITION_17,
|
||||
COMPETITION_18,
|
||||
COMPETITION_19,
|
||||
COMPETITION_20,
|
||||
COMPETITION_21,
|
||||
COMPETITION_22,
|
||||
COMPETITION_23,
|
||||
COMPETITION_24,
|
||||
COMPETITION_25,
|
||||
COMPETITION_26,
|
||||
COMPETITION_27,
|
||||
COMPETITION_28,
|
||||
COMPETITION_29,
|
||||
COMPETITION_30,
|
||||
COMPETITION_31,
|
||||
COMPETITION_32,
|
||||
COMPETITION_33,
|
||||
COMPETITION_34,
|
||||
COMPETITION_35,
|
||||
COMPETITION_36,
|
||||
COMPETITION_37,
|
||||
COMPETITION_38,
|
||||
COMPETITION_39,
|
||||
COMPETITION_40,
|
||||
COMPETITION_41,
|
||||
COMPETITION_42,
|
||||
COMPETITION_43,
|
||||
COMPETITION_44,
|
||||
COMPETITION_45,
|
||||
COMPETITION_46,
|
||||
COMPETITION_47,
|
||||
COMPETITION_48,
|
||||
COMPETITION_49,
|
||||
COMPETITION_50,
|
||||
COMPETITION_51,
|
||||
COMPETITION_52,
|
||||
COMPETITION_53,
|
||||
COMPETITION_54,
|
||||
COMPETITION_55,
|
||||
COMPETITION_56,
|
||||
COMPETITION_57,
|
||||
COMPETITION_58,
|
||||
COMPETITION_59,
|
||||
COMPETITION_60,
|
||||
COMPETITION_61,
|
||||
COMPETITION_62,
|
||||
COMPETITION_63,
|
||||
COMPETITION_64,
|
||||
COMPETITION_65,
|
||||
COMPETITION_66,
|
||||
COMPETITION_67,
|
||||
COMPETITION_68,
|
||||
COMPETITION_69,
|
||||
COMPETITION_70,
|
||||
COMPETITION_71,
|
||||
COMPETITION_72,
|
||||
COMPETITION_73,
|
||||
COMPETITION_74,
|
||||
COMPETITION_75,
|
||||
COMPETITION_76,
|
||||
COMPETITION_77,
|
||||
COMPETITION_78,
|
||||
COMPETITION_79,
|
||||
COMPETITION_80,
|
||||
COMPETITION_81,
|
||||
COMPETITION_82,
|
||||
COMPETITION_83,
|
||||
COMPETITION_84,
|
||||
COMPETITION_85,
|
||||
COMPETITION_86,
|
||||
COMPETITION_87,
|
||||
COMPETITION_88,
|
||||
COMPETITION_89,
|
||||
COMPETITION_90,
|
||||
COMPETITION_91,
|
||||
COMPETITION_92,
|
||||
COMPETITION_93,
|
||||
COMPETITION_94,
|
||||
COMPETITION_95,
|
||||
COMPETITION_96,
|
||||
COMPETITION_97,
|
||||
// COMPETITION_98, // Invalid input file (floats not integers).
|
||||
COMPETITION_99,
|
||||
COMPETITION_100,
|
||||
COMPETITION_101,
|
||||
COMPETITION_102,
|
||||
COMPETITION_103,
|
||||
COMPETITION_104,
|
||||
COMPETITION_105,
|
||||
COMPETITION_106,
|
||||
COMPETITION_107,
|
||||
COMPETITION_108,
|
||||
COMPETITION_109,
|
||||
COMPETITION_110,
|
||||
COMPETITION_111,
|
||||
COMPETITION_112,
|
||||
COMPETITION_113,
|
||||
COMPETITION_114,
|
||||
COMPETITION_115,
|
||||
COMPETITION_116,
|
||||
COMPETITION_117,
|
||||
COMPETITION_118,
|
||||
COMPETITION_119,
|
||||
COMPETITION_120,
|
||||
COMPETITION_121,
|
||||
COMPETITION_122,
|
||||
COMPETITION_123,
|
||||
COMPETITION_124,
|
||||
COMPETITION_125,
|
||||
COMPETITION_126,
|
||||
COMPETITION_127,
|
||||
COMPETITION_128,
|
||||
COMPETITION_129,
|
||||
COMPETITION_130,
|
||||
COMPETITION_131,
|
||||
COMPETITION_132,
|
||||
COMPETITION_133,
|
||||
COMPETITION_134,
|
||||
COMPETITION_135,
|
||||
COMPETITION_136,
|
||||
COMPETITION_137,
|
||||
COMPETITION_138,
|
||||
COMPETITION_139,
|
||||
COMPETITION_140,
|
||||
COMPETITION_141,
|
||||
COMPETITION_142,
|
||||
COMPETITION_143,
|
||||
COMPETITION_144,
|
||||
COMPETITION_145,
|
||||
COMPETITION_146,
|
||||
COMPETITION_147,
|
||||
COMPETITION_148,
|
||||
COMPETITION_149,
|
||||
COMPETITION_150,
|
||||
COMPETITION_151,
|
||||
COMPETITION_152,
|
||||
COMPETITION_153,
|
||||
COMPETITION_154,
|
||||
COMPETITION_155,
|
||||
COMPETITION_156,
|
||||
COMPETITION_157,
|
||||
COMPETITION_158,
|
||||
COMPETITION_159,
|
||||
COMPETITION_160,
|
||||
COMPETITION_161,
|
||||
COMPETITION_162,
|
||||
COMPETITION_163,
|
||||
COMPETITION_164,
|
||||
COMPETITION_165,
|
||||
COMPETITION_166,
|
||||
COMPETITION_167,
|
||||
COMPETITION_168,
|
||||
COMPETITION_169,
|
||||
COMPETITION_170,
|
||||
COMPETITION_171,
|
||||
COMPETITION_172,
|
||||
COMPETITION_173,
|
||||
COMPETITION_174,
|
||||
COMPETITION_175,
|
||||
COMPETITION_176,
|
||||
COMPETITION_177,
|
||||
COMPETITION_178,
|
||||
COMPETITION_179,
|
||||
COMPETITION_180,
|
||||
COMPETITION_181,
|
||||
COMPETITION_182,
|
||||
COMPETITION_183,
|
||||
COMPETITION_184,
|
||||
COMPETITION_185,
|
||||
COMPETITION_186,
|
||||
COMPETITION_187,
|
||||
COMPETITION_188,
|
||||
COMPETITION_189,
|
||||
COMPETITION_190,
|
||||
COMPETITION_191,
|
||||
COMPETITION_192,
|
||||
COMPETITION_193,
|
||||
COMPETITION_194,
|
||||
COMPETITION_195,
|
||||
COMPETITION_196,
|
||||
COMPETITION_197,
|
||||
COMPETITION_198,
|
||||
COMPETITION_199,
|
||||
COMPETITION_200,
|
||||
COMPETITION_201,
|
||||
COMPETITION_202,
|
||||
COMPETITION_203,
|
||||
COMPETITION_204,
|
||||
COMPETITION_205,
|
||||
COMPETITION_206,
|
||||
COMPETITION_207,
|
||||
COMPETITION_208,
|
||||
COMPETITION_209,
|
||||
COMPETITION_210,
|
||||
COMPETITION_211,
|
||||
COMPETITION_212,
|
||||
COMPETITION_213,
|
||||
COMPETITION_214,
|
||||
COMPETITION_215,
|
||||
COMPETITION_216,
|
||||
COMPETITION_217,
|
||||
COMPETITION_218,
|
||||
COMPETITION_219,
|
||||
COMPETITION_220,
|
||||
COMPETITION_221,
|
||||
COMPETITION_222,
|
||||
COMPETITION_223,
|
||||
COMPETITION_224,
|
||||
COMPETITION_225,
|
||||
COMPETITION_226,
|
||||
COMPETITION_227,
|
||||
COMPETITION_228,
|
||||
COMPETITION_229,
|
||||
COMPETITION_230,
|
||||
COMPETITION_231,
|
||||
COMPETITION_232,
|
||||
COMPETITION_233,
|
||||
COMPETITION_234,
|
||||
COMPETITION_235,
|
||||
COMPETITION_236,
|
||||
COMPETITION_237,
|
||||
COMPETITION_238;
|
||||
|
||||
public static final String COMPETITION_PREFIX = "COMPETITION_";
|
||||
|
||||
public boolean isCompetitionInput(){
|
||||
return this.toString().startsWith(COMPETITION_PREFIX);
|
||||
}
|
||||
|
||||
public ObjectSupplier getObjectSupplier() {
|
||||
// We use a seed to get the same random list every time -> Repeatable benchmarks on same input data!
|
||||
@ -21,9 +266,245 @@ public enum DataEnum {
|
||||
case RANDOM_INTEGERS_300M -> new RandomIntegers(longListSize, seed);
|
||||
case ASCENDING_INTEGERS_300M -> new AscendingIntegers(longListSize);
|
||||
case DESCENDING_INTEGERS_250M -> new DescendingIntegers(middleListSize);
|
||||
|
||||
case ASCENDING_RUNS_1M -> AscendingRuns.newAscendingRuns(runs, runLength, -runLength);
|
||||
case ASCENDING_RUNS_WITH_OVERLAP_1M -> AscendingRuns.newAscendingRuns(runs, runLength, (int) (-0.5 * runLength));
|
||||
case ASCENDING_RUNS_WITH_OVERLAP_1M ->
|
||||
AscendingRuns.newAscendingRuns(runs, runLength, (int) (-0.5 * runLength));
|
||||
|
||||
case COMPETITION_1 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_2 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_3 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_5 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_6 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_7 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_8 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_9 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_10 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_11 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_12 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_13 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_15 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_16 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_17 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_18 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_19 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_20 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_21 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_22 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_23 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_24 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_25 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_26 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_27 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_28 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_29 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_30 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_31 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_32 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_33 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_34 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_35 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_36 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_37 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_38 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_39 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_40 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_41 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_42 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_43 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_44 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_45 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_46 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_47 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_48 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_49 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_50 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_51 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_52 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_53 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_54 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_55 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_56 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_57 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_58 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_59 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_60 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_61 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_62 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_63 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_64 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_65 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_66 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_67 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_68 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_69 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_70 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_71 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_72 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_73 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_74 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_75 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_76 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_77 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_78 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_79 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_80 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_81 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_82 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_83 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_84 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_85 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_86 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_87 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_88 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_89 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_90 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_91 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_92 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_93 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_94 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_95 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_96 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_97 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_99 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_100 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_101 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_102 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_103 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_104 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_105 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_106 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_107 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_108 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_109 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_110 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_111 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_112 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_113 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_114 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_115 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_116 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_117 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_118 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_119 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_120 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_121 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_122 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_123 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_124 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_125 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_126 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_127 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_128 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_129 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_130 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_131 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_132 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_133 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_134 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_135 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_136 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_137 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_138 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_139 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_140 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_141 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_142 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_143 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_144 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_145 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_146 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_147 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_148 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_149 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_150 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_151 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_152 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_153 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_154 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_155 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_156 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_157 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_158 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_159 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_160 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_161 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_162 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_163 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_164 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_165 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_166 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_167 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_168 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_169 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_170 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_171 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_172 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_173 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_174 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_175 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_176 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_177 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_178 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_179 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_180 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_181 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_182 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_183 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_184 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_185 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_186 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_187 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_188 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_189 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_190 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_191 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_192 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_193 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_194 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_195 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_196 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_197 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_198 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_199 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_200 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_201 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_202 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_203 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_204 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_205 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_206 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_207 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_208 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_209 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_210 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_211 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_212 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_213 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_214 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_215 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_216 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_217 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_218 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_219 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_220 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_221 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_222 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_223 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_224 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_225 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_226 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_227 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_228 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_229 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_230 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_231 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_232 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_233 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_234 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_235 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_236 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_237 -> IntegerSerializer.fromEnum(this);
|
||||
case COMPETITION_238 -> IntegerSerializer.fromEnum(this);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,89 @@
|
||||
package de.uni_marburg.powersort.data;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class IntegerSerializer {
|
||||
public static final Path DATA_DIR = Paths.get("integer_lists");
|
||||
|
||||
private final int id;
|
||||
|
||||
public static ObjectSupplier fromEnum(DataEnum dataEnum) {
|
||||
if(!dataEnum.isCompetitionInput()){
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
String prefixedId = dataEnum.toString();
|
||||
IntegerSerializer serializer = new IntegerSerializer(Integer.parseInt(prefixedId.substring(DataEnum.COMPETITION_PREFIX.length())));
|
||||
return serializer.getObjectSupplier();
|
||||
}
|
||||
|
||||
public IntegerSerializer(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ObjectSupplier getObjectSupplier() {
|
||||
Integer[] list = read();
|
||||
return new IntegerSupplier(list) {
|
||||
@Override
|
||||
public Integer[] getCopy() {
|
||||
return super.getCopy();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Integer[] read() {
|
||||
Path path = getPath();
|
||||
String content;
|
||||
try {
|
||||
content = Files.readString(path);
|
||||
} catch (IOException e) {
|
||||
System.err.println(this + ": Could not read file " + path.toAbsolutePath());
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
|
||||
content = content.strip();
|
||||
if (content.charAt(0) != '[' || content.charAt(content.length() - 1) != ']') {
|
||||
System.err.println(this + ": Illegal data format: Expected list of integers surrounded by square brackets.");
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
content = content.substring(1, content.length() - 1);
|
||||
|
||||
// Remove spaces
|
||||
content = content.replaceAll(" ", "");
|
||||
|
||||
String[] elements = content.split(",");
|
||||
try {
|
||||
return Arrays.stream(elements).map(Integer::valueOf).toArray(Integer[]::new);
|
||||
} catch (NumberFormatException e) {
|
||||
System.err.println(this + ": Number format exception: " + e.getMessage());
|
||||
System.exit(1);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void write(Integer[] list) throws IOException {
|
||||
Path path = getPath();
|
||||
if (Files.exists(path)) {
|
||||
throw new IOException(this + ": Target file does already exist");
|
||||
}
|
||||
|
||||
String[] elements = Arrays.stream(list).map(Object::toString).toArray(String[]::new);
|
||||
String content = "[" + String.join(",", elements) + "]";
|
||||
Files.writeString(path, content);
|
||||
}
|
||||
|
||||
private Path getPath() {
|
||||
return DATA_DIR.resolve(Integer.toString(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IntegerSerializer{" + id + "}";
|
||||
}
|
||||
}
|
@ -6,14 +6,14 @@ import de.uni_marburg.powersort.benchmark.NaturalOrder;
|
||||
import de.uni_marburg.powersort.sort.dpqs.DualPivotQuicksort;
|
||||
|
||||
public enum SortEnum {
|
||||
BUBBLE_SORT,
|
||||
QUICK_SORT,
|
||||
DPQS,
|
||||
MERGE_SORT,
|
||||
TIM_SORT,
|
||||
FINN_SORT,
|
||||
ASORT,
|
||||
FASTER_FINN_SORT,
|
||||
ASORT;
|
||||
FINN_SORT,
|
||||
DPQS,
|
||||
QUICK_SORT,
|
||||
MERGE_SORT,
|
||||
BUBBLE_SORT;
|
||||
|
||||
public SortImpl getSortImpl() {
|
||||
return switch (this) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user