public class IlrDTHelper
extends java.lang.Object
implements ilog.rules.dt.model.IlrDTProperties
IlrDTHelper provides helper methods used to manipulate a DT.| Constructor and Description |
|---|
IlrDTHelper() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
containsOtherwise(IlrDTPartition partition)
Tests if a partition contains an otherwise expression.
|
static IlrDTController |
createDTController(IlrDTRuleElement dtRuleElement,
IlrDTEnvironment dtEnvironment)
This method is a helper to create a DTController from a given DTRuleElement, a DT environment.
|
static IlrDTController |
createDTController(IlrDTRuleElement dtRuleElement,
IlrDTEnvironment dtEnvironment,
org.w3c.dom.Node dom)
This method is a helper to create a DTController from a given DTRuleElement, a DT environment and a content given as a DOM fragment.
|
static IlrDTController |
createDTController(IlrDTRuleElement dtRuleElement,
IlrDTEnvironment dtEnvironment,
org.w3c.dom.Node dom,
boolean check,
java.util.Collection errors)
This method is a helper to create a DTController from a given DTRuleElement, a DT environment and a content given as a DOM fragment.
|
static IlrDTController |
createDTController(IlrDTRuleElement dtRuleElement,
IlrDTEnvironment dtEnvironment,
java.io.Reader content)
This method is a helper to create a DTController from a given DTRuleElement, an environment and a content given as Reader.
|
static IlrDTController |
createDTController(IlrDTRuleElement dtRuleElement,
IlrDTEnvironment dtEnvironment,
java.io.Reader content,
boolean check,
java.util.Collection errors)
This method is a helper to create a DTController from a given DTRuleElement, a DT environment and a content given as a Reader.
|
static IlrDTPartitionItem |
createPartitionItemAt(IlrDTModel dtModel,
int row,
int column)
Creates a partition item and fills it with the default expression of
its definition if no partition item exist at a specific row and column.
|
static IlrDTDefinition |
getDefinition(IlrDTModel dtModel,
int columnIndex)
Returns the definition in a specific column.
|
static IlrDTExpressionHandler |
getExpressionHandler(IlrDTModel dtModel,
int rowIndex,
int columnIndex)
Returns the expression handler at row/column, a partition item or an action, depending on the column.
|
static java.lang.String |
getHTMLTable(IlrDTController controller)
Computes an HTML table representation of the given decision table model.
|
static java.lang.String |
getHTMLTable(IlrDTController controller,
boolean showEmptyRow,
boolean includeCSS)
Computes an HTML table representation of the given decision table model.
|
static java.lang.String |
getHTMLTable(IlrDTController controller,
boolean showEmptyRow,
boolean includeCSS,
boolean inlineStyle)
Deprecated.
inlineStyle option has no effect
|
static java.lang.String |
getIRLCode(IlrDTController dtController,
java.util.Collection errors)
Converts the given DT Model represented by its controller into IRL code.
|
static int |
getOtherwiseItemCount(IlrDTPartition partition)
Gets the number of Otherwise items in a partition.
|
static IlrDTPartitionItem |
getPartitionItem(IlrDTModel dtModel,
int rowIndex,
int columnIndex)
Returns the partition item at a specific row and column.
|
static java.lang.String |
getPreconditionHTMLText(IlrDTController controller)
This method returns the HTML of the preconditions of the given DT represented by its controller.
|
static java.lang.String |
getPreconditionsText(IlrDTModel dtModel)
Returns the precondition of the dtModel.
|
static java.lang.String |
getRuleHTMLText(IlrDTController controller,
IlrDTActionSet as,
boolean includeComment)
Return an HTML representation of the rule corresponding of the given Action Set
|
static java.lang.String |
getRuleText(IlrDTController controller,
IlrDTActionSet as)
Returns the BAL text of a row in a decision table or the action node of a
decision tree represented by the given ActionSet for the DT
represented by its controller.
|
static org.w3c.dom.Node |
getXML(IlrDTController dtController)
Creates an XML serialization of the model.
|
static boolean |
hasInvalidDefinitions(IlrDTModel dtModel,
boolean checkOverriddenExpressions)
This method returns whether the given DT has some invalid definition expressions.
|
static boolean |
isTree(IlrDTModel dtModel)
Tests if the model is a decision tree or a decision table.
|
static void |
setPreconditionsText(IlrDTModel dtModel,
java.lang.String text)
Changes the guard condition of the
IlrDTModel. |
public static boolean isTree(IlrDTModel dtModel)
dtModel - The DT model to test.true is returned.
If the model is a decision table, false is returned.public static int getOtherwiseItemCount(IlrDTPartition partition)
partition - The partition to test.public static boolean containsOtherwise(IlrDTPartition partition)
partition - The partition to test.true
is returned.public static IlrDTPartitionItem createPartitionItemAt(IlrDTModel dtModel, int row, int column)
getPartitionItem(IlrDTModel, int, int)public static IlrDTPartitionItem getPartitionItem(IlrDTModel dtModel, int rowIndex, int columnIndex)
rowIndex,
columnIndex. This method may return null.createPartitionItemAt(IlrDTModel, int, int)public static IlrDTDefinition getDefinition(IlrDTModel dtModel, int columnIndex)
columnIndex.public static IlrDTExpressionHandler getExpressionHandler(IlrDTModel dtModel, int rowIndex, int columnIndex)
public static java.lang.String getRuleText(IlrDTController controller, IlrDTActionSet as)
controller - the DT Controller representing the Decision Table or the Decision Treeas - the action set representing the Row or the Action Nodepublic static java.lang.String getRuleHTMLText(IlrDTController controller, IlrDTActionSet as, boolean includeComment)
controller - as - the action set representing the Row or the Action Nodepublic static java.lang.String getHTMLTable(IlrDTController controller, boolean showEmptyRow, boolean includeCSS, boolean inlineStyle)
controller - showEmptyRow - includeCSS - inlineStyle - public static java.lang.String getHTMLTable(IlrDTController controller, boolean showEmptyRow, boolean includeCSS)
controller - The DT controller.showEmptyRow - Set to true to print empty rows.includeCSS - Set to true to include CSS definitions in the
generated HTML.public static java.lang.String getHTMLTable(IlrDTController controller)
controller - The DT controller.public static java.lang.String getPreconditionHTMLText(IlrDTController controller)
controller - the DT Controller representing the DT for which we would like to have the preconditionspublic static java.lang.String getPreconditionsText(IlrDTModel dtModel)
dtModel - The DT model to get the preconditions from.public static void setPreconditionsText(IlrDTModel dtModel, java.lang.String text)
IlrDTModel.dtModel - The DT model to set the preconditions text.text - The new precondition of the model.public static IlrDTController createDTController(IlrDTRuleElement dtRuleElement, IlrDTEnvironment dtEnvironment)
dtRuleElement - the DTRuleElement represented the Decision Table or Tree.dtEnvironment - the environment in which the controller is builtpublic static IlrDTController createDTController(IlrDTRuleElement dtRuleElement, IlrDTEnvironment dtEnvironment, org.w3c.dom.Node dom)
dtRuleElement - the DTRuleElement represented the Decision Table or Tree.dtEnvironment - the environment in which the controller is builtdom - the root element of the DOM representing the content of the Decision Table or Tree. If null, the DT model will stay empty.public static IlrDTController createDTController(IlrDTRuleElement dtRuleElement, IlrDTEnvironment dtEnvironment, java.io.Reader content)
dtRuleElement - the DTRuleElement represented the Decision Table or Tree.dtEnvironment - the environment in which the controller is builtcontent - a reader that contains the XML of the Decision Table or Tree content. If null, the DT model will stay empty. The root node of the XML fragment
is supposed to be <DT>.public static IlrDTController createDTController(IlrDTRuleElement dtRuleElement, IlrDTEnvironment dtEnvironment, java.io.Reader content, boolean check, java.util.Collection errors)
dtRuleElement - the DTRuleElement represented the Decision Table or Tree.dtEnvironment - the environment in which the controller is builtcontent - a reader that contains the XML of the Decision Table or Tree content. If null, the DT model will stay empty. The root node of the XML fragment
is supposed to be <DT>.check - if true, the model is checked after beeing load.errors - if not null, errors are collected and added to this collectionpublic static IlrDTController createDTController(IlrDTRuleElement dtRuleElement, IlrDTEnvironment dtEnvironment, org.w3c.dom.Node dom, boolean check, java.util.Collection errors)
dtRuleElement - the DTRuleElement represented the Decision Table or Tree.dtEnvironment - the environment in which the controller is builtdom - the root element of the DOM representing the content of the Decision Table or Tree. If null, the DT model will stay empty.check - if true, the model is checked after being load.errors - if not null and check is true, errors are collected and added to this collectionpublic static org.w3c.dom.Node getXML(IlrDTController dtController)
dtController - The dt controller.public static java.lang.String getIRLCode(IlrDTController dtController, java.util.Collection errors)
dtController - The DT controller representing the DT Model.errors - If provided, translation errors may be reported in this listpublic static boolean hasInvalidDefinitions(IlrDTModel dtModel, boolean checkOverriddenExpressions)
dtModel - checkOverriddenExpressions - if true, definition of condition overriding their column are also checked.© Copyright IBM Corp. 1987, 2017