/** * To be called every time a new node is added to the tree component. */ private void collectPossiblyNewVariables(QueryNode newNode) { variableGenerator.registerAdditionalVariables(newNode.getLocalVariables()); } }
/** * To be called every time a new node is added to the tree component. */ private void collectPossiblyNewVariables(QueryNode newNode) { variableGenerator.registerAdditionalVariables(newNode.getLocalVariables()); } }
private Variable generateNonConflictingVariable(Variable v, VariableGenerator variableGenerator, ImmutableSet<Variable> variables) { Variable proposedVariable = variableGenerator.generateNewVariableIfConflicting(v); if (proposedVariable.equals(v) // Makes sure that a "fresh" variable does not exists in the variable set || (!variables.contains(proposedVariable))) return proposedVariable; /* * Generates a "really fresh" variable */ ImmutableSet<Variable> knownVariables = Sets.union( variableGenerator.getKnownVariables(), variables) .immutableCopy(); VariableGenerator newVariableGenerator = coreUtilsFactory.createVariableGenerator(knownVariables); Variable newVariable = newVariableGenerator.generateNewVariableFromVar(v); variableGenerator.registerAdditionalVariables(ImmutableSet.of(newVariable)); return newVariable; } }