1 /* Generated By:JJTree: Do not edit this line. ASTElement.java */
2
3 package net.sourceforge.pmd.lang.jsp.ast;
4
5 public class ASTElement extends AbstractJspNode {
6
7 /* BEGIN CUSTOM CODE */
8
9 /**
10 * Name of the element-tag. Cannot be null.
11 */
12 private String name;
13
14 /**
15 * Flag indicating that the element consists of one tag ("<... />").
16 */
17 private boolean empty; //
18
19 /**
20 * Flag indicating that the parser did not find a proper ending marker
21 * or ending tag for this element
22 */
23 private boolean unclosed;
24
25 /**
26 * @return boolean - true if the element has a namespace-prefix, false otherwise
27 */
28 public boolean isHasNamespacePrefix() {
29 return name.indexOf(':') >= 0;
30 }
31
32 /**
33 * @return String - the part of the name that is before the (first) colon (":")
34 */
35 public String getNamespacePrefix() {
36 int colonIndex = name.indexOf(':');
37 return colonIndex >= 0
38 ? name.substring(0, colonIndex)
39 : "";
40 }
41
42 /**
43 * @return String - The part of the name that is after the first colon (":").
44 * If the name does not contain a colon, the full name is returned.
45 */
46 public String getLocalName() {
47 int colonIndex = name.indexOf(':');
48 return colonIndex >= 0
49 ? name.substring(colonIndex + 1)
50 : name;
51 }
52
53 /**
54 * @return Returns the name.
55 */
56 public String getName() {
57 return name;
58 }
59
60 /**
61 * @param name The name to set.
62 */
63 public void setName(String name) {
64 this.name = name;
65 }
66
67 /**
68 * @return Returns the empty.
69 */
70 public boolean isEmpty() {
71 return empty;
72 }
73
74 public boolean isUnclosed() {
75 return unclosed;
76 }
77
78 public void setUnclosed(boolean unclosed) {
79 this.unclosed = unclosed;
80 }
81
82 /**
83 * @param empty The empty to set.
84 */
85 public void setEmpty(boolean empty) {
86 this.empty = empty;
87 }
88 /* END CUSTOM CODE */
89
90
91
92 public ASTElement(int id) {
93 super(id);
94 }
95
96 public ASTElement(JspParser p, int id) {
97 super(p, id);
98 }
99
100
101 /**
102 * Accept the visitor. *
103 */
104 public Object jjtAccept(JspParserVisitor visitor, Object data) {
105 return visitor.visit(this, data);
106 }
107 }