/*    Copyright 2013 Simon Brakhane
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.failedprojects.anjaroot.library.containers;

import android.annotation.SuppressLint;

/**
 * AnJaRoot version information holder.
 * 
 * This class holds version information from either the AnJaRoot Library or it's
 * native counterpart. It's only useful under certain conditions (additional
 * compatibility checks or simple version printing).
 * 
 * The versioning scheme used by AnJaRoot complies with the Semantic Versioning
 * 2.0.0. The ApiLevel is constantly increased whenever a "significant" Api
 * change has been done on the native side.
 * 
 * @see <a href="http://semver.org/spec/v2.0.0.html">Semantic Versioning
 *      2.0.0.</a>
 */
public class Version {
	private final int major;
	private final int minor;
	private final int patch;
	private final int apilvl;

	public Version(int major, int minor, int patch, int apilvl) {
		this.major = major;
		this.minor = minor;
		this.patch = patch;
		this.apilvl = apilvl;
	}

	/**
	 * Get Version as String for printing
	 * 
	 * @return A String with the format Major.Minor.Patch-ApiLevel
	 */
	@Override
	@SuppressLint("DefaultLocale")
	public String toString() {
		return String.format("%d.%d.%d-%d", major, minor, patch, apilvl);
	}

	public int getMajor() {
		return major;
	}

	public int getMinor() {
		return minor;
	}

	public int getPatch() {
		return patch;
	}

	public int getApiLevel() {
		return apilvl;
	}
}

@@ -1150,16 +1150,152 @@
 ive side
+, it's not part of the version%0A * identifier itself - it's meant for AnJaRootLibrary to be able to react to%0A * different native versions
 .%0A * %0A *
@@ -1781,17 +1781,8 @@
 atch
--ApiLevel
 %0A%09 *
@@ -1890,11 +1890,8 @@
 d.%25d
--%25d
 %22, m
@@ -1912,16 +1912,8 @@
 atch
-, apilvl
 );%0A%09

remove api version from toString to comply with semver