/* * CurrentInfo.java * * Created on February 15, 2007, 7:45 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package chess; /** * * @author Stanislav Hromek */ public class CurrentMoveInfo { // working variables for processed move String currentMovingPiece; String movePieceFrom; String movePieceFromTwo; String movePieceTo; String movePieceToTwo; String action; // holds result of operation, if parsing problem, error message set and false (allways ?) returned boolean result; // if pawn reaches last line, this will hold the promoting pice Piece promotingPiece; // type of notation (long or short) int notation; // set error message (when we test in short notation each square, we don't want to set error message) boolean isErrorMessageAllowed = true; /** Creates a new instance of CurrentInfo */ public CurrentMoveInfo() { } public String getAction() { return action; } // action can be move, castle or exchange, maybe we can test it public void setAction(String action) { this.action = action; } public CurrentMoveInfo clone(){ CurrentMoveInfo currentMoveInfo = new CurrentMoveInfo(); currentMoveInfo.currentMovingPiece = this.currentMovingPiece; currentMoveInfo.movePieceFrom = this.movePieceFrom; currentMoveInfo.movePieceFromTwo = this.movePieceFromTwo; currentMoveInfo.movePieceTo = this.movePieceTo; currentMoveInfo.movePieceToTwo = this.movePieceToTwo; currentMoveInfo.action = this.action; currentMoveInfo.result = this.result; currentMoveInfo.promotingPiece = this.promotingPiece; currentMoveInfo.notation = this.notation; currentMoveInfo.isErrorMessageAllowed = this.isErrorMessageAllowed; return currentMoveInfo; } public String toString(){ if(this.promotingPiece != null){ return "currentMovingPiece =" + this.currentMovingPiece + "\n" + "movePieceFrom =" + this.movePieceFrom + "\n" + "movePieceFromTwo =" + this.movePieceFromTwo + "\n" + "movePieceTo =" + this.movePieceTo + "\n" + "movePieceToTwo =" + this.movePieceToTwo + "\n" + "action =" + this.action + "\n" + "result =" + this.result + "\n" + "promotingPiece =" + this.promotingPiece.getName() + "\n" + "notation =" + this.notation + "\n"; } else{ return "currentMovingPiece =" + this.currentMovingPiece + "\n" + "movePieceFrom =" + this.movePieceFrom + "\n" + "movePieceFromTwo =" + this.movePieceFromTwo + "\n" + "movePieceTo =" + this.movePieceTo + "\n" + "movePieceToTwo =" + this.movePieceToTwo + "\n" + "action =" + this.action + "\n" + "result =" + this.result + "\n" + "promotingPiece =" + this.promotingPiece + "\n" + "notation =" + this.notation + "\n"; } } }