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

org.unlaxer.tinyexpression.evaluator.javacode.StringInBooleanExpressionBuilder Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.unlaxer.tinyexpression.evaluator.javacode;

import java.util.Iterator;
import java.util.List;

import org.unlaxer.Token;

public class StringInBooleanExpressionBuilder implements TokenCodeBuilder {

	public static final StringInBooleanExpressionBuilder SINGLETON = new StringInBooleanExpressionBuilder();

	@Override
	public void build(SimpleJavaCodeBuilder builder, Token token , 
	    TinyExpressionTokens tinyExpressionTokens) {
		
		builder.append("org.unlaxer.util.StringIn.match(");
		
		List filteredChildren = token.filteredChildren;
		Iterator iterator = filteredChildren.stream()
			.map(_token-> StringClauseBuilder.SINGLETON.build(_token, tinyExpressionTokens))
			.iterator();
		
		while (iterator.hasNext()) {
			ExpressionOrLiteral expressionOrLiteral = iterator.next();
			builder.append(expressionOrLiteral.toString());
			if(iterator.hasNext()) {
				builder.append(",");
			}
		}
		
		builder.append(")");
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy