Package com.google.ical.values

Examples of com.google.ical.values.WeekdayNum


    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;
  }
View Full Code Here


    runGeneratorTests(g3, new DTBuilder(2004, 5, 1), "day", "");
  }

  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");
View Full Code Here

    //  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));
  }
View Full Code Here

          // iterate through days and resolve each [week, day of week] pair to a
          // day of the month
          IntSet udates = new IntSet();
          for (int j = 0; j < udays.length; ++j) {
            WeekdayNum day = udays[j];
            if (0 != day.num) {
              int date = Util.dayNumToDate(
                  dow0, nDays, day.num, day.wday, d0, nDaysInMonth);
              if (0 != date) { udates.add(date); }
            } else {
View Full Code Here

          // of it in the earlier discussion of the BYDAY rule.
          // Does it apply to yearly week numbers calculated for BYDAY rules in
          // a FREQ=YEARLY rule?

          for (int i = days.length; --i >= 0;) {
            WeekdayNum day = days[i];

            if (day.wday == dow) {
              int weekNo = day.num;
              if (0 == weekNo) { return true; }
View Full Code Here

TOP

Related Classes of com.google.ical.values.WeekdayNum

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.