Interface VerbalChoice
- All Superinterfaces:
Choice
,Serializable
- All Known Implementing Classes:
AbstractPermutedChoice
,AbstractVerbalChoice
,ActionPermutedChoice
,SimpleTestPermutedChoice
,VerbalChoiceImpl
- Since:
- 12.1.2
Represents a Choice for the value of a
VerbalProperty
Sample Usage:To obtain the display value of a VerbalChoice 'verbalChoice'
verbalChoice.getValue(); // This can be used to construct a list of auto-complete suggestions
To construct the editable display value for setting parameters and setting the choice on a
VerbalRuleComponent
VerbalChoiceTokenizer vcTokenizer = verbalChoice.getVerbalChoiceTokenizer(); for(int k = 0; k < vcTokenizer.size(); k++) { VerbalChoiceToken token = vcTokenizer.get(k); String tokenValue = token.getValue(); switch(token.getType()){ case VerbalChoiceToken.Type.value: // Render tokenValue using a value editor case VerbalChoiceToken.Type.variable: // Render tokenValue using a variable chooser case VerbalChoiceToken.Type.expression: // Render tokenValue using an expression editor case VerbalChoiceToken.Type.text: // Render as Text uiComponentMap.put(uiComponent, token); } } verbalRuleComponent.setValue(verbalChoice);
To set the value of a required parameter in the VerbalChoice
VerbalChoiceToken token = uiComponentMap.get(uiComponent); token.setValue(uiComponent.getValue());
To Add an Expression in the VerbalChoice for the [in] operator
verbalChoice.addExpression(value);
To Remove an Expression from the VerbalChoice for the [in] operator
VerbalChoiceToken token = uiComponentMap.get(uiComponent); verbalChoice.removeExpression(token);
- Author:
- gopandey
-
Nested Class Summary
Nested classes/interfaces inherited from interface oracle.rules.sdk2.dictionary.Choice
Choice.Kind
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExpression
(String value) Adds an Expression to the VerbalChoice if and only ifcanAddExpression()
is true.void
addExpression
(Choice value) Adds an Expression to the VerbalChoice if and only ifcanAddExpression()
is true.boolean
Can be used to check if Expressions can be added to this VerbalChoiceboolean
Can be used to check if Expressions can be removed from this VerbalChoiceA list of VerbalChoices that are similar to this choice.Get a tokenizer to compute the display value of the VerbalChoice.boolean
Check if the VerbalChoice has any required parametersboolean
Does this VerbalChoice represent a new Definitionvoid
Removes an expression from the VerbalChoice if and only ifcanRemoveExpression(oracle.rules.sdk2.dictionary.VerbalChoiceToken)
is true and there are more than two Expressions.Methods inherited from interface oracle.rules.sdk2.dictionary.Choice
getAltValue, getChildren, getDefinition, getDescription, getDescription, getID, getKind, getListContentType, getListContentType, getListContentTypeID, getLiteralValue, getName, getName, getParent, getTranslatedName, getTranslatedValue, getTranslatedValue, getType, getType, getTypeID, getValue, getValue, getVerbalValue, getVerbalValue, isAssignable, isAssignablePrefix, isExpanded, isGlobal, isQualified, isSelectable, isStatic, isTestable
-
Field Details
-
VERBAL_CHOICE_EXPR
Place holder translated property for expressions- See Also:
-
VERBAL_CHOICE_TYPE
Place holder translated property for expressions- See Also:
-
VERBAL_CHOICE_VAR
Place holder translated property for variables- See Also:
-
-
Method Details
-
getVerbalChoiceTokenizer
VerbalChoiceTokenizer getVerbalChoiceTokenizer()Get a tokenizer to compute the display value of the VerbalChoice. Tokens can be used to identify expressions and variables and to set their values in the VerbalChoice.- Returns:
- VerbalChoiceTokenizer
-
addExpression
Adds an Expression to the VerbalChoice if and only ifcanAddExpression()
is true. Else, this is a no-op. Adding an Expression resets the VerbalChoice. To obtain the new display value for the VerbalChoice, MUST iterate through theVerbalChoiceTokenizer
from the beginning- Parameters:
value
- Expression Value
-
addExpression
Adds an Expression to the VerbalChoice if and only ifcanAddExpression()
is true. Else, this is a no-op. Adding an Expression resets the VerbalChoice. To obtain the new display value for the VerbalChoice, MUST iterate through theVerbalChoiceTokenizer
from the beginning- Parameters:
value
- Choice representing the Expression Value
-
removeExpression
Removes an expression from the VerbalChoice if and only ifcanRemoveExpression(oracle.rules.sdk2.dictionary.VerbalChoiceToken)
is true and there are more than two Expressions. Else, this is a no-op. Removing an Expression resets the VerbalChoice. To obtain the new display value for the VerbalChoice, MUST iterate through theVerbalChoiceTokenizer
from the beginning- Parameters:
token
- Token representing the Expression to be removed
-
canAddExpression
boolean canAddExpression()Can be used to check if Expressions can be added to this VerbalChoice- Returns:
- true if this VerbalChoice is for a SimpleTest and has the [in] operator, false otherwise
-
canRemoveExpression
Can be used to check if Expressions can be removed from this VerbalChoice- Parameters:
token
- Token representing the Expression to be removed- Returns:
- true if this VerbalChoice is for a SimpleTest and has the [in] operator and has more than 2 expressions, false otherwise
-
hasParameters
boolean hasParameters()Check if the VerbalChoice has any required parameters- Returns:
- true if the VerbalChoice has any parameters, false otherwise
-
getSimilarChoices
List<VerbalChoice> getSimilarChoices()A list of VerbalChoices that are similar to this choice. If the VerbalChoice is for a SimpleTest, the returned list would be the choices with the same left and right expressions, with different operators. If the VerbalChoice is for an Action, this may not be relevant.- Returns:
- a list of similar VerbalChoices
-
isNewDefinition
boolean isNewDefinition()Does this VerbalChoice represent a new Definition- Returns:
- true if the VerbalChoice represents a new Definition, false otherwise
-