Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 45   Methods: 3
NCLOC: 28   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
IdConstraint.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.schema.constraint;
 11   
 
 12   
 import java.util.Collections;
 13   
 import java.util.Iterator;
 14   
 
 15   
 import org.jbind.xml.base.IHasLocation;
 16   
 import org.jbind.xml.core.constraint.ConstraintType;
 17   
 import org.jbind.xml.core.content.IAttrRefOrDecl;
 18   
 import org.jbind.xml.core.data.IAnyTypeData;
 19   
 import org.jbind.xml.core.data.ISimpleData;
 20   
 import org.jbind.xml.schema.cmp.W3CTypes;
 21   
 
 22   
 public class IdConstraint extends IdOrIdsConstraint {
 23   
 
 24  6
   public IdConstraint(IAttrRefOrDecl aDecl, IHasLocation aHasLocation) {
 25  6
     super(aDecl, aHasLocation);
 26   
   }
 27   
 
 28  4
   public Iterator iterKeys(IAnyTypeData aData) {
 29  4
     Iterator res = null;
 30  4
     ISimpleData d = (ISimpleData)getAddressedData(aData);
 31  4
     if ((null != d) && W3CTypes.id.isBaseType(d.getType_())) {
 32  3
       Object key = d.getCanonicalForm_();
 33  3
       res = Collections.singletonList(key).iterator();
 34   
     } else {
 35  1
       res = Collections.EMPTY_LIST.iterator();
 36   
     }
 37  4
     return res;
 38   
   }
 39   
 
 40  6
   public ConstraintType getConstraintType() {
 41  6
     return ConstraintType.ID;
 42   
   }
 43   
 
 44   
 }
 45