package programming101.calculBeanz;


/**
	* Applies last operation to current data in entry area and displays
	* result.
	*
	* @author © 1998 Peter T. Sander
	* @version 1.0  (18/03/98)
	* @since 18/03/98
	*/
	
public class EqButton extends CalculatorButton {
	/**
		* No-args constructor (needed for JavaBeans).
		*/
	public EqButton() {
		setLabel("=");
	}
	
	/**
		* Applies last operation to current data in entry area by invoking 
		* the previously-clicked button.
		*
		* @param cumul cumulator value
		* @param entry newly-entered value
		* @param button previously clicked
		* @return new cumulator value
		*/
	public double op(double cumul, double entry, CalculatorButton lastButton) {
		System.out.println("EqButton putsched");
		if (lastButton != this) {  // previous button wasn't =
			return lastButton.op(cumul, entry, this);
		} else {  // previous button was =, returns cumulator unchanged
			return cumul;
		}
	}
}
