當前位置: 首頁>>代碼示例>>Java>>正文


Java WidthAbsoluteEven類代碼示例

本文整理匯總了Java中de.vandermeer.asciitable.v2.render.WidthAbsoluteEven的典型用法代碼示例。如果您正苦於以下問題:Java WidthAbsoluteEven類的具體用法?Java WidthAbsoluteEven怎麽用?Java WidthAbsoluteEven使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


WidthAbsoluteEven類屬於de.vandermeer.asciitable.v2.render包,在下文中一共展示了WidthAbsoluteEven類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: render

import de.vandermeer.asciitable.v2.render.WidthAbsoluteEven; //導入依賴的package包/類
public String render(String[] header, List<String[]> rows) {
    V2_AsciiTable table = new V2_AsciiTable();
    
    table.addStrongRule();
    table.addRow(header);
    for (String[] row : rows) {
        table.addRule();
        table.addRow(row);
    }
    if (showBottomHeader()) {
        table.addRule();
        table.addRow(header);
    }
    table.addStrongRule();

    V2_AsciiTableRenderer renderer = new V2_AsciiTableRenderer();
    renderer.setTheme(V2_E_TableThemes.UTF_LIGHT.get());
    final int tableWidth = getTableWidth();
    renderer.setWidth(new WidthAbsoluteEven(tableWidth));
    return renderer.render(table).toString();
}
 
開發者ID:meridor,項目名稱:perspective-backend,代碼行數:22,代碼來源:TableRenderer.java

示例2: showRandedStats

import de.vandermeer.asciitable.v2.render.WidthAbsoluteEven; //導入依賴的package包/類
private void showRandedStats(@NotNull MessageReceivedEvent event, final String ladder, final String name) throws RateLimitException, DiscordException, MissingPermissionsException {
    /*if (Objects.isNull(name) || StringUtils.isEmpty(name)) {
        answerWithError(event, "Nome de summoner invalido.");
        return;
    }
    if (Objects.isNull(ladder) || StringUtils.isEmpty(ladder)) {
        answerWithError(event, "Nome de ladder invalido.");
        return;
    }
    @NotNull final PlayerStatsSummaryType type;
    try {
        type = PlayerStatsSummaryType.valueOf(ladder);
    } catch (IllegalArgumentException e) {
        LOGGER.debug(() -> "Ladde " + ladder + " nao encontrada", e);
        answerWithError(event, MessageFormat.format("Ladder {0} nao encontrado.", ladder));
        return;
    }

    @NotNull final Summoner summoner;
    try {
        summoner = RiotAPI.getSummonerByName(name);
    } catch (APIException ioob) {
        LOGGER.debug(() -> "Summoner " + name + "Nao encontrado", ioob);
        answerWithError(event, MessageFormat.format("Summoner {0} nao encontrado.", name));
        return;
    }*/
    Summoner summoner = RiotAPI.getSummonerByName("Hide on bush");
    PlayerStatsSummary stats = summoner.getStats(Season.SEASON2016).get(PlayerStatsSummaryType.RankedSolo5x5);
    if (Objects.isNull(stats)) {
        answerWithError(event, MessageFormat.format("Summoner {0} nao tem dados para ladder {1}.", name, ladder));
        return;
    }
    @NotNull V2_AsciiTable table = new V2_AsciiTable();
    table.addRule();
    table.addRow(MessageFormat.format("Summoner stats for {0} from the {1} ladder.", summoner, ladder));
    table.addRule();
    int wins = stats.getWins();
    int losses = stats.getLosses();
    @NotNull Double winratio = (losses != 0 && wins != 0) ? ((wins * 100) / losses) : Double.POSITIVE_INFINITY;
    table.addRow("Wins", wins, "Losses", losses, "Win Ratio", winratio.toString());
    table.addRule();
    table.addRow("Averages");
    AggregatedStats agr = stats.getAggregatedStats();
    table.addRow("Kills", agr.getAverageKills(), "Deaths", agr.getAverageDeaths(), "Assists", agr.getAverageAssists());
    table.addRow("Maxes");
    table.addRow("Kills", agr.getMaxKills(), "Deaths", agr.getMaxDeaths(), "Assists", agr.getMaxAssists(), "Killing Spree", agr.getMaxKillingSpree());
    table.addRule();
    table.addRow("Misc");
    table.addRow("Maior jogo", agr.getMaxTimePlayed(), "Penta Kills", agr.getTotalPentaKills(), "Quadra Kills", agr.getTotalQuadraKills());
    table.addRule();

    @NotNull V2_AsciiTableRenderer renderer = new V2_AsciiTableRenderer();
    renderer.setTheme(V2_E_TableThemes.UTF_LIGHT.get());
    renderer.setWidth(new WidthAbsoluteEven(200));
    RenderedTable result = renderer.render(table);

    new MessageBuilder(event.getClient())
            .appendQuote(result.toString())
            .withChannel(event.getMessage().getChannel())
            .send();
}
 
開發者ID:ViniciusArnhold,項目名稱:ProjectAltaria,代碼行數:62,代碼來源:LeagueCommandHandler.java


注:本文中的de.vandermeer.asciitable.v2.render.WidthAbsoluteEven類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。