From 0fa4f162f4e42a455dbb7e7459854b9467337863 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Fri, 22 Apr 2016 14:48:25 -0400 Subject: Formatting changes --- .../main/java/bjc/dicelang/ast/DiceASTUtils.java | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java') 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 @@ -35,25 +35,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 tree) { - return tree.transformHead((node) -> { - return ((ILiteralDiceNode) node).optimize(); - }); - } - /** * Convert an AST tree to a dice expression, if possible. * @@ -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 tree) { + return tree.transformHead((node) -> { + return ((ILiteralDiceNode) node).optimize(); + }); + } } -- cgit v1.2.3