scg/ch13/util/Position

From FANG

Jump to: navigation, search

01 package scg.ch13.util;
02 
03 /**
04  * Represents a {@link BlockDrop} game position. Each position has a row
05  * and a column. It can be constructed with a pair of integers or
06  * another {@link Position}. Both fields have standard getter/setter
07  * methods.
08  */
09 public class Position {
10   private int column;
11 
12   /** the row and column of this position */
13   private int row;
14 
15   /**
16    * Construct a new {@link Position} from the given values.
17    *
18    @param  row     the row value in this {@link Position}
19    @param  column  the column value in this {@link Position}
20    */
21   public Position(int row, int column{
22     this.row = row;
23     this.column = column;
24   }
25 
26   /**
27    * Construct a copy of the original {@link Position}.
28    *
29    @param  original  the {@link Position} to copy
30    */
31   public Position(Position original{
32     this(original.row, original.column);
33   }
34 
35   /**
36    * Get the current column
37    *
38    @return  the column
39    */
40   public int getColumn() {
41     return column;
42   }
43 
44   /**
45    * Get the current row.
46    *
47    @return  the row
48    */
49   public int getRow() {
50     return row;
51   }
52 
53   /**
54    Set the column in this {@link Position}.
55    *
56    @param  column  the column to set
57    */
58   public void setColumn(int column{
59     this.column = column;
60   }
61 
62   /**
63    Set the row in this {@link Position}.
64    *
65    @param  row  the row to set
66    */
67   public void setRow(int row{
68     this.row = row;
69   }
70 }
71 
72 //Uploaded on Mon Mar 29 21:38:40 EDT 2010


Download/View scg/ch13/util/Position.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter

Games
Games