TermUtils.addReferencedVariablesTo(currentLevelVariables, atom); } else if (atom.isAlgebraFunction()) { currentLevelVariables.addAll(getDefinedVariables(atom.getTerms())); } else {
/**** * Gets all the variables that are defined in this list of atoms, except in * atom i * * @param atoms * @return */ private static Set<Variable> getDefinedVariables(List<Term> atoms) { Set<Variable> currentLevelVariables = new HashSet<>(); for (Term l : atoms) { Function atom = (Function) l; if (atom.isOperation()) { continue; } else if (atom.isAlgebraFunction()) { currentLevelVariables.addAll(getDefinedVariables(atom.getTerms())); } else { TermUtils.addReferencedVariablesTo(currentLevelVariables, atom); } } return currentLevelVariables; }