Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 78   Methods: 11
NCLOC: 58   Classes: 1
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
TimeZone.java 50% 72,7% 90,9% 77,1%
 1   
 /*
 2   
  * JBind
 3   
  *
 4   
  * Copyright (c) by Stefan Wachter. All rights reserved.
 5   
  *
 6   
  * Usage, modification, and redistribution is subject to license terms that are
 7   
  * available at 'http://www.jbind.org'. The JBind license is like the
 8   
  * 'Apache Software License V 1.1'.
 9   
  */
 10   
 package org.jbind.xml.instance.data;
 11   
 
 12   
 import java.math.BigDecimal;
 13   
 
 14   
 import org.jbind.util.other.StrBuffer;
 15   
 import org.jbind.xml.core.data.ITimeZone;
 16   
 
 17   
 public class TimeZone implements ITimeZone {
 18   
 
 19   
   public static final ITimeZone UTC = new TimeZone(1, 0, 0);
 20   
 
 21   
   private int mySign;
 22   
   private int myHours;
 23   
   private int myMinutes;
 24   
 
 25  14
   public TimeZone(int aSign, int anHours, int aMinutes) {
 26   
     assert (aSign == 1) || (aSign == -1);
 27   
     assert anHours >= 0;
 28   
     assert aMinutes >= 0;
 29  14
     mySign = aSign;
 30  14
     myHours = anHours;
 31  14
     myMinutes = aMinutes;
 32   
   }
 33   
 
 34  15
   public int getSign() {
 35  15
     return mySign;
 36   
   }
 37  9
   public int getYears() {
 38  9
     return 0;
 39   
   }
 40  9
   public int getMonths() {
 41  9
     return 0;
 42   
   }
 43  9
   public int getDays() {
 44  9
     return 0;
 45   
   }
 46  34
   public int getHours() {
 47  34
     return myHours;
 48   
   }
 49  32
   public int getMinutes() {
 50  32
     return myMinutes;
 51   
   }
 52  13
   public int getSeconds() {
 53  13
     return 0;
 54   
   }
 55  13
   public BigDecimal getFraction() {
 56  13
     return null;
 57   
   }
 58   
 
 59  2
   public boolean equals(Object anObject) {
 60  2
     boolean res = anObject instanceof ITimeZone;
 61  2
     if (res) {
 62  2
       ITimeZone z = (ITimeZone)anObject;
 63  2
       res = (myMinutes == z.getMinutes()) && (myHours == z.getHours()) && ((mySign == z.getSign()) || ((myHours == 0) && (myMinutes == 0)));
 64   
     }
 65  2
     return res;
 66   
   }
 67   
 
 68  0
   public String toString() {
 69  0
     StrBuffer sb = new StrBuffer();
 70  0
     sb.append(((myHours == 0) && (myMinutes == 0)) ? '+' : (mySign < 0) ? '-' : '+');
 71  0
     TimeHelper.output(myHours, 2, sb);
 72  0
     sb.append(':');
 73  0
     TimeHelper.output(myMinutes, 2, sb);
 74  0
     return sb.toString();
 75   
   }
 76   
 
 77   
 }
 78