private static void collectReferences(final LValue lval, final LinkedHashMap<String,Boolean> map)
{
if (lval instanceof Term)
{
final Term t = (Term) lval;
final LValue[] childValues = t.getChildValues();
for (int i = 0; i < childValues.length; i++)
{
final LValue childValue = childValues[i];
collectReferences(childValue, map);
}