1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package sk.uniba.euromath.document.schema;
18 import java.util.Map;
19 import javax.xml.namespace.QName;
20 import sk.baka.ikslibs.ptr.DOMPoint;
21 import sk.uniba.euromath.document.schema.plug.IElementLocP;
22 import sk.uniba.euromath.document.schema.plug.INameListP;
23 import sk.uniba.euromath.document.schema.plug.INewElementRuleP;
24 /***
25 * Mutable instance, representing element locator. This element can be
26 * inserted amongst children of some element.
27 * @author Martin Vysny
28 */
29 public final class ElementLoc {
30 /***
31 * Returns point, where the element can be inserted.
32 */
33 public final DOMPoint ip;
34 /***
35 * Returns namelist for element, that can be inserted at specified position.
36 */
37 public INameList<NewElementRule> nameList;
38 /***
39 * Constructor.
40 * @param locP wrap this instance.
41 */
42 ElementLoc(IElementLocP locP) {
43 super();
44 this.ip = locP.getDOMPoint();
45 INameListP<INewElementRuleP> nameList = locP.getNameList();
46 this.nameList = new NameListWrapper<NewElementRule,INewElementRuleP>(nameList, providerInstance);
47 }
48 /***
49 * Provides the namelist with foreign roots.
50 * @author Martin Vysny
51 */
52 private class ForeignRootsProvider implements INameListWrapperDataProvider<INewElementRuleP> {
53
54
55
56
57 public Map<QName,INewElementRuleP> getForeignRules(INameListP original) {
58 return SchemaPool.getInstance().getForeignRoots(original);
59 }
60 }
61 /***
62 * The instance of the provider.
63 */
64 private final ForeignRootsProvider providerInstance = new ForeignRootsProvider();
65 }