Package com.google.ical.values

Examples of com.google.ical.values.DateValueImpl


    super.tearDown();
  }

  public void testCountCondition() throws Exception {
    Predicate<DateValue> cc = Conditions.countCondition(3);
    assertTrue(cc.apply(new DateValueImpl(2006, 2, 1)));
    assertTrue(cc.apply(new DateValueImpl(2006, 2, 2)));
    assertTrue(cc.apply(new DateValueImpl(2006, 2, 3)));
    assertTrue(!cc.apply(new DateValueImpl(2006, 2, 4)));
  }
View Full Code Here


    Util.rollToNextWeekStart(builder, Weekday.MO);
    assertEquals("20060206", builder.toDate().toString());
  }

  public void testNextWeekStart() throws Exception {
    assertEquals(new DateValueImpl(2006, 1, 24),
                 Util.nextWeekStart(new DateValueImpl(2006, 1, 23),
                                    Weekday.TU));

    assertEquals(new DateValueImpl(2006, 1, 24),
                 Util.nextWeekStart(new DateValueImpl(2006, 1, 24),
                                    Weekday.TU));

    assertEquals(new DateValueImpl(2006, 1, 31),
                 Util.nextWeekStart(new DateValueImpl(2006, 1, 25),
                                    Weekday.TU));

    assertEquals(new DateValueImpl(2006, 1, 23),
                 Util.nextWeekStart(new DateValueImpl(2006, 1, 23),
                                    Weekday.MO));

    assertEquals(new DateValueImpl(2006, 1, 30),
                 Util.nextWeekStart(new DateValueImpl(2006, 1, 24),
                                    Weekday.MO));

    assertEquals(new DateValueImpl(2006, 1, 30),
                 Util.nextWeekStart(new DateValueImpl(2006, 1, 25),
                                    Weekday.MO));

    assertEquals(new DateValueImpl(2006, 2, 6),
                 Util.nextWeekStart(new DateValueImpl(2006, 1, 31),
                                    Weekday.MO));
  }
View Full Code Here

    RDateList rd1 = new RDateList("RDATE:20060412", PST);
    RDateList rd2 = new RDateList("RDATE:20060412T120000", PST);
    RDateList rd3 =
      new RDateList("RDATE:20060412T120000,20060413T153000Z", PST);
    assertEquals(1, rd1.getDatesUtc().length);
    assertEquals(new DateValueImpl(2006, 4, 12), rd1.getDatesUtc()[0]);
    assertEquals(1, rd2.getDatesUtc().length);
    assertEquals(new DateTimeValueImpl(2006, 4, 12, 19, 0, 0),
                 rd2.getDatesUtc()[0]);
    assertEquals(2, rd3.getDatesUtc().length);
    assertEquals(new DateTimeValueImpl(2006, 4, 12, 19, 0, 0),
View Full Code Here

  public void testComparisonSameAsDateValueImpl() throws Exception {
    // It's more important for DateValueComparison to be a total ordering
    // (see the class comments) than it be consistent with DateValue.
    DateValue[] inOrder = {
      new DateValueImpl(2006, 4, 11),
      new DateTimeValueImpl(2006, 4, 11, 0, 0, 0),
      new DateTimeValueImpl(2006, 4, 11, 0, 0, 1),
      new DateTimeValueImpl(2006, 4, 11, 12, 30, 15),
      new DateTimeValueImpl(2006, 4, 11, 23, 59, 59),
      new DateValueImpl(2006, 4, 12),
      new DateValueImpl(2006, 4, 13),
      new DateTimeValueImpl(2006, 4, 14, 12, 0, 0),
      new DateTimeValueImpl(2006, 4, 14, 15, 0, 0),
    };

    for (int i = 1; i < inOrder.length; ++i) {
View Full Code Here

            if (interval != 1) {
              // Calculate the number of days between the first of the new
              // month andthe old date and extend it to make it an integer
              // multiple of interval
              int daysBetween = TimeUtils.daysBetween(
                  new DateValueImpl(builder.year, builder.month, 1),
                  new DateValueImpl(year, month, date));
              ndate = ((interval - (daysBetween % interval)) % interval) + 1;
              if (ndate > nDays) {
                // need to early out without updating year or month so that the
                // next time we enter, with a different month, the daysBetween
                // call above compares against the proper last date
View Full Code Here

      // < dtStart.
      switch (freq) {
        case YEARLY:
          start = dtStart instanceof TimeValue
              ? new DateTimeValueImpl(start.year(), 1, 1, 0, 0, 0)
              : new DateValueImpl(start.year(), 1, 1);
          break;
        case MONTHLY:
          start = dtStart instanceof TimeValue
              ? new DateTimeValueImpl(start.year(), start.month(), 1, 0, 0, 0)
              : new DateValueImpl(start.year(), start.month(), 1);
          break;
        case WEEKLY:
          int d = (7 + wkst.ordinal() - Weekday.valueOf(dtStart).ordinal()) % 7;
          start = TimeUtils.add(dtStart, new DateValueImpl(0, 0, -d));
          break;
        default: break;
      }
    }
View Full Code Here

                 new DTBuilder(2006, 1, 2).hashCode());
    assertEquals(new DTBuilder(0, 0, 0), new DTBuilder(0, 0, 0, 0, 0, 0));
  }

  public void testToDate() throws Exception {
    assertEquals(new DateValueImpl(2006, 1, 2),
                 new DTBuilder(2006, 1, 2).toDate());
    assertEquals(new DateValueImpl(2006, 1, 2),
                 new DTBuilder(2006, 1, 2, 12, 30, 45).toDate());
    // test normalization
    assertEquals(new DateValueImpl(2006, 1, 2),
                 new DTBuilder(2005, 12, 33).toDate());
  }
View Full Code Here

                 new DTBuilder(2005, 12, 31, 60, 0, 0).toDateTime());
  }

  public void testCompareTo() throws Exception {
    assertTrue(
        new DTBuilder(2005, 6, 15).compareTo(new DateValueImpl(2005, 6, 15))
        == 0);
    assertTrue(
        new DTBuilder(2005, 6, 15).compareTo(new DateValueImpl(2006, 6, 15))
        < 0);
    assertTrue(
        new DTBuilder(2005, 6, 15).compareTo(new DateValueImpl(2005, 7, 15))
        < 0);
    assertTrue(
        new DTBuilder(2005, 6, 15).compareTo(new DateValueImpl(2005, 6, 16))
        < 0);
    assertTrue(
        new DTBuilder(2006, 6, 15).compareTo(new DateValueImpl(2005, 6, 15))
        > 0);
    assertTrue(
        new DTBuilder(2005, 7, 15).compareTo(new DateValueImpl(2005, 6, 15))
        > 0);
    assertTrue(
        new DTBuilder(2005, 6, 16).compareTo(new DateValueImpl(2005, 6, 15))
        > 0);
    assertTrue(
        new DTBuilder(2005, 6, 15, 12, 0, 0).compareTo(
            new DateTimeValueImpl(2005, 6, 15, 12, 0, 0))
        == 0);
View Full Code Here

TOP

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

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.