-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpace.java
More file actions
61 lines (49 loc) · 1.27 KB
/
Space.java
File metadata and controls
61 lines (49 loc) · 1.27 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
56
57
58
59
60
61
import java.util.Arrays;
import java.util.Scanner;
import java.util.HashMap;
import java.util.ArrayList;
public class Space {
private int height;
private String letter;
public Space(int height, String letter) {
this.height = height;
this.letter = letter;
}
public Space() {
this.height = 0;
this.letter = "";
}
public Space clone(){
return new Space(height,letter);
}
public String toString() {
if (letter.equals("")){
return " ";
}
if (letter.equals("Qu")){
return letter+Integer.valueOf(height);
}
return letter+" "+Integer.valueOf(height);
}
public int getHeight() {
return height;
}
public void setHeight(int height) {
this.height = height;
}
public String getLetter() {
return letter;
}
public void setLetter(String letter) {
this.letter = letter;
height++;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + height;
result = prime * result + ((letter == null) ? 0 : letter.hashCode());
return result;
}
}