Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 77   Methods: 5
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
WildcardUseState.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.instance.use;
 11   
 
 12   
 import org.jbind.xml.base.IHasLocation;
 13   
 import org.jbind.xml.base.ISymbolspaces;
 14   
 import org.jbind.xml.base.ProcessContentsType;
 15   
 import org.jbind.xml.base.Ref;
 16   
 import org.jbind.xml.core.cmp.IWildcard;
 17   
 import org.jbind.xml.core.content.IElemDecl;
 18   
 import org.jbind.xml.core.content.IElemDesc;
 19   
 import org.jbind.xml.core.content.IElemRefOrDecl;
 20   
 import org.jbind.xml.core.content.IElemUseState;
 21   
 import org.jbind.xml.core.content.IElemWildcard;
 22   
 import org.jbind.xml.core.content.IUseState;
 23   
 import org.jbind.xml.core.type.IAnyType;
 24   
 import org.jbind.xml.msg.XmlException;
 25   
 import org.jbind.xml.msg.XmlMessages;
 26   
 import org.jbind.xml.schema.cmp.Schemas;
 27   
 
 28   
 public class WildcardUseState extends ElemUseState implements IWildcardUseState {
 29   
 
 30   
   private IWildcard myWildcard = null;
 31   
 
 32   
   private IElemDesc myCurrentDataDecl = null;
 33   
   private IElemRefOrDecl myMatchedElemRefOrDecl = null;
 34   
 
 35  415
   public WildcardUseState(IElemWildcard aContent, IUseState aParent) {
 36  415
     super(aContent, aParent);
 37  415
     myWildcard = aContent.getWildcard();
 38   
   }
 39   
 
 40  514
   public IElemUseState getNextUseState(String aNamespace, String aName, IAnyType anOverloadingType, IHasLocation aHasLocation) throws XmlException {
 41  514
     IElemUseState res = null;
 42  514
     myCurrentDataDecl = null;
 43  514
     myMatchedElemRefOrDecl = null;
 44  514
     if (mayIncrementUseCounter()) {
 45  303
       if (myWildcard.isAllowed(aNamespace)) {
 46  284
         res = this;
 47  284
         if (!ProcessContentsType.SKIP.equals(myWildcard.getProcessContentsType())) {
 48  267
           Ref ref = new Ref(aNamespace, ISymbolspaces.ELEMENT, aName);
 49  267
           myMatchedElemRefOrDecl = (IElemDecl)Schemas.getInstance().getComponent(ref);
 50  267
           myCurrentDataDecl = myMatchedElemRefOrDecl;
 51  267
           if (null == myCurrentDataDecl) {
 52  249
             if (null != anOverloadingType) {
 53  2
               myCurrentDataDecl = (IElemWildcard)getContentDesc();
 54  247
             } else if (ProcessContentsType.STRICT.equals(myWildcard.getProcessContentsType())) {
 55  3
               throw new XmlException(XmlMessages.cvcWildcard2(ref, aHasLocation));
 56   
             }
 57   
           }
 58   
         }
 59  281
         incrementUseCounter();
 60   
       }
 61   
     }
 62  511
     return res;
 63   
   }
 64   
 
 65  44
   protected void doIsValidEnd(IHasLocation aHasLocation) {}
 66   
 
 67  281
   public IElemDesc getElemDesc() {
 68  281
     return myCurrentDataDecl;
 69   
   }
 70   
 
 71  281
   public IElemRefOrDecl getSubstitutionHead() {
 72  281
     return null;
 73   
   }
 74   
 
 75   
 
 76   
 }
 77