lojix/wam_prolog/src/main/com/thesett/aima/logic/fol/wam/machine/WAMResolvingJavaMachine.java
private boolean unifyConst(int fn, int addr)
    {
        boolean success;

        int deref = deref(addr);
        int tag = derefTag;
        int val = derefVal;

        // case STORE[addr] of
        switch (tag)
        {
        case REF:
        {
            // <REF, _> :
            // STORE[addr] <- <CON, c>
            data.put(deref, constantCell(fn));

            // trail(addr)
            trail(deref);

            success = true;

            break;
        }

        case CON:
        {
            // <CON, c'> :
            // fail <- (c != c');
            success = val == fn;

            break;
        }

        default:
        {
            // other: fail <- true;
            success = false;
        }
        }

        return success;
    }
private boolean unifyConst(int fn, int addr)
    {
        boolean success;

        int deref = deref(addr);
        int tag = derefTag;
        int val = derefVal;

        // case STORE[addr] of
        switch (tag)
        {
        case REF:
        {
            // <REF, _> :
            // STORE[addr] <- <CON, c>
            data.put(deref, constantCell(fn));

            // trail(addr)
            trail(deref);

            success = true;

            break;
        }

        case CON:
        {
            // <CON, c'> :
            // fail <- (c != c');
            success = val == fn;

            break;
        }

        default:
        {
            // other: fail <- true;
            success = false;
        }
        }

        return success;
    }
A simplified unification algorithm, for unifying against a constant.

<p/>Attempts to unify a constant or references on the heap, with a constant. If the address leads to a free
variable on dereferencing, the variable is bound to the constant. If the address leads to a constant it is
compared with the passed in constant for equality, and unification succeeds when they are equal.

@param  fn   The constant to unify with.
@param  addr The address of the first constant or reference.

@return <tt>true</tt> if the two constant unify, <tt>false</tt> otherwise.