summaryrefslogtreecommitdiff
path: root/dice-lang/src/bjc/dicelang/Node.java
diff options
context:
space:
mode:
authorEVE <EVE@EVE-PC>2017-03-13 16:41:45 -0400
committerEVE <EVE@EVE-PC>2017-03-13 16:41:45 -0400
commit01136c6796e21f023713e026674576d8e623462d (patch)
treee77886fe0e0adaf3c0430fba9ce248ef83f74fe4 /dice-lang/src/bjc/dicelang/Node.java
parent870d769cfc152171d27b2331a7c590d0b307ad48 (diff)
Formatting
Diffstat (limited to 'dice-lang/src/bjc/dicelang/Node.java')
-rw-r--r--dice-lang/src/bjc/dicelang/Node.java55
1 files changed, 27 insertions, 28 deletions
diff --git a/dice-lang/src/bjc/dicelang/Node.java b/dice-lang/src/bjc/dicelang/Node.java
index 3ae54e3..15ae66e 100644
--- a/dice-lang/src/bjc/dicelang/Node.java
+++ b/dice-lang/src/bjc/dicelang/Node.java
@@ -2,10 +2,7 @@ package bjc.dicelang;
public class Node {
public static enum Type {
- ROOT, TOKREF,
- UNARYOP, BINOP,
- GROUP, OGROUP,
- RESULT
+ ROOT, TOKREF, UNARYOP, BINOP, GROUP, OGROUP, RESULT
}
public static enum GroupType {
@@ -15,9 +12,9 @@ public class Node {
public final Type type;
// These can have or not have values based of the node type
- public Token tokenVal;
- public Token.Type operatorType;
- public GroupType groupType;
+ public Token tokenVal;
+ public Token.Type operatorType;
+ public GroupType groupType;
public EvaluatorResult resultVal;
public Node(Type typ) {
@@ -49,34 +46,36 @@ public class Node {
}
public String toString() {
- switch(type) {
- case UNARYOP:
- case BINOP:
- return "(" + type.name() + " : " + operatorType + ")";
- case OGROUP:
- case TOKREF:
- return "(" + type.name() + " : " + tokenVal + ")";
- case GROUP:
- return "(" + type.name() + " : " + groupType + ")";
- case RESULT:
- return "(" + type.name() + " : " + resultVal + ")";
- default:
- return "Unknown node type " + type;
+ switch (type) {
+ case UNARYOP:
+ case BINOP:
+ return "(" + type.name() + " : " + operatorType + ")";
+ case OGROUP:
+ case TOKREF:
+ return "(" + type.name() + " : " + tokenVal + ")";
+ case GROUP:
+ return "(" + type.name() + " : " + groupType + ")";
+ case RESULT:
+ return "(" + type.name() + " : " + resultVal + ")";
+ default:
+ return "Unknown node type " + type;
}
}
public boolean equals(Object other) {
- if(!(other instanceof Node)) return false;
+ if (!(other instanceof Node))
+ return false;
- Node otk = (Node)other;
+ Node otk = (Node) other;
- if(otk.type != type) return false;
+ if (otk.type != type)
+ return false;
- switch(type) {
- case OGROUP:
- return tokenVal.equals(otk.tokenVal);
- default:
- return true;
+ switch (type) {
+ case OGROUP:
+ return tokenVal.equals(otk.tokenVal);
+ default:
+ return true;
}
}
}