Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 110   Methods: 12
NCLOC: 82   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
Any.java 92,9% 90,3% 66,7% 86%
 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 java.util.Collections;
 13   
 import java.util.Enumeration;
 14   
 import java.util.HashSet;
 15   
 import java.util.Set;
 16   
 import java.util.StringTokenizer;
 17   
 
 18   
 import org.jbind.xml.base.IAttribute;
 19   
 import org.jbind.xml.base.INamespaces;
 20   
 import org.jbind.xml.base.ISymbolspace;
 21   
 import org.jbind.xml.base.ProcessContentsType;
 22   
 import org.jbind.xml.core.cmp.IComponent;
 23   
 import org.jbind.xml.core.cmp.IComponentStore;
 24   
 import org.jbind.xml.core.cmp.IWildcard;
 25   
 import org.jbind.xml.msg.IConstraintViolations;
 26   
 import org.jbind.xml.msg.XmlException;
 27   
 import org.jbind.xml.schema.cmp.Wildcard;
 28   
 import org.jbind.xml.schema.instantiation.IElemValHelper;
 29   
 import org.jbind.xml.schema.instantiation.IElementHelper;
 30   
 import org.jbind.xml.schema.instantiation.IHasTopLevelJobs;
 31   
 import org.jbind.xml.schema.instantiation.IJobRefs;
 32   
 
 33   
 public abstract class Any extends Annotated implements IAny {
 34   
 
 35   
   private boolean myIsNegative = true;
 36   
   private Set myNamespaces = Collections.EMPTY_SET;
 37   
 
 38   
   private ProcessContentsType myProcessContents = ProcessContentsType.STRICT;
 39   
 
 40   
   private IWildcard myWildcard = null;
 41   
 
 42  108
   public Any(CreationParams aCreationParams) {
 43  108
     super(aCreationParams);
 44   
   }
 45   
 
 46  153
   protected IAttribute doCreateAttribute(ACParams anACParams) throws XmlException {
 47  153
     IAttribute res = null;
 48  153
     String an = NameUtil.getSchemaAttributeName(anACParams);
 49  153
     if ("processContents".equals(an)) {
 50  78
       res = new Attribute(anACParams);
 51  78
       myProcessContents = ConstantResolver.getProcessContents(res.getStringValue(), this);
 52  75
     } else if ("namespace".equals(an)) {
 53  75
       res = new Attribute(anACParams);
 54  75
       String n = res.getStringValue();
 55   
 
 56  75
       if ("##any".equals(n)) {
 57   
         // this is the default
 58  4
         myNamespaces = Collections.EMPTY_SET;// JIKES because of a bug in jikes there must be a statement here
 59  71
       } else if ("##other".equals(n)) {
 60  58
         myNamespaces = Collections.singleton(getSchemaElement().getTargetNamespace());
 61   
       } else {
 62  13
         myIsNegative = false;
 63  13
         myNamespaces = new HashSet(11);
 64  13
         for (Enumeration e = new StringTokenizer(n, " "); e.hasMoreElements(); ) {
 65  21
           String uri = (String)e.nextElement();
 66  21
           String namespace = null;
 67  21
           if ("##targetNamespace".equals(uri)) {
 68  6
             namespace = getSchemaElement().getTargetNamespace();
 69  15
           } else if ("##local".equals(uri)) {
 70  7
             namespace = INamespaces.NO;
 71   
           } else {
 72  8
             namespace = uri;
 73   
           }
 74  21
           myNamespaces.add(namespace);
 75   
         }
 76   
       }
 77   
 
 78   
     } else {
 79  0
       res = super.doCreateAttribute(anACParams);
 80   
     }
 81  153
     return res;
 82   
   }
 83   
 
 84  108
   public void validateElement(IElemValHelper aHelper, IConstraintViolations aViolations) {
 85  108
     super.validateElement(aHelper, aViolations);
 86  108
     myWildcard = new Wildcard(myIsNegative, myNamespaces, myProcessContents);
 87   
   }
 88   
 
 89  101
   public IWildcard getWildcard() {
 90  101
     return myWildcard;
 91   
   }
 92   
 
 93  136
   public void collectRefsForCreation(IJobRefs aJobRefs) {}
 94  272
   public void collectRefsForCompletion(IElementHelper aHelper, IJobRefs aJobRefs) {}
 95  0
   public void collectRefsForValidation(IElementHelper aHelper, IJobRefs aJobRefs) {}
 96   
 
 97  93
   public void addSchemaData(IComponentStore aStore, IComponent aComponent, IConstraintViolations aViolations) {}
 98  0
   public void createAndAddJob(IHasTopLevelJobs aHasTopLevelJobs) {}
 99  101
   public void completeComponent(IElementHelper anElementHelper, IComponent aComponent, IConstraintViolations aViolations) {}
 100   
 
 101  0
   public String getName() {
 102  0
     return null;
 103   
   }
 104   
 
 105  0
   public ISymbolspace getSymbolSpace() {
 106  0
     return null;
 107   
   }
 108   
 
 109   
 }
 110