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
ShortData.java 50% 68,8% 71,4% 68%
 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.IShortData;
 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 ShortData extends AbstractShortData {
 19   
 
 20   
   short myValue;
 21   
 
 22  3
   public short getShort() {
 23  3
     return myValue;
 24   
   }
 25   
 
 26  1
   public void setShort(short aNewValue) throws XmlException {
 27  1
     short oldValue = myValue;
 28  1
     myValue = aNewValue;
 29  1
     IConstraintViolations violations = completeSimpleStorageAssignment_();
 30  1
     if (!violations.isEmpty()) {
 31  0
       myValue = oldValue;
 32  0
       throw new XmlException(violations);
 33   
     }
 34   
   }
 35   
 
 36  3
   protected void doAccept(String aString) throws XmlException {
 37  3
     super.doAccept(aString);
 38  3
     try {
 39  3
       myValue = Short.parseShort(aString);
 40   
     } catch (NumberFormatException e) {
 41  0
       throw new XmlException(XmlMessages.simpleDataConversionException(aString, e, getImpl_()));
 42   
     }
 43   
   }
 44   
 
 45  1
   public int compareSubTypeData_(IDecimalData aData) {
 46  1
     short v = ((IShortData)aData).getShort();
 47  1
     return (myValue < v) ? -1 : ((myValue > v) ? 1 : 0);
 48   
   }
 49   
 
 50  0
   public String getCanonicalForm_() {
 51  0
     return String.valueOf(myValue);
 52   
   }
 53   
 
 54  2
   public Object getSimpleStorageObject() {
 55  2
     return new Short(myValue);
 56   
   }
 57   
 
 58  0
   public void setSimpleStorageObject(Object aValue) {
 59  0
     myValue = ((Short)aValue).shortValue();
 60   
   }
 61   
 
 62   
 }
 63