/** Eliminates all non-normal variables from varInfos. See isNormalVar() for details. */ private static VarInfo[] filterNonVars(VarInfo[] varInfos) { List<VarInfo> filteredList = new ArrayList<VarInfo>(); for (int i = 0; i < varInfos.length; i++) { if (isNormalVar(varInfos[i])) { filteredList.add(varInfos[i]); } else { // System.out.println("filterNonVars removed " + varInfos[i].name.name()); } } return filteredList.toArray(new VarInfo[0]); }
/** * Creates a new instance of VariableManager. * * @param varInfos the varInfos for the variables to be managed. * @param condition the condition in which the variables are used. */ private static VariableManager[] makeVariableManagerArray( VarInfo[] varInfos, String condition, String className) throws ParseException { List<VariableManager> variableManagerList = new ArrayList<VariableManager>(); List<String> classVars = findPossibleClassVariables(condition); for (int i = 0; i < varInfos.length; i++) { VarInfo varInfo = varInfos[i]; try { String compilableName = compilableName(varInfo, className); // System.out.println("varInfo " + varInfo.name.name() + ", compilableName=" + // compilableName + ", isNeeded=" + isNeeded(compilableName, classVars)); if (isNeeded(compilableName, classVars)) { variableManagerList.add(new VariableManager(varInfo, condition, className)); } } catch (ParseException e) { System.out.println("ParseException: " + e.toString()); } } return variableManagerList.toArray(new VariableManager[0]); }