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.cmp;
|
11
|
|
|
12
|
|
import java.util.List;
|
13
|
|
import java.util.Map;
|
14
|
|
|
15
|
|
import org.jbind.xml.base.BlockType;
|
16
|
|
import org.jbind.xml.base.FinalType;
|
17
|
|
import org.jbind.xml.base.IRange;
|
18
|
|
import org.jbind.xml.base.IRef;
|
19
|
|
import org.jbind.xml.base.ISymbolspace;
|
20
|
|
import org.jbind.xml.base.Range;
|
21
|
|
import org.jbind.xml.core.base.IKeyStore;
|
22
|
|
import org.jbind.xml.core.cmp.IComponentVisitor;
|
23
|
|
import org.jbind.xml.core.cmp.ISourceInfo;
|
24
|
|
import org.jbind.xml.core.cmp.IWildcard;
|
25
|
|
import org.jbind.xml.core.content.IElemGroupDesc;
|
26
|
|
import org.jbind.xml.core.content.IElemWildcard;
|
27
|
|
import org.jbind.xml.core.content.IUseState;
|
28
|
|
import org.jbind.xml.core.data.IAnyTypeData;
|
29
|
|
import org.jbind.xml.core.data.ISimpleData;
|
30
|
|
import org.jbind.xml.core.type.IAnyType;
|
31
|
|
import org.jbind.xml.instance.use.WildcardUseState;
|
32
|
|
import org.jbind.xml.msg.IConstraintViolations;
|
33
|
|
import org.jbind.xml.msg.XmlException;
|
34
|
|
|
35
|
|
public class ElemWildcard extends ElemDesc implements IElemWildcard {
|
36
|
|
|
37
|
|
private IWildcard myWildcard;
|
38
|
|
|
39
|
45
|
public ElemWildcard(ISourceInfo aSourceInfo, IRange aRange, IWildcard aWildcard) {
|
40
|
45
|
super(aSourceInfo, null, null, aRange);
|
41
|
45
|
myWildcard = aWildcard;
|
42
|
|
}
|
43
|
|
|
44
|
836
|
public IWildcard getWildcard() {
|
45
|
836
|
return myWildcard;
|
46
|
|
}
|
47
|
|
|
48
|
415
|
public IUseState createUseState(IUseState aParent) {
|
49
|
415
|
return new WildcardUseState(this, aParent);
|
50
|
|
}
|
51
|
|
|
52
|
0
|
public String getDesc() {
|
53
|
0
|
return "any (" + getWildcard() + ")";
|
54
|
|
}
|
55
|
|
|
56
|
346
|
public IRange getRange(IRef aRef) {
|
57
|
346
|
IRange res = null;
|
58
|
346
|
if ((null == aRef) || getWildcard().isAllowed(aRef)) {
|
59
|
330
|
res = getRange();
|
60
|
|
} else {
|
61
|
16
|
res = Range.ZERO;
|
62
|
|
}
|
63
|
346
|
return res;
|
64
|
|
}
|
65
|
|
|
66
|
0
|
public ISymbolspace getSymbolspace() {
|
67
|
0
|
return null;
|
68
|
|
}
|
69
|
|
|
70
|
2
|
public String getDefaultTextContent() {
|
71
|
2
|
return null;
|
72
|
|
}
|
73
|
|
|
74
|
4
|
public IAnyType getType() {
|
75
|
4
|
return W3CTypes.anyType;
|
76
|
|
}
|
77
|
|
|
78
|
0
|
public ISimpleData getDefault() {
|
79
|
0
|
return null;
|
80
|
|
}
|
81
|
2
|
public ISimpleData getFixed() {
|
82
|
2
|
return null;
|
83
|
|
}
|
84
|
|
|
85
|
4
|
public boolean isActive(BlockType aBlockType) {
|
86
|
4
|
return false;
|
87
|
|
}
|
88
|
0
|
public boolean isActive(FinalType aFinalType) {
|
89
|
0
|
return false;
|
90
|
|
}
|
91
|
|
|
92
|
61
|
public void accept(IComponentVisitor aVisitor) throws XmlException {
|
93
|
61
|
aVisitor.visitElemWildcardStart(this);
|
94
|
61
|
visitSubComponents(aVisitor);
|
95
|
61
|
aVisitor.visitElemWildcardEnd(this);
|
96
|
|
}
|
97
|
|
|
98
|
0
|
public boolean isReference() {
|
99
|
0
|
return false;
|
100
|
|
}
|
101
|
|
|
102
|
35
|
public void validate(IConstraintViolations aViolations) {}
|
103
|
|
|
104
|
70
|
public void collectElemDescs(Map anElementDecls, List anElemWildcards, IConstraintViolations aViolations) {
|
105
|
70
|
anElemWildcards.add(this);
|
106
|
|
}
|
107
|
|
|
108
|
168
|
public void replaceSubstitutions(IElemGroupDesc aParent) {
|
109
|
168
|
aParent.add(this);
|
110
|
|
}
|
111
|
|
|
112
|
7
|
protected void doAddToParentWithNewRange(IRange aRange, IElemGroupDesc aParent) {
|
113
|
7
|
aParent.add(new ElemWildcard(this, aRange, myWildcard));
|
114
|
|
}
|
115
|
|
|
116
|
2
|
public void checkIdentityConstraints(IAnyTypeData aData, IKeyStore anElementKeys, IConstraintViolations aViolations) {}
|
117
|
|
|
118
|
2
|
public boolean isAbstract() {
|
119
|
2
|
return false;
|
120
|
|
}
|
121
|
|
|
122
|
0
|
public boolean isNillable() {
|
123
|
0
|
return false;
|
124
|
|
}
|
125
|
|
|
126
|
|
}
|
127
|
|
|