01: /* Generated By:JJTree: Do not edit this line. ASTElement.java */
02:
03: package net.sourceforge.pmd.jsp.ast;
04:
05: public class ASTElement extends SimpleNode {
06:
07: /* BEGIN CUSTOM CODE */
08:
09: /**
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: * @return boolean - true if the element has a namespace-prefix, false otherwise
21: */
22: public boolean isHasNamespacePrefix() {
23: return (name.indexOf(':') >= 0);
24: }
25:
26: /**
27: * @return String - the part of the name that is before the (first) colon (":")
28: */
29: public String getNamespacePrefix() {
30: int colonIndex = name.indexOf(':');
31: return ((colonIndex >= 0) ? name.substring(0, colonIndex) : "");
32: }
33:
34: /**
35: * @return String - The part of the name that is after the first colon (":").
36: * If the name does not contain a colon, the full name is returned.
37: */
38: public String getLocalName() {
39: int colonIndex = name.indexOf(':');
40: return ((colonIndex >= 0) ? name.substring(colonIndex + 1)
41: : name);
42: }
43:
44: /**
45: * @return Returns the name.
46: */
47: public String getName() {
48: return name;
49: }
50:
51: /**
52: * @param name The name to set.
53: */
54: public void setName(String name) {
55: this .name = name;
56: }
57:
58: /**
59: * @return Returns the empty.
60: */
61: public boolean isEmpty() {
62: return empty;
63: }
64:
65: /**
66: * @param empty The empty to set.
67: */
68: public void setEmpty(boolean empty) {
69: this .empty = empty;
70: }
71:
72: /* (non-Javadoc)
73: * @see com.applicationengineers.pmd4jsp.ast.SimpleNode#toString(java.lang.String)
74: */
75: public String toString(String prefix) {
76: return super .toString(prefix) + " name=[" + name + "] ";
77: }
78:
79: /* END CUSTOM CODE */
80:
81: public ASTElement(int id) {
82: super (id);
83: }
84:
85: public ASTElement(JspParser p, int id) {
86: super (p, id);
87: }
88:
89: /**
90: * Accept the visitor. *
91: */
92: public Object jjtAccept(JspParserVisitor visitor, Object data) {
93: return visitor.visit(this, data);
94: }
95: }
|