org.drools.decisiontable.model
Class Rule

java.lang.Object
  extended byorg.drools.decisiontable.model.DRLElement
      extended byorg.drools.decisiontable.model.Rule
All Implemented Interfaces:
DRLJavaEmitter

public class Rule
extends DRLElement
implements DRLJavaEmitter

 

Constructor Summary
Rule(java.lang.String name, java.lang.Integer salience, int spreadsheetRow)
          Create a new rule.
 
Method Summary
 void addCondition(Condition con)
           
 void addConsequence(Consequence con)
           
 void appendDescription(java.lang.String value)
           
static int calcSalience(int rowNumber)
           
static java.lang.String convertColNumToColName(int i)
           
 java.lang.String getActivationGroup()
           
 java.util.List getConditions()
           
 java.util.List getConsequences()
           
 java.lang.String getDescription()
           
 java.lang.String getDuration()
           
 java.lang.String getName()
           
 boolean getNoLoop()
           
 java.lang.Integer getSalience()
           
 int getSpreadsheetRowNumber()
           
 void renderDRL(DRLOutput out)
          Each node can add its contribution to the output
 void setActivationrGroup(java.lang.String value)
           
 void setDescription(java.lang.String value)
           
 void setDuration(Duration value)
           
 void setName(java.lang.String value)
           
 void setNoLoop(java.lang.String value)
           
 void setSalience(java.lang.Integer value)
           
 
Methods inherited from class org.drools.decisiontable.model.DRLElement
setComment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rule

public Rule(java.lang.String name,
            java.lang.Integer salience,
            int spreadsheetRow)
Create a new rule. Note that the rule name should be post-fixed with the row number, as one way of providing tracability for errors back to the originating spreadsheet.

Parameters:
name - The name of the rule. This may be used to calculate DRL row error to Spreadsheet row error (just need to keep track of output lines, and map spreadsheetRow to a start and end range in the rendered output).
salience -
spreadsheetRow - The phyical row number from the spreadsheet.
Method Detail

addCondition

public void addCondition(Condition con)

addConsequence

public void addConsequence(Consequence con)

renderDRL

public void renderDRL(DRLOutput out)
Description copied from interface: DRLJavaEmitter
Each node can add its contribution to the output

Specified by:
renderDRL in interface DRLJavaEmitter

calcSalience

public static int calcSalience(int rowNumber)

convertColNumToColName

public static java.lang.String convertColNumToColName(int i)
Returns:
The spreadsheet name for this col number, such as "AA" or "AB" or "A" and such and such.

getConditions

public java.util.List getConditions()

getConsequences

public java.util.List getConsequences()

setSalience

public void setSalience(java.lang.Integer value)

getSalience

public java.lang.Integer getSalience()

setName

public void setName(java.lang.String value)

getName

public java.lang.String getName()

setDescription

public void setDescription(java.lang.String value)

appendDescription

public void appendDescription(java.lang.String value)

getDescription

public java.lang.String getDescription()

setDuration

public void setDuration(Duration value)

getDuration

public java.lang.String getDuration()

setActivationrGroup

public void setActivationrGroup(java.lang.String value)

getActivationGroup

public java.lang.String getActivationGroup()

setNoLoop

public void setNoLoop(java.lang.String value)

getNoLoop

public boolean getNoLoop()

getSpreadsheetRowNumber

public int getSpreadsheetRowNumber()
Returns:
The row in the spreadsheet this represents. This can be handy when mapping a line error from Parser back to the rule row. Will need to have a map of ranges of line numbers that each rule covers. Then can find out the rule that cause it, and this will give the row number to report.