diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java index e07d54f..2c53063 100644 --- a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java +++ b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | |||
| @@ -5,6 +5,8 @@ import org.apache.log4j.Logger; | |||
| 5 | import java.io.FileInputStream; | 5 | import java.io.FileInputStream; |
| 6 | import java.io.IOException; | 6 | import java.io.IOException; |
| 7 | import java.io.InputStream; | 7 | import java.io.InputStream; |
| 8 | import java.nio.file.Path; | ||
| 9 | import java.nio.file.Paths; | ||
| 8 | import java.util.Properties; | 10 | import java.util.Properties; |
| 9 | 11 | ||
| 10 | public class PagodaProperties { | 12 | public class PagodaProperties { |
| @@ -13,6 +15,7 @@ public class PagodaProperties { | |||
| 13 | public static final boolean DEFAULT_DEBUG = false; | 15 | public static final boolean DEFAULT_DEBUG = false; |
| 14 | private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; | 16 | private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; |
| 15 | private static final boolean DEFAULT_USE_SKOLEM_UPPER_BOUND; | 17 | private static final boolean DEFAULT_USE_SKOLEM_UPPER_BOUND; |
| 18 | private static final Path DEFAULT_STATISTICS_DIR; | ||
| 16 | 19 | ||
| 17 | public static boolean shellModeDefault = false; | 20 | public static boolean shellModeDefault = false; |
| 18 | private static boolean debug = DEFAULT_DEBUG; | 21 | private static boolean debug = DEFAULT_DEBUG; |
| @@ -20,6 +23,7 @@ public class PagodaProperties { | |||
| 20 | static { | 23 | static { |
| 21 | boolean defaultUseAlwaysSimpleUpperBound = false; | 24 | boolean defaultUseAlwaysSimpleUpperBound = false; |
| 22 | boolean defaultUseSkolemUpperBound = true; | 25 | boolean defaultUseSkolemUpperBound = true; |
| 26 | Path defaultStatisticsDir = null; | ||
| 23 | 27 | ||
| 24 | try(InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { | 28 | try(InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { |
| 25 | Properties config = new Properties(); | 29 | Properties config = new Properties(); |
| @@ -28,8 +32,12 @@ public class PagodaProperties { | |||
| 28 | Logger logger = Logger.getLogger("PagodaProperties"); | 32 | Logger logger = Logger.getLogger("PagodaProperties"); |
| 29 | if(config.containsKey("debug")) { | 33 | if(config.containsKey("debug")) { |
| 30 | debug = Boolean.parseBoolean(config.getProperty("debug")); | 34 | debug = Boolean.parseBoolean(config.getProperty("debug")); |
| 31 | // logger.info("Debugging mode is enabled (you can disable it from file \"pagoda.properties\")"); | ||
| 32 | logger.info("Debugging mode is enabled"); | 35 | logger.info("Debugging mode is enabled"); |
| 36 | |||
| 37 | if(config.containsKey("statisticsDir")) { | ||
| 38 | defaultStatisticsDir = Paths.get(config.getProperty("statisticsDir")); | ||
| 39 | logger.info("The directory where statistics are saved is: \"" + defaultStatisticsDir + "\""); | ||
| 40 | } | ||
| 33 | } | 41 | } |
| 34 | if(config.containsKey("useAlwaysSimpleUpperBound")) { | 42 | if(config.containsKey("useAlwaysSimpleUpperBound")) { |
| 35 | defaultUseAlwaysSimpleUpperBound = | 43 | defaultUseAlwaysSimpleUpperBound = |
| @@ -40,11 +48,13 @@ public class PagodaProperties { | |||
| 40 | defaultUseSkolemUpperBound = Boolean.parseBoolean(config.getProperty("useSkolemUpperBound")); | 48 | defaultUseSkolemUpperBound = Boolean.parseBoolean(config.getProperty("useSkolemUpperBound")); |
| 41 | logger.info("The Skolem upper bound is enabled"); | 49 | logger.info("The Skolem upper bound is enabled"); |
| 42 | } | 50 | } |
| 51 | |||
| 43 | } catch(IOException e) { | 52 | } catch(IOException e) { |
| 44 | e.printStackTrace(); | 53 | e.printStackTrace(); |
| 45 | } | 54 | } |
| 46 | DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND = defaultUseAlwaysSimpleUpperBound; | 55 | DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND = defaultUseAlwaysSimpleUpperBound; |
| 47 | DEFAULT_USE_SKOLEM_UPPER_BOUND = defaultUseSkolemUpperBound; | 56 | DEFAULT_USE_SKOLEM_UPPER_BOUND = defaultUseSkolemUpperBound; |
| 57 | DEFAULT_STATISTICS_DIR = defaultStatisticsDir; | ||
| 48 | } | 58 | } |
| 49 | 59 | ||
| 50 | String dataPath = null; | 60 | String dataPath = null; |
| @@ -56,6 +66,8 @@ public class PagodaProperties { | |||
| 56 | boolean shellMode = shellModeDefault; | 66 | boolean shellMode = shellModeDefault; |
| 57 | private boolean useAlwaysSimpleUpperBound = DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; | 67 | private boolean useAlwaysSimpleUpperBound = DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; |
| 58 | private boolean useSkolemUpperBound = DEFAULT_USE_SKOLEM_UPPER_BOUND; | 68 | private boolean useSkolemUpperBound = DEFAULT_USE_SKOLEM_UPPER_BOUND; |
| 69 | private Path statisticsDir = DEFAULT_STATISTICS_DIR; | ||
| 70 | |||
| 59 | public PagodaProperties(String path) { | 71 | public PagodaProperties(String path) { |
| 60 | java.util.Properties m_properties = new java.util.Properties(); | 72 | java.util.Properties m_properties = new java.util.Properties(); |
| 61 | InputStream inputStream = null; | 73 | InputStream inputStream = null; |
| @@ -92,6 +104,10 @@ public class PagodaProperties { | |||
| 92 | return DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; | 104 | return DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; |
| 93 | } | 105 | } |
| 94 | 106 | ||
| 107 | public static Path getDefaultStatisticsDir() { | ||
| 108 | return DEFAULT_STATISTICS_DIR; | ||
| 109 | } | ||
| 110 | |||
| 95 | public static boolean getDefaultUseSkolemUpperBound() { | 111 | public static boolean getDefaultUseSkolemUpperBound() { |
| 96 | return DEFAULT_USE_SKOLEM_UPPER_BOUND; | 112 | return DEFAULT_USE_SKOLEM_UPPER_BOUND; |
| 97 | } | 113 | } |
| @@ -167,4 +183,12 @@ public class PagodaProperties { | |||
| 167 | public void setUseSkolemUpperBound(boolean flag) { | 183 | public void setUseSkolemUpperBound(boolean flag) { |
| 168 | useSkolemUpperBound = flag; | 184 | useSkolemUpperBound = flag; |
| 169 | } | 185 | } |
| 186 | |||
| 187 | public Path getStatisticsDir() { | ||
| 188 | return statisticsDir; | ||
| 189 | } | ||
| 190 | |||
| 191 | public void setStatisticsDir(Path statisticsDir) { | ||
| 192 | this.statisticsDir = statisticsDir; | ||
| 193 | } | ||
| 170 | } | 194 | } |
