Skip to content
Snippets Groups Projects
Commit 4e2a94b3 authored by Antoine Pietri's avatar Antoine Pietri
Browse files

java: cleanup MPHTranslate

parent a315f1b9
No related branches found
No related tags found
No related merge requests found
......@@ -5,20 +5,17 @@ import it.unimi.dsi.fastutil.io.BinIO;
import it.unimi.dsi.fastutil.objects.Object2LongFunction;
import it.unimi.dsi.io.FastBufferedReader;
import it.unimi.dsi.io.LineIterator;
import org.softwareheritage.graph.experiments.multiplicationfactor.GenDistribution;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
public class MPHTranslate {
final static String SORT_BUFFER_SIZE = "40%";
private static JSAPResult parse_args(String[] args) {
JSAPResult config = null;
try {
SimpleJSAP jsap = new SimpleJSAP(
GenDistribution.class.getName(),
MPHTranslate.class.getName(),
"",
new Parameter[]{
new UnflaggedOption("function", JSAP.STRING_PARSER, JSAP.REQUIRED,
......@@ -36,25 +33,21 @@ public class MPHTranslate {
return config;
}
public static void main(String[] args) throws IOException {
JSAPResult config = parse_args(args);
String mphPath = config.getString("function");
outputPermutation(mphPath);
@SuppressWarnings("unchecked") // Suppress warning for Object2LongFunction cast
static Object2LongFunction<String> loadMPH(String mphPath)
throws IOException, ClassNotFoundException {
return (Object2LongFunction<String>) BinIO.loadObject(mphPath);
}
public static void main(String[] args)
throws IOException, ClassNotFoundException {
JSAPResult config = parse_args(args);
String mphPath = config.getString("function");
@SuppressWarnings("unchecked") // Suppress warning for Object2LongFunction cast
static void outputPermutation(String mphPath)
throws IOException {
Object2LongFunction<String> mphMap = null;
try {
mphMap = (Object2LongFunction<String>) BinIO.loadObject(mphPath);
} catch (ClassNotFoundException e) {
System.exit(2);
}
Object2LongFunction<String> mphMap = loadMPH(mphPath);
FastBufferedReader buffer = new FastBufferedReader(new InputStreamReader(System.in,
StandardCharsets.US_ASCII));
FastBufferedReader buffer = new FastBufferedReader(
new InputStreamReader(System.in, StandardCharsets.US_ASCII));
LineIterator lineIterator = new LineIterator(buffer);
while (lineIterator.hasNext()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment