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


Java LocalTime.from方法代碼示例

本文整理匯總了Java中java.time.LocalTime.from方法的典型用法代碼示例。如果您正苦於以下問題:Java LocalTime.from方法的具體用法?Java LocalTime.from怎麽用?Java LocalTime.from使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.time.LocalTime的用法示例。


在下文中一共展示了LocalTime.from方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseLineToInfo

import java.time.LocalTime; //導入方法依賴的package包/類
private InfoSchema parseLineToInfo(String line, LocalDate localDate) {
    String[] columns = line.split(" \\| ");
    Matcher matcher = mjlogPattern.matcher(columns[3]);
    if (matcher.find()) {
        String id = matcher.group(1);
        if (this.databaseService.existsIdInINFO(id)) return null;

        boolean isSanma = columns[2].substring(0, 1).equals("三");
        boolean isTonnan = columns[2].substring(2, 3).equals("南");
        int minute = Integer.parseInt(columns[1]);
        String[] playerAndScore = columns[4].split(" ");
        String[] players = new String[4];
        int[] scores = new int[4];
        for (int i = 0; i < playerAndScore.length; i++) {
            Matcher playerMatcher = playerPattern.matcher(playerAndScore[i]);
            if (playerMatcher.find()) {
                players[i] = playerMatcher.group(1);
                scores[i] = (int) Float.parseFloat(playerMatcher.group(2));
            }
        }
        LocalTime localTime = LocalTime.from(DateTimeFormatter.ofPattern("HH:mm").parse(columns[0]));
        LocalDateTime localDateTime = LocalDateTime.of(localDate, localTime);
        return new InfoSchema.Builder(id, isSanma, isTonnan, localDateTime,
                players[0], players[1], players[2], players[3])
                .minute(minute)
                .firstScore(scores[0])
                .secondScore(scores[1])
                .thirdScore(scores[2])
                .fourthScore(scores[3])
                .build();
    }

    return null;
}
 
開發者ID:CrazyBBB,項目名稱:tenhou-visualizer,代碼行數:35,代碼來源:DownloadService.java

示例2: factory_from_TemporalAccessor_invalid_noDerive

import java.time.LocalTime; //導入方法依賴的package包/類
@Test(expectedExceptions=DateTimeException.class)
public void factory_from_TemporalAccessor_invalid_noDerive() {
    LocalTime.from(LocalDate.of(2007, 7, 15));
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:TCKLocalTime.java

示例3: factory_from_TemporalAccessor_null

import java.time.LocalTime; //導入方法依賴的package包/類
@Test(expectedExceptions=NullPointerException.class)
public void factory_from_TemporalAccessor_null() {
    LocalTime.from((TemporalAccessor) null);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:5,代碼來源:TCKLocalTime.java


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