1 /*
2 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 /*
21 * $Id: Template.java,v 1.2.4.1 2005/09/12 11:30:11 pvedula Exp $
22 */
23
24 package com.sun.org.apache.xalan.internal.xsltc.compiler;
25
26 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
27 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
28 import com.sun.org.apache.bcel.internal.generic.InstructionList;
29 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
30 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
31 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
32 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NamedMethodGenerator;
33 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
34 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
35 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
36 import com.sun.org.apache.xml.internal.utils.XML11Char;
37 import java.util.List;
38 import java.util.Vector;
39
40
41 /**
42 * @author Jacek Ambroziak
44 * @author Morten Jorgensen
45 * @author Erwin Bolwidt <ejb@klomp.org>
46 */
47 public final class Template extends TopLevelElement {
48
49 private QName _name; // The name of the template (if any)
50 private QName _mode; // Mode in which this template is instantiated.
51 private Pattern _pattern; // Matching pattern defined for this template.
52 private double _priority; // Matching priority of this template.
53 private int _position; // Position within stylesheet (prio. resolution)
54 private boolean _disabled = false;
55 private boolean _compiled = false;//make sure it is compiled only once
56 private boolean _simplified = false;
57
58 // True if this is a simple named template. A simple named
59 // template is a template which only has a name but no match pattern.
60 private boolean _isSimpleNamedTemplate = false;
61
62 // The list of parameters in this template. This is only used
63 // for simple named templates.
64 private Vector _parameters = new Vector();
65
66 public boolean hasParams() {
67 return _parameters.size() > 0;
68 }
69
70 public boolean isSimplified() {
71 return(_simplified);
72 }
73
74 public void setSimplified() {
75 _simplified = true;
76 }
77
78 public boolean isSimpleNamedTemplate() {
79 return _isSimpleNamedTemplate;
80 }
81
82 public void addParameter(Param param) {
83 _parameters.addElement(param);
84 }
85
86 public Vector getParameters() {
87 return _parameters;
88 }
89
90 public void disable() {
91 _disabled = true;
92 }
93
94 public boolean disabled() {
95 return(_disabled);
96 }
97
98 public double getPriority() {
99 return _priority;
100 }
101
102 public int getPosition() {
103 return(_position);
104 }
105
106 public boolean isNamed() {
|
1 /*
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xalan.internal.xsltc.compiler;
22
23 import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen;
24 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
25 import com.sun.org.apache.bcel.internal.generic.InstructionList;
26 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator;
27 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
28 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator;
29 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.NamedMethodGenerator;
30 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type;
31 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
32 import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Util;
33 import com.sun.org.apache.xml.internal.utils.XML11Char;
34 import java.util.List;
35 import java.util.Vector;
36
37
38 /**
39 * @author Jacek Ambroziak
41 * @author Morten Jorgensen
42 * @author Erwin Bolwidt <ejb@klomp.org>
43 */
44 public final class Template extends TopLevelElement {
45
46 private QName _name; // The name of the template (if any)
47 private QName _mode; // Mode in which this template is instantiated.
48 private Pattern _pattern; // Matching pattern defined for this template.
49 private double _priority; // Matching priority of this template.
50 private int _position; // Position within stylesheet (prio. resolution)
51 private boolean _disabled = false;
52 private boolean _compiled = false;//make sure it is compiled only once
53 private boolean _simplified = false;
54
55 // True if this is a simple named template. A simple named
56 // template is a template which only has a name but no match pattern.
57 private boolean _isSimpleNamedTemplate = false;
58
59 // The list of parameters in this template. This is only used
60 // for simple named templates.
61 private Vector<Param> _parameters = new Vector<>();
62
63 public boolean hasParams() {
64 return _parameters.size() > 0;
65 }
66
67 public boolean isSimplified() {
68 return(_simplified);
69 }
70
71 public void setSimplified() {
72 _simplified = true;
73 }
74
75 public boolean isSimpleNamedTemplate() {
76 return _isSimpleNamedTemplate;
77 }
78
79 public void addParameter(Param param) {
80 _parameters.addElement(param);
81 }
82
83 public Vector<Param> getParameters() {
84 return _parameters;
85 }
86
87 public void disable() {
88 _disabled = true;
89 }
90
91 public boolean disabled() {
92 return(_disabled);
93 }
94
95 public double getPriority() {
96 return _priority;
97 }
98
99 public int getPosition() {
100 return(_position);
101 }
102
103 public boolean isNamed() {
|