Search in sources :

Example 1 with FunctionApplication

use of com.sri.ai.expresso.api.FunctionApplication in project aic-expresso by aic-sri-international.

the class DefaultFunctionApplication method set.

@Override
public Expression set(int i, Expression newIthArgument) {
    FunctionApplication result;
    if (get(i) == newIthArgument) {
        result = this;
    } else {
        if (i == -1) {
            result = new DefaultFunctionApplication(newIthArgument, arguments);
        } else {
            ArrayList<Expression> newArguments = new ArrayList<Expression>(arguments);
            newArguments.set(i, newIthArgument);
            result = new DefaultFunctionApplication(functor, newArguments);
        }
    }
    return result;
}
Also used : AbstractNonQuantifiedExpression(com.sri.ai.grinder.core.AbstractNonQuantifiedExpression) Expression(com.sri.ai.expresso.api.Expression) FunctionApplication(com.sri.ai.expresso.api.FunctionApplication) ArrayList(java.util.ArrayList)

Aggregations

Expression (com.sri.ai.expresso.api.Expression)1 FunctionApplication (com.sri.ai.expresso.api.FunctionApplication)1 AbstractNonQuantifiedExpression (com.sri.ai.grinder.core.AbstractNonQuantifiedExpression)1 ArrayList (java.util.ArrayList)1