net.fortuna.ical4j.model.Date.compareTo()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中net.fortuna.ical4j.model.Date.compareTo()方法的一些代码示例,展示了Date.compareTo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Date.compareTo()方法的具体详情如下:
包路径:net.fortuna.ical4j.model.Date
类名称:Date
方法名:compareTo

Date.compareTo介绍

暂无

代码示例

代码示例来源:origin: ical4j/ical4j

@Override
public int compareTo(DtStamp o) {
  return getDate().compareTo(o.getDate());
}

代码示例来源:origin: org.mnode.ical4j/ical4j

@Override
public int compareTo(DtStamp o) {
  return getDate().compareTo(o.getDate());
}

代码示例来源:origin: org.bedework/bw-ical4j-cl

/**
 * @param arg0 another observance instance
 * @return a positve value if this observance starts earlier than the other,
 * a negative value if it occurs later than the other, or zero if they start
 * at the same time
 */
public final int compareTo(final Observance arg0) {
  // TODO: sort by RDATE??
  final DtStart dtStart = (DtStart) getProperty(Property.DTSTART);
  final DtStart dtStart0 = (DtStart) arg0.getProperty(Property.DTSTART);
  return dtStart.getDate().compareTo(dtStart0.getDate());
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

private void checkDatesForComponent(Component component){
  if(component == null){
    return;
  }
  
  Property dtStart = component.getProperty(Property.DTSTART);
  Property dtEnd = component.getProperty(Property.DTEND);
  
  if( dtStart instanceof DtStart && dtStart.getValue()!= null 
    && dtEnd instanceof DtEnd && dtEnd.getValue() != null 
    && ((DtStart)dtStart).getDate().compareTo(((DtEnd)dtEnd).getDate()) > 0 ){
    throw new IllegalArgumentException("End date [" + dtEnd + " is lower than start date [" + dtStart + "]");
  }
  
}

代码示例来源:origin: 1and1/cosmo

private void checkDatesForComponent(Component component){
  if(component == null){
    return;
  }
  
  Property dtStart = component.getProperty(Property.DTSTART);
  Property dtEnd = component.getProperty(Property.DTEND);
  
  if( dtStart instanceof DtStart && dtStart.getValue()!= null 
    && dtEnd instanceof DtEnd && dtEnd.getValue() != null 
    && ((DtStart)dtStart).getDate().compareTo(((DtEnd)dtEnd).getDate()) > 0 ){
    throw new IllegalArgumentException("End date [" + dtEnd + " is lower than start date [" + dtStart + "]");
  }
  
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

/**
 * Compare Date instances using a timezone to pin floating Date and 
 * DateTimes.
 * @param date1 The date.
 * @param date2 The date.
 * @param tz timezone to use when interpreting floating Date and DateTime
 * @return The result.
 */
public static int compareDates(Date date1, Date date2, TimeZone tz) {
    if(tz!=null) {
    if(isFloating(date1)) {
      date1 = pinFloatingTime(date1, tz);
    }
    if(isFloating(date2)) {
      date2 = pinFloatingTime(date2, tz);
    }
  }
  
  return date1.compareTo(date2);
}

代码示例来源:origin: 1and1/cosmo

/**
 * Compare Date instances using a timezone to pin floating Date and 
 * DateTimes.
 * @param date1 The date.
 * @param date2 The date.
 * @param tz timezone to use when interpreting floating Date and DateTime
 * @return The result.
 */
public static int compareDates(Date date1, Date date2, TimeZone tz) {
    if(tz!=null) {
    if(isFloating(date1)) {
      date1 = pinFloatingTime(date1, tz);
    }
    if(isFloating(date2)) {
      date2 = pinFloatingTime(date2, tz);
    }
  }
  
  return date1.compareTo(date2);
}

代码示例来源:origin: caldav4j/caldav4j

public int compare(Calendar o1, Calendar  o2) {
  VEvent e1 = ICalendarUtils.getFirstEvent(o1);
  VEvent e2 = ICalendarUtils.getFirstEvent(o2);
  return e1.getStartDate().getDate().compareTo(e2.getStartDate().getDate());
}

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

end =  instance.getEnd();
if (start.compareTo(freeBusyRange.getStart()) < 0) {
  start = (DateTime) org.unitedinternet.cosmo.calendar.util.Dates.getInstance(freeBusyRange
      .getStart(), start);
if (end.compareTo(freeBusyRange.getEnd()) > 0) {
  end = (DateTime) org.unitedinternet.cosmo.calendar.util.Dates.getInstance(freeBusyRange.getEnd(),
      end);

代码示例来源:origin: net.oneandone.cosmo/cosmo-core

boolean timeShift = dtstart.compareTo(riddt) != 0;
Dur offsetTime = timeShift ? new Dur(riddt, dtstart) : null;
Dur newDuration = timeShift ? new Dur(dtstart, dtend) : null;

代码示例来源:origin: 1and1/cosmo

end =  instance.getEnd();
if (start.compareTo(freeBusyRange.getStart()) < 0) {
  start = (DateTime) org.unitedinternet.cosmo.calendar.util.Dates.getInstance(freeBusyRange
      .getStart(), start);
if (end.compareTo(freeBusyRange.getEnd()) > 0) {
  end = (DateTime) org.unitedinternet.cosmo.calendar.util.Dates.getInstance(freeBusyRange.getEnd(),
      end);

代码示例来源:origin: 1and1/cosmo

boolean timeShift = dtstart.compareTo(riddt) != 0;
Dur offsetTime = timeShift ? new Dur(riddt, dtstart) : null;
Dur newDuration = timeShift ? new Dur(dtstart, dtend) : null;

相关文章