public String getSetHistory(int n) {
		isOn = (n == -2 ? isOn : true);
		switch (n) {
		case 0:
			isOn = false;
			// fall through
		case Integer.MIN_VALUE:
		case -2:
			clear();
			return "";
		case -1:
			return getCommandUp();
		case 1:
			return getCommandDown();
		default:
			if (n < 0) {
				setMaxSize(-2 - n);
				return "";
			}
			n = Math.max(nextCommand - n, 0);
		}
		String str = "";
		for (int i = n; i < nextCommand; i++)
			str += commandList.get(i) + "\n";
		return str;
	}