Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 71   Methods: 10
NCLOC: 47   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
DateData.java 0% 43,8% 60% 46,4%
 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 org.jbind.xml.core.data.CompareResult;
 13   
 import org.jbind.xml.core.data.IAnyTypeData;
 14   
 import org.jbind.xml.core.data.IDate;
 15   
 import org.jbind.xml.core.data.IDateData;
 16   
 import org.jbind.xml.core.data.IHasOrder;
 17   
 import org.jbind.xml.msg.IConstraintViolations;
 18   
 import org.jbind.xml.msg.XmlException;
 19   
 
 20   
 public class DateData extends AbstractDateOrTimeData implements IDateData {
 21   
 
 22   
   private IDate myValue = null;
 23   
 
 24  7
   public DateData() {}
 25   
 
 26  7
   protected void doAccept(String aString) throws XmlException {
 27  7
     super.doAccept(aString);
 28  7
     DateStruct s = acceptDate(aString);
 29  7
     myValue = new Date(s.sign, s.year, s.month, s.day, s.timeZone);
 30   
   }
 31   
 
 32  0
   public String getCanonicalForm_() {
 33  0
     return String.valueOf(myValue);
 34   
   }
 35   
 
 36  9
   public IDate getDate() {
 37  9
     return myValue;
 38   
   }
 39   
 
 40  0
   public void setDate(IDate aNewValue) throws XmlException {
 41  0
     IDate oldValue = myValue;
 42  0
     myValue = aNewValue;
 43  0
     IConstraintViolations violations = completeSimpleStorageAssignment_();
 44  0
     if (!violations.isEmpty()) {
 45  0
       myValue = oldValue;
 46  0
       throw new XmlException(violations);
 47   
     }
 48   
   }
 49   
 
 50  3
   public boolean simpleStorageValueEquals(IAnyTypeData aData) {
 51  3
     return (aData instanceof IDateData) && myValue.equals(((IDateData)aData).getDate());
 52   
   }
 53   
 
 54  6
   public int simpleStorageValueHashCode() {
 55  6
     return myValue.hashCode();
 56   
   }
 57   
 
 58  7
   public Object getSimpleStorageObject() {
 59  7
     return myValue;
 60   
   }
 61   
 
 62  0
   public void setSimpleStorageObject(Object aValue) {
 63  0
     myValue = (IDate)aValue;
 64   
   }
 65   
 
 66  0
   protected CompareResult doGetCompareResult(IHasOrder aData) {
 67  0
     return myValue.compareTo(((IDateData)aData).getDate());
 68   
   }
 69   
 
 70   
 }
 71