Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 55   Methods: 3
NCLOC: 38   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
IdsConstraint.java 83,3% 100% 100% 95,7%
 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.ArrayList;
 13   
 import java.util.Collections;
 14   
 import java.util.Iterator;
 15   
 import java.util.List;
 16   
 
 17   
 import org.jbind.xml.base.IHasLocation;
 18   
 import org.jbind.xml.core.constraint.ConstraintType;
 19   
 import org.jbind.xml.core.content.IAttrRefOrDecl;
 20   
 import org.jbind.xml.core.data.IAnyListTypeData;
 21   
 import org.jbind.xml.core.data.IAnyTypeData;
 22   
 import org.jbind.xml.core.data.ISimpleData;
 23   
 import org.jbind.xml.schema.cmp.W3CTypes;
 24   
 
 25   
 public class IdsConstraint extends IdOrIdsConstraint {
 26   
 
 27  2
   public IdsConstraint(IAttrRefOrDecl aDecl, IHasLocation aHasLocation) {
 28  2
     super(aDecl, aHasLocation);
 29   
   }
 30   
 
 31  2
   protected Iterator iterKeys(IAnyTypeData aData) {
 32  2
     Iterator res = null;
 33  2
     IAnyListTypeData ld = (IAnyListTypeData)getAddressedData(aData);
 34  2
     if (null != ld) {
 35  1
       List l = new ArrayList();
 36  1
       for (Iterator i = ld.iterItems(); i.hasNext(); ) {
 37  2
         ISimpleData sd = (ISimpleData)i.next();
 38  2
         if (W3CTypes.id.isBaseType(sd.getType_())) {
 39  2
           Object key = sd.getCanonicalForm_();
 40  2
           l.add(key);
 41   
         }
 42   
       }
 43  1
       res = l.iterator();
 44   
     } else {
 45  1
       res = Collections.EMPTY_LIST.iterator();
 46   
     }
 47  2
     return res;
 48   
   }
 49   
 
 50  2
   public ConstraintType getConstraintType() {
 51  2
     return ConstraintType.IDS;
 52   
   }
 53   
 
 54   
 }
 55