return setVariablesInHead(head.getBody(), sentence.getBody(), assignment);
}
private static boolean setVariablesInHead(List<GdlTerm> head,
List<GdlTerm> sentence, Map<GdlVariable, GdlConstant> assignment) {
for(int i = 0; i < head.size(); i++) {
GdlTerm headTerm = head.get(i);
GdlTerm refTerm = sentence.get(i);
if(headTerm instanceof GdlConstant) {
if(!refTerm.equals(headTerm))
//The rule can't produce this sentence
return false;
} else if(headTerm instanceof GdlVariable) {
GdlVariable var = (GdlVariable) headTerm;
GdlConstant curValue = assignment.get(var);