Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 90   Methods: 12
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
IdRefOrIdRefsConstraint.java 100% 46,7% 33,3% 44,8%
 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.constraint;
 11   
 
 12   
 import java.util.Iterator;
 13   
 import java.util.Map;
 14   
 
 15   
 import org.jbind.xml.base.IAttribute;
 16   
 import org.jbind.xml.base.IHasLocation;
 17   
 import org.jbind.xml.base.IRefs;
 18   
 import org.jbind.xml.core.cmp.IAnnotation;
 19   
 import org.jbind.xml.core.constraint.IIdRefOrIdRefsConstraint;
 20   
 import org.jbind.xml.core.content.IAttrRefOrDecl;
 21   
 import org.jbind.xml.core.data.IAnyTypeData;
 22   
 import org.jbind.xml.core.data.IDataContext;
 23   
 import org.jbind.xml.core.data.IDataReference;
 24   
 import org.jbind.xml.msg.IConstraintViolations;
 25   
 
 26   
 public abstract class IdRefOrIdRefsConstraint extends IdentityConstraint implements IIdRefOrIdRefsConstraint {
 27   
 
 28  12
   public IdRefOrIdRefsConstraint(IAttrRefOrDecl aDecl, IHasLocation aHasLocation) {
 29  12
     super(aDecl, aHasLocation);
 30   
   }
 31   
 
 32   
   /**
 33   
    * Adds data references to the data context.
 34   
    */
 35  10
   public void globalCheck(IDataContext aContext, IAnyTypeData aData, IAnyTypeData anEnclosingData, IConstraintViolations aViolations) {
 36  10
     for (Iterator i = iterKeys(aData); i.hasNext(); ) {
 37  13
       Object key = i.next();
 38  13
       IDataReference openReference = new OpenReference(getConstraintKey(), aData, IRefs.ID_INDEX, key);
 39  13
       aContext.add(openReference);
 40   
     }
 41   
   }
 42   
 
 43  33
   public String getConstraintKey() {
 44  33
     return getAttributeRef().asStringKey();
 45   
   }
 46   
 
 47   
   /**
 48   
    * Iterates the keys of the data objects that are referenced by the constraint.
 49   
    *
 50   
    * @return <i>(required)</i>. An iterator of {@link org.jbind.xml.core.base.IKey IKey}.
 51   
    */
 52   
   protected abstract Iterator iterKeys(IAnyTypeData aData);
 53   
 
 54  0
   public IAttribute getLocalBindingAttribute(String aName) {
 55  0
     return getAttrRefOrDecl().getLocalBindingAttribute(aName);
 56   
   }
 57   
 
 58  0
   public IAttribute getDefaultedLocalBindingAttribute(String aName) {
 59  0
     return getAttrRefOrDecl().getDefaultedLocalBindingAttribute(aName);
 60   
   }
 61   
 
 62  0
   public IAttribute getBindingAttribute(String aName) {
 63  0
     return getAttrRefOrDecl().getBindingAttribute(aName);
 64   
   }
 65   
 
 66  0
   public String getLocalStringBindingAttribute(String aName) {
 67  0
     return getAttrRefOrDecl().getLocalStringBindingAttribute(aName);
 68   
   }
 69   
 
 70  0
   public String getDefaultedLocalStringBindingAttribute(String aName) {
 71  0
     return getAttrRefOrDecl().getDefaultedLocalStringBindingAttribute(aName);
 72   
   }
 73   
 
 74  8
   public String getStringBindingAttribute(String aName) {
 75  8
     return getAttrRefOrDecl().getStringBindingAttribute(aName);
 76   
   }
 77   
 
 78  0
   public boolean isTopLevelComponent() {
 79  0
     return false;
 80   
   }
 81   
 
 82  0
   public IAnnotation getAnnotation() {
 83  0
     return getAttrRefOrDecl().getAnnotation();
 84   
   }
 85   
 
 86  0
   public Map getPrefixToNamespaceMapping() {
 87  0
     return getAttrRefOrDecl().getPrefixToNamespaceMapping();
 88   
   }
 89   
 }
 90