Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 63   Methods: 7
NCLOC: 42   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
IntData.java 100% 93,8% 85,7% 92%
 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.IDecimalData;
 13   
 import org.jbind.xml.core.data.IIntData;
 14   
 import org.jbind.xml.msg.IConstraintViolations;
 15   
 import org.jbind.xml.msg.XmlException;
 16   
 import org.jbind.xml.msg.XmlMessages;
 17   
 
 18   
 public class IntData extends AbstractIntData {
 19   
 
 20   
   private int myValue;
 21   
 
 22  139
   protected void doAccept(String aString) throws XmlException {
 23  139
     super.doAccept(aString);
 24  139
     try {
 25  139
       myValue = Integer.parseInt(aString);
 26   
     } catch (NumberFormatException e) {
 27  11
       throw new XmlException(XmlMessages.simpleDataConversionException(aString, e, getImpl_()));
 28   
     }
 29   
   }
 30   
 
 31  45
   public String getCanonicalForm_() {
 32  45
     return String.valueOf(myValue);
 33   
   }
 34   
 
 35  90
   public int getInt() {
 36  90
     return myValue;
 37   
   }
 38   
 
 39  6
   public void setInt(int aNewValue) throws XmlException {
 40  6
     int oldValue = myValue;
 41  6
     myValue = aNewValue;
 42  6
     IConstraintViolations violations = completeSimpleStorageAssignment_();
 43  6
     if (!violations.isEmpty()) {
 44  2
       myValue = oldValue;
 45  2
       throw new XmlException(violations);
 46   
     }
 47   
   }
 48   
 
 49  68
   public int compareSubTypeData_(IDecimalData aData) {
 50  68
     int v = ((IIntData)aData).getInt();
 51  68
     return (myValue < v) ? -1 : ((myValue > v) ? 1 : 0);
 52   
   }
 53   
 
 54  7
   public Object getSimpleStorageObject() {
 55  7
     return new Integer(myValue);
 56   
   }
 57   
 
 58  0
   public void setSimpleStorageObject(Object aValue) {
 59  0
     myValue = ((Integer)aValue).intValue();
 60   
   }
 61   
 
 62   
 }
 63