package net.minecraft.src.weasel.lang;


import net.minecraft.src.NBTTagCompound;
import net.minecraft.src.PC_INBT;
import net.minecraft.src.weasel.InstructionList;
import net.minecraft.src.weasel.Weasel;
import net.minecraft.src.weasel.exception.WeaselRuntimeException;
import net.minecraft.src.weasel.exception.PauseRequestedException;
import net.minecraft.src.weasel.obj.WeaselObject;


/**
 * Weasel instruction
 * 
 * @author MightyPork
 * @copy (c) 2012
 */
public abstract class Instruction implements PC_INBT {

	private int address = -1;

	/**
	 * Execute the instruction
	 * 
	 * @param engine the weasel engine
	 * @param instructionList the instruction list the instruction is in
	 * @throws PauseRequestedException thrown at the end of instruction if
	 *             Weasel Engine should pause program and wait for external
	 *             resume call.
	 * @throws WeaselRuntimeException thrown if execution of this instruction
	 *             failed.
	 */
	public abstract void execute(Weasel engine, InstructionList instructionList) throws PauseRequestedException, WeaselRuntimeException;

	/**
	 * Set instruction address in {@link InstructionList}
	 * 
	 * @param address address
	 */
	public void setAddress(int address) {
		this.address = address;
	}

	/**
	 * Get {@link InstructionList} address in {@link InstructionList}
	 * 
	 * @return address
	 */
	public int getAddress() {
		return this.address;
	}

	public static NBTTagCompound saveInstructionToNBT(NBTTagCompound writeToNBT) {
		// TODO Auto-generated method stub
		return null;
	}

	public static WeaselObject loadInstructionFromNBT(NBTTagCompound tag1) {
		// TODO Auto-generated method stub
		return null;
	}

}
