private static String[] rVersionChoices(JsArray<RVersionSpec> rVersions) { // do we need to disambiguate identical version numbers boolean disambiguate = RVersionSpec.hasDuplicates(rVersions); // build list of choices ArrayList<String> choices = new ArrayList<String>(); // always include "default" lable choices.add(USE_DEFAULT_VERSION); for (int i = 0; i < rVersions.length(); i++) { RVersionSpec version = rVersions.get(i); String choice = "R version " + version.getVersion(); if (disambiguate) choice = choice + " (" + version.getRHome() + ")"; choices.add(choice); } return choices.toArray(new String[0]); }
private static String rVersionSpecToString(RVersionSpec version) { if (version.getVersion().length() == 0) return ""; else return version.getVersion() + SEP + version.getRHome(); }