Clover coverage report - brownies library - 1.0-beta-1
Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00
file stats: LOC: 69   Methods: 5
NCLOC: 37   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
DateRange.java 50% 62.5% 60% 58.6%
coverage coverage
 1   
 /*
 2   
  * Joey and its relative products are published under the terms
 3   
  * of the Apache Software License.
 4   
  */
 5   
 package org.asyrinx.brownie.core.util;
 6   
 
 7   
 import java.util.Date;
 8   
 
 9   
 import org.apache.commons.lang.ObjectUtils;
 10   
 
 11   
 /**
 12   
  * @author akima
 13   
  */
 14   
 public class DateRange {
 15   
 
 16   
     /**
 17   
      *  
 18   
      */
 19  10
     public DateRange(Date from, Date to) {
 20  10
         super();
 21  10
         this.from = from;
 22  10
         this.to = to;
 23   
     }
 24   
 
 25   
     private final Date from;
 26   
 
 27   
     private final Date to;
 28   
 
 29   
     /**
 30   
      * @param obj
 31   
      * @return @see java.lang.Object#equals(java.lang.Object)
 32   
      */
 33  4
     public boolean equals(Object obj) {
 34  4
         if (obj instanceof DateRange) {
 35  4
             final DateRange range = (DateRange) obj;
 36  4
             return ObjectUtils.equals(this.from, range.from)
 37   
                     && ObjectUtils.equals(this.to, range.to);
 38   
         } else {
 39  0
             return super.equals(obj);
 40   
         }
 41   
     }
 42   
 
 43  6
     public boolean include(Date when) {
 44  6
         if (from == null && to == null) {
 45  0
             return false;
 46  6
         } else if (from != null && to == null) {
 47  0
             return from.before(when);
 48  6
         } else if (from == null && to != null) {
 49  0
             return to.after(when);
 50   
         } else {
 51  6
             return from.before(when) && to.after(when);
 52   
         }
 53   
     }
 54   
 
 55   
     /**
 56   
      * @return
 57   
      */
 58  0
     public Date getFrom() {
 59  0
         return from;
 60   
     }
 61   
 
 62   
     /**
 63   
      * @return
 64   
      */
 65  0
     public Date getTo() {
 66  0
         return to;
 67   
     }
 68   
 
 69   
 }