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