How to build a function on the fly in java?
<p>I'm parsing a text file that is being mapped to some java code like such:</p>

<pre><code>public void eval(Node arg)
    {
        if(arg.data.equals("rand"))
        {
            moveRandomly();
        }
        else if(arg.data.equals("home"))
        {
            goHome();
        }
            else if(arg.data.equals("iffood"))
    {
        ifFoodHere(arg.left, arg.right);
    }//snip..
</code></pre>

<p>This is going to need to be re-evaluated about a thousand times and I'd rather not have to traverse the whole thing every time.  Is there any way to make this traversal once and then have it be a function that is called every other time?</p>
