if(gdl instanceof GdlDistinct) {
return GdlPool.getDistinct((GdlTerm) replaceVariableInternal(((GdlDistinct) gdl).getArg1(), toSubstitute, theReplacement), (GdlTerm) replaceVariableInternal(((GdlDistinct) gdl).getArg2(), toSubstitute, theReplacement));
} else if(gdl instanceof GdlNot) {
return GdlPool.getNot((GdlLiteral) replaceVariableInternal(((GdlNot) gdl).getBody(), toSubstitute, theReplacement));
} else if(gdl instanceof GdlOr) {
GdlOr or = (GdlOr)gdl;
List<GdlLiteral> rval = new ArrayList<GdlLiteral>();
for(int i=0; i<or.arity(); i++)
{
rval.add((GdlLiteral) replaceVariableInternal(or.get(i), toSubstitute, theReplacement));
}
return GdlPool.getOr(rval);
} else if(gdl instanceof GdlProposition) {
return gdl;
} else if(gdl instanceof GdlRelation) {