ilog.rules.dt.expression
Class ExpressionInstance
- java.lang.Object
-
- ilog.rules.shared.model.IlrDecorableElementImpl
-
- ilog.rules.dt.model.common.impl.DTAbstractElement
-
- ilog.rules.dt.expression.Expression
-
- ilog.rules.dt.expression.ExpressionInstance
-
- All Implemented Interfaces:
- DTTimeStampable, IlrDTExpression, IlrDTExpressionInstance, IlrDTExpressionSentence, IlrDTExpressionText, IlrDTElement, IlrDecorableElement, java.io.Serializable, java.lang.Cloneable
- Direct Known Subclasses:
- MergedExpressionInstance
public class ExpressionInstance extends ilog.rules.dt.expression.Expression implements IlrDTExpressionInstance, IlrDTExpressionSentence
ExpressionInstancerepresents an expression used as a condition or an action in the DT model. AnExpressionInstanceobject refers to anExpressionDefinitioninstance and a list ofExpressionParameterobjects.- Since:
- JRules 7.0
- See Also:
IlrDTExpressionInstance, Serialized Form
-
-
Field Summary
-
Fields inherited from interface ilog.rules.dt.model.expression.IlrDTExpression
NIL
-
Fields inherited from interface ilog.rules.shared.model.IlrDecorableElement
INSTANCE, TRANSIENT, VOLATILE
-
-
Method Summary
Methods Modifier and Type Method and Description java.lang.Objectclone()Creates and returns a copy of this expression.IlrDTExpressionclone(IlrDTContext context)java.lang.ObjectcloneWithoutParameters()Creates and returns a copy of this expression.IlrDTExpressionDefinitiongetDefinition()Returns the definition associated with this expression instance.IlrDTContextgetDTContext()IlrDTErrorManagergetErrorManager()This method returns the error manager associated to this expressionIlrConceptgetExpressionConcept()Deprecated.IlrSyntaxTree.NodegetExpressionSyntaxNode()Returns the syntax node that represents this expression.IlrSyntaxTree.NodegetExpressionSyntaxNode(int index)If this expression has a syntax tree, the syntax node corresponding to a specific index is returned.java.lang.StringgetExpressionText()Returns the complete text of this expression.IlrSyntacticRolegetHolderRole()Deprecated.IlrConceptgetHolderRoleConcept()Deprecated.IlrDTExpressionRolegetHolderRoleExpression()Deprecated.IlrDTErrorManagergetLocalErrorManager()Returns the error manager used to store errors local to this instance.IlrDTExpressionParametergetParameter(int index)Returns the expression parameter at a specific index.IlrSyntacticRolegetParameterRole(int index)Deprecated.IlrConceptgetParameterRoleConcept(int index)Deprecated.intgetParameterRoleCount()Deprecated.IlrDTExpressionRolegetParameterRoleExpression(int index)Deprecated.java.util.List<IlrDTExpressionParameter>getParameters()Returns the list of expression parameters associated to this expression instance.IlrSentencegetSentence()Deprecated.IlrDTSentenceContextgetSentenceContext()Deprecated.IlrSyntacticRolegetSyntacticRole(IlrDTExpressionParameter param)Returns the syntactic role that corresponds to an expression parameter instance.booleanhasSyntacticErrors()Deprecated.booleanisExpressionValid()Tests if the expression is valid.booleanisValid()booleanreset()Drops all references to vocabulary, and will requires parsing.voidsetHolderRoleText(java.lang.String text)Deprecated.voidsetParameterRoleText(int index, java.lang.String text)Deprecated.voidsetParameterText(int index, java.lang.String text)Sets the text of the expression parameter at a specific index.voidsetSentenceContext(IlrDTSentenceContext sentenceContext)Deprecated.java.lang.StringtoString()-
Methods inherited from class ilog.rules.dt.model.common.impl.DTAbstractElement
getTimeStamp, setTimeStamp
-
Methods inherited from class ilog.rules.shared.model.IlrDecorableElementImpl
addProperties, clearProperties, clearVolatileProperties, getProperties, getProperty, setProperty
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ilog.rules.dt.model.expression.IlrDTExpression
equals
-
Methods inherited from interface ilog.rules.shared.model.IlrDecorableElement
addProperties, clearProperties, clearVolatileProperties, getProperties, getProperty, setProperty
-
Methods inherited from interface ilog.rules.dt.model.common.DTTimeStampable
getTimeStamp, setTimeStamp
-
-
-
-
Method Detail
-
getDefinition
public IlrDTExpressionDefinition getDefinition()
Description copied from interface:IlrDTExpressionInstanceReturns the definition associated with this expression instance.- Specified by:
getDefinitionin interfaceIlrDTExpressionInstance- Returns:
- The definition. This method cannot return
null.
-
getParameter
public IlrDTExpressionParameter getParameter(int index)
Description copied from interface:IlrDTExpressionInstanceReturns the expression parameter at a specific index.- Specified by:
getParameterin interfaceIlrDTExpressionInstance- Parameters:
index- This parameter corresponds to the index placeholder in the expression definition.- Returns:
- The expression parameter. If
indexis out of range,nullis returned.
-
getParameters
public java.util.List<IlrDTExpressionParameter> getParameters()
Description copied from interface:IlrDTExpressionInstanceReturns the list of expression parameters associated to this expression instance. This object contains one expression parameter per expression definition placeholder.- Specified by:
getParametersin interfaceIlrDTExpressionInstance- Returns:
- The list of expression parameters. The list returned cannot be
null. - See Also:
IlrDTExpressionDefinition
-
isExpressionValid
public boolean isExpressionValid()
Description copied from interface:IlrDTExpressionTextTests if the expression is valid. An expression is valid if it can be parsed against the current vocabulary without syntax error.The corresponding syntax tree for an invalid expression is either
nullor in error recovery.- Specified by:
isExpressionValidin interfaceIlrDTExpressionText- Returns:
- If the expression is syntactically valid,
trueis returned.
-
isValid
public boolean isValid()
-
getExpressionText
public java.lang.String getExpressionText()
Returns the complete text of this expression. The complete text is generated by substituting parameters with definition placeholders.- Specified by:
getExpressionTextin interfaceIlrDTExpressionText- Returns:
- The complete text of the expression.
-
getExpressionSyntaxNode
public IlrSyntaxTree.Node getExpressionSyntaxNode()
Returns the syntax node that represents this expression.- Specified by:
getExpressionSyntaxNodein interfaceIlrDTExpressionText- Returns:
- The syntax node that represents this expression.
-
getErrorManager
public IlrDTErrorManager getErrorManager()
Description copied from class:ilog.rules.dt.expression.ExpressionThis method returns the error manager associated to this expression- Specified by:
getErrorManagerin interfaceIlrDTExpression- Overrides:
getErrorManagerin classilog.rules.dt.expression.Expression- Returns:
- the error manager associated to the expression or a dummy error manager if not relevant for an expression
-
getLocalErrorManager
public IlrDTErrorManager getLocalErrorManager()
Description copied from interface:IlrDTExpressionInstanceReturns the error manager used to store errors local to this instance.- Specified by:
getLocalErrorManagerin interfaceIlrDTExpressionInstance- Returns:
- The local error manager. This error manager does not contains
errors in the expression parameters. The returned value cannot be
null.
-
getExpressionSyntaxNode
public IlrSyntaxTree.Node getExpressionSyntaxNode(int index)
Description copied from interface:IlrDTExpressionInstanceIf this expression has a syntax tree, the syntax node corresponding to a specific index is returned.- Specified by:
getExpressionSyntaxNodein interfaceIlrDTExpressionInstance- Specified by:
getExpressionSyntaxNodein interfaceIlrDTExpressionSentence- Parameters:
index- The place to retrieve the node from.- Returns:
- A syntax node.
-
clone
public java.lang.Object clone()
Creates and returns a copy of this expression.- Specified by:
clonein interfaceIlrDTExpression- Specified by:
clonein interfaceIlrDecorableElement- Returns:
- A clone of this expression containing its pattern, parameters and properties.
-
cloneWithoutParameters
public java.lang.Object cloneWithoutParameters()
Creates and returns a copy of this expression.- Returns:
- A clone of this expression containing its pattern but not its parameters.
-
reset
public boolean reset()
Description copied from interface:IlrDTExpressionDrops all references to vocabulary, and will requires parsing. Generally used when the context of the expression changes.- Specified by:
resetin interfaceIlrDTExpression
-
setParameterText
public void setParameterText(int index, java.lang.String text)Description copied from interface:IlrDTExpressionInstanceSets the text of the expression parameter at a specific index. Ifindexis out of range, nothing is done.- Specified by:
setParameterTextin interfaceIlrDTExpressionInstance- Parameters:
index- The place in this object to settext.text- The text to set atindex.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
clone
public IlrDTExpression clone(IlrDTContext context)
- Specified by:
clonein interfaceIlrDTExpression- Parameters:
context- The context of the cloned expression.- Returns:
- A copy of the expression attached to the given context.
-
getDTContext
public IlrDTContext getDTContext()
- Specified by:
getDTContextin interfaceIlrDTExpression- Returns:
- The DT context which connects the expression to its environment.
-
getHolderRole
public IlrSyntacticRole getHolderRole()
Deprecated.- Specified by:
getHolderRolein interfaceIlrDTExpressionSentence- Returns:
- The vocabulary syntactic role of the holder role expression.
-
getHolderRoleConcept
public IlrConcept getHolderRoleConcept()
Deprecated.- Specified by:
getHolderRoleConceptin interfaceIlrDTExpressionSentence- Returns:
- The vocabulary concept of the holder role expression.
-
getHolderRoleExpression
public IlrDTExpressionRole getHolderRoleExpression()
Deprecated.- Specified by:
getHolderRoleExpressionin interfaceIlrDTExpressionSentence- Returns:
- The expression corresponding to the holder role.
-
getParameterRole
public IlrSyntacticRole getParameterRole(int index)
Deprecated.- Specified by:
getParameterRolein interfaceIlrDTExpressionSentence- Parameters:
index- tTe position of the parameter.- Returns:
- The vocabulary syntactic roles of the parameter at position index.
-
getParameterRoleConcept
public IlrConcept getParameterRoleConcept(int index)
Deprecated.- Specified by:
getParameterRoleConceptin interfaceIlrDTExpressionSentence- Parameters:
index- The position of the parameter.- Returns:
- The vocabulary concept of the parameter at position index.
-
getParameterRoleCount
public int getParameterRoleCount()
Deprecated.- Specified by:
getParameterRoleCountin interfaceIlrDTExpressionSentence- Returns:
- The cardinality of the parameters of the sentence.
-
getParameterRoleExpression
public IlrDTExpressionRole getParameterRoleExpression(int index)
Deprecated.- Specified by:
getParameterRoleExpressionin interfaceIlrDTExpressionSentence- Parameters:
index- The position of the parameter.- Returns:
- The parameter role expression corresponding to the parameter at position index.
-
getSentenceContext
public IlrDTSentenceContext getSentenceContext()
Deprecated.- Specified by:
getSentenceContextin interfaceIlrDTExpressionSentence- Returns:
- The sentence context corresponding to the vocabulary sentence.
-
setHolderRoleText
public void setHolderRoleText(java.lang.String text)
Deprecated.Description copied from interface:IlrDTExpressionSentenceDefines the text of the holder expression.- Specified by:
setHolderRoleTextin interfaceIlrDTExpressionSentence- Parameters:
text- The new text of the holder role expression.
-
setParameterRoleText
public void setParameterRoleText(int index, java.lang.String text)Deprecated.- Specified by:
setParameterRoleTextin interfaceIlrDTExpressionSentence- Parameters:
index- The position of the parameter.text- The new text of the parameter.
-
setSentenceContext
public void setSentenceContext(IlrDTSentenceContext sentenceContext)
Deprecated.Description copied from interface:IlrDTExpressionSentenceDefines the sentence context of the expression sentence.- Specified by:
setSentenceContextin interfaceIlrDTExpressionSentence- Parameters:
sentenceContext- The new sentence context
-
getExpressionConcept
public IlrConcept getExpressionConcept()
Deprecated.Description copied from interface:IlrDTExpressionTextReturns the vocabulary concept associated with the expression.- Specified by:
getExpressionConceptin interfaceIlrDTExpressionText- Returns:
- The concept of the expression.
-
hasSyntacticErrors
public boolean hasSyntacticErrors()
Deprecated.Description copied from interface:IlrDTExpressionTextCheck if the expression has syntactic errors. return True if the expression has syntactic errors.- Specified by:
hasSyntacticErrorsin interfaceIlrDTExpressionText
-
getSentence
public IlrSentence getSentence()
Deprecated.
-
getSyntacticRole
public IlrSyntacticRole getSyntacticRole(IlrDTExpressionParameter param)
Description copied from interface:IlrDTExpressionInstanceReturns the syntactic role that corresponds to an expression parameter instance. The syntactic role is returned if:- The expression definition represents a sentence.
- The
paramargument is mapped to the sentence.
- Specified by:
getSyntacticRolein interfaceIlrDTExpressionInstance- Parameters:
param- The expression parameter to match.- Returns:
- A syntactic role. If the criteria are not matched,
nullis returned.
-
-