Source Code Cross Referenced for ActionType.java in  » Rule-Engine » drolls-Rule-Engine » org » drools » decisiontable » parser » 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 » Rule Engine » drolls Rule Engine » org.drools.decisiontable.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.drools.decisiontable.parser;
002:
003:        /*
004:         * Copyright 2005 JBoss Inc
005:         * 
006:         * Licensed under the Apache License, Version 2.0 (the "License");
007:         * you may not use this file except in compliance with the License.
008:         * You may obtain a copy of the License at
009:         * 
010:         *      http://www.apache.org/licenses/LICENSE-2.0
011:         * 
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS,
014:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015:         * See the License for the specific language governing permissions and
016:         * limitations under the License.
017:         */
018:
019:        import java.util.Map;
020:
021:        /**
022:         * Simple holder class identifying a condition or action column etc.
023:         * This is stored in a map in the main listener class, to track what type of values
024:         * you can expect to see in the rows directly below.
025:         * 
026:         * There are five types of columns relevant to a rule table.
027:         * @author Michael Neale
028:         */
029:        public class ActionType {
030:
031:            public static final int CONDITION = 0;
032:
033:            public static final int ACTION = 1;
034:
035:            // 08 - 16 - 2005 RIK: Define 3 new ActionType types
036:            // PRIORITY is used to set the salience parameter of a rule tag
037:            public static final int PRIORITY = 2;
038:
039:            // DURATION is used to set a duration tag inside a rule tag
040:            public static final int DURATION = 3;
041:
042:            // NAME is used to set the name parameter of a rule tag
043:            public static final int NAME = 4;
044:
045:            // 10 - 05 - 2005 RIK: Add 2 new AtcionType types
046:            // DESCRIPTION is used to set the description parameter of a rule tag
047:            public static final int DESCRIPTION = 5;
048:
049:            //  NOLOOP is used to set the no-loop parameter of a rule tag
050:            public static final int NOLOOP = 6;
051:
052:            //  XOR-GROUP is used to set the activation-group parameter of a rule tag
053:            public static final int ACTIVATIONGROUP = 7;
054:
055:            //  14 September 2006 SJW: Add new Agenda Group ActionType
056:            //  AGENDA-GROUP is used to set the agenda-group parameter of a rule tag
057:            public static final int AGENDAGROUP = 8;
058:
059:            public static final int RULEFLOWGROUP = 9;
060:
061:            int type;
062:
063:            private SourceBuilder sourceBuilder = null;
064:
065:            //    private String                  value;
066:
067:            ActionType(final int actionType) {
068:                this .type = actionType;
069:            }
070:
071:            /**
072:             * This is only set for LHS or RHS building. 
073:             */
074:            public void setSourceBuilder(SourceBuilder src) {
075:                this .sourceBuilder = src;
076:            }
077:
078:            public SourceBuilder getSourceBuilder() {
079:                return this .sourceBuilder;
080:            }
081:
082:            //    String getSnippet(final String cellValue) {
083:            //        final SnippetBuilder builder = new SnippetBuilder( this.value );
084:            //        return builder.build( cellValue );
085:            //    }
086:
087:            /**
088:             * Create a new action type that matches this cell, and add it to the map,
089:             * keyed on that column.
090:             */
091:            public static void addNewActionType(final Map actionTypeMap,
092:                    final String value, final int column, final int row) {
093:
094:                if (value.toUpperCase().startsWith("U")
095:                        || value.toUpperCase().equals("NO-LOOP")) // if the title cell
096:                // value starts with
097:                // "U" then put a
098:                // ActionType.NOLOOP
099:                // to the _actions  
100:                // list
101:                {
102:                    actionTypeMap.put(new Integer(column), new ActionType(
103:                            ActionType.NOLOOP));
104:                } else if (value.toUpperCase().equals("RULEFLOW-GROUP")
105:                        || value.toUpperCase().startsWith("R")) {
106:                    actionTypeMap.put(new Integer(column), new ActionType(
107:                            ActionType.RULEFLOWGROUP));
108:
109:                } else if (value.toUpperCase().equals("AGENDA-GROUP")) // if the title cell
110:                // value equals "AGENDA-GROUP"
111:                // then put a
112:                // ActionType.AGENDAGROUP
113:                // to the _actions  
114:                // list
115:                {
116:                    actionTypeMap.put(new Integer(column), new ActionType(
117:                            ActionType.AGENDAGROUP));
118:                } else if (value.toUpperCase().startsWith("X")
119:                        || value.toUpperCase().equals("ACTIVATION-GROUP")) // if the title cell
120:                // value starts with
121:                // "X" then put a
122:                // ActionType.XORGROUP
123:                // to the _actions  
124:                // list
125:                {
126:                    actionTypeMap.put(new Integer(column), new ActionType(
127:                            ActionType.ACTIVATIONGROUP));
128:                } else if (value.toUpperCase().startsWith("C")) {
129:                    actionTypeMap.put(new Integer(column), new ActionType(
130:                            ActionType.CONDITION));
131:                } else if (value.toUpperCase().startsWith("A")) {
132:                    actionTypeMap.put(new Integer(column), new ActionType(
133:                            ActionType.ACTION));
134:                } else if (value.toUpperCase().startsWith("P")) // if the title cell
135:                // value starts with
136:                // "P" then put a
137:                // ActionType.PRIORITY
138:                // to the _actions
139:                // list
140:                {
141:                    actionTypeMap.put(new Integer(column), new ActionType(
142:                            ActionType.PRIORITY));
143:                } else if (value.toUpperCase().startsWith("D")) // if the title cell
144:                // value starts with
145:                // "D" then put a
146:                // ActionType.DURATION
147:                // to the _actions
148:                // list
149:                {
150:                    actionTypeMap.put(new Integer(column), new ActionType(
151:                            ActionType.DURATION));
152:                } else if (value.toUpperCase().startsWith("N")) // if the title cell
153:                // value starts with
154:                // "N" then put a
155:                // ActionType.NAME
156:                // to the _actions
157:                // list
158:                {
159:                    actionTypeMap.put(new Integer(column), new ActionType(
160:                            ActionType.NAME));
161:                } else if (value.toUpperCase().startsWith("I")) // if the title cell
162:                // value starts with
163:                // "I" then put a
164:                // ActionType.DESCRIPTION
165:                // to the _actions	
166:                // list
167:                {
168:                    actionTypeMap.put(new Integer(column), new ActionType(
169:                            ActionType.DESCRIPTION));
170:                } else {
171:                    throw new DecisionTableParseException(
172:                            "Invalid column header (ACTION type), "
173:                                    + "should be CONDITION or ACTION (etc..) row number:"
174:                                    + (row + 1)
175:                                    + " cell number:"
176:                                    + (column + 1)
177:                                    + " - does not contain a leading C or A identifer.");
178:                }
179:            }
180:
181:            /**
182:             * This is where a code snippet template is added.
183:             */
184:            public void addTemplate(int col, String content) {
185:                this .sourceBuilder.addTemplate(col, content);
186:            }
187:
188:            /**
189:             * Values are added to populate the template.
190:             * The source builder contained needs to be "cleared" when the resultant snippet is extracted.
191:             */
192:            public void addCellValue(int col, String content) {
193:                this.sourceBuilder.addCellValue(col, content);
194:            }
195:
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.