/**
 * Copyright (c) 2005 by Kevin Bierhoff
 */
package edu.cmu.cs.l3.trace;

/**
 * @author Kevin
 *
 */
public class Instrumentation {
	
	private boolean initPathRegister;
	private boolean incPathRegister;
	private int pathRegisterIncrement;
	private boolean incCounter;

	public Instrumentation() {
		super();
	}
	
	/**
	 * @return Returns the incCounter.
	 */
	public boolean isIncCounter() {
		return incCounter;
	}

	/**
	 * @param incCounter The incCounter to set.
	 */
	public void setIncCounter(boolean incCounter) {
		this.incCounter = incCounter;
	}

	/**
	 * @return Returns the initPathRegister.
	 */
	public boolean isInitPathRegister() {
		return initPathRegister;
	}

	/**
	 * @param initPathRegister The initPathRegister to set.
	 */
	public void setInitPathRegister(boolean initPathRegister) {
		this.initPathRegister = initPathRegister;
	}

	/**
	 * @return Returns the pathRegisterIncrement.
	 */
	public int getPathRegisterIncrement() {
		return pathRegisterIncrement;
	}

	/**
	 * @param pathRegisterIncrement The pathRegisterIncrement to set.
	 */
	public void setPathRegisterIncrement(int pathRegisterIncrement) {
		this.pathRegisterIncrement = pathRegisterIncrement;
	}

	/**
	 * Ignore this flag if <code>initPathRegister</code> is set.
	 * @return Returns the incPathRegister.
	 */
	public boolean isIncPathRegister() {
		return incPathRegister;
	}

	/**
	 * This flag is to be ignored if <code>initPathRegister</code> is set.
	 * @param incPathRegister The incPathRegister to set.
	 */
	public void setIncPathRegister(boolean incPathRegister) {
		this.incPathRegister = incPathRegister;
	}
	
	public String toString() {
		if(initPathRegister && incCounter) {
			return "count[" + pathRegisterIncrement + "]++";
		}
		if(initPathRegister && !incCounter) {
			return "r = " + pathRegisterIncrement;
		}
		if(incPathRegister && incCounter) {
			return "count[r + " + pathRegisterIncrement + "]++";
		}
		if(incPathRegister && !incCounter) {
			return "r += " + pathRegisterIncrement;
		}
		if(incCounter) {
			return "count[r]++";
		}
		return "unknown instrumentation!!!";
	}

}
