• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java WeekdayNum类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.ical.values.WeekdayNum的典型用法代码示例。如果您正苦于以下问题:Java WeekdayNum类的具体用法?Java WeekdayNum怎么用?Java WeekdayNum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WeekdayNum类属于com.google.ical.values包,在下文中一共展示了WeekdayNum类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleWeeklyRepeatAfterComplete

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
private static long handleWeeklyRepeatAfterComplete(RRule rrule, DateTime original,
        boolean hasDueTime) {
    List<WeekdayNum> byDay = rrule.getByDay();
    long newDate = original.getMillis();
    newDate += DateUtilities.ONE_WEEK * (rrule.getInterval() - 1);
    DateTime date = new DateTime(newDate);

    Collections.sort(byDay, weekdayCompare);
    WeekdayNum next = findNextWeekday(byDay, date);

    do {
        date = date.plusDays(1);
    } while (date.getDayOfWeek() != next.wday.javaDayNum);

    long time = date.getMillis();
    if(hasDueTime) {
        return Task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME, time);
    } else {
        return Task.createDueDate(Task.URGENCY_SPECIFIC_DAY, time);
    }
}
 
开发者ID:andyCano,项目名称:TaskApp,代码行数:22,代码来源:RepeatTaskCompleteListener.java


示例2: isSelected

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
private boolean isSelected(Weekday day, List<WeekdayNum> days) {
    for (WeekdayNum num : days) {
        if (num.wday.equals(day)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:10,代码来源:RecurrenceViewSkin.java


示例3: testByDayGenerator

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
public void testByDayGenerator() throws Exception {
    WeekdayNum[] days = new WeekdayNum[]{
            new WeekdayNum(0, Weekday.SU), // every sunday
            new WeekdayNum(1, Weekday.MO), // first monday
            new WeekdayNum(5, Weekday.MO), // fifth monday
            new WeekdayNum(-2, Weekday.TU) // second to last tuesday
    };
    Generator g = Generators.byDayGenerator(
            days, false, IcalParseUtil.parseDateValue("20060101"));
    runGeneratorTests(
            g, new DTBuilder(2006, 1, 1), "day", "1, 2, 8, 15, 22, 24, 29, 30");
    runGeneratorTests(
            g, new DTBuilder(2006, 2, 1), "day", "5, 6, 12, 19, 21, 26");
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:15,代码来源:GeneratorsTest.java


示例4: monkeySeeWeekdayNumList

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
WeekdayNum[] monkeySeeWeekdayNumList(Frequency freq) {
    int numRange;
    switch (freq) {
        case WEEKLY:
            numRange = 0;
            break;
        case MONTHLY:
            numRange = 5;
            break;
        case YEARLY:
            numRange = 53;
            break;
        default:
            numRange = 0;
            break;
    }
    int n = 1 + (int) (Math.abs(rnd.nextGaussian() * 2));
    WeekdayNum[] wdays = new WeekdayNum[n];
    for (int i = n; --i >= 0; ) {
        int num = numRange != 0 && rnd.nextInt(10) < 2
                ? rnd.nextInt(numRange)
                : 0;
        Weekday wday = WDAYS[rnd.nextInt(7)];
        wdays[i] = new WeekdayNum(num, wday);
    }
    return wdays;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:28,代码来源:MonkeyKeyboardTest.java


示例5: findNextWeekday

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
private static WeekdayNum findNextWeekday(List<WeekdayNum> byDay, DateTime date) {
    WeekdayNum next = byDay.get(0);
    for (WeekdayNum weekday : byDay) {
        if (weekday.wday.javaDayNum > date.getDayOfWeek()) {
            return weekday;
        }
    }
    return next;
}
 
开发者ID:andyCano,项目名称:TaskApp,代码行数:10,代码来源:RepeatTaskCompleteListener.java


示例6: testAdvancedWeeklyFromDueDate

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
private void testAdvancedWeeklyFromDueDate(boolean completeBefore, String title) {
    RRule rrule = new RRule();
    rrule.setFreq(Frequency.WEEKLY);

    int interval = 1;
    rrule.setInterval(interval);
    List<WeekdayNum> weekdays = new ArrayList<>();
    weekdays.add(new WeekdayNum(0, Weekday.MO));
    weekdays.add(new WeekdayNum(0, Weekday.WE));
    rrule.setByDay(weekdays);
    testRepeating(completeBefore, false, rrule, Frequency.WEEKLY, title);
}
 
开发者ID:andyCano,项目名称:TaskApp,代码行数:13,代码来源:NewRepeatTests.java


示例7: testAdvancedWeeklyFromCompleteDate

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
private void testAdvancedWeeklyFromCompleteDate(boolean completeBefore, String title) {
    RRule rrule = new RRule();
    rrule.setFreq(Frequency.WEEKLY);

    int interval = 1;
    rrule.setInterval(interval);
    List<WeekdayNum> weekdays = new ArrayList<>();
    weekdays.add(new WeekdayNum(0, Weekday.MO));
    weekdays.add(new WeekdayNum(0, Weekday.WE));
    rrule.setByDay(weekdays);
    testRepeating(completeBefore, true, rrule, Frequency.WEEKLY, title);
}
 
开发者ID:andyCano,项目名称:TaskApp,代码行数:13,代码来源:NewRepeatTests.java


示例8: setDays

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
public void setDays(boolean[] days) {
    List<WeekdayNum> byDay = new ArrayList<>();
    if (days != null) {
        for (int i = 0; i < days.length; i++) {
            if (days[i]) {
                byDay.add(new WeekdayNum(0, WEEK_DAYS[i]));
            }
        }
    }
    rrule.setByDay(byDay);
    // invalidate cached value
    this.days = null;
}
 
开发者ID:citiususc,项目名称:calendula,代码行数:14,代码来源:RepetitionRule.java


示例9: getDays

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
public boolean[] getDays() {
    if (this.days == null) {
        this.days = new boolean[7];
        for (WeekdayNum w : rrule.getByDay()) {
            this.days[JAVA_DAY_INDEXES[w.wday.javaDayNum]] = true;
        }
    }
    return this.days;
}
 
开发者ID:citiususc,项目名称:calendula,代码行数:10,代码来源:RepetitionRule.java


示例10: updateView

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
private void updateView() {
    try {
        String rule = getSkinnable().getRecurrenceRule();
        if (rule == null) {
            return;
        }
        RRule rrule = new RRule(rule);
        switch (rrule.getFreq()) {
            case DAILY:
                frequencyBox.setValue(Frequency.DAILY);
                repeatCountGranularity.setText(Messages.getString("RecurrenceViewSkin.DAYS")); //$NON-NLS-1$
                break;
            case WEEKLY:
                frequencyBox.setValue(Frequency.WEEKLY);
                repeatCountGranularity.setText(Messages.getString("RecurrenceViewSkin.32")); //$NON-NLS-1$
                break;
            case MONTHLY:
                frequencyBox.setValue(Frequency.MONTHLY);
                repeatCountGranularity.setText(Messages.getString("RecurrenceViewSkin.MONTHS")); //$NON-NLS-1$
                break;
            case YEARLY:
                frequencyBox.setValue(Frequency.YEARLY);
                repeatCountGranularity.setText(Messages.getString("RecurrenceViewSkin.YEARS")); //$NON-NLS-1$
                break;
            case SECONDLY:
            case HOURLY:
            case MINUTELY:
                throw new IllegalArgumentException(
                        "unsupported frequency: " + rrule.getFreq()); //$NON-NLS-1$
            default:
                throw new IllegalArgumentException(
                        "unknown frequency: " + rrule.getFreq()); //$NON-NLS-1$

        }

        DateValue until = rrule.getUntil();
        if (until != null) {
            endsOnButton.setSelected(true);
            endsOnDatePicker.setValue(
                    LocalDate.of(until.year(), until.month(), until.day()));
        } else if (rrule.getCount() > 0) {
            endsAfterButton.setSelected(true);
        } else {
            endsNeverButton.setSelected(true);
        }

        if (rrule.getByMonthDay().length > 0) {
            repeatByDayOfTheMonth.setSelected(true);
        } else {
            repeatByDayOfTheWeek.setSelected(true);
        }

        repeatCountSpinnerValueFactory.setValue(rrule.getInterval());
        endsAfterCounterSpinnerValueFactory.setValue(rrule.getCount());

        List<WeekdayNum> days = rrule.getByDay();

        weekDayMondayButton.setSelected(isSelected(Weekday.MO, days));
        weekDayTuesdayButton.setSelected(isSelected(Weekday.TU, days));
        weekDayWednesdayButton.setSelected(isSelected(Weekday.WE, days));
        weekDayThursdayButton.setSelected(isSelected(Weekday.TH, days));
        weekDayFridayButton.setSelected(isSelected(Weekday.FR, days));
        weekDaySaturdayButton.setSelected(isSelected(Weekday.SA, days));
        weekDaySundayButton.setSelected(isSelected(Weekday.SU, days));

        summary.setText(Util.convertRFC2445ToText(rule,
                getSkinnable().getStartDate()));
    } catch (ParseException e) {
        e.printStackTrace();
    }

    startOnDateLabel
            .setText(DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG)
                    .format(getSkinnable().getStartDate()));
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:76,代码来源:RecurrenceViewSkin.java


示例11: maybeAddWeekday

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
private void maybeAddWeekday(List<WeekdayNum> weekdays,
                             WeekdayNum weekdayNum, ToggleButton button) {
    if (button.isSelected()) {
        weekdays.add(weekdayNum);
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:7,代码来源:RecurrenceViewSkin.java


示例12: testInvertWeekdayNum

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
public void testInvertWeekdayNum() throws Exception {

        //        January 2006
        //  # Su Mo Tu We Th Fr Sa
        //  1  1  2  3  4  5  6  7
        //  2  8  9 10 11 12 13 14
        //  3 15 16 17 18 19 20 21
        //  4 22 23 24 25 26 27 28
        //  5 29 30 31

        // the 1st falls on a sunday, so dow0 == SU
        assertEquals(
                5,
                Util.invertWeekdayNum(new WeekdayNum(-1, Weekday.SU), Weekday.SU, 31));
        assertEquals(
                5,
                Util.invertWeekdayNum(new WeekdayNum(-1, Weekday.MO), Weekday.SU, 31));
        assertEquals(
                5,
                Util.invertWeekdayNum(new WeekdayNum(-1, Weekday.TU), Weekday.SU, 31));
        assertEquals(
                4,
                Util.invertWeekdayNum(new WeekdayNum(-1, Weekday.WE), Weekday.SU, 31));
        assertEquals(
                3,
                Util.invertWeekdayNum(new WeekdayNum(-2, Weekday.WE), Weekday.SU, 31));


        //      February 2006
        //  # Su Mo Tu We Th Fr Sa
        //  1           1  2  3  4
        //  2  5  6  7  8  9 10 11
        //  3 12 13 14 15 16 17 18
        //  4 19 20 21 22 23 24 25
        //  5 26 27 28

        assertEquals(
                4,
                Util.invertWeekdayNum(new WeekdayNum(-1, Weekday.SU), Weekday.WE, 28));
        assertEquals(
                4,
                Util.invertWeekdayNum(new WeekdayNum(-1, Weekday.MO), Weekday.WE, 28));
        assertEquals(
                4,
                Util.invertWeekdayNum(new WeekdayNum(-1, Weekday.TU), Weekday.WE, 28));
        assertEquals(
                4,
                Util.invertWeekdayNum(new WeekdayNum(-1, Weekday.WE), Weekday.WE, 28));
        assertEquals(
                3,
                Util.invertWeekdayNum(new WeekdayNum(-2, Weekday.WE), Weekday.WE, 28));
    }
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:53,代码来源:UtilTest.java


示例13: compare

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
@Override
public int compare(WeekdayNum object1, WeekdayNum object2) {
    return object1.wday.javaDayNum - object2.wday.javaDayNum;
}
 
开发者ID:andyCano,项目名称:TaskApp,代码行数:5,代码来源:RepeatTaskCompleteListener.java


示例14: getRecurrence

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
private String getRecurrence() {
    String result;
    if(!doRepeat) {
        result = ""; //$NON-NLS-1$
    } else {
        RRule rrule = new RRule();
        rrule.setInterval(repeatValue);
        switch(intervalValue) {
            case INTERVAL_DAYS:
                rrule.setFreq(Frequency.DAILY);
                break;
            case INTERVAL_WEEKS: {
                rrule.setFreq(Frequency.WEEKLY);

                ArrayList<WeekdayNum> days = new ArrayList<>();
                for (int i = 0 ; i < isChecked.length ; i++) {
                    if (isChecked[i]) {
                        days.add(new WeekdayNum(0, weekdays[i]));
                    }
                }
                rrule.setByDay(days);
                break;
            }
            case INTERVAL_MONTHS:
                rrule.setFreq(Frequency.MONTHLY);
                break;
            case INTERVAL_HOURS:
                rrule.setFreq(Frequency.HOURLY);
                break;
            case INTERVAL_MINUTES:
                rrule.setFreq(Frequency.MINUTELY);
                break;
            case INTERVAL_YEARS:
                rrule.setFreq(Frequency.YEARLY);
                break;
        }

        result = rrule.toIcal();
    }

    return result;
}
 
开发者ID:andyCano,项目名称:TaskApp,代码行数:43,代码来源:RepeatControlSet.java


示例15: setRRuleDays

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
private void setRRuleDays(RRule rrule, Weekday... weekdays) {
    ArrayList<WeekdayNum> days = new ArrayList<>();
    for(Weekday wd : weekdays)
        days.add(new WeekdayNum(0, wd));
    rrule.setByDay(days);
}
 
开发者ID:andyCano,项目名称:TaskApp,代码行数:7,代码来源:AdvancedRepeatTest.java


示例16: parseRecurrence

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
protected Recurrence parseRecurrence(String property, TimeZone tz) throws ParseException {
	RRule tmpRecRule = new RRule(property);

	Recurrence.Frequency freq = null;
	switch(tmpRecRule.getFreq()) {
		case DAILY:
			freq = Recurrence.Frequency.DAILY;
			break;
		case HOURLY:
			freq = Recurrence.Frequency.HOURLY;
			break;
		case MINUTELY:
			freq = Recurrence.Frequency.MINUTELY;
			break;
		case MONTHLY:
			freq = Recurrence.Frequency.MONTHLY;
			break;
		case SECONDLY:
			freq = Recurrence.Frequency.SECONDLY;
			break;
		case WEEKLY:
			freq = Recurrence.Frequency.WEEKLY;
			break;
		case YEARLY:
			freq = Recurrence.Frequency.YEARLY;
			break;
		default:
			//Fail quietly
	}

	List<Recurrence.DayOfWeek> dows = new ArrayList<Recurrence.DayOfWeek>();
	for (WeekdayNum wday: tmpRecRule.getByDay()) {
		switch(wday.wday) {
			case MO:
				dows.add(Recurrence.DayOfWeek.MONDAY);
				break;
			case TU:
				dows.add(Recurrence.DayOfWeek.TUESDAY);
				break;
			case WE:
				dows.add(Recurrence.DayOfWeek.WEDNESDAY);
				break;
			case TH:
				dows.add(Recurrence.DayOfWeek.THURSDAY);
				break;
			case FR:
				dows.add(Recurrence.DayOfWeek.FRIDAY);
				break;
			case SA:
				dows.add(Recurrence.DayOfWeek.SATURDAY);
				break;
			case SU:
				dows.add(Recurrence.DayOfWeek.SUNDAY);
				break;
			default:
				//Fail quietly
		}
	}

	Recurrence tmpRec = new Recurrence.Builder(freq)
			.interval(tmpRecRule.getInterval())
			.count(tmpRecRule.getCount())
			.until(dateValueToDate(tmpRecRule.getUntil()))
			.byDay(dows)
			.byHour(new ArrayList<Integer>(Arrays.asList(ArrayUtils.toObject(tmpRecRule.getByHour()))))
			.byMinute(new ArrayList<Integer>(Arrays.asList(ArrayUtils.toObject(tmpRecRule.getByMinute()))))
			.byMonth(new ArrayList<Integer>(Arrays.asList(ArrayUtils.toObject(tmpRecRule.getByMonth()))))
			.byMonthDay(new ArrayList<Integer>(Arrays.asList(ArrayUtils.toObject(tmpRecRule.getByMonthDay()))))
			.bySecond(new ArrayList<Integer>(Arrays.asList(ArrayUtils.toObject(tmpRecRule.getBySecond()))))
			.byWeekNo(new ArrayList<Integer>(Arrays.asList(ArrayUtils.toObject(tmpRecRule.getByWeekNo()))))
			.byYearDay(new ArrayList<Integer>(Arrays.asList(ArrayUtils.toObject(tmpRecRule.getByYearDay()))))
			.build();

	return tmpRec;
}
 
开发者ID:eXfio,项目名称:CucumberSync,代码行数:76,代码来源:LocalCalendar.java


示例17: invertWeekdayNum

import com.google.ical.values.WeekdayNum; //导入依赖的package包/类
/**
 * Compute an absolute week number given a relative one.
 * The day number -1SU refers to the last Sunday, so if there are 5 Sundays
 * in a period that starts on dow0 with nDays, then -1SU is 5SU.
 * Depending on where its used it may refer to the last Sunday of the year
 * or of the month.
 *
 * @param weekdayNum -1SU in the example above.
 * @param dow0 the day of the week of the first day of the week or month.
 *   One of the RRULE_WDAY_* constants.
 * @param nDays the number of days in the month or year.
 * @return an abolute week number, e.g. 5 in the example above.
 *   Valid if in [1,53].
 */
static int invertWeekdayNum(
        WeekdayNum weekdayNum, Weekday dow0, int nDays) {
    assert weekdayNum.num < 0;
    // how many are there of that week?
    return countInPeriod(weekdayNum.wday, dow0, nDays) + weekdayNum.num + 1;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:21,代码来源:Util.java



注:本文中的com.google.ical.values.WeekdayNum类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NamingException类代码示例发布时间:2022-05-22
下一篇:
Java RichFilterFunction类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap