home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
inprise
/
JSAMPLES.Z
/
MoveTuple.java
< prev
next >
Wrap
Text File
|
1998-05-08
|
2KB
|
62 lines
/*
* Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved.
*
* This SOURCE CODE FILE, which has been provided by Borland as part
* of a Borland product for use ONLY by licensed users of the product,
* includes CONFIDENTIAL and PROPRIETARY information of Borland.
*
* USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS
* OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH
* THE PRODUCT.
*
* IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED
* COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS
* OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION
* OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF
* OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS
* OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE
* CODE FILE.
*/
package borland.samples.apps.chess.client.board;
public class MoveTuple
{
public int newpieceValue;
public int pieceValue;
public int pieceColor;
public int fromRank;
public int fromFile;
public int toRank;
public int toFile;
public MoveTuple() {
newpieceValue = 0;
pieceValue = 0;
pieceColor = 0;
fromRank = 0;
fromFile = 0;
toRank = 0;
toFile = 0;
}
public MoveTuple(String x) {
try {
newpieceValue = Integer.parseInt(x.substring(6));
pieceValue = Integer.parseInt(x.substring(0,1));
pieceColor = Integer.parseInt(x.substring(1,2));
fromRank = Integer.parseInt(x.substring(2,3));
fromFile = Integer.parseInt(x.substring(3,4));
toRank = Integer.parseInt(x.substring(4,5));
toFile = Integer.parseInt(x.substring(5,6));
}
catch (Exception e) {
System.out.println("Failed to parse tokenmsg " + e);
}
}
public String toString() {
//override this java.lang.Object method
return String.valueOf(pieceValue) + pieceColor + fromRank + fromFile + toRank + toFile + newpieceValue;
}
}