Rename classes & packages
This commit is contained in:
parent
f7a2398a75
commit
202eec3547
@ -2,7 +2,7 @@ package eu.mikroskeem.uurimustoo.algoritmidetest;
|
|||||||
|
|
||||||
import eu.mikroskeem.shuriken.instrumentation.validate.Validate;
|
import eu.mikroskeem.shuriken.instrumentation.validate.Validate;
|
||||||
import eu.mikroskeem.shuriken.reflect.Reflect;
|
import eu.mikroskeem.shuriken.reflect.Reflect;
|
||||||
import eu.mikroskeem.uurimustoo.algoritmidetest.compressors.AbstractCompressor;
|
import eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid.AbstractAlgorithm;
|
||||||
import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
|
import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -17,13 +17,13 @@ import java.util.stream.Collectors;
|
|||||||
* @author Mark Vainomaa
|
* @author Mark Vainomaa
|
||||||
*/
|
*/
|
||||||
public class Utils {
|
public class Utils {
|
||||||
public static List<AbstractCompressor> getAllCompressors(){
|
public static List<AbstractAlgorithm> getAllCompressors(){
|
||||||
return new FastClasspathScanner(AbstractCompressor.class.getPackage().getName())
|
return new FastClasspathScanner(AbstractAlgorithm.class.getPackage().getName())
|
||||||
.scan().getNamesOfSubclassesOf(AbstractCompressor.class)
|
.scan().getNamesOfSubclassesOf(AbstractAlgorithm.class)
|
||||||
.stream()
|
.stream()
|
||||||
.map(className -> {
|
.map(className -> {
|
||||||
try {
|
try {
|
||||||
return (AbstractCompressor)Reflect.getClass(className)
|
return (AbstractAlgorithm)Reflect.getClass(className)
|
||||||
.get().construct().getClassInstance();
|
.get().construct().getClassInstance();
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
return null;
|
return null;
|
||||||
@ -34,7 +34,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static CompressorResult executeCompressor(byte[] input, AbstractCompressor compressor){
|
public static CompressorResult executeCompressor(byte[] input, AbstractAlgorithm compressor){
|
||||||
String compressorName = compressor.getName();
|
String compressorName = compressor.getName();
|
||||||
byte[] compressed = compressor.compress(input);
|
byte[] compressed = compressor.compress(input);
|
||||||
/* Verify for sure */
|
/* Verify for sure */
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package eu.mikroskeem.uurimustoo.algoritmidetest.compressors;
|
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||||
|
|
||||||
import eu.mikroskeem.shuriken.common.SneakyThrow;
|
import eu.mikroskeem.shuriken.common.SneakyThrow;
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ import java.io.*;
|
|||||||
/**
|
/**
|
||||||
* @author Mark Vainomaa
|
* @author Mark Vainomaa
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractCompressor {
|
public abstract class AbstractAlgorithm {
|
||||||
public abstract String getName();
|
public abstract String getName();
|
||||||
|
|
||||||
public final byte[] compress(byte[] input){
|
public final byte[] compress(byte[] input){
|
@ -1,4 +1,4 @@
|
|||||||
package eu.mikroskeem.uurimustoo.algoritmidetest.compressors;
|
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ import java.util.zip.GZIPOutputStream;
|
|||||||
/**
|
/**
|
||||||
* @author Mark Vainomaa
|
* @author Mark Vainomaa
|
||||||
*/
|
*/
|
||||||
public class CompressGZip extends AbstractCompressor {
|
public class GZip extends AbstractAlgorithm {
|
||||||
@Getter private final String name = "GZip";
|
@Getter private final String name = "GZip";
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,4 +1,4 @@
|
|||||||
package eu.mikroskeem.uurimustoo.algoritmidetest.compressors;
|
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.tukaani.xz.LZMA2Options;
|
import org.tukaani.xz.LZMA2Options;
|
||||||
@ -12,7 +12,7 @@ import java.io.OutputStream;
|
|||||||
/**
|
/**
|
||||||
* @author Mark Vainomaa
|
* @author Mark Vainomaa
|
||||||
*/
|
*/
|
||||||
public class CompressXZ extends AbstractCompressor {
|
public class XZ extends AbstractAlgorithm {
|
||||||
@Getter private final String name = "XZ";
|
@Getter private final String name = "XZ";
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,4 +1,4 @@
|
|||||||
package eu.mikroskeem.uurimustoo.algoritmidetest.compressors;
|
package eu.mikroskeem.uurimustoo.algoritmidetest.algoritmid;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ import java.util.zip.ZipOutputStream;
|
|||||||
/**
|
/**
|
||||||
* @author Mark Vainomaa
|
* @author Mark Vainomaa
|
||||||
*/
|
*/
|
||||||
public class CompressZip extends AbstractCompressor {
|
public class Zip extends AbstractAlgorithm {
|
||||||
@Getter private final String name = "ZIP";
|
@Getter private final String name = "ZIP";
|
||||||
|
|
||||||
@Override
|
@Override
|
Loading…
Reference in New Issue
Block a user