/** * Returns the installation path for the specified platform name. * <p/> * This looks for a variable named {@code TargetPanel.dir.<platform name>}. If none is found, it searches the * parent platforms, in a breadth-first manner. * * @param installData the installation data * @param name the platform name * @return the default path, or {@code null} if none is found */ private static String getTargetPanelDir(InstallData installData, Platform.Name name) { String path = null; List<Platform.Name> queue = new ArrayList<Platform.Name>(); queue.add(name); while (!queue.isEmpty()) { name = queue.remove(0); path = installData.getVariable(PREFIX + name.toString().toLowerCase()); if (path != null) { break; } Collections.addAll(queue, name.getParents()); } return path; } }
/** * Returns a hash for the platform. * * @return a hash for the platform */ public int hashCode() { int hash = name.hashCode() ^ arch.hashCode(); if (version != null) { hash ^= version.hashCode(); } if (javaVersion != null) { hash ^= javaVersion.hashCode(); } return hash; }
result = Name.valueOf(name.toUpperCase());
/** * Determines if the current name is an instance of the specified platform family name. * * @param current the current name * @param name the platform family name * @return {@code true} if current is an instance of {@code name} */ private boolean isA(Name current, Name name) { if (name == current) { return true; } else { for (Name parent : current.getParents()) { if (isA(parent, name)) { return true; } } } return false; }
/** * Determines if the current name is an instance of the specified platform family name. * * @param current the current name * @param name the plaform family name * @return {@code true} if current is an instance of <tt>name</tt> */ private boolean isA(Name current, Name name) { if (name == current) { return true; } else { for (Name parent : current.getParents()) { if (isA(parent, name)) { return true; } } } return false; }
/** * Determines if this is an instance of the specified name. * * @param name the name to check * @return {@code true} if this is an instance of {@code name} */ public boolean isA(Name name) { return isA(this, name); }
/** * Returns a string representation of the platform. * * @return a string representation of the platform */ public String toString() { return name.toString().toLowerCase() + ",version=" + version + ",arch=" + arch.toString().toLowerCase() + ",symbolicName=" + symbolicName + ",javaVersion=" + javaVersion; }