lojix/prolog/src/main/com/thesett/aima/logic/fol/prolog/builtins/BuiltInTransform.java
public BuiltInFunctor apply(Functor functor)
    {
        FunctorName functorName = interner.getFunctorFunctorName(functor);

        Class<? extends BuiltInFunctor> builtInClass;

        if (builtIns.containsKey(functorName))
        {
            builtInClass = builtIns.get(functorName);
        }
        else
        {
            builtInClass = DefaultBuiltIn.class;
        }

        return ReflectionUtils.newInstance(ReflectionUtils.getConstructor(builtInClass, new Class[] { Functor.class }),
            new Object[] { functor });
    }
public BuiltInFunctor apply(Functor functor)
    {
        FunctorName functorName = interner.getFunctorFunctorName(functor);

        Class<? extends BuiltInFunctor> builtInClass;

        if (builtIns.containsKey(functorName))
        {
            builtInClass = builtIns.get(functorName);
        }
        else
        {
            builtInClass = DefaultBuiltIn.class;
        }

        return ReflectionUtils.newInstance(ReflectionUtils.getConstructor(builtInClass, new Class[] { Functor.class }),
            new Object[] { functor });
    }
Applies a built-in replacement transformation to functors. If the functor matches built-in, a
{@link BuiltInFunctor} is created with a mapping to the functors built-in implementation, and the functors
arguments are copied into this new functor. If the functor does not match a built-in, it is returned unmodified.

@param  functor The functor to attempt to map onto a built-in.

@return The functor umodified, or a {@link BuiltInFunctor} replacement for it.