MCPcopy Create free account
hub / github.com/Card-Forge/forge / generateTextExport

Method generateTextExport

forge-core/src/main/java/forge/deck/Deck.java:781–804  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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}

Callers 3

copyDeckToClipboardMethod · 0.80
copyDeckToClipboardMethod · 0.80
copyToClipboardMethod · 0.80

Calls 12

getMethod · 0.95
streamMethod · 0.95
startsWithMethod · 0.80
valuesMethod · 0.80
getNameMethod · 0.65
containsMethod · 0.65
isEmptyMethod · 0.65
appendMethod · 0.45
toStringMethod · 0.45
getCardNameMethod · 0.45
getKeyMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected