View Javadoc

1   /* Generated By:JJTree: Do not edit this line. ASTElement.java */
2   
3   package net.sourceforge.pmd.jsp.ast;
4   
5   public class ASTElement extends SimpleNode {
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      /**
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  
76      /* (non-Javadoc)
77       * @see com.applicationengineers.pmd4jsp.ast.SimpleNode#toString(java.lang.String)
78       */
79      public String toString(String prefix) {
80          return super.toString(prefix) + " name=[" + name + "] ";
81      }
82  /* END CUSTOM CODE */
83  
84  
85  
86      public ASTElement(int id) {
87          super(id);
88      }
89  
90      public ASTElement(JspParser p, int id) {
91          super(p, id);
92      }
93  
94  
95      /**
96       * Accept the visitor. *
97       */
98      public Object jjtAccept(JspParserVisitor visitor, Object data) {
99          return visitor.visit(this, data);
100     }
101 }