Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 68   Methods: 8
NCLOC: 48   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
AttrDecl.java 100% 100% 100% 100%
 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.schema.cmp;
 11   
 
 12   
 import org.jbind.xml.base.AttributeOccurence;
 13   
 import org.jbind.xml.core.cmp.IComponentVisitor;
 14   
 import org.jbind.xml.core.cmp.ISourceInfo;
 15   
 import org.jbind.xml.core.content.IAttrDecl;
 16   
 import org.jbind.xml.core.data.ISimpleData;
 17   
 import org.jbind.xml.core.type.IAnyType;
 18   
 import org.jbind.xml.instance.data.StringDataImpl;
 19   
 import org.jbind.xml.msg.IConstraintViolations;
 20   
 import org.jbind.xml.msg.XmlException;
 21   
 
 22   
 public class AttrDecl extends AttrRefOrDecl implements IAttrDecl {
 23   
 
 24   
   private IAnyType myType;
 25   
 
 26   
   private boolean myHasDefaultType = false;
 27   
 
 28  644
   public AttrDecl(ISourceInfo aSourceInfo, AttributeOccurence anOccurence, String aNamespace, String aName) {
 29  644
     super(aSourceInfo, aNamespace, aName, anOccurence);
 30   
   }
 31   
 
 32  1185
   public void accept(IComponentVisitor aVisitor) throws XmlException {
 33  1185
     aVisitor.visitAttrDeclStart(this);
 34  1185
     visitSubComponents(aVisitor);
 35  1185
     aVisitor.visitAttrDeclEnd(this);
 36   
   }
 37   
 
 38  102
   public void setHasDefaultType() {
 39  102
     myHasDefaultType = true;
 40   
   }
 41  105
   public boolean hasDefaultType() {
 42  105
     return myHasDefaultType;
 43   
   }
 44   
 
 45  16554
   public IAnyType getType() {
 46  16554
     return myType;
 47   
   }
 48  698
   public void setType(IAnyType aType) {
 49  698
     myType = aType;
 50   
   }
 51   
 
 52  749
   public boolean isReference() {
 53  749
     return false;
 54   
   }
 55   
 
 56  619
   public void addValueConstraints(String aDefault, String aFixed, IConstraintViolations aViolations) {
 57  619
     try {
 58  619
       myDefault = (null != aDefault) ? (ISimpleData)myType.createData(new StringDataImpl(aDefault, getPrefixToNamespaceMapping(), this)) : null;
 59  619
       myFixed = (null != aFixed) ? (ISimpleData)myType.createData(new StringDataImpl(aFixed, getPrefixToNamespaceMapping(), this)) : null;
 60  618
       if (null != myFixed) {
 61  32
         myDefault = myFixed;
 62   
       }
 63   
     } catch (XmlException e) {
 64  1
       aViolations.add(e.getXmlMessage());
 65   
     }
 66   
   }
 67   
 }
 68