package it.sieradzki.userscript_parser.metadata;

/**
 * Implementation of <a href="https://developer.mozilla.org/en/Toolkit_version_format">Toolkit version format</a>
 */
public class Version implements Comparable<Version> {

	private Part[] versionParts;

	public Version(String versionString) {
	}

	@Override
	public int compareTo(Version o) {

		for (int i = 0; i < Math.min(versionParts.length, o.versionParts.length); i++) {

			int comparedPartResult = versionParts[i].compareTo(o.versionParts[i]);
			if (comparedPartResult != 0) {
				return comparedPartResult;
			}
		}

		return versionParts.length - o.versionParts.length;
	}

	private static class Part implements Comparable<Part> {

		private Integer numberA;

		private String stringB;

		private Integer numberC;

		private String stringD;

		@Override
		public int compareTo(Part o) {
			return 0;
		}
	}
}

@@ -850,19 +850,460 @@
 ) %7B%0A
+%0A
 %09%09%09
-return 0
+int comparedFieldResult;%0A%0A%09%09%09comparedFieldResult = numberA.compareTo(o.numberA);%0A%09%09%09if (comparedFieldResult != 0) %7B%0A%09%09%09%09return comparedFieldResult;%0A%09%09%09%7D%0A%0A%09%09%09comparedFieldResult = stringB.compareTo(o.stringB);%0A%09%09%09if (comparedFieldResult != 0) %7B%0A%09%09%09%09return comparedFieldResult;%0A%09%09%09%7D%0A%0A%09%09%09comparedFieldResult = numberC.compareTo(o.numberC);%0A%09%09%09if (comparedFieldResult != 0) %7B%0A%09%09%09%09return comparedFieldResult;%0A%09%09%09%7D%0A%0A%09%09%09return numberA.compareTo(o.numberA)
 ;%0A%09%09

Implement comparing of two Part objects