|
01 packagepackage is used to name the directory or folder a class is in scg.ch13.pieces;
02
03 importimport means to make the classes and/or packages available in this program java.awt.Color;
04 importimport means to make the classes and/or packages available in this program java.util.ArrayList;
05 importimport means to make the classes and/or packages available in this program java.util.Arrays;
06
07 importimport means to make the classes and/or packages available in this program scg.ch13.util.Position;
08
09 /** The O, or square, piece. */
10 publicpublic is used to indicate unrestricted access (any other class can have access) classclass is a group of fields and methods used for making objects O_Piece
11 extendsextends means to customize or extend the functionality of a class Piece {open braces start code blocks and must be matched with a close brace
12 @SuppressWarnings("unchecked")
13 publicpublic is used to indicate unrestricted access (any other class can have access) O_Piece(intint is the type for whole numbers and it is short for integer facing, Color color) {open braces start code blocks and must be matched with a close brace
14 super(facing, color);
15 setRotationDegrees(0);// square always in same rotational position
16 blockPositionByFacing =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ArrayList<ArrayList<Position>>this performs a bit-wise right shift(Arrays
17 .asList(
18 newnew is used to create objects by calling the constructor ArrayList<Position>(
19 Arrays.asList(newnew is used to create objects by calling the constructor Position(2, 2), newnew is used to create objects by calling the constructor Position(2, 2),
20 newnew is used to create objects by calling the constructor Position(2, 2), newnew is used to create objects by calling the constructor Position(2, 2))),
21 newnew is used to create objects by calling the constructor ArrayList<Position>(
22 Arrays.asList(newnew is used to create objects by calling the constructor Position(2, 3), newnew is used to create objects by calling the constructor Position(2, 3),
23 newnew is used to create objects by calling the constructor Position(2, 3), newnew is used to create objects by calling the constructor Position(2, 3))),
24 newnew is used to create objects by calling the constructor ArrayList<Position>(
25 Arrays.asList(newnew is used to create objects by calling the constructor Position(3, 2), newnew is used to create objects by calling the constructor Position(3, 2),
26 newnew is used to create objects by calling the constructor Position(3, 2), newnew is used to create objects by calling the constructor Position(3, 2))),
27 newnew is used to create objects by calling the constructor ArrayList<Position>(
28 Arrays.asList(newnew is used to create objects by calling the constructor Position(3, 3), newnew is used to create objects by calling the constructor Position(3, 3),
29 newnew is used to create objects by calling the constructor Position(3, 3), newnew is used to create objects by calling the constructor Position(3, 3)))));
30
31 initialOffsetByFacing =this assignment operator makes the left side equal to the right side newnew is used to create objects by calling the constructor ArrayList<Position>(Arrays.asList(
32 newnew is used to create objects by calling the constructor Position(-2, -2), newnew is used to create objects by calling the constructor Position(-2, -2),
33 newnew is used to create objects by calling the constructor Position(-2, -2), newnew is used to create objects by calling the constructor Position(-2, -2)));
34
35 generateBlocks();
36 }close braces end code blocks and must match an earlier open brace
37
38 /**
39 * Rotate the piece in the anti-clockwise direction. Overridden here
40 * because all facings of {open braces start code blocks and must be matched with a close brace@link O_Piece}close braces end code blocks and must match an earlier open brace are the same.
41 */
42 @Override
43 publicpublic is used to indicate unrestricted access (any other class can have access) voidvoid means the method does not return a value rotateCCW() {open braces start code blocks and must be matched with a close brace
44 setFacing(turnCCW(getFacing()));
45 }close braces end code blocks and must match an earlier open brace
46 }close braces end code blocks and must match an earlier open brace
47
48 //Uploaded on Mon Mar 29 21:40:21 EDT 2010
|