Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 86   Methods: 9
NCLOC: 61   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
ComplexDerivation.java 57,1% 70,4% 66,7% 66%
 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.IRef;
 13   
 import org.jbind.xml.msg.IConstraintViolations;
 14   
 import org.jbind.xml.msg.XmlException;
 15   
 import org.jbind.xml.msg.XmlMessages;
 16   
 import org.jbind.xml.schema.instantiation.IElemValHelper;
 17   
 import org.jbind.xml.schema.instantiation.IJobRefs;
 18   
 
 19   
 public abstract class ComplexDerivation extends Derivation implements IComplexDerivation {
 20   
 
 21   
   private IModelGroup myModelGroup = null;
 22   
   private IModelGroupRef myModelGroupRef = null;
 23   
 
 24  165
   public ComplexDerivation(CreationParams aCreationParams) {
 25  165
     super(aCreationParams);
 26   
   }
 27   
 
 28   
 
 29  396
   public IElement doCreateChild(CreationParams aCreationParams) throws XmlException {
 30  396
     IElement res = null;
 31  396
     String componentName = NameUtil.getSchemaComponentName(aCreationParams);
 32  396
     if ("group".equals(componentName)) {
 33  14
       res = new ModelGroupRef(aCreationParams);
 34  382
     } else if ("all".equals(componentName)) {
 35  0
       res = new AllModelGroup(aCreationParams);
 36  382
     } else if ("choice".equals(componentName)) {
 37  8
       res = new ChoiceModelGroup(aCreationParams);
 38  374
     } else if ("sequence".equals(componentName)) {
 39  95
       res = new SequenceModelGroup(aCreationParams);
 40   
     } else {
 41  279
       res = super.doCreateChild(aCreationParams);
 42   
     }
 43  396
     return res;
 44   
   }
 45   
 
 46   
 
 47  165
   public IModelGroup getModelGroup() {
 48  165
     return myModelGroup;
 49   
   }
 50   
 
 51  165
   public IModelGroupRef getModelGroupRef() {
 52  165
     return myModelGroupRef;
 53   
   }
 54   
 
 55  0
   public ISimpleTypeDef getSimpleTypeDef() {
 56  0
     return null;
 57   
   }
 58   
 
 59  0
   public IRef getInlinedBaseAttribute() {
 60  0
     return null;
 61   
   }
 62   
 
 63  161
   public IRef getEffectiveBaseAttribute() {
 64  161
     return getBaseAttribute();
 65   
   }
 66   
 
 67  165
   public void validateElement(IElemValHelper aHelper, IConstraintViolations aViolations) {
 68  165
     super.validateElement(aHelper, aViolations);
 69  165
     myModelGroup = (IModelGroup)getSubElement(IModelGroup.class, "duplicate model group", aViolations);
 70  165
     myModelGroupRef = (IModelGroupRef)getSubElement(IModelGroupRef.class, "duplicate model group ref", aViolations);
 71  165
     if ((null != myModelGroup) && (null != myModelGroupRef)) {
 72  0
       aViolations.add(XmlMessages.referencedAndInlinedModelGroup(this));
 73   
     }
 74   
   }
 75   
 
 76  0
   public void collectRefsForCreation(IJobRefs aJobRefs) {
 77  0
     if (null != myModelGroupRef) {
 78  0
       myModelGroupRef.collectRefsForCreation(aJobRefs);
 79   
     }
 80  0
     if (null != myModelGroup) {
 81  0
       myModelGroup.collectRefsForCreation(aJobRefs);
 82   
     }
 83   
   }
 84   
 
 85   
 }
 86