public Collection<String> getAllVariables(ValueMapPath path) { Vector<String> vars = new Vector<String>(); vars.add(getName()); Collection<String> moreVars = JavaParser.getAllVariables(path.substitute(variable.getInitialValue())); for (String var : moreVars) if (!vars.contains(var)) vars.add(var); Collection<String> ifVars = getCodeBundleContainingMe().getIfClauseVariables(path); vars.addAll(ifVars); return (vars); }
public Collection<VariableDependency> getVariableDependencies(ValueMapPath path) { Vector<VariableDependency> deps = new Vector<VariableDependency>(); String leftVar = path.substituteJavaName(getName()); Collection<String> rightVars = JavaParser.getAllVariables(path.substitute(variable.getInitialValue())); for (String var : rightVars) deps.add(new VariableDependency(leftVar, var, VariableDependency.ASSIGN)); Collection<String> ifVars = getCodeBundleContainingMe().getIfClauseVariables(path); for (String var : ifVars) deps.add(new VariableDependency(leftVar, var, VariableDependency.LITERAL_if)); return (deps); }