Coverage Report - org.openpermis.policy.predicate.CurrentTime
 
Classes in this File Line Coverage Branch Coverage Complexity
CurrentTime
75%
9/12
50%
3/6
1.833
 
 1  
 /*
 2  
  * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport
 3  
  *                     (http://www.vbs.admin.ch)
 4  
  * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch)
 5  
  * All rights reserved.
 6  
  *
 7  
  * Licensed under the Open Permis License which accompanies this distribution,
 8  
  * and is available at http://www.openpermis.org/BSDlicenceKent.txt
 9  
  */
 10  
 package org.openpermis.policy.predicate;
 11  
 
 12  
 import java.util.Map;
 13  
 
 14  
 import org.joda.time.DateTime;
 15  
 
 16  
 import org.openpermis.policy.TimeStamp;
 17  
 
 18  
 
 19  
 /**
 20  
  * An actual time value.
 21  
  * @since 0.1.0
 22  
  */
 23  3
 public class CurrentTime implements Value<DateTime> {
 24  
 
 25  
         //---- Constructors
 26  
         
 27  
         /**
 28  
          * @since 0.1.0
 29  
          */
 30  
         public CurrentTime () {
 31  27
                 super();
 32  27
         }
 33  
         
 34  
         //---- Value
 35  
         
 36  
         /**
 37  
          * @since 0.1.0
 38  
          */
 39  
         public Class<?> getType () {
 40  87
                 return DateTime.class;
 41  
         }
 42  
         
 43  
         /**
 44  
          * @since 0.1.0
 45  
          */
 46  
         public DateTime valueOf (TimeStamp timeStamp, Map<String, ?> arguments) {
 47  3
                 return new DateTime(timeStamp.getDate());
 48  
         }
 49  
         
 50  
         /**
 51  
          * @since 0.3.0
 52  
          */
 53  
         public boolean isMatchable (Map<String, Class<?>> arguments) {
 54  1
                 return true;
 55  
         }
 56  
         
 57  
         //---- Object
 58  
         
 59  
         /**
 60  
          * @since 0.1.0
 61  
          */
 62  
         @Override
 63  
         public final boolean equals (Object obj) {
 64  4
                 if (obj == null) {
 65  0
                         return false;
 66  
                 }
 67  4
                 if (obj == this || obj instanceof CurrentTime) {
 68  4
                         return true;
 69  
                 }
 70  0
                 return false;
 71  
         }
 72  
 
 73  
         /**
 74  
          * @since 0.1.0
 75  
          */
 76  
         @Override
 77  
         public int hashCode () {
 78  0
                 return CurrentTime.class.hashCode();
 79  
         }
 80  
         
 81  
 }