/** * Returns the entry related to a given package name. * * @param package_name The package name of the application to check. * @return An object containing all the neccessary information to extract a version and/or a * download url and changelog from a web page. */ public UpdateSourceEntry get_entry(String package_name) { for (UpdateSourceEntry use : _entries) { Matcher m = Pattern.compile(use.get_applicable_packages()).matcher(package_name); if (m.find()) { return use; } } return null; }
/** * Checks whether the UpdateSource is applicable for a given application. The package name of the * given app is checked against the different regular expressions available for the update source. * * @param package_name The package name of the application to check. * @return Whether the UpdateSource is valid for a given application. */ public boolean is_applicable(String package_name) { // Verify that the update source supports given application by matching the package name. for (UpdateSourceEntry pe : _entries) { Matcher m = Pattern.compile(pe.get_applicable_packages()).matcher(package_name); if (m.find()) { return true; } } return false; }