class Version implements Comparable<Version> {

   public static Version fromRepresentation(String version) throws IllegalArgumentException {
      Matcher m = p.matcher(version);
      if(!m.matches()) {
         throw new IllegalArgumentException("Invalid version format, should be of the form: <major>.<minor>.<patch>.<build>-<qualifier> where <major> and <minor> are non-negative integers, <patch> and <build> are optional non-negative integers and <qualifier> may contain the letters a through z, A through Z, and the underscore character (_).");
      }

      int major = Integer.parseInt(m.group(1));
      int minor = Integer.parseInt(m.group(2));
      Integer patch = m.group(3) == null ? null : Integer.parseInt(m.group(3));
      Integer build = m.group(4) == null ? null : Integer.parseInt(m.group(4));
      String qualifier = m.group(5);
      return new Version(major, minor, patch, build, qualifier, version);
   }

   public  Version(int major);
   public  Version(int major, int minor);
   public  Version(int major, int minor, @Nullable String qualifier);
   private  Version(int major, int minor, @Nullable String qualifier, String representation);
     Version(int major, int minor, @Nullable Integer patch, @Nullable Integer build, @Nullable String qualifier, String representation);

}