public Node mutate(Random rng, Probability mutationProbability, TreeFactory treeFactory)
    {
        if (mutationProbability.nextEvent(rng))
        {
            return treeFactory.generateRandomCandidate(rng);
        }
        else
        {
            Node newLeft = left.mutate(rng, mutationProbability, treeFactory);
            Node newRight = right.mutate(rng, mutationProbability, treeFactory);
            if (newLeft != left && newRight != right)
            {
                return newInstance(newLeft, newRight);
            }
            else
            {
                // Tree has not changed.
                return this;
            }
        }
    }
public Node mutate ( Random rng , Probability mutationProbability , TreeFactory treeFactory ) { if ( mutationProbability . nextEvent ( rng ) ) { return treeFactory . generateRandomCandidate ( rng ) ; } else { Node newLeft = left . mutate ( rng , mutationProbability , treeFactory ) ; Node newRight = right . mutate ( rng , mutationProbability , treeFactory ) ; if ( newLeft != left && newRight != right ) { return newInstance ( newLeft , newRight ) ; } else { return this ; } } }
{@inheritDoc}