Java Code Examples for java.time.DayOfWeek#SATURDAY

The following examples show how to use java.time.DayOfWeek#SATURDAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TCKWeekFields.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@DataProvider(name="IsoWeekData")
Object[][] data_week() {
    return new Object[][] {
            {LocalDate.of(1969, 12, 29), DayOfWeek.MONDAY, 1, 1970},
            {LocalDate.of(2012, 12, 23), DayOfWeek.SUNDAY, 51, 2012},
            {LocalDate.of(2012, 12, 24), DayOfWeek.MONDAY, 52, 2012},
            {LocalDate.of(2012, 12, 27), DayOfWeek.THURSDAY, 52, 2012},
            {LocalDate.of(2012, 12, 28), DayOfWeek.FRIDAY, 52, 2012},
            {LocalDate.of(2012, 12, 29), DayOfWeek.SATURDAY, 52, 2012},
            {LocalDate.of(2012, 12, 30), DayOfWeek.SUNDAY, 52, 2012},
            {LocalDate.of(2012, 12, 31), DayOfWeek.MONDAY, 1, 2013},
            {LocalDate.of(2013, 1, 1), DayOfWeek.TUESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 2), DayOfWeek.WEDNESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 6), DayOfWeek.SUNDAY, 1, 2013},
            {LocalDate.of(2013, 1, 7), DayOfWeek.MONDAY, 2, 2013},
    };
}
 
Example 2
Source File: TCKWeekFields.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@DataProvider(name="IsoWeekData")
Object[][] data_week() {
    return new Object[][] {
            {LocalDate.of(1969, 12, 29), DayOfWeek.MONDAY, 1, 1970},
            {LocalDate.of(2012, 12, 23), DayOfWeek.SUNDAY, 51, 2012},
            {LocalDate.of(2012, 12, 24), DayOfWeek.MONDAY, 52, 2012},
            {LocalDate.of(2012, 12, 27), DayOfWeek.THURSDAY, 52, 2012},
            {LocalDate.of(2012, 12, 28), DayOfWeek.FRIDAY, 52, 2012},
            {LocalDate.of(2012, 12, 29), DayOfWeek.SATURDAY, 52, 2012},
            {LocalDate.of(2012, 12, 30), DayOfWeek.SUNDAY, 52, 2012},
            {LocalDate.of(2012, 12, 31), DayOfWeek.MONDAY, 1, 2013},
            {LocalDate.of(2013, 1, 1), DayOfWeek.TUESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 2), DayOfWeek.WEDNESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 6), DayOfWeek.SUNDAY, 1, 2013},
            {LocalDate.of(2013, 1, 7), DayOfWeek.MONDAY, 2, 2013},
    };
}
 
Example 3
Source File: TCKWeekFields.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@DataProvider(name="IsoWeekData")
Object[][] data_week() {
    return new Object[][] {
            {LocalDate.of(1969, 12, 29), DayOfWeek.MONDAY, 1, 1970},
            {LocalDate.of(2012, 12, 23), DayOfWeek.SUNDAY, 51, 2012},
            {LocalDate.of(2012, 12, 24), DayOfWeek.MONDAY, 52, 2012},
            {LocalDate.of(2012, 12, 27), DayOfWeek.THURSDAY, 52, 2012},
            {LocalDate.of(2012, 12, 28), DayOfWeek.FRIDAY, 52, 2012},
            {LocalDate.of(2012, 12, 29), DayOfWeek.SATURDAY, 52, 2012},
            {LocalDate.of(2012, 12, 30), DayOfWeek.SUNDAY, 52, 2012},
            {LocalDate.of(2012, 12, 31), DayOfWeek.MONDAY, 1, 2013},
            {LocalDate.of(2013, 1, 1), DayOfWeek.TUESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 2), DayOfWeek.WEDNESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 6), DayOfWeek.SUNDAY, 1, 2013},
            {LocalDate.of(2013, 1, 7), DayOfWeek.MONDAY, 2, 2013},
    };
}
 
Example 4
Source File: TCKWeekFields.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@DataProvider(name="IsoWeekData")
Object[][] data_week() {
    return new Object[][] {
            {LocalDate.of(1969, 12, 29), DayOfWeek.MONDAY, 1, 1970},
            {LocalDate.of(2012, 12, 23), DayOfWeek.SUNDAY, 51, 2012},
            {LocalDate.of(2012, 12, 24), DayOfWeek.MONDAY, 52, 2012},
            {LocalDate.of(2012, 12, 27), DayOfWeek.THURSDAY, 52, 2012},
            {LocalDate.of(2012, 12, 28), DayOfWeek.FRIDAY, 52, 2012},
            {LocalDate.of(2012, 12, 29), DayOfWeek.SATURDAY, 52, 2012},
            {LocalDate.of(2012, 12, 30), DayOfWeek.SUNDAY, 52, 2012},
            {LocalDate.of(2012, 12, 31), DayOfWeek.MONDAY, 1, 2013},
            {LocalDate.of(2013, 1, 1), DayOfWeek.TUESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 2), DayOfWeek.WEDNESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 6), DayOfWeek.SUNDAY, 1, 2013},
            {LocalDate.of(2013, 1, 7), DayOfWeek.MONDAY, 2, 2013},
    };
}
 
Example 5
Source File: MarketDayUtil.java    From java-trader with Apache License 2.0 6 votes vote down vote up
public static LocalDate nextMarketDay(Exchange exchange, LocalDate tradingDay){
    if ( exchange==null ) {
        exchange = Exchange.SSE;
    }
    List<LocalDate> closeDays = closeDayMap.get(exchange.name());
    while(true){
        tradingDay = tradingDay.plusDays(1);
        DayOfWeek dayOfWeek = tradingDay.getDayOfWeek();
        if ( dayOfWeek == DayOfWeek.SUNDAY || dayOfWeek==DayOfWeek.SATURDAY) {
            continue;
        }
        if ( closeDays!=null && closeDays.contains(tradingDay) ) {
            continue;
        }
        return tradingDay;
    }
}
 
Example 6
Source File: MarketDayUtil.java    From java-trader with Apache License 2.0 6 votes vote down vote up
/**
 * 上一个交易日
 */
public static LocalDate prevMarketDay(Exchange exchange, LocalDate tradingDay, boolean stopOnHolidy){
    if ( exchange==null ) {
        exchange = Exchange.SSE;
    }
    List<LocalDate> closeDays = closeDayMap.get(exchange.name());

    while(true){
        tradingDay = tradingDay.plusDays(-1);
        DayOfWeek dayOfWeek = tradingDay.getDayOfWeek();
        if ( dayOfWeek == DayOfWeek.SUNDAY || dayOfWeek==DayOfWeek.SATURDAY) {
            continue;
        }
        if ( closeDays!=null && closeDays.contains(tradingDay) ) {
            if ( !stopOnHolidy ) {
                continue;
            }
            tradingDay = null;
            break;
        }
        break;
    }
    return tradingDay;
}
 
Example 7
Source File: WeeklyPlanningServiceImp.java    From axelor-open-suite with GNU Affero General Public License v3.0 6 votes vote down vote up
private DayOfWeek getDayOfWeek(DayPlanning day) {
  switch (day.getName()) {
    case "monday":
      return DayOfWeek.MONDAY;
    case "tuesday":
      return DayOfWeek.TUESDAY;
    case "wednesday":
      return DayOfWeek.WEDNESDAY;
    case "thursday":
      return DayOfWeek.THURSDAY;
    case "friday":
      return DayOfWeek.FRIDAY;
    case "saturday":
      return DayOfWeek.SATURDAY;
    case "sunday":
      return DayOfWeek.SUNDAY;
    default:
      return DayOfWeek.SUNDAY;
  }
}
 
Example 8
Source File: WorkDayQuery.java    From levelup-java-examples with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean queryFrom(TemporalAccessor date) {
	
	int dayOfWeekNumber = date.get(ChronoField.DAY_OF_WEEK);
	DayOfWeek dayOfWeek = DayOfWeek.of(dayOfWeekNumber);
	
	if (dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) {
		return Boolean.FALSE; 
	} else {
		return Boolean.TRUE; 
	}
}
 
Example 9
Source File: DateTimeExamples.java    From Java8InAction with MIT License 5 votes vote down vote up
@Override
public Temporal adjustInto(Temporal temporal) {
    DayOfWeek dow = DayOfWeek.of(temporal.get(ChronoField.DAY_OF_WEEK));
    int dayToAdd = 1;
    if (dow == DayOfWeek.FRIDAY) dayToAdd = 3;
    if (dow == DayOfWeek.SATURDAY) dayToAdd = 2;
    return temporal.plus(dayToAdd, ChronoUnit.DAYS);
}
 
Example 10
Source File: TestStart.java    From LGoodDatePicker with MIT License 5 votes vote down vote up
/**
 * isDateAllowed, Return true if a date should be allowed, or false if a date should be
 * vetoed.
 */
@Override
public boolean isDateAllowed(LocalDate date) {
    // Disallow days 7 to 11.
    if ((date.getDayOfMonth() >= 7) && (date.getDayOfMonth() <= 11)) {
        return false;
    }
    // Disallow odd numbered saturdays.
    if ((date.getDayOfWeek() == DayOfWeek.SATURDAY) && ((date.getDayOfMonth() % 2) == 1)) {
        return false;
    }
    // Allow all other days.
    return true;
}
 
Example 11
Source File: FullDemo.java    From LGoodDatePicker with MIT License 5 votes vote down vote up
/**
 * isDateAllowed, Return true if a date should be allowed, or false if a date should be
 * vetoed.
 */
@Override
public boolean isDateAllowed(LocalDate date) {
    // Disallow days 7 to 11.
    if ((date.getDayOfMonth() >= 7) && (date.getDayOfMonth() <= 11)) {
        return false;
    }
    // Disallow odd numbered saturdays.
    if ((date.getDayOfWeek() == DayOfWeek.SATURDAY) && ((date.getDayOfMonth() % 2) == 1)) {
        return false;
    }
    // Allow all other days.
    return true;
}
 
Example 12
Source File: OnDayOfMonthValueGenerator.java    From cron-utils with Apache License 2.0 5 votes vote down vote up
private int generateValue(final On on, final int year, final int month) throws NoSuchValueException {
    final int dayOfMonth = on.getTime().getValue();
    switch (on.getSpecialChar().getValue()) {
        case L:
            final int daysBefore = on.getNth().getValue();
            return LocalDate.of(year, month, 1).lengthOfMonth() - (daysBefore > 0 ? daysBefore : 0);
        case W: // First work day of the week
            final LocalDate doM = LocalDate.of(year, month, dayOfMonth);
            if (doM.getDayOfWeek() == DayOfWeek.SATURDAY) { //dayOfWeek is Saturday!
                if (dayOfMonth == 1) { //first day in month is Saturday! We execute on Monday
                    return 3;
                }
                return dayOfMonth - 1;
            }
            if (doM.getDayOfWeek() == DayOfWeek.SUNDAY && (dayOfMonth + 1) <= doM.lengthOfMonth()) {
                return dayOfMonth + 1;
            }
            return dayOfMonth;  // first day of week is a weekday
        case LW:
            final LocalDate lastDayOfMonth = LocalDate.of(year, month, LocalDate.of(year, month, 1).lengthOfMonth());
            final int dow = lastDayOfMonth.getDayOfWeek().getValue();
            final int diff = dow - 5;
            if (diff > 0) {
                return lastDayOfMonth.minusDays(diff).getDayOfMonth();
            }
            return lastDayOfMonth.getDayOfMonth();
        default:
            throw new NoSuchValueException();
    }
}
 
Example 13
Source File: Adjusters.java    From jphp with Apache License 2.0 5 votes vote down vote up
private static TemporalAdjuster plusBusinessDays(long days) {
    return temporal -> {

        temporal = temporal.plus(getAllDays(temporal.get(DAY_OF_WEEK), days) * Long.signum(days), DAYS);
        DayOfWeek dayOfWeek = DayOfWeek.of(temporal.get(DAY_OF_WEEK));

        if (dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY) {
            temporal = temporal.with(TemporalAdjusters.next(DayOfWeek.MONDAY));
        }

        return temporal;
    };
}
 
Example 14
Source File: MarketDayUtil.java    From java-trader with Apache License 2.0 5 votes vote down vote up
private static LocalDate nextWorkingDay(LocalDate tradingDay, boolean nextOrPrev) {
    while(true){
        tradingDay = tradingDay.plusDays(nextOrPrev?1:-1);
        DayOfWeek dayOfWeek = tradingDay.getDayOfWeek();
        if ( dayOfWeek == DayOfWeek.SUNDAY || dayOfWeek==DayOfWeek.SATURDAY) {
            continue;
        }
        break;
    }
    return tradingDay;
}
 
Example 15
Source File: TimeSection.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public TimeSection(final LocalTime START, final LocalTime STOP, final String TEXT, final Color COLOR, final Color TEXT_COLOR) {
    this(START, STOP, TEXT, null, COLOR, COLOR, TEXT_COLOR, false, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY);
}
 
Example 16
Source File: HistoricalTesterImpl.java    From FX-AlgorithmTrading with MIT License 4 votes vote down vote up
@Override
public void startReplay() {
    // connectorセットアップ
    historicalConnector.setupForReplay(symbolSet);
    timerChecker.resetTimer(LocalDateTime.of(startDate, LocalTime.MIN));

    // (日~土) 単位になるようにデータロード実行(最初のみincrementDays+α)
    LocalDate nextStartDate = startDate;
    LocalDate nextEndDate = nextStartDate.plusDays(incrementDays - 1);
    while (nextEndDate.getDayOfWeek() != DayOfWeek.SATURDAY) {
        nextEndDate = nextEndDate.plusDays(1);
    }
    if (nextEndDate.isAfter(endDate)) {
        nextEndDate = endDate;
    }

    // 初期データロード
    if (loadInitial) {
        loadInitialData();
    }

    while (true) {
        // データロード
        logger.info("Data Load : {}-{}", nextStartDate.toString(), nextEndDate.toString());
        List<MarketData> marketDataList = null;
        if (byFunctionType == KdbByFunctionType.UNUSED || byCount <= 0) {
            marketDataList = historicalDao.findMarketData(nextStartDate, nextEndDate, symbolSet);
        } else {
            marketDataList = historicalDao.findMarketData(nextStartDate, nextEndDate, symbolSet, byCount, byFunctionType);
        }

        if (marketDataList.size() == 0) {
            logger.error("No Historical Data.");
        }

        // データ再生開始
        loadData(marketDataList);

        // Indicatorデータ削除
        if (indicatorDataHoldDays > 0) {
            logger.info("Reduce indicator data.");
            IndicatorDataHolder.reduceIndicatorData(indicatorDataHoldDays);
        }
        System.gc();

        // RT Disk書き込み
        if (writeDisk) {
            while (dbConnectionManager.checkdDataQueueSize() != 0 || dbConnectionManager.checkActiveThread() != 0) {
                SystemUtility.waitSleep(1000);
            }
            logger.info("Writing kdb to disk.");
            historicalDao.writeToDisk();
            SystemUtility.waitSleep(1000);
        }

        // 次の日付を設定
        nextStartDate = nextEndDate.plusDays(1);
        nextEndDate = nextEndDate.plusDays(incrementDays);
        // 次の開始日がEnd以降なら終了
        if (nextStartDate.isAfter(endDate)) {
            break;
        }
        // 次の終了日がEnd以降だったらEndを終了日に設定
        if (nextEndDate.isAfter(endDate)) {
            nextEndDate = endDate;
        }
    }

    // RT Finalize
    if (writeDisk) {
        logger.info("Finalize kdb to disk.");
        historicalDao.finalizeDisk();
    }

    // ロードが終わったら5秒waitしてシステムを強制終了
    SystemUtility.waitSleep(5000);

    logger.info("### FINISHED ###");
    System.exit(0);
}
 
Example 17
Source File: TimeSection.java    From OEE-Designer with MIT License 4 votes vote down vote up
public TimeSection(final LocalTime START, final LocalTime STOP, final Color COLOR, final Color HIGHLIGHT_COLOR) {
    this(START, STOP, "", null, COLOR, HIGHLIGHT_COLOR, Color.TRANSPARENT, false, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY);
}
 
Example 18
Source File: TimeSection.java    From OEE-Designer with MIT License 4 votes vote down vote up
public TimeSection(final LocalTime START, final LocalTime STOP, final Color COLOR) {
    this(START, STOP, "", null, COLOR, COLOR, Color.TRANSPARENT, false, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY);
}
 
Example 19
Source File: TimeSection.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
public TimeSection(final LocalTime START, final LocalTime STOP, final Color COLOR, final Color HIGHLIGHT_COLOR) {
    this(START, STOP, "", null, COLOR, HIGHLIGHT_COLOR, Color.TRANSPARENT, false, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY);
}
 
Example 20
Source File: TimeSection.java    From tilesfx with Apache License 2.0 2 votes vote down vote up
/**
 * Represents an area of a given range, defined by a start and stop time.
 * This class is used for regions and areas in many clocks. It is possible
 * to check a time against the defined range and fire events in case the
 * value enters or leaves the defined region.
 */
public TimeSection() {
    this(LocalTime.now(), LocalTime.now(), "", null, Color.TRANSPARENT, Color.TRANSPARENT, Color.TRANSPARENT, false, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY);
}