-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWord.java
More file actions
51 lines (41 loc) · 1.25 KB
/
Word.java
File metadata and controls
51 lines (41 loc) · 1.25 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
package test;
import java.util.Arrays;
import java.util.Objects;
public class Word {
private final Tile[] tiles; //final ???
private final int row, col;
private final boolean vertical;
public Word(Tile[] tileArr, int row, int col, boolean v){
this.tiles = tileArr;
this.row = row;
this.col = col;
this.vertical = v;
}
public int getRow(){
return this.row;
}
public int getCol(){
return this.col;
}
public boolean getVertical(){
return this.vertical;
}
public Tile[] getTiles(){
return this.tiles;
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Word newWord = (Word) o;
return newWord.row==row && newWord.col==col && newWord.vertical==vertical && Arrays.equals(tiles, newWord.tiles);
}
// @Override
// public int hashCode() {
// return Objects.hash(tiles, row, col, vertical);
// }
}
//example:
// Tile[] tiles = {new Tile('H', 4), new Tile('E', 1), new Tile('L', 1), new Tile('L', 1), new Tile('O', 1)};
// Word word = new Word(tiles, 7, 7, false);