public List<ClauseInfo> getClauses() { List<ClauseInfo> l = new ArrayList<ClauseInfo>(); OneWayList<ClauseInfo> t = clauses; while (t != null) { l.add(t.getHead()); t = t.getTail(); } return l; }
/** Return the clause to load. */ public ClauseInfo fetch() { if (clauses == null) return null; deunify(vars); if (!checkCompatibility(goal)) return null; ClauseInfo clause = (ClauseInfo) clauses.getHead(); clauses = clauses.getTail(); haveAlternatives = checkCompatibility(goal); return clause; }
/** * Verify if a clause exists that is compatible with goal. As a side effect, clauses that are not * compatible get discarded from the currently examined family. * * @param goal */ private boolean checkCompatibility(Term goal) { if (clauses == null) return false; ClauseInfo clause = null; do { clause = (ClauseInfo) clauses.getHead(); if (goal.match(clause.getHead())) return true; clauses = clauses.getTail(); } while (clauses != null); return false; }