diff --git a/bin/main/edu/rpi/legup/log4j2.properties b/bin/main/edu/rpi/legup/log4j2.properties index 4f2556c2d..de1fa02ed 100644 --- a/bin/main/edu/rpi/legup/log4j2.properties +++ b/bin/main/edu/rpi/legup/log4j2.properties @@ -1,15 +1,15 @@ -# Logging level -# Root logger option -log4j.rootLogger=DEBUG, stdout, file -# Redirect log messages to console -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n -# Redirect log messages to a log file, support file rolling. -log4j.appender.file=org.apache.log4j.RollingFileAppender -log4j.appender.file.File=Legup.log -log4j.appender.file.MaxFileSize=5MB -log4j.appender.file.MaxBackupIndex=10 -log4j.appender.file.layout=org.apache.log4j.PatternLayout +# Logging level +# Root logger option +log4j.rootLogger=DEBUG, stdout, file +# Redirect log messages to console +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +# Redirect log messages to a log file, support file rolling. +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=Legup.log +log4j.appender.file.MaxFileSize=5MB +log4j.appender.file.MaxBackupIndex=10 +log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n \ No newline at end of file diff --git a/src/main/java/edu/rpi/legup/model/rules/CaseRule.java b/src/main/java/edu/rpi/legup/model/rules/CaseRule.java index efb96e21a..a01db2b6d 100644 --- a/src/main/java/edu/rpi/legup/model/rules/CaseRule.java +++ b/src/main/java/edu/rpi/legup/model/rules/CaseRule.java @@ -60,20 +60,10 @@ public String checkRule(TreeTransition transition) { return "Must not have multiple parent nodes"; } - /*if (transition.getBoard().getModifiedData().size() != 0){ - return "Should not modify before case rule"; - }*/ - - for (TreeTransition childTrans : parentNodes.get(0).getChildren()) { if (childTrans.getRule() == null || !childTrans.getRule().getClass().equals(this.getClass())) { return "All children nodes must be justified with the same case rule."; } - else { - if (childTrans.getBoard().getModifiedData().isEmpty()) { - return "You must modify the board in each case node"; - } - } } String check = checkRuleRaw(transition); diff --git a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRule_Generic.java b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRule_Generic.java index 1409f4baa..46163c2a3 100644 --- a/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRule_Generic.java +++ b/src/main/java/edu/rpi/legup/puzzle/shorttruthtable/rules/caserule/CaseRule_Generic.java @@ -38,20 +38,20 @@ public CaseRule_Generic(String ruleID, String ruleName, String title, String des public String checkRuleRaw(TreeTransition transition) { // Validate that two children are generated List childTransitions = transition.getParents().get(0).getChildren(); - if (childTransitions.size() >= 1) { + if (childTransitions.size() == 0) { return "ERROR: This case rule must spawn at least 1 child."; } - // Validate that the modified cells are of type UNKNOWN, TRUE, or FALSE - List cases = Arrays.asList(childTransitions.get(0), childTransitions.get(1)); - for (TreeTransition c : cases) { - ShortTruthTableCell mod1 = (ShortTruthTableCell)c.getBoard().getModifiedData().iterator().next(); - ShortTruthTableCell mod2 = (ShortTruthTableCell)c.getBoard().getModifiedData().iterator().next(); - if (!(mod1.getType() == ShortTruthTableCellType.TRUE || mod1.getType() == ShortTruthTableCellType.FALSE || mod1.getType() == ShortTruthTableCellType.UNKNOWN) && - (mod2.getType() == ShortTruthTableCellType.TRUE || mod2.getType() == ShortTruthTableCellType.FALSE || mod2.getType() == ShortTruthTableCellType.UNKNOWN)) { - return "ERROR: This case rule must be an unknown, true, or false cell."; - } - } + // // Validate that the modified cells are of type UNKNOWN, TRUE, or FALSE + // List cases = Arrays.asList(childTransitions.get(0), childTransitions.get(1)); + // for (TreeTransition c : cases) { + // ShortTruthTableCell mod1 = (ShortTruthTableCell)c.getBoard().getModifiedData().iterator().next(); + // ShortTruthTableCell mod2 = (ShortTruthTableCell)c.getBoard().getModifiedData().iterator().next(); + // if (!(mod1.getType() == ShortTruthTableCellType.TRUE || mod1.getType() == ShortTruthTableCellType.FALSE || mod1.getType() == ShortTruthTableCellType.UNKNOWN) && + // (mod2.getType() == ShortTruthTableCellType.TRUE || mod2.getType() == ShortTruthTableCellType.FALSE || mod2.getType() == ShortTruthTableCellType.UNKNOWN)) { + // return "ERROR: This case rule must be an unknown, true, or false cell."; + // } + // } return null; } diff --git a/src/test/java/puzzles/shorttruthtable/rules/AndCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/AndCaseRuleTest.java index 5f0a1243a..4d4e95762 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/AndCaseRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/AndCaseRuleTest.java @@ -42,7 +42,7 @@ private void falseAndTest(String fileName, ArrayList cases = RULE.getCases(board, cell); // Make sure that the rule checks out - Assert.assertNotNull(RULE.checkRule(transition)); + Assert.assertNull(RULE.checkRule(transition)); // Make sure there are two branches Assert.assertEquals(2, cases.size()); @@ -120,7 +120,7 @@ private void trueAndTest(String fileName, ArrayList cases = RULE.getCases(board, cell); // Make sure that the rule checks out - Assert.assertNotNull(RULE.checkRule(transition)); + Assert.assertNull(RULE.checkRule(transition)); // There should only be 1 branch Assert.assertEquals(1, cases.size()); diff --git a/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java index 276e822cf..0f7e93db5 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java @@ -43,7 +43,7 @@ private void trueOrTest(String fileName, ArrayList cases = RULE.getCases(board, cell); // Make sure that the rule checks out - Assert.assertNotNull(RULE.checkRule(transition)); + Assert.assertNull(RULE.checkRule(transition)); // Make sure there are two branches Assert.assertEquals(2, cases.size()); @@ -121,7 +121,7 @@ private void falseOrTest(String fileName, ArrayList cases = RULE.getCases(board, cell); // Make sure that the rule checks out - Assert.assertNotNull(RULE.checkRule(transition)); + Assert.assertNull(RULE.checkRule(transition)); // There should only be 1 branch Assert.assertEquals(1, cases.size()); diff --git a/src/test/java/puzzles/shorttruthtable/rules/TrueOrFalseCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/TrueOrFalseCaseRuleTest.java index 849e9f15c..2c0b9fb15 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/TrueOrFalseCaseRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/TrueOrFalseCaseRuleTest.java @@ -44,7 +44,7 @@ public void TwoBranchesTest() throws InvalidFileFormatException { ArrayList cases = RULE.getCases(board, cell); // Make sure that the rule checks out - Assert.assertNotNull(RULE.checkRule(transition)); + Assert.assertNull(RULE.checkRule(transition)); // Make sure there are two branches Assert.assertEquals(2, cases.size());