91 discard.add(card);
92 }
93
94 public Card currentCard() { 95 if (discard.isEmpty()) { 96 return null; 97 } 98 return discard.peek(); 99 }100
101 public Queue<Card> getDraw() {
102 return draw;
67
68 }
69
70 private void addCards(int start, int end, Card.Color color) { 71 for (int i = start; i <= end; i++) { 72 draw.add(new Card(color, i)); 73 } 74 } 75
76 private void shuffle() {
77 while (discard.size() > 1) {
73 }
74 }
75
76 private void shuffle() { 77 while (discard.size() > 1) { 78 int index = (int) (Math.random() * discard.size()); 79 draw.add(discard.remove(index)); 80 } 81 } 82
83 public Card drawCard() {
84 if (draw.size() == 0) {
80 }
81 }
82
83 public Card drawCard() { 84 if (draw.size() == 0) { 85 shuffle(); 86 } 87 return draw.poll(); 88 } 89
90 public void discard(Card card) {
91 discard.add(card);
87 return draw.poll();
88 }
89
90 public void discard(Card card) { 91 discard.add(card); 92 } 93
94 public Card currentCard() {
95 if (discard.isEmpty()) {
This method does not have any documentation.
Consider adding a documentation comment to explain its use.
While it may seem like the usage of a method is perfectly obvious, any consumers of your API may not be able to pick up on certain details.
This method appears to return an address string based on its name and the return type, but it is hard to say anything further about it. We neither know if the address will be formatted in a special way nor are we given any useful information regarding the returned value.
String getAddress() {
// ...
}
Provide a detailed description of what the method does.
/**
* Returns the address in 3 line format,
* with street address on line 1, area/city on line 2
* and state and country as well as postal code on line 3.
*/
String getAddress() {
// ...
}