Package com.google.ical.values

Examples of com.google.ical.values.DateValue.compareTo()


    PeriodValue period = IcalParseUtil.parsePeriodValue(dateStr);
    DTBuilder b = new DTBuilder(period.start());
    StringBuilder out = new StringBuilder();
    while (true) {
      DateValue d = b.toDate();
      if (d.compareTo(period.end()) > 0) { break; }
      if (0 != out.length()) { out.append(','); }
      out.append(d);
      b.day += interval;
    }
    return out.toString();
View Full Code Here


    }
    // check cross genus failures
    for (int i = 0; i < 100; i++) {
      DateValue a = DATE_VALUES[rnd.nextInt(DATE_VALUES.length)],
                b = DATE_TIME_VALUES[rnd.nextInt(DATE_TIME_VALUES.length)];
      if (a.compareTo(b) > 0) {
        DateValue t = a;
        a = b;
        b = t;
      }
      try {
View Full Code Here

      for (int i = 0; i < 10000; ++i) {
        int a = rnd.nextInt(values.length),
            b = rnd.nextInt(values.length);
        DateValue dvA = values[a], dvB = values[b];
        assertEquals(a == b, dvA.equals(dvB));
        assertEquals(dvA.equals(dvB), 0 == dvA.compareTo(dvB));
      }
    }
  }

  public void testToString() throws Exception {
View Full Code Here

      return;
    }

    DateValue dateLocal = TimeUtils.fromUtc(dateUtc, tzid_);
    // Short-circuit if we're already past dateUtc.
    if (dateLocal.compareTo(this.builder_.toDate()) <= 0) { return; }
    this.pendingUtc_ = null;

    try {
      if (this.canShortcutAdvance_) {
        // skip years before date.year
View Full Code Here

        if (null == dUtc) {
          this.done_ = true;
        } else {
          if (!this.condition_.apply(dUtc)) {
            this.done_ = true;
          } else if (dUtc.compareTo(dateUtc) >= 0) {
            this.pendingUtc_ = dUtc;
            break;
          }
        }
      }
View Full Code Here

      do {
        if (!this.instanceGenerator_.generate(this.builder_)) { return null; }
        DateValue dUtc = this.dtStart_ instanceof TimeValue
            ? TimeUtils.toUtc(this.builder_.toDateTime(), this.tzid_)
            : this.builder_.toDate();
        if (dUtc.compareTo(this.lastUtc_) > 0) {
          return dUtc;
        }
      } while (true);
    } catch (Generator.IteratorShortCircuitingException ex) {
      return null;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.