Package org.drools.decisiontable.parser
Class DefaultRuleSheetListener
java.lang.Object
org.drools.decisiontable.parser.DefaultRuleSheetListener
- All Implemented Interfaces:
RuleSheetListener,DataListener
- Direct Known Subclasses:
RuleMatrixSheetListener
An object of this class is prepared to receive calls passing it the
contents of a spreadsheet containing one or more decision tables.
Each of these tables is then expanded into a set of similar rules,
varying to a degree with respect to the patterns and actions.
A "rule set" starts with some overall definitions such as imports,
globals, functions and queries.
A table is identifed by a cell beginning with the text "RuleTable". The first
row after the table identifier defines the column type: either a pattern of
the condition or an action for the consequence, or an attribute.
The second row contains optional pattern type declarations. If cells in
this row are merged, then all snippets below the merged stretch become part of
the same pattern, as separate constraints.
The third row identifies the java code block associated with the condition
or consequence. This code block should include one or more parameter markers
for the insertion of values defined in cells of that column.
The third row is available for comments on the purpose of the column.
All subsequent rows identify rules with the set, providing values to be
inserted where there are markers in the code snippets defined in the third
row, or for the attribute identified by the column header.
href="mailto:michael.neale@gmail.com"> Michael Neale
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface org.drools.template.parser.DataListener
NON_MERGED -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.DefaultRuleSheetListener(boolean showPackage, boolean trimCell) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdd a new rule to the current list of rulesbooleanvoidprotected RuleReturn the rule sheet propertiesBuild the final ruleset as parsed.booleanvoidvoidnewRow(int rowNumber, int columns) protected voidpostInitRuleTable(int row, int column, String value) Called after rule table initialisation.protected voidpreInitRuleTable(int row, int column, String value) Called before rule table initialisation.voidsetWorksheetName(String worksheetName) voidstartSheet(String name)
-
Field Details
-
QUERIES_TAG
- See Also:
-
FUNCTIONS_TAG
- See Also:
-
DECLARES_TAG
- See Also:
-
UNIT_TAG
- See Also:
-
IMPORT_TAG
- See Also:
-
SEQUENTIAL_FLAG
- See Also:
-
ESCAPE_QUOTES_FLAG
- See Also:
-
MIN_SALIENCE_TAG
- See Also:
-
MAX_SALIENCE_TAG
- See Also:
-
NUMERIC_DISABLED_FLAG
- See Also:
-
IGNORE_NUMERIC_FORMAT_FLAG
- See Also:
-
VARIABLES_TAG
- See Also:
-
RULE_TABLE_TAG
- See Also:
-
RULESET_TAG
- See Also:
-
DIALECT_TAG
- See Also:
-
-
Constructor Details
-
DefaultRuleSheetListener
public DefaultRuleSheetListener()Constructor. -
DefaultRuleSheetListener
public DefaultRuleSheetListener(boolean showPackage, boolean trimCell) Constructor.- Parameters:
showPackage- if true, the rule set name is passed to the resulting package
-
-
Method Details
-
setWorksheetName
-
getProperties
Description copied from interface:RuleSheetListenerReturn the rule sheet properties- Specified by:
getPropertiesin interfaceRuleSheetListener
-
getRuleSet
Description copied from interface:RuleSheetListenerBuild the final ruleset as parsed.- Specified by:
getRuleSetin interfaceRuleSheetListener
-
addRule
Add a new rule to the current list of rules- Parameters:
newRule-
-
startSheet
- Specified by:
startSheetin interfaceDataListener
-
finishSheet
public void finishSheet()- Specified by:
finishSheetin interfaceDataListener
-
newRow
public void newRow(int rowNumber, int columns) - Specified by:
newRowin interfaceDataListener
-
newCell
- Specified by:
newCellin interfaceDataListener
-
preInitRuleTable
Called before rule table initialisation. Subclasses may override this method to do additional processing. -
getCurrentRule
-
postInitRuleTable
Called after rule table initialisation. Subclasses may override this method to do additional processing. -
isNumericDisabled
public boolean isNumericDisabled() -
doesIgnoreNumericFormat
public boolean doesIgnoreNumericFormat()
-