Fix code style

This commit is contained in:
Mark Vainomaa 2018-01-28 21:11:10 +02:00
parent 6c79bf8514
commit 984aec2342
Signed by: mikroskeem
GPG Key ID: 1B3F9523B542D315
5 changed files with 29 additions and 21 deletions

View File

@ -11,7 +11,7 @@ public class Main {
byte[] classFile = ByteArrays.fromInputStream(Main.class.getResourceAsStream("/Test.class")); byte[] classFile = ByteArrays.fromInputStream(Main.class.getResourceAsStream("/Test.class"));
Utils.generateReport(classFile); Utils.generateReport(classFile);
System.out.println("=== Suure class faili pakkimise test (100x)"); System.out.println("==== Suure class faili pakkimise test (100x)");
byte[] classFile2 = ByteArrays.fromInputStream(Main.class.getResourceAsStream("/TestBig.class")); byte[] classFile2 = ByteArrays.fromInputStream(Main.class.getResourceAsStream("/TestBig.class"));
Utils.generateReport(classFile2); Utils.generateReport(classFile2);
} }

View File

@ -27,8 +27,7 @@ public class Utils {
.stream() .stream()
.map(className -> { .map(className -> {
try { try {
return (AbstractAlgorithm)Reflect.getClass(className) return (AbstractAlgorithm) Reflect.getClass(className).get().construct().getClassInstance();
.get().construct().getClassInstance();
} catch (Exception e){ } catch (Exception e){
return null; return null;
} }
@ -62,7 +61,7 @@ public class Utils {
} }
float sizeDiff = (float)input.length / (float)compressed.length; float sizeDiff = (float)input.length / (float)compressed.length;
int compressTime = Duration.between(start, end).getNano(); int compressTime = Duration.between(start, end).getNano();
int decompressTime = start2!=null&&end2!=null?Duration.between(start2, end2).getNano():-1; int decompressTime = (start2 != null && end2 != null) ? Duration.between(start2, end2).getNano() : -1;
return new CompressorResult(compressor, decompressFailed, compressed.length, sizeDiff, compressTime, decompressTime); return new CompressorResult(compressor, decompressFailed, compressed.length, sizeDiff, compressTime, decompressTime);
} }
@ -116,7 +115,7 @@ public class Utils {
@Override @Override
public int compareTo(@NotNull Utils.CompressorResult o) { public int compareTo(@NotNull Utils.CompressorResult o) {
return new Integer(size).compareTo(o.getSize()); return Integer.compare(size, o.getSize());
} }
} }

View File

@ -2,7 +2,11 @@ package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
import eu.mikroskeem.shuriken.common.SneakyThrow; import eu.mikroskeem.shuriken.common.SneakyThrow;
import java.io.*; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/** /**
* @author Mark Vainomaa * @author Mark Vainomaa

View File

@ -1,7 +1,12 @@
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid; package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
import lombok.Getter; import lombok.Getter;
import org.anarres.lzo.*; import org.anarres.lzo.LzoAlgorithm;
import org.anarres.lzo.LzoCompressor;
import org.anarres.lzo.LzoDecompressor;
import org.anarres.lzo.LzoInputStream;
import org.anarres.lzo.LzoLibrary;
import org.anarres.lzo.LzoOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;