org.sakaiproject.time.api.Time.compareTo()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(206)

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

Time.compareTo介绍

暂无

代码示例

代码示例来源:origin: sakaiproject/sakai

public int compare(Object o1, Object o2)
  {
    // if the same object
    if (o1 == o2) return 0;
    // assume they are Resource
    Entity r1 = (Entity) o1;
    Entity r2 = (Entity) o2;
    // get each one's date
    Time t1 = m_user.getDate(r1);
    Time t2 = m_user.getDate(r2);
    // compare based on date
    int compare = t2.compareTo(t1);
    return compare;
  }
});

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-storage-util

public int compare(Object o1, Object o2)
  {
    // if the same object
    if (o1 == o2) return 0;
    // assume they are Resource
    Entity r1 = (Entity) o1;
    Entity r2 = (Entity) o2;
    // get each one's date
    Time t1 = m_user.getDate(r1);
    Time t2 = m_user.getDate(r2);
    // compare based on date
    int compare = t2.compareTo(t1);
    return compare;
  }
});

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

public void setRetractDate(Time time)
{
  if(time == null)
  {
    if(m_retractDate != null) {
      this.m_visibilityUpdated = true;
    }
    m_retractDate = null;
  }
  else
  {
    if(m_retractDate == null || m_retractDate.compareTo(time) != 0) {
      this.m_visibilityUpdated = true;
    }
    m_retractDate = timeService.newTime(time.getTime());
  }
  m_hidden = false;
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

public void setReleaseDate(Time time)
{
  if(time == null)
  {
    if(m_releaseDate != null) {
      this.m_visibilityUpdated = true;
    }
    m_releaseDate = null;
  }
  else
  {
    if(m_releaseDate == null || m_releaseDate.compareTo(time) != 0) {
      this.m_visibilityUpdated = true;
    }
    m_releaseDate = timeService.newTime(time.getTime());
  }
  m_hidden = false;
}

代码示例来源:origin: sakaiproject/sakai

public int compare(Alias o1, Alias o2)
{
  // Sort by date, then by ID to assure consistent order.
  return o1.getCreatedTime().compareTo(o2.getCreatedTime()) * 10 +
    o1.getId().compareTo(o2.getId());
}

代码示例来源:origin: org.sakaiproject.portal/sakai-portal-impl

public int compare(Alias o1, Alias o2)
{
  // Sort by date, then by ID to assure consistent order.
  return o1.getCreatedTime().compareTo(o2.getCreatedTime()) * 10 +
    o1.getId().compareTo(o2.getId());
}

代码示例来源:origin: sakaiproject/sakai

/**
 * Compare this object with the specified object for order.
 * 
 * @return A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
 */
public int compareTo(Object obj)
{
  if (!(obj instanceof Message)) throw new ClassCastException();
  // if the object are the same, say so
  if (obj == this) return 0;
  // compare the header's date
  int compare = getHeader().getDate().compareTo(((Message) obj).getHeader().getDate());
  return compare;
} // compareTo

代码示例来源:origin: org.sakaiproject.message/sakai-message-util

/**
 * Compare this object with the specified object for order.
 * 
 * @return A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
 */
public int compareTo(Object obj)
{
  if (!(obj instanceof Message)) throw new ClassCastException();
  // if the object are the same, say so
  if (obj == this) return 0;
  // compare the header's date
  int compare = getHeader().getDate().compareTo(((Message) obj).getHeader().getDate());
  return compare;
} // compareTo

代码示例来源:origin: org.sakaiproject.message/sakai-message-impl

/**
 * Compare this object with the specified object for order.
 * 
 * @return A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
 */
public int compareTo(Object obj)
{
  if (!(obj instanceof Message)) throw new ClassCastException();
  // if the object are the same, say so
  if (obj == this) return 0;
  // compare the header's date
  int compare = getHeader().getDate().compareTo(((Message) obj).getHeader().getDate());
  return compare;
} // compareTo

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

} else if(releaseDate != null && m_releaseDate == null) {
  this.m_visibilityUpdated = true;
} else if(m_releaseDate != null && releaseDate != null && m_releaseDate.compareTo(releaseDate) != 0) {
  this.m_visibilityUpdated = true;
} else if(retractDate == null && m_retractDate != null) {
} else if(retractDate != null && m_retractDate == null) {
  this.m_visibilityUpdated = true;
} else if(m_retractDate != null && retractDate != null && m_retractDate.compareTo(retractDate) != 0) {
  this.m_visibilityUpdated = true;

代码示例来源:origin: org.sakaiproject/sakai-podcasts-impl

if (t2 == null)  t2 = ((ContentResource) o2).getProperties().getTimeProperty(m_property);
rv = t1.compareTo(t2);

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

int rv = t1.compareTo(t2);
if (!m_ascending) rv = -rv;
return rv;

相关文章