|
|||||||||||||||||||
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 | |||||||||||||||
IdRefConstraint.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 IdRefConstraint extends IdRefOrIdRefsConstraint { |
|
23 |
|
|
24 | 6 |
public IdRefConstraint(IAttrRefOrDecl aDecl, IHasLocation aHasLocation) { |
25 | 6 |
super(aDecl, aHasLocation); |
26 |
} |
|
27 |
|
|
28 | 12 |
public boolean isSingleNotMultipleReference() { |
29 | 12 |
return true; |
30 |
} |
|
31 |
|
|
32 | 6 |
public ConstraintType getConstraintType() { |
33 | 6 |
return ConstraintType.ID_REF; |
34 |
} |
|
35 |
|
|
36 | 5 |
protected Iterator iterKeys(IAnyTypeData aData) { |
37 | 5 |
Iterator res = null; |
38 | 5 |
ISimpleData sd = (ISimpleData)getAddressedData(aData); |
39 | 5 |
if ((null != sd) && W3CTypes.idRef.isBaseType(sd.getType_())) { |
40 | 4 |
String key = sd.getCanonicalForm_(); |
41 | 4 |
res = Collections.singleton(key).iterator(); |
42 |
} else { |
|
43 | 1 |
res = Collections.EMPTY_LIST.iterator(); |
44 |
} |
|
45 | 5 |
return res; |
46 |
} |
|
47 |
|
|
48 |
} |
|
49 |
|
|