-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriple.java
More file actions
36 lines (32 loc) · 857 Bytes
/
Copy pathTriple.java
File metadata and controls
36 lines (32 loc) · 857 Bytes
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
/**
* Triple class is a subclass of Hand which model a triple hand
* and implement the method in Hand
*
* @author Chan Yuk Yin (UID: 3035786574)
*/
public class Triple extends Hand{
public Triple(CardGamePlayer player, CardList cards){
super(player, cards);
}
/**
* Check whether the hand is a valid triple or not
* @return boolean
*/
public boolean isValid(){
if (!this.isEmpty()){
if (this.size() == 3){
if (this.getCard(0).getRank() == this.getCard(1).getRank() && this.getCard(1).getRank() == this.getCard(2).getRank()){
return true;
}
}
}
return false;
}
/**
* Return type of hand
* @return String
*/
public String getType(){
return "Triple";
}
}