Debian Codegraph @

net/sf/saxon/style/ComponentDeclaration.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.style;
9
10 /**
11 * The object represents a declaration (that is, a top-level element) in a stylesheet.
12 * A declaration exists within a stylesheet module and takes its import precedence
13 * from that of the module. The declaration corresponds to a source element in a stylesheet
14 * document. However, if a stylesheet module is imported twice with different precedences,
15 * then two declarations may share the same source element.
16 */
17
18 public class ComponentDeclaration {
19
20 private StyleElement sourceElement;
21 private StylesheetModule module;
22
23 /**
24 * Create a ComponentDeclaration as the combination of a stylesheet module and a declaration
25 * within that module
26 * @param module the stylesheet module
27 * @param source the source declaration within that module
28 */
29
30 public ComponentDeclaration(StylesheetModule module, StyleElement source) {
31 this.module = module;
32 this.sourceElement = source;
33 }
34
35 /**
36 * Get the module in which this ComponentDeclaration appears
37 * @return the module
38 */
39
40 public StylesheetModule getModule() {
41 return module;
42 }
43
44 /**
45 * Get the source declaration of this component
46 * @return the element in the stylesheet tree corresponding to the declaration
47 */
48
49 public StyleElement getSourceElement() {
50 return sourceElement;
51 }
52
53 /**
54 * Get the import precedence of the declaration, which is the same as the import
55 * precedence of the module in which it appears
56 * @return the import precedence
57 */
58
59 public int getPrecedence() {
60 return module.getPrecedence();
61 }
62 }