Skip to content

Commit

Permalink
Added safeties
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsbasjes committed Nov 21, 2017
1 parent d2ca899 commit f3a92de
Showing 1 changed file with 9 additions and 3 deletions.
Expand Up @@ -97,10 +97,15 @@ public class WalkList implements Serializable {
public static class WalkResult {
private ParseTree tree;
private String value;

public WalkResult(ParseTree tree, String value) {
this.tree = tree;
this.value = value;
// if (value == null || tree == null ) {
// throw new IllegalStateException("An invalid WalkResult was created :" + this.toString());
// }
}

public ParseTree getTree() {
return tree;
}
Expand All @@ -112,8 +117,8 @@ public String getValue() {
@Override
public String toString() {
return "WalkResult{" +
"tree=" + tree.getText() +
", value='" + value + '\'' +
"tree=" + (tree == null ? ">>>NULL<<<" : tree.getText()) +
", value=" + (value == null ? ">>>NULL<<<" : '\'' + value + '\'') +
'}';
}
}
Expand Down Expand Up @@ -142,7 +147,7 @@ public WalkList(ParserRuleContext requiredPattern,

private void linkSteps() {
Step nextStep = null;
for (int i = steps.size() -1; i >= 0; i--) {
for (int i = steps.size() - 1; i >= 0; i--) {
Step current = steps.get(i);
current.setNextStep(i, nextStep);
nextStep = current;
Expand Down Expand Up @@ -170,6 +175,7 @@ public Step getFirstStep() {
}

private Boolean usesIsNull = null;

public boolean usesIsNull() {
if (usesIsNull != null) {
return usesIsNull;
Expand Down

0 comments on commit f3a92de

Please sign in to comment.