package net.murakamin.sticker.commands;

import net.murakamin.sticker.commands.exception.CommandExecutionException;

public class VersionTerm
{
	public static final VersionTerm PERMANENT_COMMAND = new VersionTerm("0.0");

	private String validVersion = "0.0";

	private String removeVersion = "100.00";

	public VersionTerm(final String startVersion)
	{
		this.validVersion = startVersion;
	}

	public VersionTerm(final String startVersion, final String endVersion)
	{
		this.validVersion = startVersion;
		this.removeVersion = endVersion;
	}

	public void compare(final String currentVersion)
	        throws CommandExecutionException
	{
		if (!((currentVersion.compareTo(this.validVersion) >= 0) && (currentVersion
		        .compareTo(this.removeVersion) <= 0)))
		{
			throw new CommandExecutionException(
			        "このバージョンのStickerではサポートされないコマンドです");
		}
	}
}
