Class RuleMatrixSheetListener

  • All Implemented Interfaces:
    RuleSheetListener, org.drools.template.parser.DataListener

    public class RuleMatrixSheetListener
    extends DefaultRuleSheetListener
    href="mailto:michael.neale@gmail.com"> Michael Neale Define a ruleset spreadsheet which contains a matrix style decision tables. This is an example of a custom RuleSheetListener. It differs from the standard decision table in the following ways: - AgendaGroup property so that all rules fall within the same agenda-group - Precondition property which specifies a condition that is always included if a rule is being generated - Action property. Each cell within the decision table causes this action to be triggered - HorizontalCondition property. Each column header in the matrix applies this condition - VerticalCondition property. Each row header in the matrix applies this condition A table is identifed by a cell beginning with the text "RuleTable". The cells after RuleTable in the same row identify the Horizontal Conditions. The cells after RuleTable in the same column identify the Vertical Conditions. The cells with the matrix identify the actions. Wherever an action cell exists for a Vertical/Horizontal condition intersection the following rule is created: rule "rule_row_col" agenda-group AgendaGroup when Precondition VerticalCondition HorizontalCondition then Action end
    • Constructor Detail

      • RuleMatrixSheetListener

        public RuleMatrixSheetListener()
    • Method Detail

      • newCell

        public void newCell​(int row,
                            int column,
                            java.lang.String value,
                            int mergedColStart)
        Specified by:
        newCell in interface org.drools.template.parser.DataListener
        Overrides:
        newCell in class DefaultRuleSheetListener
      • newRow

        public void newRow​(int rowNumber,
                           int columns)
        Specified by:
        newRow in interface org.drools.template.parser.DataListener
        Overrides:
        newRow in class DefaultRuleSheetListener
      • finishSheet

        public void finishSheet()
        Specified by:
        finishSheet in interface org.drools.template.parser.DataListener
        Overrides:
        finishSheet in class DefaultRuleSheetListener
      • postInitRuleTable

        protected void postInitRuleTable​(int row,
                                         int column,
                                         java.lang.String value)
        Description copied from class: DefaultRuleSheetListener
        Called after rule table initialisation. Subclasses may override this method to do additional processing.
        Overrides:
        postInitRuleTable in class DefaultRuleSheetListener
      • preInitRuleTable

        protected void preInitRuleTable​(int row,
                                        int column,
                                        java.lang.String value)
        This gets called each time a "new" rule table is found.
        Overrides:
        preInitRuleTable in class DefaultRuleSheetListener