import java.awt.event.ActionEvent;
public class HandleEquation extends HandleEvent{
    public HandleEquation(CalculatorWindow window) {
        super(window);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        String s ="";
        if(window.computer.computerDataItem()==window.computer.getResult()){
            if(window.computer.getTempResult()==-window.computer.getResult())
            s=" "+window.computer.getTempResult()+" 取反为 "+window.computer.getResult();
            if(1/window.computer.getTempResult()==window.computer.getResult())
                s=" "+window.computer.getTempResult()+" 倒数为 "+window.computer.getResult();
            if(Math.sqrt(window.computer.getTempResult())==window.computer.getResult())
                s=" "+window.computer.getTempResult()+" 开方为 "+window.computer.getResult();
        }else{
        s=" "+window.computer.getTempResult()+" "+window.computer.getOperator()+
                " "+window.computer.computerDataItem()+" = "+window.computer.getResult();}
        window.computerProcess.append("\n"+s);
//       show();
    }
}
