public int compareTo()

in nuget-common/src/jetbrains/buildServer/nuget/common/version/SemanticVersion.java [84:112]


  public int compareTo(@NotNull PackageVersion other) {
    if (!(other instanceof SemanticVersion)) {
      return myOriginalString.compareTo(other.toString());
    }

    SemanticVersion o = (SemanticVersion)other;
    int result = myVersion.compareTo(o.myVersion);
    if (result != 0) return result;
    boolean empty = StringUtil.isEmpty(myRelease);
    boolean otherEmpty = StringUtil.isEmpty(o.myRelease);
    if (empty && otherEmpty) return 0;
    else if (empty) return 1;
    else if (otherEmpty) return -1;

    String[] o1 = split(myRelease);
    String[] o2 = split(o.myRelease);

    int x;
    for(int i = 0, max = Math.min(o1.length, o2.length); i < max; i++) {
      if ((x = compareElements(o1[i], o2[i]))!= 0) return x;
    }
    if (o1.length == 0 && o2.length > 0) return 1;
    if (o2.length == 0 && o1.length > 0) return -1;

    if (o1.length < o2.length) return -1;
    if (o1.length > o2.length) return 1;

    return 0;
  }