Java Code Examples for com.github.zafarkhaja.semver.Version#compareTo()

The following examples show how to use com.github.zafarkhaja.semver.Version#compareTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AvailableCordovaEnginesSection.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public int compare(HybridMobileEngine o1, HybridMobileEngine o2) {
	try {
		Version version1 = Version.valueOf(o1.getSpec());
		Version version2 = Version.valueOf(o2.getSpec());
		if (descending) {
			return version2.compareTo(version1);
		}
		return version1.compareTo(version2);
	} catch (Exception e) {
		return 1;
	}
}
 
Example 2
Source File: EngineAddDialog.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public int compare(DownloadableCordovaEngine o1, DownloadableCordovaEngine o2) {
	Version v1 = Version.valueOf(o1.getVersion());
	Version v2 = Version.valueOf(o2.getVersion());
	//Make it descending switch v1 to v2
	return v2.compareTo(v1);
}
 
Example 3
Source File: CordovaEngineProvider.java    From thym with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public int compare(DownloadableCordovaEngine o1, DownloadableCordovaEngine o2) {
	Version v1 = Version.valueOf(o1.getVersion());
	Version v2 = Version.valueOf(o2.getVersion());
	return v2.compareTo(v1);
}