Skip navigation links

Oracle Business Rules Java API Reference
10g (10.1.3.1.0)

B28966-01


oracle.rules.sdk.editor.ruleset
Class AdvancedExpression

java.lang.Object
  extended byjava.util.AbstractMap
      extended byjava.util.HashMap
          extended byoracle.rules.sdk.editor.ruleset.RuleComponent
              extended byoracle.rules.sdk.editor.ruleset.AdvancedExpression

All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class AdvancedExpression
extends RuleComponent

An AdvancedExpression is a String consisting of variables, calls, literals, and operators. AdvancedExpression parses the input String and returns information about the location and source of errors. It also provides option choices for operators and expression terms.

The rules expression language supported by the rule SDK is the same as RL with the following exceptions:

An AdvancedExpresson can be used either as a Pattern test or as an Action parameter.

See Also:
Serialized Form

Field Summary
static java.lang.String PROP_CONSTANT
           
static java.lang.String PROP_CONSTRUCTOR
           
static java.lang.String PROP_CURSOR_POSITION
           
static java.lang.String PROP_FUNCTION
           
static java.lang.String PROP_OPERATOR
           
static java.lang.String PROP_TOKEN_UNDER_CURSOR
           
static java.lang.String PROP_VALUE
           
static java.lang.String PROP_VARIABLE
           

 

Constructor Summary
AdvancedExpression(oracle.rules.sdk.datamodel.DataModel dataModel)
           
AdvancedExpression(oracle.rules.sdk.datamodel.DataModel dataModel, java.lang.String varDefID)
          This constructor is for internal use by the DataModel editor.

 

Method Summary
 java.lang.String append(java.lang.String str)
          Append the given string to the end of the existing Value Behavior is the same as the append method of java.lang.StringBuffer, except that a null value of str inserts the String "null".
 int[][] balanced()
          Matches up operators which come in pairs, such as ( ), then returns an array of ordered pairs of the matches.
 void checkUse(java.lang.String factType, java.lang.String op)
           
 java.lang.Object get(java.lang.Object key)
          Generic property getter inheirited from RuleComponent.
 java.lang.String getConstant()
           
 java.lang.String getConstantConstraint()
           
 java.lang.String[] getConstantOptions()
           
 int getConstantSelected()
           
 java.lang.String getConstructor()
           
 java.lang.String getConstructorConstraint()
           
 java.lang.String[] getConstructorOptions()
           
 int getConstructorSelected()
           
 int getCursorPosition()
           
 java.lang.String getFunction()
           
 java.lang.String getFunctionConstraint()
           
 java.lang.String[] getFunctionOptions()
           
 int getFunctionSelected()
           
 java.lang.String getOperator()
           
 java.lang.String getOperatorConstraint()
           
 java.lang.String[] getOperatorOptions()
           
 int getOperatorSelected()
           
 java.lang.String[] getPropertyNames()
           
 java.lang.String getResultType()
           
 Token getTokenUnderCursor()
          If the cursor is in a token or white space preceeding the token, returns a description of the token.
 java.lang.String getValue()
           
 java.lang.String getValueConstraint()
           
 java.lang.String[] getValueOptions()
           
 int getValueSelected()
           
 java.lang.String getVariable()
           
 java.lang.String getVariableConstraint()
           
 java.lang.String[] getVariableOptions()
           
 int getVariableSelected()
           
 java.lang.String insert(int offset, java.lang.String str)
          Insert the given string at the given position of the Value.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Generic property setter.
 java.lang.String replace(int start, int end, java.lang.String str)
          Insert the given string at the given position of the Value String.
 void setConstant(java.lang.String constant)
           
 void setConstantConstraint(java.lang.String constantConstraint)
           
 void setConstantOptions(java.lang.String[] constantOptions)
           
 void setConstructor(java.lang.String constructor)
           
 void setConstructorConstraint(java.lang.String constructorConstraint)
           
 void setConstructorOptions(java.lang.String[] constructorOptions)
           
 void setCursorPosition(int cursorPosition)
           
 void setFunction(java.lang.String function)
           
 void setFunctionConstraint(java.lang.String functionConstraint)
           
 void setFunctionOptions(java.lang.String[] functionOptions)
           
 void setOperator(java.lang.String operator)
           
 void setOperatorConstraint(java.lang.String operatorConstraint)
           
 void setOperatorOptions(java.lang.String[] operatorOptions)
           
 void setShowConstructorsWithFunctions(boolean b)
          Include Constructors in the Function options list
 void setValue(java.lang.String value)
           
 void setValueConstraint(java.lang.String valueConstraint)
           
 void setValueOptions(java.lang.String[] valueOptions)
           
 void setVariable(java.lang.String variable)
           
 void setVariableConstraint(java.lang.String variableConstraint)
           
 void setVariableOptions(java.lang.String[] variableOptions)
           
 int[] unbalanced()
          Matches up operators which come in pairs, such as ( ), then returns an array of integers indicating unmatched grouping operators.
 void validate()
          Validate the expression.

 

Methods inherited from class oracle.rules.sdk.editor.ruleset.RuleComponent
clear, discardCopy, get, getConstraint, getConstraintList, getCustom, getDescription, getID, getOptions, getParent, getParentTable, getRange, getRuleDictionary, getSelected, remove, restoreCopy, saveCopy, setCustom, setDescription, setRuleDictionary, toString

 

Methods inherited from class java.util.HashMap
clone, containsKey, containsValue, entrySet, isEmpty, keySet, putAll, size, values

 

Methods inherited from class java.util.AbstractMap
equals, hashCode

 

Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait

 

Methods inherited from interface java.util.Map
equals, hashCode

 

Field Detail

PROP_VALUE

public static final java.lang.String PROP_VALUE
See Also:
Constant Field Values

PROP_CURSOR_POSITION

public static final java.lang.String PROP_CURSOR_POSITION
See Also:
Constant Field Values

PROP_CONSTANT

public static final java.lang.String PROP_CONSTANT
See Also:
Constant Field Values

PROP_OPERATOR

public static final java.lang.String PROP_OPERATOR
See Also:
Constant Field Values

PROP_VARIABLE

public static final java.lang.String PROP_VARIABLE
See Also:
Constant Field Values

PROP_FUNCTION

public static final java.lang.String PROP_FUNCTION
See Also:
Constant Field Values

PROP_CONSTRUCTOR

public static final java.lang.String PROP_CONSTRUCTOR
See Also:
Constant Field Values

PROP_TOKEN_UNDER_CURSOR

public static final java.lang.String PROP_TOKEN_UNDER_CURSOR
See Also:
Constant Field Values

Constructor Detail

AdvancedExpression

public AdvancedExpression(oracle.rules.sdk.datamodel.DataModel dataModel)

AdvancedExpression

public AdvancedExpression(oracle.rules.sdk.datamodel.DataModel dataModel,
                          java.lang.String varDefID)
This constructor is for internal use by the DataModel editor. It is used in defining initial expression for variables and constants. Such an expression cannot contain references to itself or any variable defined after it (RL restriction).
Parameters:
dataModel -
varDefID - - the id of the variable being defined.

Method Detail

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Description copied from class: RuleComponent
Generic property setter. Throws runtime exceptions for incorrect arguments. Please see the specific bean class for a list of properties, their types, and permissible values.

A put() with either null key or null value throws a NullPointerException.

A put() with a key that is not a String throws a ClassCastException

A put() of a value that is not of the correct type for the key throws a ClassCastException.

Bean properties which have no set() method are read only, and cannot be modified using the put(). Attempting to do so throws a runtime IllegalArgumentException. PROP_ID, and PROP_*_SELECTED are always read only.

Specified by:
put in interface java.util.Map
Overrides:
put in class RuleComponent
Parameters:
key - the key of the property to set
value - the value of the named property to set
Returns:
the previous value of the property

get

public java.lang.Object get(java.lang.Object key)
Description copied from class: RuleComponent
Generic property getter inheirited from RuleComponent.

Please see the specific bean class for a list of properties.

Specified by:
get in interface java.util.Map
Overrides:
get in class RuleComponent
Parameters:
key - a String containing the property name to be fetched.
Returns:
the value corresponding to the key: a String, String[], RuleComponent, or RuleComponentTable

setShowConstructorsWithFunctions

public void setShowConstructorsWithFunctions(boolean b)
Include Constructors in the Function options list

balanced

public int[][] balanced()
Matches up operators which come in pairs, such as ( ), then returns an array of ordered pairs of the matches. The integer is the offset into the expression String. This allows applications to indicate to in the view which grouping operators are paired.
Returns:
an Array of ordered pairs (dimensions int [][2])of indexes into the expression String

unbalanced

public int[] unbalanced()
Matches up operators which come in pairs, such as ( ), then returns an array of integers indicating unmatched grouping operators. The integer is the offset into the expression String.
Returns:
an array of offsets into the expression String

validate

public void validate()
              throws RuleEditorException,
                     RuleEditorSDKException
Validate the expression. RuleEditorException records parser begin and end offset of errors.
Overrides:
validate in class RuleComponent
Throws:
RuleEditorException, - RuleEditorSDKException then stops further validation
RuleEditorSDKException - incorrect SDK usage
RuleEditorException - for user input errors

getResultType

public java.lang.String getResultType()

checkUse

public void checkUse(java.lang.String factType,
                     java.lang.String op)
              throws RuleEditorException
Throws:
RuleEditorException

insert

public java.lang.String insert(int offset,
                               java.lang.String str)
Insert the given string at the given position of the Value. Behavior is the same as the insert method of java.lang.StringBuffer, except that invalid values for start and end are adjusted to the closest valid values, and a null value of str inserts the String "null". No exceptions are thrown.
  0 <= offset <= getExpression.length()
Parameters:
offset - where to insert the text, 0 based
str - the text to insert
Returns:
the new String (also available by calling getValue()

replace

public java.lang.String replace(int start,
                                int end,
                                java.lang.String str)
Insert the given string at the given position of the Value String. Behavior is the same as the replace method of java.lang.StringBuffer, except that invalid values for start and end are adjusted to the closest valid values, and a null value of str inserts the String "null". No exceptions are thrown.
  0 <= start <= end <= getExpression.length()
Parameters:
start - beginning index of substring to replace, 0 based
end - ending index of substring to replace, 0 based
str - the text to insert
Returns:
the new String (also available by calling getValue()

append

public java.lang.String append(java.lang.String str)
Append the given string to the end of the existing Value Behavior is the same as the append method of java.lang.StringBuffer, except that a null value of str inserts the String "null". No exceptions are thrown.
Parameters:
str - the String to append
Returns:
the new String (also available by calling getValue()

getPropertyNames

public java.lang.String[] getPropertyNames()
Overrides:
getPropertyNames in class RuleComponent

getValue

public java.lang.String getValue()

setValue

public void setValue(java.lang.String value)

getValueConstraint

public java.lang.String getValueConstraint()

setValueConstraint

public void setValueConstraint(java.lang.String valueConstraint)

getValueOptions

public java.lang.String[] getValueOptions()

setValueOptions

public void setValueOptions(java.lang.String[] valueOptions)

getValueSelected

public int getValueSelected()

getCursorPosition

public int getCursorPosition()

setCursorPosition

public void setCursorPosition(int cursorPosition)

getConstant

public java.lang.String getConstant()

setConstant

public void setConstant(java.lang.String constant)

getConstantConstraint

public java.lang.String getConstantConstraint()

setConstantConstraint

public void setConstantConstraint(java.lang.String constantConstraint)

getConstantOptions

public java.lang.String[] getConstantOptions()

setConstantOptions

public void setConstantOptions(java.lang.String[] constantOptions)

getConstantSelected

public int getConstantSelected()

getOperator

public java.lang.String getOperator()

setOperator

public void setOperator(java.lang.String operator)

getOperatorConstraint

public java.lang.String getOperatorConstraint()

setOperatorConstraint

public void setOperatorConstraint(java.lang.String operatorConstraint)

getOperatorOptions

public java.lang.String[] getOperatorOptions()

setOperatorOptions

public void setOperatorOptions(java.lang.String[] operatorOptions)

getOperatorSelected

public int getOperatorSelected()

getVariable

public java.lang.String getVariable()

setVariable

public void setVariable(java.lang.String variable)

getVariableConstraint

public java.lang.String getVariableConstraint()

setVariableConstraint

public void setVariableConstraint(java.lang.String variableConstraint)

getVariableOptions

public java.lang.String[] getVariableOptions()

setVariableOptions

public void setVariableOptions(java.lang.String[] variableOptions)

getVariableSelected

public int getVariableSelected()

getFunction

public java.lang.String getFunction()

setFunction

public void setFunction(java.lang.String function)

getFunctionConstraint

public java.lang.String getFunctionConstraint()

setFunctionConstraint

public void setFunctionConstraint(java.lang.String functionConstraint)

getFunctionOptions

public java.lang.String[] getFunctionOptions()

setFunctionOptions

public void setFunctionOptions(java.lang.String[] functionOptions)

getFunctionSelected

public int getFunctionSelected()

getConstructor

public java.lang.String getConstructor()

setConstructor

public void setConstructor(java.lang.String constructor)

getConstructorConstraint

public java.lang.String getConstructorConstraint()

setConstructorConstraint

public void setConstructorConstraint(java.lang.String constructorConstraint)

getConstructorOptions

public java.lang.String[] getConstructorOptions()

setConstructorOptions

public void setConstructorOptions(java.lang.String[] constructorOptions)

getConstructorSelected

public int getConstructorSelected()

getTokenUnderCursor

public Token getTokenUnderCursor()
If the cursor is in a token or white space preceeding the token, returns a description of the token. If in whitespace following the last token, returns the last token. In cases where the Value is all spaces or comments, Token.getType() returns TYPE_ALL_SPACES.

Skip navigation links

Oracle Business Rules Java API Reference
10g (10.1.3.1.0)

B28966-01


Copyright © 2006, Oracle. All rights reserved.