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
LongData.java 0% 25% 28,6% 24%
 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.ILongData;
 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 LongData extends AbstractLongData {
 19   
 
 20   
   private long myValue;
 21   
 
 22  5
   protected void doAccept(String aString) throws XmlException {
 23  5
     super.doAccept(aString);
 24  5
     try {
 25  5
       myValue = Long.parseLong(aString);
 26   
     } catch (NumberFormatException e) {
 27  0
       throw new XmlException(XmlMessages.simpleDataConversionException(aString, e, getImpl_()));
 28   
     }
 29   
   }
 30   
 
 31  1
   public long getLong() {
 32  1
     return myValue;
 33   
   }
 34   
 
 35  0
   public void setLong(long aNewValue) throws XmlException {
 36  0
     long oldValue = myValue;
 37  0
     myValue = aNewValue;
 38  0
     IConstraintViolations violations = completeSimpleStorageAssignment_();
 39  0
     if (!violations.isEmpty()) {
 40  0
       myValue = oldValue;
 41  0
       throw new XmlException(violations);
 42   
     }
 43   
   }
 44   
 
 45  0
   public int compareSubTypeData_(IDecimalData aData) {
 46  0
     long v = ((ILongData)aData).getLong();
 47  0
     return (myValue < v) ? -1 : ((myValue > v) ? 1 : 0);
 48   
   }
 49   
 
 50  0
   public String getCanonicalForm_() {
 51  0
     return String.valueOf(myValue);
 52   
   }
 53   
 
 54  0
   public Object getSimpleStorageObject() {
 55  0
     return new Long(myValue);
 56   
   }
 57   
 
 58  0
   public void setSimpleStorageObject(Object aValue) {
 59  0
     myValue = ((Long)aValue).longValue();
 60   
   }
 61   
 
 62   
 }
 63