lojix/wam_prolog/src/main/com/thesett/aima/logic/fol/wam/machine/WAMResolvingJavaMachine.java
public void reset()
    {
        // Create fresh heaps, code areas and stacks.
        data = ByteBuffer.allocateDirect(TOP << 2).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
        codeBuffer = ByteBuffer.allocateDirect(CODE_SIZE);
        codeBuffer.order(ByteOrder.LITTLE_ENDIAN);

        // Registers are on the top of the data area, the heap comes next.
        hp = HEAP_BASE;
        hbp = HEAP_BASE;
        sp = HEAP_BASE;

        // The stack comes after the heap. Pointers are zero initially, since no stack frames exist yet.
        ep = 0;
        bp = 0;
        b0 = 0;

        // The trail comes after the stack.
        trp = TRAIL_BASE;

        // The unification stack (PDL) is a push down stack at the end of the data area.
        up = TOP;

        // Turn off write mode.
        writeMode = false;

        // Reset the instruction pointer to that start of the code area, ready for fresh code to be loaded there.
        ip = 0;

        // Could probably not bother resetting these, but will do it anyway just to be sure.
        derefTag = 0;
        derefVal = 0;

        // The machine is initially not suspended.
        suspended = false;

        // Ensure that the overridden reset method of WAMBaseMachine is run too, to clear the call table.
        super.reset();

        // Put the internal functions in the call table.
        setInternalCodeAddress(internFunctorName("call", 1), CALL_1_ID);
        setInternalCodeAddress(internFunctorName("execute", 1), EXECUTE_1_ID);

        // Notify any debug monitor that the machine has been reset.
        if (monitor != null)
        {
            monitor.onReset(this);
        }
    }
public void reset()
    {
        // Create fresh heaps, code areas and stacks.
        data = ByteBuffer.allocateDirect(TOP << 2).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
        codeBuffer = ByteBuffer.allocateDirect(CODE_SIZE);
        codeBuffer.order(ByteOrder.LITTLE_ENDIAN);

        // Registers are on the top of the data area, the heap comes next.
        hp = HEAP_BASE;
        hbp = HEAP_BASE;
        sp = HEAP_BASE;

        // The stack comes after the heap. Pointers are zero initially, since no stack frames exist yet.
        ep = 0;
        bp = 0;
        b0 = 0;

        // The trail comes after the stack.
        trp = TRAIL_BASE;

        // The unification stack (PDL) is a push down stack at the end of the data area.
        up = TOP;

        // Turn off write mode.
        writeMode = false;

        // Reset the instruction pointer to that start of the code area, ready for fresh code to be loaded there.
        ip = 0;

        // Could probably not bother resetting these, but will do it anyway just to be sure.
        derefTag = 0;
        derefVal = 0;

        // The machine is initially not suspended.
        suspended = false;

        // Ensure that the overridden reset method of WAMBaseMachine is run too, to clear the call table.
        super.reset();

        // Put the internal functions in the call table.
        setInternalCodeAddress(internFunctorName("call", 1), CALL_1_ID);
        setInternalCodeAddress(internFunctorName("execute", 1), EXECUTE_1_ID);

        // Notify any debug monitor that the machine has been reset.
        if (monitor != null)
        {
            monitor.onReset(this);
        }
    }
Resets the machine, to its initial state. This clears any programs from the machine, and clears all of its stacks
and heaps.