当前位置: 首页>>代码示例>>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;未经允许,请勿转载。