Package java.util

Examples of java.util.Date.compareTo()


          int bWeek = bCal.get(Calendar.DAY_OF_WEEK);
          weeks.add(begin);
          // 得到begin后第一个星期日
          Date firstSunday = new Date((begin.getTime() + 86400000l * (8 - (bWeek % 7))));

          while (firstSunday.compareTo(end) < 0) {
               weeks.add(firstSunday);
               firstSunday = new Date(firstSunday.getTime() + (86400000 * 7));
          }
          weeks.add(end);

View Full Code Here


      assertEquals(1, list.get(2).length);
      assertEquals(1, list.get(3).length);

      for (int i = 0; i < 4; i++) {
         Date d = (Date) list.get(i)[0];
         assertTrue(d.compareTo(DATE_FORMAT.parse("2013-01-31")) <= 0);
         assertTrue(d.compareTo(DATE_FORMAT.parse("2013-01-01")) >= 0);
      }
   }

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

      assertEquals(1, list.get(3).length);

      for (int i = 0; i < 4; i++) {
         Date d = (Date) list.get(i)[0];
         assertTrue(d.compareTo(DATE_FORMAT.parse("2013-01-31")) <= 0);
         assertTrue(d.compareTo(DATE_FORMAT.parse("2013-01-01")) >= 0);
      }
   }

   public void testSampleDomainQuery10() throws Exception {
      QueryFactory qf = Search.getSearchManager(cache).getQueryFactory();
View Full Code Here

      assertEquals(1, list.get(2).length);
      assertEquals(1, list.get(3).length);

      for (int i = 0; i < 4; i++) {
         Date d = (Date) list.get(i)[0];
         assertTrue(d.compareTo(DATE_FORMAT.parse("2013-01-31")) <= 0);
         assertTrue(d.compareTo(DATE_FORMAT.parse("2013-01-01")) >= 0);
      }
   }

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

      assertEquals(1, list.get(3).length);

      for (int i = 0; i < 4; i++) {
         Date d = (Date) list.get(i)[0];
         assertTrue(d.compareTo(DATE_FORMAT.parse("2013-01-31")) <= 0);
         assertTrue(d.compareTo(DATE_FORMAT.parse("2013-01-01")) >= 0);
      }
   }

   public void testSampleDomainQuery10() throws Exception {
      QueryFactory qf = Search.getSearchManager(cache2).getQueryFactory();
View Full Code Here

    public int compare(final JSONObject article1, final JSONObject article2) {
        try {
            final Date date1 = (Date) article1.get(Article.ARTICLE_CREATE_DATE);
            final Date date2 = (Date) article2.get(Article.ARTICLE_CREATE_DATE);

            return date2.compareTo(date1);
        } catch (final Exception e) {
            throw new IllegalStateException(e);
        }
    }
}
View Full Code Here

    public int compare(final JSONObject article1, final JSONObject article2) {
        try {
            final Date date1 = (Date) article1.get(Article.ARTICLE_UPDATE_DATE);
            final Date date2 = (Date) article2.get(Article.ARTICLE_UPDATE_DATE);

            return date2.compareTo(date1);
        } catch (final Exception e) {
            throw new IllegalStateException(e);
        }
    }
}
View Full Code Here

    public int compare(final JSONObject article1, final JSONObject article2) {
        try {
            final Date date1 = (Date) article1.get(Article.ARTICLE_CREATE_DATE);
            final Date date2 = (Date) article2.get(Article.ARTICLE_CREATE_DATE);

            return date2.compareTo(date1);
        } catch (final Exception e) {
            throw new IllegalStateException(e);
        }
    }
}
View Full Code Here

    public int compare(final JSONObject article1, final JSONObject article2) {
        try {
            final Date date1 = (Date) article1.get(Article.ARTICLE_UPDATE_DATE);
            final Date date2 = (Date) article2.get(Article.ARTICLE_UPDATE_DATE);

            return date2.compareTo(date1);
        } catch (final Exception e) {
            throw new IllegalStateException(e);
        }
    }
}
View Full Code Here

      if (startPublicationDate != null && endPublicationDate != null)
      {
         Date currentDate = new Date();

         //
         return currentDate.compareTo(startPublicationDate) >= 0 && currentDate.compareTo(endPublicationDate) <= 0;
      }
      else return startPublicationDate == null && endPublicationDate == null;
   }

   public void setShowPublicationDate(Boolean show)
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.