Skip to content
Snippets Groups Projects
Verified Commit c7be7b6a authored by Enna Gerhard's avatar Enna Gerhard :levitate:
Browse files

Allow loading different problems

parent df7c9289
No related branches found
No related tags found
1 merge request!37Allow loading different problems
Pipeline #238542 failed
......@@ -32,6 +32,21 @@ public class BasicUndirectedGraphImporterExporter
implements Exporter<BasicUndirectedGraph>,
Importer<BasicUndirectedGraph> {
private String problem;
public BasicUndirectedGraphImporterExporter() {
this("cep");
}
/**
* Specifies which problem to look for.
*
* @param problem name of the problem
*/
public BasicUndirectedGraphImporterExporter(String problem) {
this.problem = problem;
}
@Override
public void exportToFile(final BasicUndirectedGraph graph, final String path) throws IOException {
export(graph, new FileWriter(path));
......@@ -89,7 +104,7 @@ public class BasicUndirectedGraphImporterExporter
if (nextLine.startsWith("p")) { //Pace Problem importtype
//block needed for pace
String[] arguments = nextLine.split(" ");
if (!(arguments[1].equals("cep") || arguments[1].equals("td"))) {
if (!(arguments[1].equals(problem) || arguments[1].equals("td"))) {
System.err.println("Wrong problem see pace 2021 documentation");
break;
}
......
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