Get rid of Lombok
This commit is contained in:
parent
73bff02936
commit
ce0a1d1051
@ -26,8 +26,6 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.projectlombok:lombok:1.16.16")
|
||||
|
||||
compile("eu.mikroskeem:shuriken.instrumentation:0.0.1-SNAPSHOT")
|
||||
compile("io.github.lukehutch:fast-classpath-scanner:2.0.19")
|
||||
compile("org.apache.commons:commons-compress:1.15")
|
||||
|
@ -4,8 +4,6 @@ import eu.mikroskeem.shuriken.instrumentation.validate.Validate;
|
||||
import eu.mikroskeem.shuriken.reflect.Reflect;
|
||||
import eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid.AbstractAlgorithm;
|
||||
import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.time.Duration;
|
||||
@ -20,8 +18,8 @@ import static eu.mikroskeem.uurimustoo.algoritmidetest.Utils.DummyCompressor.of;
|
||||
/**
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class Utils {
|
||||
public static List<AbstractAlgorithm> getAllCompressors() {
|
||||
class Utils {
|
||||
private static List<AbstractAlgorithm> getAllCompressors() {
|
||||
return new FastClasspathScanner(AbstractAlgorithm.class.getPackage().getName())
|
||||
.scan().getNamesOfSubclassesOf(AbstractAlgorithm.class)
|
||||
.stream()
|
||||
@ -37,7 +35,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
|
||||
public static CompressorResult executeCompressor(byte[] input, AbstractAlgorithm compressor) {
|
||||
private static CompressorResult executeCompressor(byte[] input, AbstractAlgorithm compressor) {
|
||||
String compressorName = compressor.getName();
|
||||
boolean decompressFailed = false;
|
||||
|
||||
@ -65,10 +63,10 @@ public class Utils {
|
||||
return new CompressorResult(compressor, decompressFailed, compressed.length, sizeDiff, compressTime, decompressTime);
|
||||
}
|
||||
|
||||
public static List<CompressorResult> executeAllNTimes(byte[] input, int n) {
|
||||
private static List<CompressorResult> executeAllNTimes(byte[] input, int n) {
|
||||
int i = 0;
|
||||
List<CompressorResult> lastExecuted = executeAll(input, getAllCompressors());
|
||||
while(i < n-1){
|
||||
while(i < n-1) {
|
||||
lastExecuted = executeAll(input, lastExecuted.stream()
|
||||
.filter(r -> !r.isDecompressFailed())
|
||||
.map(CompressorResult::getCompressor)
|
||||
@ -81,11 +79,11 @@ public class Utils {
|
||||
return lastExecuted;
|
||||
}
|
||||
|
||||
public static List<CompressorResult> executeAll(byte[] input, List<AbstractAlgorithm> compressors) {
|
||||
private static List<CompressorResult> executeAll(byte[] input, List<AbstractAlgorithm> compressors) {
|
||||
return compressors.stream().map(c -> executeCompressor(input, c)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static void generateReport(byte[] input) {
|
||||
static void generateReport(byte[] input) {
|
||||
|
||||
System.out.println("----------------------------------------------------------------------------");
|
||||
System.out.println("| Algoritm | Suurus | Väiksem | Aeg (kokku) | Aeg (lahti) |");
|
||||
@ -103,9 +101,7 @@ public class Utils {
|
||||
System.out.println("|--------------------------------------------------------------------------|");
|
||||
}
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public static class CompressorResult implements Comparable<CompressorResult> {
|
||||
private static class CompressorResult implements Comparable<CompressorResult> {
|
||||
private final AbstractAlgorithm compressor;
|
||||
private final boolean decompressFailed;
|
||||
private final int size;
|
||||
@ -113,6 +109,39 @@ public class Utils {
|
||||
private final int timeInNS;
|
||||
private final int decompressTimeInNS;
|
||||
|
||||
CompressorResult(AbstractAlgorithm compressor, boolean decompressFailed, int size, float difference, int timeInNS, int decompressTimeInNS) {
|
||||
this.compressor = compressor;
|
||||
this.decompressFailed = decompressFailed;
|
||||
this.size = size;
|
||||
this.difference = difference;
|
||||
this.timeInNS = timeInNS;
|
||||
this.decompressTimeInNS = decompressTimeInNS;
|
||||
}
|
||||
|
||||
AbstractAlgorithm getCompressor() {
|
||||
return compressor;
|
||||
}
|
||||
|
||||
boolean isDecompressFailed() {
|
||||
return decompressFailed;
|
||||
}
|
||||
|
||||
int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
float getDifference() {
|
||||
return difference;
|
||||
}
|
||||
|
||||
int getTimeInNS() {
|
||||
return timeInNS;
|
||||
}
|
||||
|
||||
int getDecompressTimeInNS() {
|
||||
return decompressTimeInNS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull Utils.CompressorResult o) {
|
||||
return Integer.compare(size, o.getSize());
|
||||
@ -120,7 +149,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
static class DummyCompressor extends AbstractAlgorithm {
|
||||
@Getter private final String name = "Orginaal";
|
||||
@Override public String getName() { return "Orginaal"; }
|
||||
|
||||
static CompressorResult of(int size){
|
||||
return new CompressorResult(new DummyCompressor(), false, size, 1.0F, -1, -1);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
|
||||
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorOutputStream;
|
||||
|
||||
@ -12,7 +11,7 @@ import java.io.OutputStream;
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class BZip2 extends AbstractAlgorithm {
|
||||
@Getter private final String name = "BZip2";
|
||||
@Override public String getName() { return "BZip2"; }
|
||||
|
||||
@Override
|
||||
public OutputStream createCompressor(OutputStream outputStream) throws IOException {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.meteogroup.jbrotli.io.BrotliInputStream;
|
||||
import org.meteogroup.jbrotli.io.BrotliOutputStream;
|
||||
import org.meteogroup.jbrotli.libloader.BrotliLibraryLoader;
|
||||
@ -13,7 +12,7 @@ import java.io.OutputStream;
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class Brotli extends AbstractAlgorithm {
|
||||
@Getter private final String name = "Brotli";
|
||||
@Override public String getName() { return "Brotli"; }
|
||||
|
||||
static {
|
||||
BrotliLibraryLoader.loadBrotli();
|
||||
|
@ -1,7 +1,5 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -12,7 +10,7 @@ import java.util.zip.GZIPOutputStream;
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class GZip extends AbstractAlgorithm {
|
||||
@Getter private final String name = "GZip";
|
||||
@Override public String getName() { return "GZip"; }
|
||||
|
||||
@Override
|
||||
public OutputStream createCompressor(OutputStream outputStream) throws IOException {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.jpountz.lz4.LZ4Compressor;
|
||||
import net.jpountz.lz4.LZ4Factory;
|
||||
import net.jpountz.lz4.LZ4SafeDecompressor;
|
||||
@ -9,7 +8,7 @@ import net.jpountz.lz4.LZ4SafeDecompressor;
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class LZ4 extends AbstractAlgorithm {
|
||||
@Getter private final String name = "LZ4";
|
||||
@Override public String getName() { return "LZ4"; }
|
||||
private final LZ4Factory factory = LZ4Factory.fastestInstance();
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.jpountz.lz4.LZ4Compressor;
|
||||
import net.jpountz.lz4.LZ4Factory;
|
||||
import net.jpountz.lz4.LZ4SafeDecompressor;
|
||||
@ -9,7 +8,7 @@ import net.jpountz.lz4.LZ4SafeDecompressor;
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class LZ4HC extends AbstractAlgorithm {
|
||||
@Getter private final String name = "LZ4 HC";
|
||||
@Override public String getName() { return "LZ4 HC"; }
|
||||
private final LZ4Factory factory = LZ4Factory.fastestInstance();
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.compress.compressors.lzma.LZMACompressorInputStream;
|
||||
import org.apache.commons.compress.compressors.lzma.LZMACompressorOutputStream;
|
||||
|
||||
@ -12,7 +11,7 @@ import java.io.OutputStream;
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class LZMA extends AbstractAlgorithm {
|
||||
@Getter private final String name = "LZMA";
|
||||
@Override public String getName() { return "LZMA"; }
|
||||
|
||||
@Override
|
||||
public OutputStream createCompressor(OutputStream outputStream) throws IOException {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.anarres.lzo.LzoAlgorithm;
|
||||
import org.anarres.lzo.LzoCompressor;
|
||||
import org.anarres.lzo.LzoDecompressor;
|
||||
@ -16,7 +15,7 @@ import java.io.OutputStream;
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class LZO extends AbstractAlgorithm {
|
||||
@Getter private final String name = "LZO";
|
||||
@Override public String getName() { return "LZO"; }
|
||||
|
||||
@Override
|
||||
public OutputStream createCompressor(OutputStream outputStream) throws IOException {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.tukaani.xz.LZMA2Options;
|
||||
import org.tukaani.xz.XZInputStream;
|
||||
import org.tukaani.xz.XZOutputStream;
|
||||
@ -13,7 +12,7 @@ import java.io.OutputStream;
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class XZ extends AbstractAlgorithm {
|
||||
@Getter private final String name = "XZ";
|
||||
@Override public String getName() { return "XZ"; }
|
||||
|
||||
@Override
|
||||
public OutputStream createCompressor(OutputStream outputStream) throws IOException {
|
||||
|
@ -1,7 +1,5 @@
|
||||
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -13,7 +11,7 @@ import java.util.zip.ZipOutputStream;
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class Zip extends AbstractAlgorithm {
|
||||
@Getter private final String name = "ZIP";
|
||||
@Override public String getName() { return "ZIP"; }
|
||||
|
||||
@Override
|
||||
public void compress(InputStream inputStream, OutputStream outputStream) throws IOException {
|
||||
|
@ -2,7 +2,6 @@ package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||
|
||||
import com.github.luben.zstd.ZstdInputStream;
|
||||
import com.github.luben.zstd.ZstdOutputStream;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -12,7 +11,7 @@ import java.io.OutputStream;
|
||||
* @author Mark Vainomaa
|
||||
*/
|
||||
public class Zstandard extends AbstractAlgorithm {
|
||||
@Getter private final String name = "Zstandard";
|
||||
@Override public String getName() { return "Zstandard"; }
|
||||
|
||||
@Override
|
||||
public OutputStream createCompressor(OutputStream outputStream) throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user