net.japanesechess.record
Class ShogiPly

java.lang.Object
  extended by net.japanesechess.record.ShogiPly

public class ShogiPly
extends java.lang.Object

Shogi plie representing one handicap or one move of a token. A comment may be attached to a ply.

Author:
T. Gene Davis

Field Summary
private  PlyActions action
           
private  byte[] board
           
private  java.lang.String comment
           
private  boolean handicap
           
private  boolean hasPromoted
           
private  java.lang.String notation
           
private  boolean promoting
           
private  Tokens token
           
private  int x1
           
private  int x2
           
private  java.lang.String y1
           
private  java.lang.String y2
           
 
Constructor Summary
ShogiPly(java.lang.String notation)
          Takes a move in standard notation, processes it and sets up the ply.
 
Method Summary
 void appendComment(java.lang.String comment)
           
 PlyActions getAction()
           
 byte[] getBoard()
          Packed board representing the state of the board and reserves after this ply is played.
 java.lang.String getComment()
           
 java.lang.String getNotation()
           
 Tokens getToken()
           
 int getX1()
          Valid values are 1-9
 int getX2()
          Valid values are 1-9
 java.lang.String getY1()
          Valid values are a-i
 java.lang.String getY2()
          Valid values are a-i
 boolean isHandicap()
           
 boolean isHasPromoted()
           
 boolean isPromoting()
           
private  java.lang.String processMove(java.lang.String notation)
          Takes a move in notation format and populates this ply.
 void setAction(PlyActions action)
           
 void setBoard(byte[] board)
          Packed board representing the state of the board and reserves after this ply is played.
 void setComment(java.lang.String comment)
          No comments on handicap (...) plies.
 void setHandicap(boolean handicap)
           
 void setHasPromoted(boolean hasPromoted)
           
 void setNotation(java.lang.String notation)
           
 void setPromoting(boolean promoting)
           
 void setToken(Tokens token)
           
 void setX1(int x1)
          Valid values are 1-9
 void setX2(int x2)
          Valid values are 1-9
 void setY1(java.lang.String y1)
          Valid values are a-i
 void setY2(java.lang.String y2)
          Valid values are a-i
 java.lang.String toString()
          Returns standard notation for this ply.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

handicap

private boolean handicap

hasPromoted

private boolean hasPromoted

token

private Tokens token

x1

private int x1

y1

private java.lang.String y1

action

private PlyActions action

x2

private int x2

y2

private java.lang.String y2

promoting

private boolean promoting

notation

private java.lang.String notation

comment

private java.lang.String comment

board

private byte[] board
Constructor Detail

ShogiPly

public ShogiPly(java.lang.String notation)
Takes a move in standard notation, processes it and sets up the ply.

Parameters:
notation -
Method Detail

getBoard

public byte[] getBoard()
Packed board representing the state of the board and reserves after this ply is played. See BoardPackUtil.

Returns:
the board

setBoard

public void setBoard(byte[] board)
Packed board representing the state of the board and reserves after this ply is played. See BoardPackUtil.

Parameters:
board - the board to set

isHasPromoted

public boolean isHasPromoted()
Returns:
the hasPromoted

setHasPromoted

public void setHasPromoted(boolean hasPromoted)
Parameters:
hasPromoted - the hasPromoted to set

getToken

public Tokens getToken()
Returns:
the token

setToken

public void setToken(Tokens token)
Parameters:
token - the token to set

getX1

public int getX1()
Valid values are 1-9

Returns:
the x1

setX1

public void setX1(int x1)
Valid values are 1-9

Parameters:
x1 - the x1 to set

getY1

public java.lang.String getY1()
Valid values are a-i

Returns:
the y1

setY1

public void setY1(java.lang.String y1)
Valid values are a-i

Parameters:
y1 - the y1 to set

getAction

public PlyActions getAction()
Returns:
the action

setAction

public void setAction(PlyActions action)
Parameters:
action - the action to set

getX2

public int getX2()
Valid values are 1-9

Returns:
the x2

setX2

public void setX2(int x2)
Valid values are 1-9

Parameters:
x2 - the x2 to set

getY2

public java.lang.String getY2()
Valid values are a-i

Returns:
the y2

setY2

public void setY2(java.lang.String y2)
Valid values are a-i

Parameters:
y2 - the y2 to set

isPromoting

public boolean isPromoting()
Returns:
the promoting

setPromoting

public void setPromoting(boolean promoting)
Parameters:
promoting - the promoting to set

toString

public java.lang.String toString()
Returns standard notation for this ply.

Overrides:
toString in class java.lang.Object

isHandicap

public boolean isHandicap()
Returns:
the handicap

setHandicap

public void setHandicap(boolean handicap)
Parameters:
handicap - the handicap to set

processMove

private java.lang.String processMove(java.lang.String notation)
Takes a move in notation format and populates this ply.

Parameters:
notation -
Returns:

getComment

public java.lang.String getComment()
Returns:
the comment

appendComment

public void appendComment(java.lang.String comment)
Parameters:
comment - the comment to set

getNotation

public java.lang.String getNotation()
Returns:
the notation

setNotation

public void setNotation(java.lang.String notation)
Parameters:
notation - the notation to set

setComment

public void setComment(java.lang.String comment)
No comments on handicap (...) plies.

Parameters:
comment - the comment to set