WROracer / UNO-Engine

Undocumented method found JAVA-D1001
Documentation
Minor
12 occurrences in this check
Consider adding a doc comment for getNumbers
22    WILD_DRAW_FOUR("wild draw four",WildDrawFourCard.class),
23    ;
24
25    public static List<CardType> getNumbers(){26        return Arrays.stream(CardType.values()).filter(CardType::isNumber).collect(Collectors.toList());27    }28    public static List<CardType> getSpecials(){
29        return Arrays.stream(CardType.values()).filter(c->!c.isNumber()).collect(Collectors.toList());
30    }
Consider adding a doc comment for getSpecials
25    public static List<CardType> getNumbers(){
26        return Arrays.stream(CardType.values()).filter(CardType::isNumber).collect(Collectors.toList());
27    }
28    public static List<CardType> getSpecials(){29        return Arrays.stream(CardType.values()).filter(c->!c.isNumber()).collect(Collectors.toList());30    }31
32    private String name;
33    private Class<? extends Card> card;
Consider adding a doc comment for isNumber
52        return number;
53    }
54
55    public boolean isNumber(){56        return number > -1;57    }58
59    public Class<? extends Card> getCard() {
60        return card;
Consider adding a doc comment for isPlayable
27        this.color = color;
28    }
29
30    public boolean isPlayable(Card card){31        if (!card.getType().isNumber())return card.canPlayedOn(this);32        if (card.getColor() == color)return true;33        if (card.getType().getNumber()+1== type.getNumber())return true;34        return card.getType().getNumber() - 1 == type.getNumber();35    }36
37    public boolean canPlayedOn(Card card){
38        if (card.getColor() == color)return true;
Consider adding a doc comment for canPlayedOn
34        return card.getType().getNumber() - 1 == type.getNumber();
35    }
36
37    public boolean canPlayedOn(Card card){38        if (card.getColor() == color)return true;39        if (card.getType().getNumber()+1== type.getNumber())return true;40        return card.getType().getNumber() - 1 == type.getNumber();41    }42
43    /**
44     * This method is executed, when this card is played.
Consider adding a doc comment for changeDirection
116        return status;
117    }
118
119    public void changeDirection() {120        this.clockWiseDirection = !this.clockWiseDirection;121    }122
123    public Player getCurrentPlayer() {
124        return currentPlayer;
Consider adding a doc comment for checkCard
157        return card;
158    }
159
160    public boolean checkCard(Card card){161        return currentCard.isPlayable(card);162    }163
164    public HashMap<Player, List<Card>> getPlayerCardHashMap() {
165        return playerCardHashMap;
Consider adding a doc comment for getCard
146        }
147    }
148
149    private Card getCard(){150        if (cards.size() == 0){151            cards = disposedCards;152            Collections.shuffle(cards);153            disposedCards.clear();154        }155        Card card = cards.get(0);156        cards.remove(0);157        return card;158    }159
160    public boolean checkCard(Card card){
161        return currentCard.isPlayable(card);
Consider adding a doc comment for drawCard
124        return currentPlayer;
125    }
126
127    public void drawCard(Player playerToDraw) {128        playerCardHashMap.get(playerToDraw).add(getCard());129    }130
131    public void playCard(Card card,Player player) throws UnoException {
132        if (checkCard(card)){
Consider adding a doc comment for playCard
128        playerCardHashMap.get(playerToDraw).add(getCard());
129    }
130
131    public void playCard(Card card,Player player) throws UnoException {132        if (checkCard(card)){133            if (playerCardHashMap.get(player).contains(card)){134                if (card.getColor() == CardColor.BLACK){135                    throw new CantPlayBlackException();136                }137                disposedCards.add(currentCard);138                card.play(this,player);139                currentCard = card;140                playerCardHashMap.get(player).remove(card);141            }else {142                throw new PlayerHasNoCardException(player,card);143            }144        }else {145            throw new NotPlayableCardException(card,currentCard);146        }147    }148
149    private Card getCard(){
150        if (cards.size() == 0){
Consider adding a doc comment for nextPlayer
 87    public void shutdown() {
 88    }
 89
 90    public void nextPlayer(){ 91        if (clockWiseDirection){ 92            int index = Arrays.asList(players).indexOf(currentPlayer); 93            index++; 94            if (index>=players.length){ 95                index = 0; 96            } 97            currentPlayer = players[index]; 98        }else { 99            int index = Arrays.asList(players).indexOf(currentPlayer);100            index--;101            if (index<=-1){102                index = players.length-1;103            }104            currentPlayer = players[index];105        }106    }107
108    public Card getCurrentCard(){
109        return currentCard;
Consider adding a doc comment for getDeck
 6import java.util.List;
 7
 8public class DeckUtils {
 9    public static List<Card> getDeck(){10        List<Card> cards = new ArrayList<>();11        for (CardColor color : CardColor.values()) {12            if (color != CardColor.BLACK){13                for (CardType number : CardType.getNumbers()) {14                    cards.add(new Card(number,color));15                    if (number!=CardType.ZERO)16                        cards.add(new Card(number,color));17                }18                cards.add(new DrawTwoCard(color));19                cards.add(new DrawTwoCard(color));20                cards.add(new ReverseCard(color));21                cards.add(new ReverseCard(color));22                cards.add(new SkipCard(color));23                cards.add(new SkipCard(color));24            }2526        }27        for (int i = 0; i < 4; i++) {28            cards.add(new WildCard());29            cards.add(new WildDrawFourCard());30        }31        return cards;32    }33}