Package java.util

Examples of java.util.Calendar.compareTo()


     //StringBuffer
     while(sCal.compareTo(eCal)<0){
      String sti=dateFormatter.format(sCal.getTime());
      sCal.add(Calendar.HOUR_OF_DAY, duration.intValue());
      String eti;
      if(sCal.compareTo(eCal)>0)
        eti=dateFormatter.format(eCal.getTime());
      else
          eti=dateFormatter.format(sCal.getTime());
      intervalsList.add(START_TIME+"="+sti);
      intervalsList.add(END_TIME+"="+eti);
View Full Code Here


   * @tests java.util.Calendar#compareTo(Calendar)
   */
  public void test_compareToLjava_util_Calendar_null() {
    Calendar cal = Calendar.getInstance();
    try {
      cal.compareTo(null);
      fail("should throw NullPointerException");
    } catch (NullPointerException e) {
      // expected
    }
  }
View Full Code Here

    private boolean isBetween (Date actual) {

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(actual);

        int minValue = calendar.compareTo(MIN_DATE_CALENDAR);
        int maxValue = calendar.compareTo(MAX_DATE_CALENDAR);

        boolean result = (0 <= minValue) && (maxValue <= 0);

        return result;
View Full Code Here

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(actual);

        int minValue = calendar.compareTo(MIN_DATE_CALENDAR);
        int maxValue = calendar.compareTo(MAX_DATE_CALENDAR);

        boolean result = (0 <= minValue) && (maxValue <= 0);

        return result;
    }
View Full Code Here

            Calendar start = Calendar.getInstance();
            start.setTime(iteration.getStartDate());
            Calendar end = Calendar.getInstance();
            end.setTime(iteration.getEndDate());

            if (end.compareTo(start) < 0) {

                errors.reject("iteration.incoherentDate");

            }
View Full Code Here

    public void expirePipelines() {
        Calendar now = GregorianCalendar.getInstance();
        HashSet<String> deleteKeys = new HashSet<String> ();
        for (String key : pipes.keySet()) {
            PipelineConfiguration pipeconfig = pipes.get(key);
            if (now.compareTo(pipeconfig.expires) > 0) {
                deleteKeys.add(key);
            }
        }
        for (String key : deleteKeys) {
            System.err.println("Expired: " + key);
View Full Code Here

            Calendar[] valueList = getKeyValues(keyName);
            boolean keyResult = false;

            // -> stop when we hit the first true key value (i.e., key values are 'OR'ed together)
            for (int i = 0; i < valueList.length && !keyResult; i++) {
                int difference = tod.compareTo(valueList[i]);

                switch (condition) {
                    case DateEquals:
                        if (0 == difference)
                            keyResult = true;
View Full Code Here

      boolean keyResult = false;     
     
      // -> stop when we hit the first true key value (i.e., key values are 'OR'ed together)
            for( int i=0; i < valueList.length && !keyResult; i++ )
            {
              int difference = tod.compareTo( valueList[i] );
             
              switch( condition ) {
            case DateEquals:  
               if (0 == difference) keyResult = true;
               break;
View Full Code Here

                    long lastModified = request.getDateHeader("If-Modified-Since");
                    Calendar last = Calendar.getInstance();
                    last.setTime(new Date(lastModified));
                    Calendar check = Calendar.getInstance();
                    check.add(Calendar.SECOND, -2 * new Long(cacheSeconds).intValue());
                    if (check.compareTo(last) < 0) {
                        response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                        return;
                    }
                } else {
                    Calendar check = Calendar.getInstance();
View Full Code Here

   * @tests java.util.Calendar#compareTo(Calendar)
   */
  public void test_compareToLjava_util_Calendar_null() {
    Calendar cal = Calendar.getInstance();
    try {
      cal.compareTo(null);
      fail("should throw NullPointerException");
    } catch (NullPointerException e) {
      // expected
    }
  }
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.