Source Code Cross Referenced for AbstractRule.java in  » UML » jrefactory » org » acm » seguin » pmd » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » UML » jrefactory » org.acm.seguin.pmd 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.acm.seguin.pmd;
002:
003:        import net.sourceforge.jrefactory.ast.ASTCompilationUnit;
004:        import net.sourceforge.jrefactory.parser.JavaParserVisitorAdapter;
005:
006:        import java.util.Iterator;
007:        import java.util.List;
008:
009:        public abstract class AbstractRule extends JavaParserVisitorAdapter
010:                implements  Rule {
011:
012:            private String name = getClass().getName();
013:            private RuleProperties properties = new RuleProperties();
014:            private String message;
015:            private String description;
016:            private String example;
017:            private boolean m_include;
018:            private int m_priority = LOWEST_PRIORITY;
019:
020:            public String getDescription() {
021:                return description;
022:            }
023:
024:            public void setDescription(String description) {
025:                this .description = description;
026:            }
027:
028:            public String getExample() {
029:                return example;
030:            }
031:
032:            public void setExample(String example) {
033:                this .example = example;
034:            }
035:
036:            public boolean hasProperty(String name) {
037:                return properties.containsKey(name);
038:            }
039:
040:            public void addProperty(String name, String value) {
041:                properties.setValue(name, value);
042:            }
043:
044:            public double getDoubleProperty(String name) {
045:                return properties.getDoubleValue(name);
046:            }
047:
048:            public int getIntProperty(String name) {
049:                return properties.getIntegerValue(name);
050:            }
051:
052:            public boolean getBooleanProperty(String name) {
053:                return properties.getBooleanValue(name);
054:            }
055:
056:            public String getStringProperty(String name) {
057:                return properties.getValue(name);
058:            }
059:
060:            public String getName() {
061:                return name;
062:            }
063:
064:            public void setName(String name) {
065:                this .name = name;
066:            }
067:
068:            public String getMessage() {
069:                return message;
070:            }
071:
072:            public void setMessage(String message) {
073:                this .message = message;
074:            }
075:
076:            public boolean equals(Object o) {
077:                if (!(o instanceof  Rule)) {
078:                    return false;
079:                }
080:                return ((Rule) o).getName().equals(getName());
081:            }
082:
083:            public int hashCode() {
084:                return getName().hashCode();
085:            }
086:
087:            protected void visitAll(List acus, RuleContext ctx) {
088:                for (Iterator i = acus.iterator(); i.hasNext();) {
089:                    ASTCompilationUnit node = (ASTCompilationUnit) i.next();
090:                    visit(node, ctx);
091:                }
092:            }
093:
094:            public void apply(List acus, RuleContext ctx) {
095:                visitAll(acus, ctx);
096:            }
097:
098:            public RuleViolation createRuleViolation(RuleContext ctx,
099:                    int lineNumber) {
100:                return new RuleViolation(this , lineNumber, ctx);
101:            }
102:
103:            public RuleViolation createRuleViolation(RuleContext ctx,
104:                    int lineNumber, String specificDescription) {
105:                return new RuleViolation(this , lineNumber, specificDescription,
106:                        ctx);
107:            }
108:
109:            /**
110:             ********************************************************************************
111:             *
112:             * Gets an enumeration to enumerate through this rule's property names.
113:             *
114:             * @return An enumeration of property names
115:             */
116:            public RuleProperties getProperties() {
117:                return properties;
118:            }
119:
120:            /**
121:             *********************************************************************************
122:             *
123:             * When the rule is to be included in the analysis, returns true; otherwise, returns false.
124:             *
125:             * @return True when the rule is included in analysis.
126:             */
127:            public boolean include() {
128:                return m_include;
129:            }
130:
131:            /**
132:             *********************************************************************************
133:             *
134:             * When the rule is to be included in the analysis, set to true; otherwise, set to false.
135:             *
136:             * @param include True when the rule is included in analysis.
137:             */
138:            public void setInclude(boolean include) {
139:                m_include = include;
140:            }
141:
142:            /**
143:             *********************************************************************************
144:             *
145:             * Returns the rule's priority that is used for including the rule in reports and analysis.
146:             *
147:             * @return A number between 1 and LOWEST_PRIORITY.
148:             */
149:            public int getPriority() {
150:                if ((m_priority < 0) || (m_priority > LOWEST_PRIORITY)) {
151:                    m_priority = LOWEST_PRIORITY;
152:                }
153:
154:                return m_priority;
155:            }
156:
157:            /**
158:             *********************************************************************************
159:             *
160:             * Returns the rule's priority name that is used for including the rule in reports and analysis.
161:             *
162:             * @return A member of PRIORITIES.
163:             */
164:            public String getPriorityName() {
165:                return PRIORITIES[getPriority() - 1];
166:            }
167:
168:            /**
169:             *********************************************************************************
170:             *
171:             * A rule will specify a priority for inclusion in reports and analysis.  The default
172:             * priority is "Low".
173:             *
174:             * @param The rule's priority of 1..LOWEST_PRIORITY.
175:             */
176:            public void setPriority(int priority) {
177:                if ((priority < 1) || (priority > LOWEST_PRIORITY)) {
178:                    m_priority = LOWEST_PRIORITY;
179:                } else {
180:                    m_priority = priority;
181:                }
182:            }
183:
184:            public Object visit(ASTCompilationUnit expr, Object data) {
185:                super.visit(expr, data);
186:                return data;
187:            }
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.