Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 80   Methods: 7
NCLOC: 56   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
Derivation.java 70% 88% 100% 85,7%
 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.element;
 11   
 
 12   
 import org.jbind.xml.base.IAttribute;
 13   
 import org.jbind.xml.base.IRef;
 14   
 import org.jbind.xml.base.ISymbolspaces;
 15   
 import org.jbind.xml.msg.IConstraintViolations;
 16   
 import org.jbind.xml.msg.XmlException;
 17   
 import org.jbind.xml.msg.XmlMessages;
 18   
 import org.jbind.xml.schema.instantiation.IElemValHelper;
 19   
 
 20   
 public abstract class Derivation extends Annotated implements IDerivation {
 21   
 
 22   
   private IRef myBase = null;
 23   
 
 24   
   private IAttributeInfos myAttributeInfos = null;
 25   
 
 26  188
   public Derivation(CreationParams aCreationParams) {
 27  188
     super(aCreationParams);
 28  188
     myAttributeInfos = new AttributeInfos(this);
 29   
   }
 30   
 
 31   
 
 32  290
   protected IElement doCreateChild(CreationParams aCreationParams) throws XmlException {
 33  290
     IElement res = null;
 34  290
     String componentName = NameUtil.getSchemaComponentName(aCreationParams);
 35  290
     if ("attribute".equals(componentName)) {
 36  226
       res = new AttributeDeclaration(aCreationParams, true);
 37  64
     } else if ("attributeGroup".equals(componentName)) {
 38  14
       res = new AttributeGroupRef(aCreationParams);
 39  50
     } else if ("anyAttribute".equals(componentName)) {
 40  50
       res = new AnyAttribute(aCreationParams);
 41   
     } else {
 42  0
       res = super.doCreateChild(aCreationParams);
 43   
     }
 44  290
     return res;
 45   
   }
 46   
 
 47  188
   protected IAttribute doCreateAttribute(ACParams anACParams) throws XmlException {
 48  188
     IAttribute res = null;
 49  188
     String an = NameUtil.getSchemaAttributeName(anACParams);
 50  188
     if ("base".equals(an)) {
 51  188
       res = new RefAttribute(anACParams, ISymbolspaces.TYPE);
 52  188
       myBase = res.getRef();
 53   
     } else {
 54  0
       res = super.doCreateAttribute(anACParams);
 55   
     }
 56  188
     return res;
 57   
   }
 58   
 
 59  1244
   public IRef getBaseAttribute() {
 60  1244
     return myBase;
 61   
   }
 62   
 
 63  3
   public void setBaseAttribute(IRef aRef) {
 64  3
     myBase = aRef;
 65   
   }
 66   
 
 67  188
   public IAttributeInfos getAttributeInfos() {
 68  188
     return myAttributeInfos;
 69   
   }
 70   
 
 71   
 
 72   
 
 73  188
   public void validateElement(IElemValHelper aHelper, IConstraintViolations aViolations) {
 74  188
     super.validateElement(aHelper, aViolations);
 75  188
     if (null == myBase) {
 76  0
       aViolations.add(XmlMessages.missingAttribute("base", this));
 77   
     }
 78   
   }
 79   
 }
 80