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 | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java index 7b7d48d..e07d54f 100644 --- a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java +++ b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | |||
| @@ -10,24 +10,41 @@ import java.util.Properties; | |||
| 10 | public class PagodaProperties { | 10 | public class PagodaProperties { |
| 11 | 11 | ||
| 12 | public static final String CONFIG_FILE = "pagoda.properties"; | 12 | public static final String CONFIG_FILE = "pagoda.properties"; |
| 13 | |||
| 14 | public static final boolean DEFAULT_DEBUG = false; | 13 | public static final boolean DEFAULT_DEBUG = false; |
| 14 | private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; | ||
| 15 | private static final boolean DEFAULT_USE_SKOLEM_UPPER_BOUND; | ||
| 16 | |||
| 15 | public static boolean shellModeDefault = false; | 17 | public static boolean shellModeDefault = false; |
| 16 | private static boolean debug = DEFAULT_DEBUG; | 18 | private static boolean debug = DEFAULT_DEBUG; |
| 17 | 19 | ||
| 18 | static { | 20 | static { |
| 21 | boolean defaultUseAlwaysSimpleUpperBound = false; | ||
| 22 | boolean defaultUseSkolemUpperBound = true; | ||
| 23 | |||
| 19 | try(InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { | 24 | try(InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { |
| 20 | Properties config = new Properties(); | 25 | Properties config = new Properties(); |
| 21 | config.load(in); | 26 | config.load(in); |
| 22 | in.close(); | 27 | in.close(); |
| 28 | Logger logger = Logger.getLogger("PagodaProperties"); | ||
| 23 | if(config.containsKey("debug")) { | 29 | if(config.containsKey("debug")) { |
| 24 | debug = Boolean.parseBoolean(config.getProperty("debug")); | 30 | debug = Boolean.parseBoolean(config.getProperty("debug")); |
| 25 | Logger.getLogger("PagodaProperties") | 31 | // logger.info("Debugging mode is enabled (you can disable it from file \"pagoda.properties\")"); |
| 26 | .info("Debugging mode is enabled (you can disable it from file \"pagoda.properties\")"); | 32 | logger.info("Debugging mode is enabled"); |
| 33 | } | ||
| 34 | if(config.containsKey("useAlwaysSimpleUpperBound")) { | ||
| 35 | defaultUseAlwaysSimpleUpperBound = | ||
| 36 | Boolean.parseBoolean(config.getProperty("useAlwaysSimpleUpperBound")); | ||
| 37 | logger.info("The simple upper bound is always used"); | ||
| 38 | } | ||
| 39 | if(config.containsKey("useSkolemUpperBound")) { | ||
| 40 | defaultUseSkolemUpperBound = Boolean.parseBoolean(config.getProperty("useSkolemUpperBound")); | ||
| 41 | logger.info("The Skolem upper bound is enabled"); | ||
| 27 | } | 42 | } |
| 28 | } catch(IOException e) { | 43 | } catch(IOException e) { |
| 29 | e.printStackTrace(); | 44 | e.printStackTrace(); |
| 30 | } | 45 | } |
| 46 | DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND = defaultUseAlwaysSimpleUpperBound; | ||
| 47 | DEFAULT_USE_SKOLEM_UPPER_BOUND = defaultUseSkolemUpperBound; | ||
| 31 | } | 48 | } |
| 32 | 49 | ||
| 33 | String dataPath = null; | 50 | String dataPath = null; |
| @@ -37,7 +54,8 @@ public class PagodaProperties { | |||
| 37 | boolean toClassify = true; | 54 | boolean toClassify = true; |
| 38 | boolean toCallHermiT = true; | 55 | boolean toCallHermiT = true; |
| 39 | boolean shellMode = shellModeDefault; | 56 | boolean shellMode = shellModeDefault; |
| 40 | 57 | private boolean useAlwaysSimpleUpperBound = DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; | |
| 58 | private boolean useSkolemUpperBound = DEFAULT_USE_SKOLEM_UPPER_BOUND; | ||
| 41 | public PagodaProperties(String path) { | 59 | public PagodaProperties(String path) { |
| 42 | java.util.Properties m_properties = new java.util.Properties(); | 60 | java.util.Properties m_properties = new java.util.Properties(); |
| 43 | InputStream inputStream = null; | 61 | InputStream inputStream = null; |
| @@ -63,7 +81,6 @@ public class PagodaProperties { | |||
| 63 | } | 81 | } |
| 64 | } | 82 | } |
| 65 | } | 83 | } |
| 66 | |||
| 67 | public PagodaProperties() { | 84 | public PagodaProperties() { |
| 68 | } | 85 | } |
| 69 | 86 | ||
| @@ -71,6 +88,14 @@ public class PagodaProperties { | |||
| 71 | return debug; | 88 | return debug; |
| 72 | } | 89 | } |
| 73 | 90 | ||
| 91 | public static boolean getDefaultUseAlwaysSimpleUpperBound() { | ||
| 92 | return DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; | ||
| 93 | } | ||
| 94 | |||
| 95 | public static boolean getDefaultUseSkolemUpperBound() { | ||
| 96 | return DEFAULT_USE_SKOLEM_UPPER_BOUND; | ||
| 97 | } | ||
| 98 | |||
| 74 | public String getDataPath() { | 99 | public String getDataPath() { |
| 75 | return dataPath; | 100 | return dataPath; |
| 76 | } | 101 | } |
| @@ -127,4 +152,19 @@ public class PagodaProperties { | |||
| 127 | shellMode = flag; | 152 | shellMode = flag; |
| 128 | } | 153 | } |
| 129 | 154 | ||
| 155 | public boolean getUseAlwaysSimpleUpperBound() { | ||
| 156 | return useAlwaysSimpleUpperBound; | ||
| 157 | } | ||
| 158 | |||
| 159 | public void setUseAlwaysSimpleUpperBound(boolean flag) { | ||
| 160 | useAlwaysSimpleUpperBound = flag; | ||
| 161 | } | ||
| 162 | |||
| 163 | public boolean getUseSkolemUpperBound() { | ||
| 164 | return useSkolemUpperBound; | ||
| 165 | } | ||
| 166 | |||
| 167 | public void setUseSkolemUpperBound(boolean flag) { | ||
| 168 | useSkolemUpperBound = flag; | ||
| 169 | } | ||
| 130 | } | 170 | } |
