-
Notifications
You must be signed in to change notification settings - Fork 0
/
WordTuple.java
53 lines (43 loc) · 1.09 KB
/
WordTuple.java
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
/** The implementation of Word Tuple data structure.
* @author: Rafayel Mkrtchyan
**/
public class WordTuple {
/** The constructor of Word. **/
public WordTuple(String word, Integer number) {
_word = word;
_number = number;
}
/** Returns the value of word. **/
public String getword() {
return this._word;
}
/** Sets the value of the word to STR. **/
public void setword(String str) {
this._word = str;
}
/** Returns the value of number. **/
public Integer getNumber() {
return this._number;
}
/** Sets the value of the number to NUM. **/
public void setNumber(Integer num) {
this._number = num;
}
public boolean isEqualTo(WordTuple tup) {
if (tup == null) {
return false;
}
if (this._word.equals(tup.getword()) &&
this._number == tup.getNumber()) {
return true;
}
return false;
}
public void printTuple() {
System.out.println("Content of my tuple is: " + this._word + " " + this._number);
}
/** Contains the first element of the Word Tuple. **/
private String _word;
/** Contains the second element of the Word Tuple. **/
private Integer _number;
}