com.bpodgursky.jbool_expressions.rules.Assign Maven / Gradle / Ivy
package com.bpodgursky.jbool_expressions.rules;
import com.bpodgursky.jbool_expressions.Expression;
import com.bpodgursky.jbool_expressions.Literal;
import com.bpodgursky.jbool_expressions.Variable;
import java.util.Map;
public class Assign extends Rule, K> {
private Map values;
public Assign(Map values){
this.values = values;
}
@Override
public Expression applyInternal(Variable var) {
if(values.containsKey(var.getValue())){
return Literal.of(values.get(var.getValue()));
}
return var;
}
@Override
protected boolean isApply(Expression input) {
return input instanceof Variable;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy