// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/comparators/VersionComparator.java
// public class VersionComparator implements Comparator<String>, Serializable {
//     @Override
//     public int compare(String o1, String o2) {
// 
//         String[] splitO1Version = o1.split("\\.|-");
//         String[] splitO2Version = o2.split("\\.|-");
// 
//         for(int i=0; i<splitO1Version.length; i++){
//             if(i >= splitO2Version.length){
//                 return 1;
//             }
// 
//             Comparable chunk1;
//             try {
//                 chunk1 = Integer.valueOf(splitO1Version[i]);
//             }catch(NumberFormatException e){
//                 chunk1 = splitO1Version[i];
//             }
// 
//             Comparable chunk2;
//             try {
//                 chunk2 = Integer.valueOf(splitO2Version[i]);
//             }catch(NumberFormatException e){
//                 chunk2 = splitO2Version[i];
//             }
// 
//             if (chunk1.getClass() != chunk2.getClass()) {
//                 throw new IllegalArgumentException("Comparing different types in chunk " + i +
//                         ". Version 1 = " + o1 + ", version 2 = " + o2);
//             }
// 
//             if(!splitO1Version[i].equals(splitO2Version[i])){
//                 return chunk1.compareTo(chunk2);
//             }
//         }
// 
//         if(splitO1Version.length == splitO2Version.length){
//             return 0;
//         } else {
//             return -1;
//         }
//     }
// }


import javax.annotation.Nonnull;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.jenkins.tools.test.model.comparators.VersionComparator;
    }

    @Override
    public String toString(){
        return "MavenCoordinates[groupId="+groupId+", artifactId="+artifactId+", version="+version+"]";
    }

    public String toGAV(){
        return groupId+":"+artifactId+":"+version;
    }

    public static MavenCoordinates fromGAV(String gav){
        String[] chunks = gav.split(":");
        return new MavenCoordinates(chunks[0], chunks[1], chunks[2]);
    }

    @Override
    public int compareTo(MavenCoordinates o) {
        if((groupId+":"+artifactId).equals(o.groupId+":"+o.artifactId)){
            return compareVersionTo(o.version);
        } else {
            return (groupId+":"+artifactId).compareTo(o.groupId+":"+o.artifactId);
        }
    }

    public boolean matches(String groupId, String artifactId) {
        return this.groupId.equals(groupId) && this.artifactId.equals(artifactId);
    }

    public int compareVersionTo(String version) {
// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/comparators/VersionComparator.java
// public class VersionComparator implements Comparator<String>, Serializable {
//     @Override
//     public int compare(String o1, String o2) {
// 
//         String[] splitO1Version = o1.split("\\.|-");
//         String[] splitO2Version = o2.split("\\.|-");
// 
//         for(int i=0; i<splitO1Version.length; i++){
//             if(i >= splitO2Version.length){
//                 return 1;
//             }
// 
//             Comparable chunk1;
//             try {
//                 chunk1 = Integer.valueOf(splitO1Version[i]);
//             }catch(NumberFormatException e){
//                 chunk1 = splitO1Version[i];
//             }
// 
//             Comparable chunk2;
//             try {
//                 chunk2 = Integer.valueOf(splitO2Version[i]);
//             }catch(NumberFormatException e){
//                 chunk2 = splitO2Version[i];
//             }
// 
//             if (chunk1.getClass() != chunk2.getClass()) {
//                 throw new IllegalArgumentException("Comparing different types in chunk " + i +
//                         ". Version 1 = " + o1 + ", version 2 = " + o2);
//             }
// 
//             if(!splitO1Version[i].equals(splitO2Version[i])){
//                 return chunk1.compareTo(chunk2);
//             }
//         }
// 
//         if(splitO1Version.length == splitO2Version.length){
//             return 0;
//         } else {
//             return -1;
//         }
//     }
// }


// Path: plugins-compat-tester-model/src/main/java/org/jenkins/tools/test/model/MavenCoordinates.java
import javax.annotation.Nonnull;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.jenkins.tools.test.model.comparators.VersionComparator;

    }

    @Override
    public String toString(){
        return "MavenCoordinates[groupId="+groupId+", artifactId="+artifactId+", version="+version+"]";
    }

    public String toGAV(){
        return groupId+":"+artifactId+":"+version;
    }

    public static MavenCoordinates fromGAV(String gav){
        String[] chunks = gav.split(":");
        return new MavenCoordinates(chunks[0], chunks[1], chunks[2]);
    }

    @Override
    public int compareTo(MavenCoordinates o) {
        if((groupId+":"+artifactId).equals(o.groupId+":"+o.artifactId)){
            return compareVersionTo(o.version);
        } else {
            return (groupId+":"+artifactId).compareTo(o.groupId+":"+o.artifactId);
        }
    }

    public boolean matches(String groupId, String artifactId) {
        return this.groupId.equals(groupId) && this.artifactId.equals(artifactId);
    }

    public int compareVersionTo(String version) {
        return new VersionComparator().compare(this.version, version);