lojix/prolog/src/main/com/thesett/aima/logic/fol/prolog/expressions/BuiltInExpressionTransform.java
public Functor transform(Functor functor)
    {
        FunctorName functorName = interner.getFunctorFunctorName(functor);

        if (builtInExpressions.containsKey(functorName))
        {
            Class<? extends Functor> builtInExpressionClass = builtInExpressions.get(functorName);

            return ReflectionUtils.newInstance(ReflectionUtils.getConstructor(builtInExpressionClass,
                    new Class[] { Integer.TYPE, Term[].class }),
                new Object[] { functor.getName(), functor.getArguments() });
        }
        else
        {
            return functor;
        }
    }
public Functor transform(Functor functor)
    {
        FunctorName functorName = interner.getFunctorFunctorName(functor);

        if (builtInExpressions.containsKey(functorName))
        {
            Class<? extends Functor> builtInExpressionClass = builtInExpressions.get(functorName);

            return ReflectionUtils.newInstance(ReflectionUtils.getConstructor(builtInExpressionClass,
                    new Class[] { Integer.TYPE, Term[].class }),
                new Object[] { functor.getName(), functor.getArguments() });
        }
        else
        {
            return functor;
        }
    }
public Functor transform ( Functor functor ) { FunctorName functorName = interner . getFunctorFunctorName ( functor ) ; if ( builtInExpressions . containsKey ( functorName ) ) { Class < ? extends Functor > builtInExpressionClass = builtInExpressions . get ( functorName ) ; return ReflectionUtils . newInstance ( ReflectionUtils . getConstructor ( builtInExpressionClass , new Class [ ] { Integer . TYPE , Term [ ] . class } ) , new Object [ ] { functor . getName ( ) , functor . getArguments ( ) } ) ; } else { return 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.
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 .