org.unlaxer.tinyexpression.evaluator.javacode.StringBooleanEqualClauseBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tinyExpression Show documentation
Show all versions of tinyExpression Show documentation
TinyExpression implemented with Unlaxer
The newest version!
package org.unlaxer.tinyexpression.evaluator.javacode;
import java.util.List;
import org.unlaxer.Token;
import org.unlaxer.tinyexpression.evaluator.javacode.SimpleJavaCodeBuilder.Kind;
public class StringBooleanEqualClauseBuilder implements TokenCodeBuilder {
public static final StringBooleanEqualClauseBuilder SINGLETON = new StringBooleanEqualClauseBuilder();
@Override
public void build(SimpleJavaCodeBuilder builder , Token token ,
TinyExpressionTokens tinyExpressionTokens) {
List filteredChildren = token.filteredChildren;
ExpressionOrLiteral left = StringClauseBuilder.SINGLETON.build(filteredChildren.get(0) ,
tinyExpressionTokens);
ExpressionOrLiteral right = StringClauseBuilder.SINGLETON.build(filteredChildren.get(1) ,
tinyExpressionTokens);
builder.append("(")
.append(left.toString())
.append(".equals(")
.append(right.toString())
.append("))");
left.populateTo(builder, Kind.Function);
right.populateTo(builder, Kind.Function);
}
}