com.rosetta.test.conditionfunc.model.functions.IsGravy Maven / Gradle / Ivy
package com.rosetta.test.conditionfunc.model.functions;
import com.google.inject.ImplementedBy;
import com.rosetta.model.lib.expression.CardinalityOperator;
import com.rosetta.model.lib.functions.RosettaFunction;
import com.rosetta.model.lib.mapper.MapperC;
import com.rosetta.model.lib.mapper.MapperS;
import java.util.Collections;
import java.util.List;
import static com.rosetta.model.lib.expression.ExpressionOperators.*;
@ImplementedBy(IsGravy.IsGravyDefault.class)
public abstract class IsGravy implements RosettaFunction {
/**
* @param synonymPath
* @param modelPath
* @param conditionValue
* @return result
*/
public Boolean evaluate(String synonymPath, String modelPath, List conditionValue) {
Boolean result = doEvaluate(synonymPath, modelPath, conditionValue);
return result;
}
protected abstract Boolean doEvaluate(String synonymPath, String modelPath, List conditionValue);
public static class IsGravyDefault extends IsGravy {
@Override
protected Boolean doEvaluate(String synonymPath, String modelPath, List conditionValue) {
if (conditionValue == null) {
conditionValue = Collections.emptyList();
}
Boolean result = null;
return assignOutput(result, synonymPath, modelPath, conditionValue);
}
protected Boolean assignOutput(Boolean result, String synonymPath, String modelPath, List conditionValue) {
result = areEqual(MapperS.of(MapperC.of(conditionValue).get()), MapperS.of("GRAVY"), CardinalityOperator.All).get();
return result;
}
}
}