Package com.google.ical.values

Examples of com.google.ical.values.TimeValue


    DTBuilder db = new DTBuilder(d);
    db.year += dur.year();
    db.month += dur.month();
    db.day += dur.day();
    if (dur instanceof TimeValue) {
      TimeValue tdur = (TimeValue) dur;
      db.hour += tdur.hour();
      db.minute += tdur.minute();
      db.second += tdur.second();
      return db.toDateTime();
    } else if (d instanceof TimeValue) {
      return db.toDateTime();
    }
    return db.toDate();
View Full Code Here


   */
  public static long secsSinceEpoch(DateValue date) {
    long result = fixedFromGregorian(date) *
                  SECS_PER_DAY;
    if (date instanceof TimeValue) {
      TimeValue time = (TimeValue) date;
      result +=
        time.second() +
        60 * (time.minute() +
              60 * time.hour());
    }
    return result;
  }
View Full Code Here

  public DTBuilder(DateValue dv) {
    this.year = dv.year();
    this.month = dv.month();
    this.day = dv.day();
    if (dv instanceof TimeValue) {
      TimeValue tv = (TimeValue) dv;
      this.hour = tv.hour();
      this.minute = tv.minute();
      this.second = tv.second();
    }
  }
View Full Code Here

    long dvComparable =
      (((((long) dv.year()) << 4) + dv.month()) << 5) + dv.day();
    long dtbComparable =
      ((((long) year << 4) + month << 5)) + day;
    if (dv instanceof TimeValue) {
      TimeValue tv = (TimeValue) dv;
      dvComparable = (((((dvComparable << 5) + tv.hour()) << 6) + tv.minute())
                      << 6) + tv.second();
      dtbComparable = (((((dtbComparable << 5) + hour) << 6) + minute)
                       << 6) + second;
    }
    long delta = dtbComparable - dvComparable;
    return delta < 0 ? -1 : delta == 0 ? 0 : 1;
View Full Code Here

  static Date dateValueToDate(DateValue dvUtc) {
    GregorianCalendar c = new GregorianCalendar(TimeUtils.utcTimezone());
    c.clear();
    if (dvUtc instanceof TimeValue) {
      TimeValue tvUtc = (TimeValue) dvUtc;
      c.set(dvUtc.year(),
            dvUtc.month() - 1// java.util's dates are zero-indexed
            dvUtc.day(),
            tvUtc.hour(),
            tvUtc.minute(),
            tvUtc.second());
    } else {
      c.set(dvUtc.year(),
            dvUtc.month() - 1// java.util's dates are zero-indexed
            dvUtc.day(),
            0,
View Full Code Here

    }
  }

  static DateTime dateValueToDateTime(DateValue dvUtc) {
    if (dvUtc instanceof TimeValue) {
      TimeValue tvUtc = (TimeValue) dvUtc;
      return new DateTime(
          dvUtc.year(),
          dvUtc.month()// java.util's dates are zero-indexed
          dvUtc.day(),
          tvUtc.hour(),
          tvUtc.minute(),
          tvUtc.second(),
          0,
          DateTimeZone.UTC);
    } else {
      return new DateTime(
          dvUtc.year(),
View Full Code Here

          DateValue d = candidates.get(i++);
          builder.year = d.year();
          builder.month = d.month();
          builder.day = d.day();
          if (d instanceof TimeValue) {
            TimeValue t = (TimeValue) d;
            builder.hour = t.hour();
            builder.minute = t.minute();
            builder.second = t.second();
          }
          return true;
        }
      };
  }
View Full Code Here

    }
    final int bitField = hoursByBit;
    return new Predicate<DateValue>() {
      public boolean apply(DateValue date) {
        if (!(date instanceof TimeValue)) { return false; }
        TimeValue tv = (TimeValue) date;
        return (bitField & (1 << tv.hour())) != 0;
      }
    };
  }
View Full Code Here

    }
    final long bitField = minutesByBit;
    return new Predicate<DateValue>() {
      public boolean apply(DateValue date) {
        if (!(date instanceof TimeValue)) { return false; }
        TimeValue tv = (TimeValue) date;
        return (bitField & (1L << tv.minute())) != 0;
      }
    };
  }
View Full Code Here

    }
    final long bitField = secondsByBit;
    return new Predicate<DateValue>() {
      public boolean apply(DateValue date) {
        if (!(date instanceof TimeValue)) { return false; }
        TimeValue tv = (TimeValue) date;
        return (bitField & (1L << tv.second())) != 0;
      }
    };
  }
View Full Code Here

TOP

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

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.