All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jaskell.expression.Binary Maven / Gradle / Ivy

Go to download

This is a utils library for java 8 project. It include parsec combinators and sql generators library.

There is a newer version: 2.9.2
Show newest version
package jaskell.expression;

/**
 * TODO
 *
 * @author mars
 * @version 1.0.0
 * @since 2020/06/04 10:52
 */
public abstract class Binary implements Expression {
  protected Expression left;
  protected Expression right;

  public abstract int getPriority();

  @Override
  public Expression makeAst() {
    this.left = this.left.makeAst();
    this.right = this.right.makeAst();
    if (right instanceof Binary) {
      Binary r = (Binary) right;
      if (this.getPriority() >= r.getPriority()) {
        Expression lx = r.left;
        this.right = lx;
        r.left = this;
        return r;
      }
    }
    return this;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy