Skip to content

Commit

Permalink
Rename class
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusmelke committed May 30, 2018
1 parent b17880e commit b84adb7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Expand Up @@ -51,9 +51,12 @@
import static org.neo4j.values.storable.Values.doubleValue;
import static org.neo4j.values.storable.Values.stringValue;

public final class AnyValueMath
/**
* This class contains static helper methods used by the compiled expressions
*/
public final class ExpressionMethods
{
private AnyValueMath()
private ExpressionMethods()
{
throw new UnsupportedOperationException( "Do not instantiate" );
}
Expand Down
Expand Up @@ -44,39 +44,39 @@ object IntermediateCodeGeneration {
case c: FunctionInvocation if c.function == functions.Round =>
compile(c.args.head) match {
case Some(arg) =>
Some(invokeStatic(method[AnyValueMath, DoubleValue, AnyValue]("round"), arg))
Some(invokeStatic(method[ExpressionMethods, DoubleValue, AnyValue]("round"), arg))
case _ => None
}

case c: FunctionInvocation if c.function == functions.Sin =>
compile(c.args.head) match {
case Some(arg) =>
Some(invokeStatic(method[AnyValueMath, DoubleValue, AnyValue]("sin"), arg))
Some(invokeStatic(method[ExpressionMethods, DoubleValue, AnyValue]("sin"), arg))
case _ => None
}

case c: FunctionInvocation if c.function == functions.Rand =>
Some(invokeStatic(method[AnyValueMath, DoubleValue]("rand")))
Some(invokeStatic(method[ExpressionMethods, DoubleValue]("rand")))

case Multiply(lhs, rhs) =>
(compile(lhs), compile(rhs)) match {
case (Some(l), Some(r)) =>
Some(invokeStatic(method[AnyValueMath, AnyValue, AnyValue, AnyValue]("multiply"), l, r))
Some(invokeStatic(method[ExpressionMethods, AnyValue, AnyValue, AnyValue]("multiply"), l, r))

case _ => None
}

case Add(lhs, rhs) =>
(compile(lhs), compile(rhs)) match {
case (Some(l), Some(r)) =>
Some(invokeStatic(method[AnyValueMath, AnyValue, AnyValue, AnyValue]("add"), l, r))
Some(invokeStatic(method[ExpressionMethods, AnyValue, AnyValue, AnyValue]("add"), l, r))
case _ => None
}

case Subtract(lhs, rhs) =>
(compile(lhs), compile(rhs)) match {
case (Some(l), Some(r)) =>
Some(invokeStatic(method[AnyValueMath, AnyValue, AnyValue, AnyValue]("subtract"), l, r))
Some(invokeStatic(method[ExpressionMethods, AnyValue, AnyValue, AnyValue]("subtract"), l, r))
case _ => None
}

Expand All @@ -91,7 +91,7 @@ object IntermediateCodeGeneration {
case _: False => Some(falsy)

case NodeProperty(offset, token, _) =>
Some(invokeStatic(method[AnyValueMath, Value, Transaction, Long, Int]("nodeProperty"),
Some(invokeStatic(method[ExpressionMethods, Value, Transaction, Long, Int]("nodeProperty"),
load("tx"),
invoke(load("context"), method[ExecutionContext, Long, Int]("getLongAt"),
constantJavaValue(offset)), constantJavaValue(token)))
Expand Down

0 comments on commit b84adb7

Please sign in to comment.