public class RuleModel extends Object implements org.kie.soup.project.datamodel.imports.HasImports, org.kie.soup.project.datamodel.packages.HasPackageName
Modifier and Type | Field and Description |
---|---|
RuleAttribute[] |
attributes |
IPattern[] |
lhs |
RuleMetadata[] |
metadataList |
String |
modelVersion |
String |
name
This name is generally not used - the asset name or the file name is
preferred (ie it could get out of sync with the name of the file it is
in).
|
String |
parentName |
IAction[] |
rhs |
Constructor and Description |
---|
RuleModel() |
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(RuleAttribute attribute) |
void |
addLhsItem(IPattern pat) |
void |
addLhsItem(IPattern pat,
boolean append) |
void |
addLhsItem(IPattern pat,
int position) |
void |
addMetadata(RuleMetadata metadata)
Add metaData
|
void |
addRhsItem(IAction action) |
void |
addRhsItem(IAction action,
boolean append) |
void |
addRhsItem(IAction action,
int position) |
boolean |
equals(Object o) |
List<String> |
getAllLHSVariables()
This will get a list of all LHS bound variables, including bound fields..
|
List<String> |
getAllRHSVariables()
This will get a list of all RHS bound variables.
|
List<String> |
getAllVariables()
This will get a list of all bound variables (LHS and RHS), including bound fields..
|
List<String> |
getBoundVariablesInScope(BaseSingleFieldConstraint con)
This uses a deceptively simple algorithm to determine what bound
variables are in scope for a given constraint (including connectives).
|
List<String> |
getFieldBinding(FieldConstraint f) |
String |
getFieldBinding(FieldConstraint fc,
String var) |
org.kie.soup.project.datamodel.imports.Imports |
getImports() |
String |
getLHSBindingType(String var)
Get the data-type associated with the binding
|
FactPattern |
getLHSBoundFact(String var)
This will return the FactPattern that a variable is bound Eto.
|
List<String> |
getLHSBoundFacts()
This will return a List
|
SingleFieldConstraint |
getLHSBoundField(String var)
This will return the FieldConstraint that a variable is bound to.
|
FactPattern |
getLHSParentFactPatternForBinding(String var)
This will return the FactPattern that a variable is bound to.
|
List<String> |
getLHSPatternVariables()
This will get a list of all LHS bound variables, excluding bound fields
|
List<String> |
getLHSVariables(boolean includePatterns,
boolean includeFields) |
RuleMetadata |
getMetaData(String attributeName)
Locate metadata element
|
String |
getPackageName() |
ActionInsertFact |
getRHSBoundFact(String var)
This will return the ActionInsertFact that a variable is bound to.
|
List<String> |
getRHSBoundFacts()
This will return a List
|
boolean |
hasDSLSentences()
Returns true if any DSLSentences are used.
|
int |
hashCode() |
boolean |
isBoundFactUsed(String binding) |
boolean |
isNegated()
Is the Rule to be negated, i.e.
|
boolean |
isVariableNameUsed(String s)
Checks to see if a variable is used or not, includes fields as well as
facts.
|
void |
moveLhsItemDown(int itemIndex) |
void |
moveLhsItemUp(int itemIndex) |
void |
moveRhsItemDown(int itemIndex) |
void |
moveRhsItemUp(int itemIndex) |
void |
removeAttribute(int idx) |
boolean |
removeLhsItem(int idx) |
void |
removeMetadata(int idx) |
void |
removeRhsItem(int idx) |
void |
setImports(org.kie.soup.project.datamodel.imports.Imports imports) |
void |
setNegated(boolean isNegated)
Set whether the Rule is to be negated
|
void |
setPackageName(String packageName) |
boolean |
updateMetadata(RuleMetadata target)
Update metaData element if it exists or add it otherwise
|
public String name
public String parentName
public String modelVersion
public RuleAttribute[] attributes
public RuleMetadata[] metadataList
public IPattern[] lhs
public IAction[] rhs
public List<String> getLHSBoundFacts()
public FactPattern getLHSBoundFact(String var)
var
- The bound fact variable (NOT bound field).public SingleFieldConstraint getLHSBoundField(String var)
var
- The bound field variable (NOT bound fact).public String getLHSBindingType(String var)
var
- public String getFieldBinding(FieldConstraint fc, String var)
public List<String> getRHSBoundFacts()
public ActionInsertFact getRHSBoundFact(String var)
var
- The bound fact variable (NOT bound field).public FactPattern getLHSParentFactPatternForBinding(String var)
var
- The variable bindingpublic List<String> getAllLHSVariables()
public List<String> getLHSPatternVariables()
public List<String> getAllRHSVariables()
public List<String> getAllVariables()
public List<String> getFieldBinding(FieldConstraint f)
public boolean removeLhsItem(int idx)
idx
- Remove this index from the LHS. returns false if it was NOT
allowed to remove this item (ie it is used on the RHS).public boolean isBoundFactUsed(String binding)
binding
- The name of the LHS fact binding.public void addLhsItem(IPattern pat)
public void addLhsItem(IPattern pat, boolean append)
public void addLhsItem(IPattern pat, int position)
public void moveLhsItemDown(int itemIndex)
public void moveLhsItemUp(int itemIndex)
public void moveRhsItemDown(int itemIndex)
public void moveRhsItemUp(int itemIndex)
public void addRhsItem(IAction action)
public void addRhsItem(IAction action, boolean append)
public void addRhsItem(IAction action, int position)
public void removeRhsItem(int idx)
public void addAttribute(RuleAttribute attribute)
public void removeAttribute(int idx)
public void addMetadata(RuleMetadata metadata)
metadata
- public void removeMetadata(int idx)
public RuleMetadata getMetaData(String attributeName)
attributeName
- - value to look forpublic boolean updateMetadata(RuleMetadata target)
target
- public List<String> getBoundVariablesInScope(BaseSingleFieldConstraint con)
public boolean isVariableNameUsed(String s)
public boolean hasDSLSentences()
public boolean isNegated()
public void setNegated(boolean isNegated)
isNegated
- public org.kie.soup.project.datamodel.imports.Imports getImports()
getImports
in interface org.kie.soup.project.datamodel.imports.HasImports
public void setImports(org.kie.soup.project.datamodel.imports.Imports imports)
setImports
in interface org.kie.soup.project.datamodel.imports.HasImports
public String getPackageName()
getPackageName
in interface org.kie.soup.project.datamodel.packages.HasPackageName
public void setPackageName(String packageName)
setPackageName
in interface org.kie.soup.project.datamodel.packages.HasPackageName
Copyright © 2001–2018 JBoss by Red Hat. All rights reserved.