diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/util')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | 12 | ||||
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/util/SimpleProgressBar.java | 48 |
2 files changed, 59 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 4991d0d..7b68400 100644 --- a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java +++ b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | |||
| @@ -15,6 +15,7 @@ public class PagodaProperties { | |||
| 15 | public static final boolean DEFAULT_DEBUG = false; | 15 | public static final boolean DEFAULT_DEBUG = false; |
| 16 | private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; | 16 | private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; |
| 17 | private static final boolean DEFAULT_USE_SKOLEM_UPPER_BOUND; | 17 | private static final boolean DEFAULT_USE_SKOLEM_UPPER_BOUND; |
| 18 | private static final boolean DEFAULT_TO_CALL_HERMIT; | ||
| 18 | private static final Path DEFAULT_STATISTICS_DIR; | 19 | private static final Path DEFAULT_STATISTICS_DIR; |
| 19 | 20 | ||
| 20 | public static boolean shellModeDefault = false; | 21 | public static boolean shellModeDefault = false; |
| @@ -23,6 +24,7 @@ public class PagodaProperties { | |||
| 23 | static { | 24 | static { |
| 24 | boolean defaultUseAlwaysSimpleUpperBound = false; | 25 | boolean defaultUseAlwaysSimpleUpperBound = false; |
| 25 | boolean defaultUseSkolemUpperBound = true; | 26 | boolean defaultUseSkolemUpperBound = true; |
| 27 | boolean toCallHermit = true; | ||
| 26 | Path defaultStatisticsDir = null; | 28 | Path defaultStatisticsDir = null; |
| 27 | 29 | ||
| 28 | try(InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { | 30 | try(InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { |
| @@ -52,12 +54,20 @@ public class PagodaProperties { | |||
| 52 | else | 54 | else |
| 53 | logger.debug("By default the Skolem upper bound is disabled"); | 55 | logger.debug("By default the Skolem upper bound is disabled"); |
| 54 | } | 56 | } |
| 57 | if(config.containsKey("toCallHermit")) { | ||
| 58 | toCallHermit = Boolean.parseBoolean(config.getProperty("toCallHermit")); | ||
| 59 | if(toCallHermit) | ||
| 60 | logger.debug("By default Hermit is enabled"); | ||
| 61 | else | ||
| 62 | logger.debug("By default Hermit is disabled"); | ||
| 63 | } | ||
| 55 | 64 | ||
| 56 | } catch(IOException e) { | 65 | } catch(IOException e) { |
| 57 | e.printStackTrace(); | 66 | e.printStackTrace(); |
| 58 | } | 67 | } |
| 59 | DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND = defaultUseAlwaysSimpleUpperBound; | 68 | DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND = defaultUseAlwaysSimpleUpperBound; |
| 60 | DEFAULT_USE_SKOLEM_UPPER_BOUND = defaultUseSkolemUpperBound; | 69 | DEFAULT_USE_SKOLEM_UPPER_BOUND = defaultUseSkolemUpperBound; |
| 70 | DEFAULT_TO_CALL_HERMIT = toCallHermit; | ||
| 61 | DEFAULT_STATISTICS_DIR = defaultStatisticsDir; | 71 | DEFAULT_STATISTICS_DIR = defaultStatisticsDir; |
| 62 | } | 72 | } |
| 63 | 73 | ||
| @@ -66,7 +76,7 @@ public class PagodaProperties { | |||
| 66 | String queryPath = null; | 76 | String queryPath = null; |
| 67 | String answerPath = null; | 77 | String answerPath = null; |
| 68 | boolean toClassify = true; | 78 | boolean toClassify = true; |
| 69 | boolean toCallHermiT = true; | 79 | boolean toCallHermiT = DEFAULT_TO_CALL_HERMIT; |
| 70 | boolean shellMode = shellModeDefault; | 80 | boolean shellMode = shellModeDefault; |
| 71 | private boolean useAlwaysSimpleUpperBound = DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; | 81 | private boolean useAlwaysSimpleUpperBound = DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND; |
| 72 | private boolean useSkolemUpperBound = DEFAULT_USE_SKOLEM_UPPER_BOUND; | 82 | private boolean useSkolemUpperBound = DEFAULT_USE_SKOLEM_UPPER_BOUND; |
diff --git a/src/uk/ac/ox/cs/pagoda/util/SimpleProgressBar.java b/src/uk/ac/ox/cs/pagoda/util/SimpleProgressBar.java new file mode 100644 index 0000000..3c4aad7 --- /dev/null +++ b/src/uk/ac/ox/cs/pagoda/util/SimpleProgressBar.java | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.util; | ||
| 2 | |||
| 3 | import uk.ac.ox.cs.pagoda.util.disposable.Disposable; | ||
| 4 | |||
| 5 | public class SimpleProgressBar extends Disposable { | ||
| 6 | |||
| 7 | private final String name; | ||
| 8 | private int lastPercent; | ||
| 9 | private int maxValue; | ||
| 10 | |||
| 11 | public SimpleProgressBar() { | ||
| 12 | this(""); | ||
| 13 | } | ||
| 14 | |||
| 15 | public SimpleProgressBar(String name) { | ||
| 16 | this(name, 100); | ||
| 17 | } | ||
| 18 | |||
| 19 | public SimpleProgressBar(String name, int maxValue) { | ||
| 20 | this.name = name; | ||
| 21 | this.maxValue = maxValue; | ||
| 22 | } | ||
| 23 | |||
| 24 | public void update(int value) { | ||
| 25 | int percent = value * 100 / maxValue; | ||
| 26 | StringBuilder template = new StringBuilder("\r" + name + " ["); | ||
| 27 | for (int i = 0; i < 50; i++) { | ||
| 28 | if (i < percent * .5) { | ||
| 29 | template.append("="); | ||
| 30 | } else if (i == percent * .5) { | ||
| 31 | template.append(">"); | ||
| 32 | } else { | ||
| 33 | template.append(" "); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | template.append("] %s "); | ||
| 37 | System.out.printf(template.toString(), percent + "%"); | ||
| 38 | System.out.flush(); | ||
| 39 | lastPercent = percent; | ||
| 40 | } | ||
| 41 | |||
| 42 | @Override | ||
| 43 | public void dispose() { | ||
| 44 | super.dispose(); | ||
| 45 | |||
| 46 | System.out.println(); | ||
| 47 | } | ||
| 48 | } | ||
