forked from Matan-Eliyahu/BookScrabble
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWord.java
More file actions
55 lines (49 loc) · 1.21 KB
/
Word.java
File metadata and controls
55 lines (49 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package test;
import java.util.Arrays;
public class Word {
private Tile[] tiles;
private int row;
private int col;
private boolean vertical;
public Word(Tile[] tiles, int row, int col, boolean vertical) {
this.tiles = new Tile[tiles.length];
for (int i = 0; i < tiles.length; i++)
{
this.tiles[i] = tiles[i];
}
this.row = row;
this.col = col;
this.vertical = vertical;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Word other = (Word) obj;
if (!Arrays.equals(tiles, other.tiles))
return false;
if (row != other.row)
return false;
if (col != other.col)
return false;
if (vertical != other.vertical)
return false;
return true;
}
public Tile[] getTiles() {
return tiles;
}
public int getRow() {
return row;
}
public int getCol() {
return col;
}
public boolean isVertical() {
return vertical;
}
}