diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-22 14:48:25 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-22 14:48:25 -0400 |
| commit | 0fa4f162f4e42a455dbb7e7459854b9467337863 (patch) | |
| tree | 64e22da06f641f2ad1d2e1f0dc6f818b404c8661 /dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java | |
| parent | a3e0b3da5d7b0ec8dcae92a428f8e3f1c6cd6e8e (diff) | |
Formatting changes
Diffstat (limited to 'dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java')
| -rw-r--r-- | dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java b/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java index a70ee00..8d70af8 100644 --- a/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java +++ b/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java @@ -36,25 +36,6 @@ public class DiceASTUtils { } /** - * Convert an AST tree to an integer, if possible. - * - * @param tree - * The tree to convert - * @return The tree as an integer - * - * @throws ClassCastException - * if the head of the tree is not a literal (implements - * {@link ILiteralDiceNode}) - * @throws UnsupportedOperationException - * if the head of the tree is not optimizable - */ - public static int toInt(ITree<IDiceASTNode> tree) { - return tree.transformHead((node) -> { - return ((ILiteralDiceNode) node).optimize(); - }); - } - - /** * Convert an AST tree to a dice expression, if possible. * * @param tree @@ -81,4 +62,23 @@ public class DiceASTUtils { "This type of literal isn't convertable to an expression"); } } + + /** + * Convert an AST tree to an integer, if possible. + * + * @param tree + * The tree to convert + * @return The tree as an integer + * + * @throws ClassCastException + * if the head of the tree is not a literal (implements + * {@link ILiteralDiceNode}) + * @throws UnsupportedOperationException + * if the head of the tree is not optimizable + */ + public static int toInt(ITree<IDiceASTNode> tree) { + return tree.transformHead((node) -> { + return ((ILiteralDiceNode) node).optimize(); + }); + } } |
