Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 76   Methods: 9
NCLOC: 50   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
StringData.java 66,7% 89,5% 88,9% 85,3%
 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.base.WhiteSpaceProcessing;
 13   
 import org.jbind.xml.core.data.IAnyTypeData;
 14   
 import org.jbind.xml.core.data.IStringData;
 15   
 import org.jbind.xml.msg.IConstraintViolations;
 16   
 import org.jbind.xml.msg.XmlException;
 17   
 import org.jbind.xml.msg.XmlMessages;
 18   
 
 19   
 public class StringData extends AbstractSimpleData implements IStringData {
 20   
 
 21   
   /**
 22   
    * The normalized string.
 23   
    */
 24   
   private String myValue = null;
 25   
 
 26  515
   protected void doAccept(String aString) throws XmlException {
 27  515
     super.doAccept(aString);
 28  515
     myValue = aString;
 29   
   }
 30   
 
 31  140
   public int getLength() {
 32  140
     return myValue.length();
 33   
   }
 34   
 
 35  309
   public String getCanonicalForm_() {
 36  309
     return myValue;
 37   
   }
 38   
 
 39  94
   public boolean simpleStorageValueEquals(IAnyTypeData aData) {
 40  94
     return (aData instanceof IStringData) && myValue.equals(((IStringData)aData).getCanonicalForm_());
 41   
   }
 42   
 
 43  358
   public int simpleStorageValueHashCode() {
 44  358
     return myValue.hashCode();
 45   
   }
 46   
 
 47  28
   public String getString() {
 48  28
     return myValue;
 49   
   }
 50   
 
 51  6
   public void setString(String aNewValue) throws XmlException {
 52  6
     WhiteSpaceProcessing wsp = getType_().getConstraints().getWhiteSpaceProcessing();
 53  6
     if (null != wsp) {
 54  6
       if (!wsp.check(aNewValue)) {
 55  0
         throw new XmlException(XmlMessages.whiteSpaceProcessingNotSatisfied(aNewValue, null));
 56   
       }
 57   
     }
 58  6
     String oldValue = myValue;
 59  6
     myValue = aNewValue;
 60  6
     IConstraintViolations violations = completeSimpleStorageAssignment_();
 61  6
     if (!violations.isEmpty()) {
 62  1
       myValue = oldValue;
 63  1
       throw new XmlException(violations);
 64   
     }
 65   
   }
 66   
 
 67  6
   public Object getSimpleStorageObject() {
 68  6
     return myValue;
 69   
   }
 70   
 
 71  0
   public void setSimpleStorageObject(Object aValue) {
 72  0
     myValue = (String)aValue;
 73   
   }
 74   
 
 75   
 }
 76