Codota Logo
InfixOpNode.getLeft
Code IndexAdd Codota to your IDE (free)

How to use
getLeft
method
in
org.kie.dmn.feel.lang.ast.InfixOpNode

Best Java code snippets using org.kie.dmn.feel.lang.ast.InfixOpNode.getLeft (Showing top 12 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: org.kie/kie-dmn-feel

@Test
public void testComparisonInFixOp() {
  String inputExpression = "foo >= bar * 10";
  BaseNode infix = parse( inputExpression );
  assertThat( infix, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( infix.getResultType(), is( BuiltInType.BOOLEAN ) );
  assertThat( infix.getText(), is( inputExpression ) );
  InfixOpNode in = (InfixOpNode) infix;
  assertThat( in.getLeft(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( in.getLeft().getText(), is( "foo" ) );
  assertThat( in.getRight(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( in.getRight().getText(), is( "bar * 10" ) );
}
origin: org.kie/kie-dmn-feel

@Test
public void testConditionalLogicalOp() {
  String inputExpression = "foo < 10 and bar = \"x\" or baz";
  BaseNode infix = parse( inputExpression );
  assertThat( infix, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( infix.getResultType(), is( BuiltInType.BOOLEAN ) );
  assertThat( infix.getText(), is( inputExpression ) );
  InfixOpNode or = (InfixOpNode) infix;
  assertThat( or.getLeft(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( or.getLeft().getText(), is( "foo < 10 and bar = \"x\"" ) );
  assertThat( or.getOperator(), is( InfixOpNode.InfixOperator.OR ) );
  assertThat( or.getRight(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( or.getRight().getText(), is( "baz" ) );
  InfixOpNode and = (InfixOpNode) or.getLeft();
  assertThat( and.getLeft(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( and.getLeft().getText(), is( "foo < 10" ) );
  assertThat( and.getOperator(), is( InfixOpNode.InfixOperator.AND ) );
  assertThat( and.getRight(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( and.getRight().getText(), is( "bar = \"x\"" ) );
}
origin: org.kie/kie-dmn-feel

@Test
public void testPower3() {
  String inputExpression = "y ** 5 * 3";
  BaseNode infix = parse( inputExpression, mapOf(entry("y", BuiltInType.NUMBER)) );
  assertThat( infix, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( infix.getResultType(), is( BuiltInType.NUMBER ) );
  assertThat( infix.getText(), is( inputExpression ) );
  InfixOpNode mult = (InfixOpNode) infix;
  assertThat( mult.getLeft(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( mult.getLeft().getText(), is( "y ** 5" ) );
  assertThat( mult.getOperator(), is( InfixOpNode.InfixOperator.MULT ) );
  assertThat( mult.getRight(), is( instanceOf( NumberNode.class ) ) );
  assertThat( mult.getRight().getText(), is( "3" ) );
  InfixOpNode exp = (InfixOpNode) mult.getLeft();
  assertThat( exp.getLeft(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( exp.getLeft().getText(), is( "y" ) );
  assertThat( exp.getOperator(), is( InfixOpNode.InfixOperator.POW ) );
  assertThat( exp.getRight(), is( instanceOf( NumberNode.class ) ) );
  assertThat( exp.getRight().getText(), is( "5" ) );
}
origin: org.kie/kie-dmn-feel

@Test
public void testMultiplication() {
  String inputExpression = "10 * x";
  BaseNode infix = parse( inputExpression, mapOf(entry("x", BuiltInType.NUMBER)) );
  assertThat( infix, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( infix.getResultType(), is( BuiltInType.NUMBER ) );
  assertThat( infix.getText(), is( inputExpression ) );
  InfixOpNode mult = (InfixOpNode) infix;
  assertThat( mult.getLeft(), is( instanceOf( NumberNode.class ) ) );
  assertThat( mult.getLeft().getText(), is( "10" ) );
  assertThat( mult.getOperator(), is( InfixOpNode.InfixOperator.MULT ) );
  assertThat( mult.getRight(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( mult.getRight().getText(), is( "x" ) );
}
origin: org.kie/kie-dmn-feel

@Test
public void testDivision() {
  String inputExpression = "y / 5 * ( x )";
  BaseNode infix = parse( inputExpression, mapOf(entry("x", BuiltInType.NUMBER), entry("y", BuiltInType.NUMBER)) );
  assertThat( infix, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( infix.getResultType(), is( BuiltInType.NUMBER ) );
  assertThat( infix.getText(), is( inputExpression ) );
  InfixOpNode mult = (InfixOpNode) infix;
  assertThat( mult.getLeft(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( mult.getLeft().getText(), is( "y / 5" ) );
  InfixOpNode div = (InfixOpNode) mult.getLeft();
  assertThat( div.getLeft(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( div.getLeft().getText(), is( "y" ) );
  assertThat( div.getOperator(), is( InfixOpNode.InfixOperator.DIV ) );
  assertThat( div.getRight(), is( instanceOf( NumberNode.class ) ) );
  assertThat( div.getRight().getText(), is( "5" ) );
  assertThat( mult.getOperator(), is( InfixOpNode.InfixOperator.MULT ) );
  assertThat( mult.getRight(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( mult.getRight().getText(), is( "x" ) );
}
origin: org.kie/kie-dmn-feel

@Test
public void testPower2() {
  String inputExpression = "(y * 5) ** 3";
  BaseNode infix = parse( inputExpression, mapOf(entry("y", BuiltInType.NUMBER)) );
  assertThat( infix, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( infix.getResultType(), is( BuiltInType.NUMBER ) );
  assertThat( infix.getText(), is( inputExpression ) );
  InfixOpNode exp = (InfixOpNode) infix;
  assertThat( exp.getLeft(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( exp.getLeft().getText(), is( "y * 5" ) );
  assertThat( exp.getOperator(), is( InfixOpNode.InfixOperator.POW ) );
  assertThat( exp.getRight(), is( instanceOf( NumberNode.class ) ) );
  assertThat( exp.getRight().getText(), is( "3" ) );
  InfixOpNode mult = (InfixOpNode) exp.getLeft();
  assertThat( mult.getLeft(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( mult.getLeft().getText(), is( "y" ) );
  assertThat( mult.getOperator(), is( InfixOpNode.InfixOperator.MULT ) );
  assertThat( mult.getRight(), is( instanceOf( NumberNode.class ) ) );
  assertThat( mult.getRight().getText(), is( "5" ) );
}
origin: org.kie/kie-dmn-feel

@Test
public void testSub1() {
  String inputExpression = "(y - 5) ** 3";
  BaseNode infix = parse( inputExpression, mapOf(entry("y", BuiltInType.NUMBER)) );
  assertThat( infix, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( infix.getResultType(), is( BuiltInType.NUMBER ) );
  assertThat( infix.getText(), is( inputExpression ) );
  InfixOpNode sub = (InfixOpNode) infix;
  assertThat( sub.getLeft(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( sub.getLeft().getText(), is( "y - 5" ) );
  assertThat( sub.getOperator(), is( InfixOpNode.InfixOperator.POW ) );
  assertThat( sub.getRight(), is( instanceOf( NumberNode.class ) ) );
  assertThat( sub.getRight().getText(), is( "3" ) );
  InfixOpNode mult = (InfixOpNode) sub.getLeft();
  assertThat( mult.getLeft(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( mult.getLeft().getText(), is( "y" ) );
  assertThat( mult.getOperator(), is( InfixOpNode.InfixOperator.SUB ) );
  assertThat( mult.getRight(), is( instanceOf( NumberNode.class ) ) );
  assertThat( mult.getRight().getText(), is( "5" ) );
}
origin: org.kie/kie-dmn-feel

@Test
public void testPower4() {
  String inputExpression = "y ** ( 5 * 3 )";
  BaseNode infix = parse( inputExpression, mapOf(entry("y", BuiltInType.NUMBER)) );
  assertThat( infix, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( infix.getResultType(), is( BuiltInType.NUMBER ) );
  assertThat( infix.getText(), is( inputExpression ) );
  InfixOpNode exp = (InfixOpNode) infix;
  assertThat( exp.getLeft(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( exp.getLeft().getText(), is( "y" ) );
  assertThat( exp.getOperator(), is( InfixOpNode.InfixOperator.POW ) );
  assertThat( exp.getRight(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( exp.getRight().getText(), is( "5 * 3" ) );
  InfixOpNode mult = (InfixOpNode) exp.getRight();
  assertThat( mult.getLeft(), is( instanceOf( NumberNode.class ) ) );
  assertThat( mult.getLeft().getText(), is( "5" ) );
  assertThat( mult.getOperator(), is( InfixOpNode.InfixOperator.MULT ) );
  assertThat( mult.getRight(), is( instanceOf( NumberNode.class ) ) );
  assertThat( mult.getRight().getText(), is( "3" ) );
}
origin: org.kie/kie-dmn-feel

@Test
public void testAdd1() {
  String inputExpression = "y + 5 * 3";
  BaseNode infix = parse( inputExpression, mapOf(entry("y", BuiltInType.NUMBER)) );
  assertThat( infix, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( infix.getResultType(), is( BuiltInType.NUMBER ) );
  assertThat( infix.getText(), is( inputExpression ) );
  InfixOpNode add = (InfixOpNode) infix;
  assertThat( add.getLeft(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( add.getLeft().getText(), is( "y" ) );
  assertThat( add.getOperator(), is( InfixOpNode.InfixOperator.ADD ) );
  assertThat( add.getRight(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( add.getRight().getText(), is( "5 * 3" ) );
  InfixOpNode mult = (InfixOpNode) add.getRight();
  assertThat( mult.getLeft(), is( instanceOf( NumberNode.class ) ) );
  assertThat( mult.getLeft().getText(), is( "5" ) );
  assertThat( mult.getOperator(), is( InfixOpNode.InfixOperator.MULT ) );
  assertThat( mult.getRight(), is( instanceOf( NumberNode.class ) ) );
  assertThat( mult.getRight().getText(), is( "3" ) );
}
origin: org.kie/kie-dmn-feel

@Test
public void testPower1() {
  String inputExpression = "y * 5 ** 3";
  BaseNode infix = parse( inputExpression, mapOf(entry("y", BuiltInType.NUMBER)) );
  assertThat( infix, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( infix.getResultType(), is( BuiltInType.NUMBER ) );
  assertThat( infix.getText(), is( inputExpression ) );
  InfixOpNode mult = (InfixOpNode) infix;
  assertThat( mult.getLeft(), is( instanceOf( NameRefNode.class ) ) );
  assertThat( mult.getLeft().getText(), is( "y" ) );
  assertThat( mult.getOperator(), is( InfixOpNode.InfixOperator.MULT ) );
  assertThat( mult.getRight(), is( instanceOf( InfixOpNode.class ) ) );
  assertThat( mult.getRight().getText(), is( "5 ** 3" ) );
  InfixOpNode exp = (InfixOpNode) mult.getRight();
  assertThat( exp.getLeft(), is( instanceOf( NumberNode.class ) ) );
  assertThat( exp.getLeft().getText(), is( "5" ) );
  assertThat( exp.getOperator(), is( InfixOpNode.InfixOperator.POW ) );
  assertThat( exp.getRight(), is( instanceOf( NumberNode.class ) ) );
  assertThat( exp.getRight().getText(), is( "3" ) );
}
origin: org.kie/kie-dmn-feel

@Override
public DirectCompilerResult visit(InfixOpNode n) {
  DirectCompilerResult left = n.getLeft().accept(this);
  DirectCompilerResult right = n.getRight().accept(this);
  MethodCallExpr expr = Expressions.binary(
      n.getOperator(),
      left.getExpression(),
      right.getExpression());
  return DirectCompilerResult.of(expr, BuiltInType.UNKNOWN).withFD(left).withFD(right);
}
origin: org.kie/kie-dmn-feel

@Test
public void testInstanceOfExpressionAnd() {
  String inputExpression = "\"foo\" instance of string and 10 instance of number";
  BaseNode andExpr = parse( inputExpression );
  assertThat( andExpr, is( instanceOf( InfixOpNode.class ) ) );
  assertThat( andExpr.getText(), is( inputExpression ) );
  assertThat( andExpr.getResultType(), is( BuiltInType.BOOLEAN ) );
  InfixOpNode and = (InfixOpNode) andExpr;
  assertThat( and.getOperator(), is( InfixOpNode.InfixOperator.AND ) );
  assertThat( and.getLeft(), is( instanceOf( InstanceOfNode.class ) ) );
  assertThat( and.getRight(), is( instanceOf( InstanceOfNode.class ) ) );
  assertThat( and.getLeft().getText(), is( "\"foo\" instance of string" ) );
  assertThat( and.getRight().getText(), is( "10 instance of number" ) );
  assertThat( and.getLeft().getResultType(), is( BuiltInType.BOOLEAN ) );
  assertThat( and.getRight().getResultType(), is( BuiltInType.BOOLEAN ) );
  InstanceOfNode ioExpr = (InstanceOfNode) and.getLeft();
  assertThat( ioExpr.getExpression(), is( instanceOf( StringNode.class ) ) );
  assertThat( ioExpr.getExpression().getText(), is( "\"foo\"" ) );
  assertThat( ioExpr.getType(), is( instanceOf( TypeNode.class ) ) );
  assertThat( ioExpr.getType().getText(), is( "string" ) );
  ioExpr = (InstanceOfNode) and.getRight();
  assertThat( ioExpr.getExpression(), is( instanceOf( NumberNode.class ) ) );
  assertThat( ioExpr.getExpression().getText(), is( "10" ) );
  assertThat( ioExpr.getType(), is( instanceOf( TypeNode.class ) ) );
  assertThat( ioExpr.getType().getText(), is( "number" ) );
}
org.kie.dmn.feel.lang.astInfixOpNodegetLeft

Popular methods of InfixOpNode

  • getOperator
  • getRight
  • <init>
  • add
  • and
    Implements the ternary logic AND operation
  • div
  • isBoolean
  • math
  • mult
  • or
    Implements the ternary logic OR operation
  • sub
  • sub

Popular in Java

  • Updating database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • onRequestPermissionsResult (Fragment)
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • Pattern (java.util.regex)
    A compiled representation of a regular expression. A regular expression, specified as a string, must
  • Notification (javax.management)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now