f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: src/main/java/io/protobase/f7/models/BinaryOperationNode.java
-rw-r--r--
1228
 1package io.protobase.f7.models;
 2
 3import com.google.common.base.MoreObjects;
 4
 5/**
 6 * Represents a binary operation with a left and right node, and an operator. Eg: 10 * 20.
 7 */
 8public class BinaryOperationNode extends BaseObject implements Node {
 9  private Node left;
10  private Node right;
11  private String operator;
12
13  public BinaryOperationNode(Node left, String operator, Node right) {
14    this.left = left;
15    this.operator = operator;
16    this.right = right;
17  }
18
19  /**
20   * Get left node.
21   *
22   * @return left node.
23   */
24  public Node getLeft() {
25    return left;
26  }
27
28  /**
29   * Get right node.
30   *
31   * @return right node.
32   */
33  public Node getRight() {
34    return right;
35  }
36
37  /**
38   * Operator is one of the traditional arithmetic / computational operators. Eg: + - * / ^ % & %
39   *
40   * @return operator
41   */
42  public String getOperator() {
43    return operator;
44  }
45
46  @Override
47  public String toString() {
48    return MoreObjects.toStringHelper(this)
49        .add("left", left)
50        .add("operator", operator)
51        .add("right", right)
52        .toString();
53  }
54
55  @Override
56  public Object[] significantAttributes() {
57    return new Object[]{
58        left,
59        operator,
60        right
61    };
62  }
63}