package com.metacodestudio.hotsuploader.versions;

import java.util.Comparator;

public class ReleaseComparator implements Comparator<GitHubRelease> {

    public int compare(final GitHubRelease release1, final GitHubRelease release2) {
        if (release1.isPrerelease() && !release2.isPrerelease()) {
            return 1;
        } else if (!release1.isPrerelease() && release2.isPrerelease()) {
            return -1;
        }

        double release1Version = stripVersion(release1.getTagName());
        double release2Version = stripVersion(release2.getTagName());

        return Double.compare(release1Version, release2Version);
    }

    private double stripVersion(final String tagName) {
        return Double.parseDouble(tagName.replaceAll("-\\w*", ""));
    }
}

@@ -427,38 +427,38 @@
      %7D%0A%0A        
-double
+String
  release1Version
@@ -505,22 +505,22 @@
         
-double
+String
  release
@@ -587,23 +587,8 @@
 urn 
-Double.compare(
 rele
@@ -598,18 +598,27 @@
 1Version
-, 
+.compareTo(
 release2
@@ -650,14 +650,14 @@
 ate 
-double
+String
  str
@@ -709,34 +709,37 @@
 urn 
-Double.parseDouble(tagName
+tagName.replaceFirst(%22v%22, %22%22)
 .rep
@@ -758,17 +758,16 @@
 w*%22, %22%22)
-)
 ;%0A    %7D%0A

fix release comparator's string compare