()
| 779 | } |
| 780 | |
| 781 | public String generateTextExport() { |
| 782 | final String nl = System.lineSeparator(); |
| 783 | final StringBuilder deckList = new StringBuilder(); |
| 784 | String dName = getName(); |
| 785 | //fix copying a commander netdeck then importing it again... |
| 786 | if (dName.startsWith("[Commander")||dName.contains("Commander")) |
| 787 | dName = ""; |
| 788 | deckList.append(dName == null ? "" : "Deck: "+dName + nl + nl); |
| 789 | |
| 790 | for (DeckSection s : DeckSection.values()) { |
| 791 | CardPool cp = get(s); |
| 792 | if (cp == null || cp.isEmpty()) { |
| 793 | continue; |
| 794 | } |
| 795 | deckList.append(s.toString()).append(": "); |
| 796 | deckList.append(nl); |
| 797 | |
| 798 | for (final Entry<String, Integer> ev: StreamUtil.stream(cp).collect(Collectors.groupingBy(ev -> ev.getKey().getCardName(), TreeMap::new, Collectors.summingInt(ev -> ev.getValue()))).entrySet()) { |
| 799 | deckList.append(ev.getValue()).append(" ").append(ev.getKey()).append(nl); |
| 800 | } |
| 801 | deckList.append(nl); |
| 802 | } |
| 803 | return deckList.toString(); |
| 804 | } |
| 805 | } |
no test coverage detected