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.ArrayList;
|
13
|
|
import java.util.HashMap;
|
14
|
|
import java.util.Iterator;
|
15
|
|
import java.util.List;
|
16
|
|
import java.util.Map;
|
17
|
|
|
18
|
|
import org.jbind.xml.base.IRange;
|
19
|
|
import org.jbind.xml.core.cmp.ISourceInfo;
|
20
|
|
import org.jbind.xml.core.content.IContentDesc;
|
21
|
|
import org.jbind.xml.msg.IConstraintViolations;
|
22
|
|
|
23
|
|
public abstract class ElemGroupDecl extends ElemGroupDesc {
|
24
|
|
|
25
|
|
private List myContentList = new ArrayList();
|
26
|
2481
|
public ElemGroupDecl(ISourceInfo aSourceInfo, String aNamespace, String aName, IRange aRange) {
|
27
|
2481
|
super(aSourceInfo, aNamespace, aName, aRange);
|
28
|
|
}
|
29
|
|
|
30
|
15286
|
public Iterator iterContent() {
|
31
|
15286
|
return myContentList.iterator();
|
32
|
|
}
|
33
|
1583
|
public int getNbParticles() {
|
34
|
1583
|
return myContentList.size();
|
35
|
|
}
|
36
|
3570
|
public void add(IContentDesc aContent) {
|
37
|
3570
|
myContentList.add(aContent);
|
38
|
|
}
|
39
|
746
|
public void setSubContent(int anIndex, IContentDesc aContent) {
|
40
|
746
|
while (anIndex >= myContentList.size()) {
|
41
|
746
|
myContentList.add(null);
|
42
|
|
}
|
43
|
746
|
myContentList.set(anIndex, aContent);
|
44
|
|
}
|
45
|
|
|
46
|
0
|
public boolean isReference() {
|
47
|
0
|
return false;
|
48
|
|
}
|
49
|
|
|
50
|
1093
|
public void collectElemDescs(Map anElemRefOrDecls, List anElemWildcards, IConstraintViolations aViolations) {
|
51
|
1093
|
for (Iterator i = iterContent(); i.hasNext(); ) {
|
52
|
2452
|
IContentDesc c = (IContentDesc)i.next();
|
53
|
2452
|
c.collectElemDescs(anElemRefOrDecls, anElemWildcards, aViolations);
|
54
|
|
}
|
55
|
|
}
|
56
|
|
|
57
|
362
|
public void validate(IConstraintViolations aViolations) {
|
58
|
362
|
Map elemRefOrDecls = new HashMap(31);
|
59
|
362
|
List elemWildcards = new ArrayList();
|
60
|
|
// collects and validates the element declarations
|
61
|
362
|
collectElemDescs(elemRefOrDecls, elemWildcards, aViolations);
|
62
|
|
}
|
63
|
|
}
|
64
|
|
|