Search in sources :

Example 1 with FunctorSwitch

use of com.sri.ai.grinder.rewriter.core.FunctorSwitch in project aic-expresso by aic-sri-international.

the class ProceduralAttachments method registerProceduralAttachment.

/**
 * This method registers a procedural attachment top rewriter to a function with a given arity;
 * the check of functor and arity will be added to the given top rewriter, so it does not need to do that.
 * @param functor
 * @param proceduralAttachmentParameters
 * @param topRewriter
 * @param context
 * @return
 */
public static void registerProceduralAttachment(Expression functor, int arity, TopRewriter topRewriter, Context context) {
    TopRewriter proceduralAttachment = new FunctorSwitch(functor.toString(), arity, topRewriter);
    context.updateInplaceGlobalObject(PROCEDURAL_ATTACHEMENTS_KEY, EMPTY_REWRITER_MAKER, combine(proceduralAttachment));
}
Also used : TopRewriter(com.sri.ai.grinder.rewriter.api.TopRewriter) CombiningTopRewriter(com.sri.ai.grinder.rewriter.core.CombiningTopRewriter) FunctorSwitch(com.sri.ai.grinder.rewriter.core.FunctorSwitch)

Aggregations

TopRewriter (com.sri.ai.grinder.rewriter.api.TopRewriter)1 CombiningTopRewriter (com.sri.ai.grinder.rewriter.core.CombiningTopRewriter)1 FunctorSwitch (com.sri.ai.grinder.rewriter.core.FunctorSwitch)1