Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 80   Methods: 10
NCLOC: 56   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
GYearData.java 25% 52,2% 40% 45,9%
 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.IGYear;
 15   
 import org.jbind.xml.core.data.IGYearData;
 16   
 import org.jbind.xml.core.data.IHasOrder;
 17   
 import org.jbind.xml.core.data.ITimeZone;
 18   
 import org.jbind.xml.msg.IConstraintViolations;
 19   
 import org.jbind.xml.msg.XmlException;
 20   
 
 21   
 public class GYearData extends AbstractDateOrTimeData implements IGYearData {
 22   
 
 23   
   private IGYear myValue = null;
 24   
 
 25  1
   public GYearData() {}
 26   
 
 27  1
   protected void doAccept(String aString) throws XmlException {
 28  1
     super.doAccept(aString);
 29  1
     int idx = 0;
 30  1
     int sign = 1;
 31  1
     if (aString.charAt(0) == '-') {
 32  1
       sign = -1;
 33  1
       idx++;
 34   
     }
 35  1
     int year = parseYear(aString, idx);
 36  1
     idx = advanceNumber(aString, idx);
 37  1
     ITimeZone timeZone = acceptTimeZone(aString, idx);
 38  1
     myValue = new GYear(sign, year, timeZone);
 39   
   }
 40   
 
 41  0
   public String getCanonicalForm_() {
 42  0
     return String.valueOf(myValue);
 43   
   }
 44   
 
 45  2
   public IGYear getGYear() {
 46  2
     return myValue;
 47   
   }
 48   
 
 49  0
   public void setGYear(IGYear aNewValue) throws XmlException {
 50  0
     IGYear oldValue = myValue;
 51  0
     myValue = aNewValue;
 52  0
     IConstraintViolations violations = completeSimpleStorageAssignment_();
 53  0
     if (!violations.isEmpty()) {
 54  0
       myValue = oldValue;
 55  0
       throw new XmlException(violations);
 56   
     }
 57   
   }
 58   
 
 59  0
   public boolean simpleStorageValueEquals(IAnyTypeData aData) {
 60  0
     return (aData instanceof IGYearData) && myValue.equals(((IGYearData)aData).getGYear());
 61   
   }
 62   
 
 63  0
   public int simpleStorageValueHashCode() {
 64  0
     return myValue.hashCode();
 65   
   }
 66   
 
 67  1
   public Object getSimpleStorageObject() {
 68  1
     return myValue;
 69   
   }
 70   
 
 71  0
   public void setSimpleStorageObject(Object aValue) {
 72  0
     myValue = (IGYear)aValue;
 73   
   }
 74   
 
 75  0
   protected CompareResult doGetCompareResult(IHasOrder aData) {
 76  0
     return myValue.compareTo(((IGYearData)aData).getGYear());
 77   
   }
 78   
 
 79   
 }
 80