Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 84   Methods: 11
NCLOC: 59   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
LanguageData.java 16,7% 21,7% 18,2% 20%
 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.ILanguage;
 13   
 import org.jbind.xml.core.data.IAnyTypeData;
 14   
 import org.jbind.xml.core.data.ILanguageData;
 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 LanguageData extends AbstractSimpleData implements ILanguageData {
 20   
 
 21   
   private ILanguage myValue = null;
 22   
 
 23  0
   public String getCanonicalForm_() {
 24  0
     return String.valueOf(myValue);
 25   
   }
 26   
 
 27  0
   public int getLength() {
 28  0
     return String.valueOf(myValue).length();
 29   
   }
 30   
 
 31  0
   public Object getSimpleStorageObject() {
 32  0
     return myValue;
 33   
   }
 34   
 
 35  0
   protected void setSimpleStorageObject(Object anObject) {
 36  0
     myValue = (ILanguage)anObject;
 37   
   }
 38   
 
 39  2
   public void doAccept(String aString) throws XmlException {
 40  2
     super.doAccept(aString);
 41  2
     Language l = Language.createLanguage(aString);
 42  2
     if (null != l) {
 43  2
       myValue = l;
 44   
     } else {
 45  0
       throw new XmlException(XmlMessages.invalidLanguageSyntax(aString, getImpl_()));
 46   
     }
 47   
   }
 48   
 
 49  0
   public String getString() {
 50  0
     return String.valueOf(myValue);
 51   
   }
 52   
 
 53  0
   public void setString(String aValue) throws XmlException {
 54  0
     ILanguage l = Language.createLanguage(aValue);
 55  0
     if (null == l) {
 56  0
       throw new XmlException(XmlMessages.invalidLanguageSyntax(aValue, null));
 57   
     }
 58  0
     setLanguage(l);
 59   
   }
 60   
 
 61  2
   public ILanguage getLanguage() {
 62  2
     return myValue;
 63   
   }
 64   
 
 65  0
   public void setLanguage(ILanguage aNewValue) throws XmlException {
 66  0
     ILanguage oldValue = myValue;
 67  0
     myValue = aNewValue;
 68  0
     IConstraintViolations violations = completeSimpleStorageAssignment_();
 69  0
     if (!violations.isEmpty()) {
 70  0
       myValue = oldValue;
 71  0
       throw new XmlException(violations);
 72   
     }
 73   
   }
 74   
 
 75  0
   public boolean simpleStorageValueEquals(IAnyTypeData aData) {
 76  0
     return (aData instanceof ILanguageData) && myValue.equals(((ILanguageData)aData).getLanguage());
 77   
   }
 78   
 
 79  0
   public int simpleStorageValueHashCode() {
 80  0
     return myValue.hashCode();
 81   
   }
 82   
 
 83   
 }
 84