Package java.util

Examples of java.util.Date.compareTo()


        /* Feed was visited Two Weeks Ago */
        else if (date.compareTo(earlierThisWeek) >= 0)
          new EntityGroupItem(gEarlierThisWeek, news);

        /* Feed was visited Last Week */
        else if (date.compareTo(lastWeek) >= 0)
          new EntityGroupItem(gLastWeek, news);

        /* Feed was visited more than a Week ago */
        else
          new EntityGroupItem(gOlder, news);
View Full Code Here


    /* Compare with other News Item */
    if (o instanceof NewsNotificationItem) {
      Date date1 = fRecentNewsDate;
      Date date2 = ((NewsNotificationItem) o).fRecentNewsDate;

      return date2.compareTo(date1);
    }

    /* Otherwise sort to Bottom */
    return 1;
  }
View Full Code Here

    else if (fType == Type.SORT_BY_LAST_VISIT_DATE) {
      Date d1 = mark1.getLastVisitDate();
      Date d2 = mark2.getLastVisitDate();

      if (d1 != null && d2 != null)
        return d2.compareTo(d1);
      else if (d2 != null)
        return -1;
      else if (d1 != null)
        return 1;
    }
View Full Code Here

    else if (fType == Type.SORT_BY_LAST_VISIT_DATE) {
      Date d1 = mark1.getLastVisitDate();
      Date d2 = mark2.getLastVisitDate();

      if (d1 != null && d2 != null)
        return d2.compareTo(d1);
      else if (d2 != null)
        return -1;
      else if (d1 != null)
        return 1;
    }
View Full Code Here

      /* Compare by Date */
      Date date1 = fRecentNewsDate;
      Date date2 = ((NewsNotificationItem) o).fRecentNewsDate;

      int res = date2.compareTo(date1);
      return (res != 0) ? res : -1;
    }

    /* Otherwise sort to Bottom */
    return 1;
View Full Code Here

      Set<INews> sortedNews = new TreeSet<INews>(new Comparator<INews>() {
        public int compare(INews news1, INews news2) {
          Date date1 = DateUtils.getRecentDate(news1);
          Date date2 = DateUtils.getRecentDate(news2);

          int res = date2.compareTo(date1);
          if (res != 0)
            return res;

          return -1;
        }
View Full Code Here

      /* Default: Sort by Date */
      Date date1 = DateUtils.getRecentDate(news1.getNews());
      Date date2 = DateUtils.getRecentDate(news2.getNews());

      return date2.compareTo(date1);
    }

    void setAscending(boolean ascending) {
      fNewsComparator.setAscending(ascending);
    }
View Full Code Here

    }

    @Test
    public void lastsave() throws Exception {
        Date start = new Date(System.currentTimeMillis() / 1000);
        assertTrue(start.compareTo(redis.lastsave()) <= 0);
    }

    @Test
    public void save() throws Exception {
        assertEquals("OK", redis.save());
View Full Code Here

                Date curStartDate = higherItem.myStartDate;
                LineItem curItem = null;
                // System.err.println("unit count="+unitCount+"
                // startDate="+curStartDate);
                for (int i = 0; i < unitCount
                        && curStartDate.compareTo(higherItem.myEndDate) < 0; i++) {
                    Date nextEndDate = ((DateFrameable) header.myUnit)
                            .adjustRight(curStartDate);
                    LineItem newItem = createLineItem(curStartDate, nextEndDate);
                    if (curItem == null) {
                        header.myFirstItem = newItem;
View Full Code Here

    Date d1 = a.getPublishDate();
    Date d2 = b.getPublishDate();
    if(d1 == null) return 1;
    if(d2 == null) return -1;
   
    return d2.compareTo(d1);
  }
}
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.