Search in sources :

Example 1 with NaturalOrderCardNumberComparator

use of mage.client.util.NaturalOrderCardNumberComparator in project mage by magefree.

the class MageBook method getCards.

private List<CardInfo> getCards(int page, String set) {
    CardCriteria criteria = new CardCriteria();
    criteria.setCodes(set);
    List<CardInfo> cards = CardRepository.instance.findCards(criteria);
    cards.sort(new NaturalOrderCardNumberComparator());
    int start = page * conf.CARDS_PER_PAGE;
    int end = page * conf.CARDS_PER_PAGE + conf.CARDS_PER_PAGE;
    if (end > cards.size()) {
        end = cards.size();
    }
    if (cards.size() > end) {
        pageRight.setVisible(true);
    }
    return cards.subList(start, end);
}
Also used : NaturalOrderCardNumberComparator(mage.client.util.NaturalOrderCardNumberComparator) CardCriteria(mage.cards.repository.CardCriteria) CardInfo(mage.cards.repository.CardInfo)

Example 2 with NaturalOrderCardNumberComparator

use of mage.client.util.NaturalOrderCardNumberComparator in project mage by magefree.

the class MageBook method loadCards.

private List<Object> loadCards() {
    CardCriteria criteria = new CardCriteria();
    criteria.setCodes(currentSet);
    List<CardInfo> cards = CardRepository.instance.findCards(criteria);
    cards.sort(new NaturalOrderCardNumberComparator());
    List<Object> res = new ArrayList<>();
    cards.forEach(card -> res.add(new CardView(card.getMockCard())));
    return res;
}
Also used : NaturalOrderCardNumberComparator(mage.client.util.NaturalOrderCardNumberComparator) CardCriteria(mage.cards.repository.CardCriteria) ArrayList(java.util.ArrayList) CardInfo(mage.cards.repository.CardInfo)

Aggregations

CardCriteria (mage.cards.repository.CardCriteria)2 CardInfo (mage.cards.repository.CardInfo)2 NaturalOrderCardNumberComparator (mage.client.util.NaturalOrderCardNumberComparator)2 ArrayList (java.util.ArrayList)1