summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-05-28 18:16:46 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-05-28 18:16:46 +0200
commitae65703e96e8c51880b9995ef5de27890722b275 (patch)
tree4f77229c438a34ad421706d5210b476e12885fba
parent32e195da6941067000c8574515b97c50bcbd4466 (diff)
downloadhastabel2idp-ae65703e96e8c51880b9995ef5de27890722b275.zip
hastabel2idp-ae65703e96e8c51880b9995ef5de27890722b275.tar.bz2
Takes the property name as a parameter.
-rw-r--r--src/hastabel2idp/HastabelResult.java1
-rw-r--r--src/hastabel2idp/Parameters.java49
2 files changed, 40 insertions, 10 deletions
diff --git a/src/hastabel2idp/HastabelResult.java b/src/hastabel2idp/HastabelResult.java
index 7b40e2d..102a229 100644
--- a/src/hastabel2idp/HastabelResult.java
+++ b/src/hastabel2idp/HastabelResult.java
@@ -43,7 +43,6 @@ public class HastabelResult
{
add_solution_to_level(predicate, signature);
add_solution_to_model(predicate, idp_solution);
- level.write(predicate);
}
private void add_solution_to_level
diff --git a/src/hastabel2idp/Parameters.java b/src/hastabel2idp/Parameters.java
index a2f72ae..74cc139 100644
--- a/src/hastabel2idp/Parameters.java
+++ b/src/hastabel2idp/Parameters.java
@@ -3,6 +3,8 @@ package hastabel2idp;
import java.util.List;
import java.util.ArrayList;
+import java.io.File;
+
public class Parameters
{
private final List<String> level_files;
@@ -12,6 +14,7 @@ public class Parameters
private final String idp_exec;
private final boolean be_verbose;
private final boolean are_valid;
+ private final String property_name;
public static void print_usage ()
{
@@ -19,8 +22,9 @@ public class Parameters
(
"HaStABeL to IDP\n"
+ "USAGE:\n"
- + "\tjava -jar hastabel2idp.jar <OUTPUT_DIR> <FILES|OPTIONS>+\n"
+ + "\tjava -jar hastabel2idp.jar <PROP_NAME> <OUTPUT_DIR> <FILES|OPTIONS>+\n"
+ "PARAMETERS:\n"
+ + "\t- <PROP_NAME>\tName of the property.\n"
+ "\t- <OUTPUT_DIR>\tDirectory in which to write the IDP model.\n"
+ "\t- <FILES>\tList of files to be loaded.\n"
+ "OPTIONS:\n"
@@ -31,11 +35,13 @@ public class Parameters
+ "\t- Model files have a \".mod\" extension.\n"
+ "\t- Level files have a \".lvl\" extension.\n"
+ "\t- The files may be given in any order."
+ + "\t- \".mod\" and \".lvl\" files from <OUTPUT_DIR> are also loaded."
);
}
public Parameters (final String... args)
{
+ final File output_folder;
boolean has_pro_file, has_error, should_be_verbose;
String prop_file, idp_file;
@@ -44,7 +50,7 @@ public class Parameters
should_be_verbose = false;
- if (args.length < 2)
+ if (args.length < 3)
{
print_usage();
@@ -55,6 +61,8 @@ public class Parameters
be_verbose = false;
idp_exec = null;
+ property_name = null;
+
return;
}
@@ -62,11 +70,13 @@ public class Parameters
has_error = false;
idp_file = null;
- output_dir = args[0];
+ property_name = args[0];
+ output_dir = args[1];
if
(
- (output_dir.equals("-e") || output_dir.equals("--exec"))
+ (property_name.equals("-e") || property_name.equals("--exec"))
+ || (output_dir.equals("-e") || output_dir.equals("--exec"))
/* || ... */
)
{
@@ -74,7 +84,8 @@ public class Parameters
System.err.println
(
- "[F] An option was found in lieu of the output file."
+ "[F] An option was found in lieu of the property name or of the"
+ + " output directory."
);
System.exit(-1);
@@ -82,7 +93,10 @@ public class Parameters
if
(
- output_dir.endsWith(".lvl")
+ property_name.endsWith(".lvl")
+ || property_name.endsWith(".mod")
+ || property_name.endsWith(".pro")
+ || output_dir.endsWith(".lvl")
|| output_dir.endsWith(".mod")
|| output_dir.endsWith(".pro")
)
@@ -105,7 +119,7 @@ public class Parameters
prop_file = new String();
- for (int i = 1; i < args.length; ++i)
+ for (int i = 2; i < args.length; ++i)
{
if (args[i].endsWith(".lvl"))
{
@@ -158,9 +172,26 @@ public class Parameters
}
}
+ output_folder = new File(output_dir);
+
+ for (final File file : output_folder.listFiles())
+ {
+ final String filename;
+
+ filename = file.getName();
+
+ if (filename.endsWith(".lvl"))
+ {
+ level_files.add(output_dir + "/" + filename);
+ }
+ else if (filename.endsWith(".mod"))
+ {
+ model_files.add(output_dir + "/" + filename);
+ }
+ }
+
idp_exec = idp_file;
property_file = prop_file;
-
if (!has_pro_file)
{
System.err.println("[E] There was no property file.");
@@ -224,7 +255,7 @@ public class Parameters
public String get_property_name ()
{
- return "my_property";
+ return property_name;
}
public boolean be_verbose ()