|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.able.AbleObject | +--com.ibm.able.rules.AbleRuleSet
This class defines an AbleRuleSet bean which is the run-time representation of an Able Rule Language ruleset.
A ruleset object is a collection of variables, rules, and optional user-defined functions, all of which can be used by one or Able inference engines to solve problems. Input data can be read from, and solution data can be written to, standard Able program buffers, thus allowing a ruleset to be embedded in, or connected to, other Able objects.
There are several ways in which to instantiate a ruleset object. One way is to use a text editor, such as the Able ruleset customizer, to write a rule program in the Able rule language and then save that program to disk. Later on, a ruleset bean can instantiate itself from that source rule file.
AbleRuleSet rs = new AbleRuleSet("test"); // construct the ruleset bean rs.parseFromARL("test.arl") ; // compile the ruleset text file rs.init() ; // initialize the bean
Another way is similar to the first, but involves writing the rules in XML according to the Able rule XML Schema.
AbleRuleSet rs = new AbleRuleSet("test"); // construct the ruleset bean rs.parseFromXML("test.arml") ; // compile the ruleset XML file rs.init() ; // initialize the bean
Yet another way is to create a ruleset entirely programmatically by using the ruleset's APIs to dynamically create variables, clauses, and rules as necessary.
Once a ruleset has been successfully instantiated, through any means, the ruleset can be saved in serialized form for later use.
Field Summary | |
---|---|
protected java.lang.Object |
altInputBuffer
"altInputBuffer" is initialized to null, but can be used by other objects to provide input data to this bean's process() synchronous method via an AbleEvent with "process" as the action string and an Object[] as the argument Object. |
static int |
DEBUG_CLAUSE
Debug type; Stop before each clause. |
static int |
DEBUG_INFERENCE_CYCLE
Debug type; Stop at each inference cycle. |
static int |
DEBUG_OFF
Debug type; No inference engine debugging. |
static int |
DEBUG_RULE
Debug type; Stop before each rule. |
static int |
DEBUG_RULEBLOCK
Debug type; Stop before entering each ruleblock. |
static int |
DEBUG_USER_BREAKPOINT
Debug type; Stop at user breakpoints only.. |
static java.lang.String |
defaultName
Value assigned to name by default. |
static java.lang.String |
FileNameUntitled
FileName: Default file name for an "untitled" ruleset, no matter what type. |
static java.lang.String |
FileTypeARLSerial
FileType: ARL RuleSet/SERialized ruleset object files. |
static java.lang.String |
FileTypeARLSource
FileType: ARL RuleSet source rule language files. |
static java.lang.String |
FileTypeARLXml
FileType: ARL RuleSet/XML source document files. |
static java.lang.String |
InferenceEngineBackward
Inference method: BackwardChain. |
static java.lang.String |
InferenceEngineDefault
Inference Engine. |
static java.lang.String |
InferenceEngineForward
Inference engine: Forward. |
static java.lang.String |
InferenceEngineFuzzy
Inference Engine: Fuzzy |
static java.lang.String |
InferenceEngineMutEx
Inference Engine: MutEx. |
static java.lang.String |
InferenceEnginePatternMatch
Inference method: PatternMatch. |
static java.lang.String |
InferenceEnginePatternMatchRete
Inference method: PatternMatchRete. |
static java.lang.String |
InferenceEnginePredicate
Inference Engine: Predicate. |
static java.lang.String |
InferenceEngineScript
Inference Engine: Script. |
static java.lang.String |
InferenceEngineUnknown
Inference engine: Unknown. |
protected java.util.Vector |
myAntClauses
|
protected AbleARLParser |
myARLParser
|
protected AbleARLTreeNode |
myARLTree
|
protected java.util.Vector |
myAstClauses
|
protected java.lang.Object |
myBaseTraceHandler
|
protected long |
myBaseTraceLvl
|
protected java.util.Hashtable |
myBuiltInDataTypes
|
protected java.util.HashSet |
myBuiltInPredicates
|
protected java.util.Hashtable |
myBuiltInUdfs
|
protected java.beans.PropertyChangeSupport |
myChgSupport
This change support object is used differently than the "chgSupport" object found in the AbleObject super class. |
protected java.util.Vector |
myCnsClauses
|
protected AbleInferenceEngine |
myCurrentInferenceEngine
|
protected AbleRuleBlock |
myCurrentRuleBlock
|
protected int |
myDebugLevel
The debug level : 0 = off > 0 = on |
protected java.util.Hashtable |
myDeclaredDataTypes
|
protected java.util.Vector |
myDeclaredDataTypesOrder
|
protected java.util.Vector |
myDeclaredInnerClassesOrder
|
protected java.util.Hashtable |
myDeclaredPredicates
|
protected java.util.Vector |
myDeclaredPredicatesOrder
|
protected java.util.Vector |
myDeclaredUdfLibs
|
protected java.util.Hashtable |
myDeclaredUdfs
|
protected java.util.Vector |
myDeclaredVarsIn
|
protected java.util.Vector |
myDeclaredVarsOut
|
protected java.util.Hashtable |
myEngineList
|
protected java.lang.String |
myEngineType
|
protected java.lang.String |
myErrorName
|
protected java.util.Hashtable |
myExpressions
|
protected java.util.BitSet |
myFbCurrent
|
protected java.util.BitSet |
myFbInitial
|
protected java.util.HashMap |
myFieldGetMethods
|
protected java.util.Hashtable |
myFieldList
|
protected java.util.HashMap |
myFieldSetMethods
|
protected java.util.Hashtable |
myFloatLiterals
|
protected java.util.Hashtable |
myGlobalTypedVariableFields
|
protected java.lang.String |
myGoalVariableName
The goal variable is used by backward chaining inference engines only. |
protected java.util.Hashtable |
myImportedUdfs
|
protected AbleInferenceContext |
myInferenceContext
This object holds the current state of the active inference engine This data is maintained by the inference engine and formatted using toString() for display when exceptions occur during inferencing. |
protected java.util.Stack |
myInferenceContextStack
This object is a stack of AbleInferenceContext objects. |
protected java.lang.Object |
myInferTraceHandler
|
protected long |
myInferTraceLvl
|
protected java.util.Hashtable |
myInnerClassDefs
|
protected java.util.Hashtable |
myInnerClasses
|
protected java.util.Hashtable |
myIntegerLiterals
|
protected java.lang.String |
myIsExReason
|
protected java.util.Hashtable |
myLocalTypedVariableFields
|
protected java.util.Hashtable |
myLocalVars
|
protected java.util.Hashtable |
myLongLiterals
|
protected java.util.Hashtable |
myNumericLiterals
|
protected boolean |
myParserInErrorState
|
protected java.lang.Object |
myParseTraceHandler
|
protected long |
myParseTraceLvl
|
protected AblePredicateQuery |
myPredicateQuery
The predicate query is used by the predicate inference engine only. |
protected java.util.Hashtable |
myPredicateSymbols
|
protected java.util.ResourceBundle |
myResourceBundle
|
protected java.lang.String |
myResourceBundleName
|
protected java.util.Hashtable |
myRuleBlocks
|
protected java.util.Vector |
myRuleBlocksOrder
|
protected int |
myRuleId
|
protected java.util.HashSet |
myRuleLabels
|
protected java.util.Hashtable |
myRuleList
|
protected java.util.Hashtable |
myRuleTemplateList
|
protected java.util.Hashtable |
myRuntimeUdfs
|
protected java.io.File |
mySrcFile
The file object containing the source language statements of this ruleset. |
protected java.lang.String |
mySrcFileName
The name of the file containing the source language statements of this ruleset. |
protected java.util.Hashtable |
myStringLiterals
|
protected boolean |
myTemplateFlag
A flag that indicates whether this ruleset is a template ruleset. |
protected java.util.Vector |
myTypedVariableFieldsList
|
protected java.util.Vector |
myVarBuiltInList
|
protected AbleTypedVariable |
myVarEvent
|
protected AbleTypedVariable |
myVarException
|
protected AbleBuiltInVariable |
myVarFunctionList
|
protected int |
myVarId
|
protected AbleArrayVariable |
myVarInputBuffer
|
protected java.util.Hashtable |
myVarList
|
protected AbleBuiltInVariable |
myVarNull
|
protected java.util.Vector |
myVarOrder
|
protected AbleArrayVariable |
myVarOutputBuffer
|
protected AbleBuiltInVariable |
myVarParent
|
protected AbleBuiltInVariable |
myVarThis
|
protected AbleBuiltInVariable |
myVarVariableList
|
protected AbleTypedVariable |
myVarWm
|
protected AbleWorkingMemory |
myWorkingMemory
|
protected java.lang.String |
myXmlFileName
The name of the file containing the XML document of this ruleset. |
static int |
TokenTypeIsBoolean
Token type; the parsed string represents a boolean value, either "true" or "false". |
static int |
TokenTypeIsCallName
Token type; the parsed string represents the name of a user-defined function. |
static int |
TokenTypeIsChar
Token type; the parsed string represents a character literal value |
static int |
TokenTypeIsDouble
Token type; the parsed string represents a double literal. |
static int |
TokenTypeIsFloat
Token type; the parsed string represents a Float value |
static int |
TokenTypeIsInteger
Token type; the parsed string represents an integer value |
static int |
TokenTypeIsLong
Token type; the parsed string represents a Long value |
static int |
TokenTypeIsName
Token type; the parsed string represents the name of a variable. |
static int |
TokenTypeIsNewObject
Token type; the parsed string represents a new Object value |
static int |
TokenTypeIsPredicate
Token type; the parsed string represents a Predicate value |
static int |
TokenTypeIsSetName
Token type; the parsed string represents the name of a fuzzy set. |
static int |
TokenTypeIsString
Token type; the parsed string represents either the name of a variable or a string literal. |
static int |
TokenTypeIsTimeStamp
Token type; the parsed string represents a time stamp literal value |
static int |
TokenTypeIsUnknown
Token type; unknown. |
static int |
TokenTypeIsVarFldPair
Token type; the parsed string represents the name of a variable with a field name. |
static int |
TokenTypeIsVarInxPair
Token type; the parsed string represents the name of an array variable with an index expression. |
static int |
TokenTypeIsVarMthPair
Token type; the parsed string represents the name of a variable with a method name. |
Fields inherited from class com.ibm.able.AbleObject |
---|
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace |
Constructor Summary | |
---|---|
AbleRuleSet()
|
|
AbleRuleSet(java.lang.String theName)
Create a new ruleset, using the specified trace objects. |
Method Summary | |
---|---|
void |
addBreakpoint(AbleRuleBreakpoint theBreakpoint)
Add the breakpoint at the specified location |
protected void |
addIsExReason(java.lang.String theIsExReason)
Yeah, it's a weird name, but it's due to historical reasons! |
protected AbleVariable |
addLocalOrGlobalVariable(java.lang.String theVariableName,
java.lang.String theVariableType)
|
AbleVariable |
addLocalVariable(java.lang.String theVariableName,
java.lang.String theVariableType)
Create and add a local variable to the ruleset |
void |
addRule(AbleRuleBlock theRuleBlock,
AbleRule theRule)
Add an Able rule to the specified rule block. |
void |
addRuleBlock(java.lang.String theRuleBlockName,
java.lang.String theReturnType)
Specify the name of the current rule block under parse. |
AbleRule |
addRuleFromTemplate(AbleRuleTemplate theTemplate)
Add a new rule using the template and its bound template variable values |
AbleRule |
addRuleFromTemplate(java.lang.String theTemplateName,
java.lang.Object[] theTemplateVarValues)
Add a new rule using the template name and associated template variable values |
void |
addRuleSetChangeListener(java.beans.PropertyChangeListener theListener)
Add a property change listener to the ruleset. |
void |
addUserDefinedFunction(AbleUserDefinedFunction theUserDefinedFunction)
Add a specific user-defined function to the master list of user-defined functions. |
void |
addVariable(AbleVariable theVariable)
Add a variable to the ruleset. |
void |
addVariableToInputSequence(java.lang.String theVariableName)
Specify that a variable is to be added to the input sequence. |
void |
addVariableToOutputSequence(java.lang.String theVariableName)
Specify that a variable is to be added to the output sequence. |
java.lang.String |
arlString()
Return a formal able rule language (ARL) string with Java-like syntax. |
protected java.lang.String |
arlStringDclInnerClasses()
|
protected java.lang.String |
arlStringDclPredicates()
|
protected java.lang.String |
arlStringHeader()
|
protected java.lang.String |
arlStringImports()
|
protected java.lang.String |
arlStringInputVariables()
|
protected java.lang.String |
arlStringLibraries()
|
protected java.lang.String |
arlStringOutputVariables()
|
protected java.lang.String |
arlStringRules()
|
protected java.lang.String |
arlStringTrailer()
|
protected java.lang.String |
arlStringUdfs()
|
protected java.lang.String |
arlStringVariables()
|
void |
checkTimePeriodPreConditions(java.util.Calendar theCurrentTime)
Evaluate each rule in every ruleblock against the time period preconditions. |
void |
clear()
Clear the ruleset of all variables and rules, clear out the trace logs, set the ruleset name to the empty string (""), and set all ruleset options (alphacut, correlation method, and so on) to default values. |
protected void |
clearLocalVarList()
|
boolean |
containsUserDefinedFunction(java.lang.String theUserDefinedFunctionName,
int theArity)
Determine whether the master list of user-defined functions contains a user-defined function with the specified name and arity. |
protected static java.util.Vector |
convertToConjunctiveNormalForm(AbleExpression theExpr,
AbleRuleSet theRuleSet)
Convert an Expression into conjunctive normal form a list of AbleAntecedentClauses (which may contain Expressions) |
static java.lang.String |
Copyright()
Determine the copyright of this class. |
AbleRd |
createArrayExpressionLiteral(java.lang.String theArrayVarName,
AbleRd theIndexExpr)
Create an AbleArrayVariableExpression object (AbleRd) which represents an Array variable with an index expression. |
AbleRd |
createCallLiteral(java.lang.String theCallName,
java.util.Vector theCallParms)
Create an AbleCallLiteral (AbleRd) object which represents a function call with arguments. |
void |
createFuzzySet(AbleFuzzyVariable theFuzzyVariable,
java.lang.String theSetName,
java.lang.String theSetType,
java.util.Vector theArgs,
double theAlphaCut,
boolean isComplement)
Create a FuzzySet of the specified type and add it to a FuzzyVariable. |
AbleRd |
createFuzzySetLiteral(java.lang.String theRuleToken,
AbleRd theFuzzyVar,
java.lang.String theHedges)
Create an AbleFuzzySet literal (AbleRd) object. |
AbleRd |
createLiteral(int theRuleTokenType,
java.lang.String theRuleToken)
Create an AbleRd object literal suitable for use in an AbleExpression, and AbleClause or an AbleRule. |
AbleRd |
createNewObjectLiteral(java.lang.String theDataType,
java.util.Vector theCallParms,
java.lang.String theFieldOrMethodName,
AbleRd theIndexExpr)
Create an AbleRd object suitable for use on the right-hand side of an AbleClause. |
AbleRd |
createRdObject(int theRuleTokenType,
java.lang.String theRuleToken,
java.util.Vector theCallParms,
AbleRd theFuzzyVar,
java.lang.String theHedges,
java.lang.String theFieldOrMethodName,
AbleRd theIndexExpr)
Create an AbleRd object suitable for use in AbleRules. |
protected AbleRule |
createRuleFromTemplate(AbleRuleTemplate theTemplate,
boolean theReplacementMode)
Create a new rule (or replace an existing one) using the rule template and its bound template variable values |
AbleRuleSet |
createRuleSetFromTemplate(AbleRuleSetTemplate theTemplate)
Create a new ruleset from a template using the template and its bound template variable values |
AbleRd |
createTimeStampLit(java.lang.String theRuleToken)
Given a string representation of a timestamp (date/time) create a TimeStampLiteral from it |
AbleRd |
createVariableFieldLiteral(java.lang.String theRuleToken,
java.lang.String theFieldName)
Create an AbleTypedVariableField object which represents a data member (field) of the object contained by an AbleTypedVariable. |
AbleRd |
createVariableMethodLiteral(java.lang.String theRuleToken,
java.util.Vector theCallParms,
java.lang.String theMethodName)
Create an AbleTypedVariableMethodLiteral object, which represents a method call with arguments on an AbleTypedVariable. |
void |
dataChanged()
Signal all registered listeners that this bean's internal state has changed by sending a synchronous event to all registered listeners via the AbleObject.dataChanged(java.lang.Object) with this ruleset
as the changed object. |
void |
declareEngineType(java.lang.String theEngineType,
java.lang.String theEngineClassName)
Declare an inference engine type and class name. |
AbleVariable |
declareGlobalVariable(java.lang.String theVariableName,
boolean theVariableStaticFlag,
java.lang.String theVariableType)
Declare a global variable by creating an instance and adding it to the ruleset. |
void |
declareInnerClass(java.lang.String theInnerClassName,
java.lang.String theComment,
java.util.Vector theFieldNames,
java.util.Vector theFieldTypes)
Declare an inner class, as a user-defined data type. |
void |
declarePredicate(java.lang.String thePredicateName)
Declare a predicate. |
void |
declareUserDataType(java.lang.String theUserTypeName,
java.lang.String theUserTypeClass)
Declare a user-defined data type. |
void |
declareUserDefinedFunction(java.lang.String theUserDefinedFunctionName)
Declare a user-defined function that must be available at runtime. |
void |
declareUserDefinedFunctionLib(java.lang.String theUDFLibName)
Declare a user-defined function library that must be available at runtime. |
void |
declareUserDefinedFunctionLib(java.lang.String theUDFLibName,
java.lang.Class theUDFLibClass)
Declare a user-defined function library that must be available at runtime. |
protected AbleAntecedentClause |
findOrCreateAntecedent(AbleAntecedentClause theClause)
See if the specified clause already exists, and if it does, return the original. |
protected AbleAntecedentClause |
findOrCreateAntecedent(AbleRd theLhs,
int theRuleOp,
AbleRd theRhs,
double theRuleAntWeight)
See if the specified clause exists, and if it does, return it. |
protected AbleAssertionClause |
findOrCreateAssertion(AbleLhs theLhs,
int theRuleOp,
AbleRd theRhs)
See if the specified clause exists, and if it does, return it. |
protected AbleConsequentClause |
findOrCreateConsequent(AbleLhs theLhs,
int theRuleOp,
AbleRd theRhs)
See if the specified clause exists, and if it does, return it. |
protected AbleRd |
findOrCreateDoubleLit(java.lang.String theRuleToken)
See if the specified literal exists, and if it does, return it. |
protected AbleExpression |
findOrCreateExpression(AbleRd theLhs,
int theRuleOp,
AbleRd theRhs)
See if the specified expression exists, and if it does, return it. |
protected AbleRd |
findOrCreateFloatLit(java.lang.String theRuleToken)
See if the specified literal exists, and if it does, return it. |
protected AbleRd |
findOrCreateIntegerLit(java.lang.String theRuleToken)
See if the specified literal exists, and if it does, return it. |
protected AbleVariable |
findOrCreateLocalPredicateVariable(java.lang.String theVariableName)
|
protected AbleRd |
findOrCreateLongLit(java.lang.String theRuleToken)
See if the specified literal exists, and if it does, return it. |
protected java.lang.String |
findOrCreatePredicateSymbol(java.lang.String thePredicateSymbol)
|
protected AbleRd |
findOrCreateStringLit(java.lang.String theRuleToken)
See if the specified literal exists, and if it does, return it. |
AbleARLParser |
getARLParser()
Retrieve the parser used to instantiate the ruleset. |
AbleARLTreeNode |
getARLTree()
Retrieve the content outline of this ruleset, produced by the parser |
long |
getBaseTraceLevel()
Return the level for base tracing. |
java.beans.PropertyChangeSupport |
getChgSupport()
Retrieve the PropertyChangeSupport object. |
java.lang.Object |
getControlParameter(java.lang.String theControlParameter)
Returns a single control parameter on the current inference engine. |
java.lang.Object |
getControlParameter(java.lang.String theRuleBlockName,
java.lang.String theControlParameter)
Returns a single control parameter on the inference engine associated with the specified ruleblock. |
int |
getCorrelationMethod()
Retrieve the current correlation method. |
java.util.Calendar |
getCurrentDateAndTime()
A built-in method that can be called from within a ruleset; it returns a Calendar object containing the current date and time of day. |
java.util.Calendar |
getCurrentDateAndTime(java.lang.String theTimeZoneId,
java.lang.String theLanguage,
java.lang.String theCountry)
A built-in method that can be called from within a ruleset; it returns a Calendar object containing the current date and time of day, based on a Locale determined from the input parameters. |
java.util.BitSet |
getCurrentFactBase()
Retrieve the current fact base. |
java.lang.Object |
getDebugConsole()
Get the debug console (if any) for this ruleset |
int |
getDebugLevel()
Get the debug level for the associated inference engine |
java.util.Hashtable |
getDeclaredPredicates()
|
java.util.Hashtable |
getDeclaredUserDefinedFunctions()
Get all declared user-defined functions. |
int |
getDefuzzifyMethod()
Retrieve the current defuzzification method. |
int |
getFuzzyInferenceMethod()
Retrieve the current fuzzy inference method. |
java.util.Vector |
getFuzzyVariables()
Get fuzzy variables. |
java.util.Vector |
getGeneratedRulesFromTemplate(java.lang.String theTemplateName)
Retrieve the list of rules generated from the specified template |
java.util.Hashtable |
getImportedUserDefinedFunctions()
Retrieve the set of active (imported) user-defined functions. |
AbleInferenceContext |
getInferenceContext()
Return the current inference engine trace context (used for tracing/debugging). |
java.util.Stack |
getInferenceContextStack()
Return the stack of inference engine trace contexts. |
AbleInferenceEngine |
getInferenceEngine()
Retrieve the current inference engine object. |
AbleInferenceEngine |
getInferenceEngine(java.lang.String theRuleBlockName)
Retrieve the inference engine associated with the specified ruleblock. |
java.lang.String |
getInferenceEngineClassName(java.lang.String theEngineType)
Retrieve the inference engine class name from the engines list. |
long |
getInferenceTraceLevel()
Return the level for inference tracing. |
AbleLogger |
getInferTraceLogger()
Retrieve the inferencing tracer logger. |
java.util.BitSet |
getInitialFactBase()
Retrieve the initial fact base. |
java.lang.Class |
getInnerClass(java.lang.String theClassName)
Retrieve an inner class given its name |
int |
getNumInputVars()
Retrieve the number of input variables. |
int |
getNumOutputVars()
Retrieve the number of output variables. |
java.util.Vector |
getOutputVars()
Retrieve the output variables. |
long |
getParseTraceLevel()
Return the level for parse tracing. |
protected java.util.Hashtable |
getPredicateSymbols()
|
java.util.ResourceBundle |
getResourceBundle()
Retrieve the resource bundle for use with this ruleset. |
java.lang.String |
getResourceBundleName()
Retrieve the resource bundle base name for use with this ruleset. |
AbleRule |
getRule(java.lang.String theRuleLabel)
Retrieve a rule by name. |
AbleRuleBlock |
getRuleBlock(java.lang.String theRuleBlockName)
Retrieve a rule block by name. |
java.util.Hashtable |
getRuleBlocks()
Retrieve all rule blocks. |
boolean |
getRuleEnabled(java.lang.String theRuleLabel)
Retrieve a rule's enabled state. |
boolean |
getRuleFired(java.lang.String theRuleLabel)
Retrieve a rule's fired state. |
double |
getRulePriority(java.lang.String theRuleLabel)
Retrieve a rule's priority. |
java.lang.String |
getRuleSetName()
Retrieve the name of the ruleset. |
AbleRuleSetTemplate |
getRuleSetTemplate()
Retrieve a ruleset template object (if defined) else return null |
int |
getRulesFiredCount(java.lang.String theRuleBlockName)
Returns the number of rules fired by the specified rule block and associated inference engine during the last infer() call on the engine |
AbleRuleTemplate |
getRuleTemplate(java.lang.String theRuleName)
Retrieve a rule template object based on specified rule name |
AbleRuleTemplate |
getRuleTemplateFromRule(java.lang.String theRuleName)
Retrieve the template from which this rule was generated (if any) |
java.util.Vector |
getRuleTemplates()
Retrieve all the rule template objects defined in this ruleset |
java.lang.String |
getSerFileName()
Retrieve the name of the serialized file for this ruleset. |
java.io.File |
getSrcFile()
Retrieve the name of the source file for this ruleset. |
java.lang.String |
getSrcFileName()
Retrieve the name of the source file for this ruleset. |
java.lang.String |
getTemplateString(java.util.Vector theTemplateVars)
Retrieve a text format string for use by ruleset templates. |
protected java.lang.String |
getTemplateStringDclInnerClasses(java.util.Vector theTemplateVars)
|
protected java.lang.String |
getTemplateStringDclPredicates(java.util.Vector theTemplateVars)
|
protected java.lang.String |
getTemplateStringHeader(java.util.Vector theTemplateVars)
|
protected java.lang.String |
getTemplateStringInputVariables(java.util.Vector theTemplateVars)
|
protected java.lang.String |
getTemplateStringOutputVariables(java.util.Vector theTemplateVars)
|
protected java.lang.String |
getTemplateStringRules(java.util.Vector theTemplateVars)
|
protected java.lang.String |
getTemplateStringTrailer()
|
protected java.lang.String |
getTemplateStringUdfs(java.util.Vector theTemplateVars)
|
protected java.lang.String |
getTemplateStringVariables(java.util.Vector theTemplateVars)
|
java.util.Vector |
getTemplateVariables()
Return a list of all template vars referenced by this ruleset. |
protected java.util.Vector |
getTemplateVariables(java.util.BitSet theIds)
Get a list of template variables based on a BitSet. |
java.util.Hashtable |
getUserDefinedDataTypes()
Retrieve the set of user-defined data types. |
AbleUserDefinedFunction |
getUserDefinedFunction(java.lang.String theUserDefinedFunctionName,
int theArity)
Retrieve the specified user-defined function |
java.util.Hashtable |
getUserDefinedFunctions()
Get the complete master list of user-defined functions registered with this function manager. |
AbleVariable |
getVariable(java.lang.String theVariableName)
Retrieve a reference to a variable declared in the ruleset. |
java.util.Hashtable |
getVariables()
Get variables. |
java.util.Vector |
getVariables(java.util.BitSet theIds)
Get a list of variables based on a BitSet. |
AbleWorkingMemory |
getWorkingMemory()
Retrieve the current workingMemory object (may be null). |
AbleWorkingMemory |
getWorkingMemory(java.lang.String theRuleBlockName)
Retrieve the workingMemory object associated with the specified rule block. |
java.lang.String |
getXmlFileName()
Retrieve the name of the XML file for this ruleset. |
boolean |
hasDebugConsole()
Tests whether this rule set object has an external debug console (GUI) |
void |
init()
Initialize and configure the bean. |
void |
initRuleTemplates()
Initialize the rule template in this ruleset and invoke the initRuleTemplates() ruleblock to refresh any info on rules that were already generated in this ruleset. |
void |
insertRuleAt(int theIndex,
AbleRuleBlock theRuleBlock,
AbleRule theRule)
Insert an Able rule at the specified position in the rule block. |
void |
instantiateFrom(java.io.DataInputStream theStream,
AbleLogger theTracer,
boolean theStopOnAbleExceptionFlag)
Deprecated. As of version 1.4.2, use parseFromArl(DataInputStream) |
void |
instantiateFrom(java.lang.String theFileName,
AbleLogger theTracer,
boolean theStopOnAbleExceptionFlag)
Deprecated. As of version 1.4.2, use parseFromArl(String theFileName) |
void |
instantiateFromXml(java.io.File theFile,
AbleLogger theTracer,
boolean theStopOnAbleExceptionFlag)
Deprecated. As of version 1.4.2, use parseFromXrl(File theFile) |
void |
instantiateFromXml(java.io.InputStream theInputStream,
AbleLogger theTracer,
boolean theStopOnAbleExceptionFlag)
Deprecated. As of version 1.4.2, use parseFromXml(InputStream theInputStream) |
void |
instantiateFromXml(java.lang.String theFileName)
Deprecated. As of version 1.4.2, use parseFromXrl(String theFileName) |
void |
instantiateFromXml(java.lang.String theFileName,
AbleLogger theTracer,
boolean theStopOnAbleExceptionFlag)
Deprecated. As of version 1.4.2, use parseFromXml(String theFileName) |
java.lang.Object |
invokeRuleBlock(java.lang.String theRuleBlockName)
Process the rules in the specified rule block in a sequential manner. |
java.lang.Object |
invokeUserDefinedFunction(java.lang.String theUserDefinedFunctionName,
java.lang.Object[] theArgs)
Call the actual method that the named user-defined function represents, passing in the array of argument objects. |
protected boolean |
ioBuffersOK()
Determine whether the input and output buffers are the expected object type (Object[]) and that they have enough slots to hold the required input and output variables. |
boolean |
isBaseTraceHigh()
Returns true if high level base trace messages should be sent to tracer. |
boolean |
isBaseTraceLow()
Returns true if low level base trace messages should be sent to tracer. |
boolean |
isBaseTraceMedium()
Returns true if medium level base trace messages should be sent to tracer. |
protected boolean |
isBuiltInDataType(java.lang.String theDataTypeName)
Determine whether a data type is a built-in type. |
protected boolean |
isBuiltInFunction(java.lang.String theName)
|
boolean |
isBuiltInVariableName(java.lang.String theVariableName)
Determine whether a variable with the specified name is a "built-in" variable. |
protected boolean |
isDeclaredDataType(java.lang.String theUserTypeName)
Determine whether an imported (user-defined) data type has already been declared within this ruleset. |
boolean |
isDeclaredPredicateName(java.lang.String thePredicateName)
|
boolean |
isDeclaredRuleBlockName(java.lang.String theRuleBlockName)
Determine whether a rule block with the specified name exists within the ruleset. |
boolean |
isDeclaredRuleLabel(java.lang.String theRuleLabel)
Determine whether any rule in the ruleset contains the specified label. |
protected boolean |
isDeclaredUserDefinedFunctionLibName(java.lang.String theImportLibName)
Determine whether a user-defined function library with the specified name exists within the ruleset. |
protected boolean |
isDeclaredUserDefinedFunctionName(java.lang.String theNameAndArity)
Determine whether a user-defined function with the specified name has already been declared as an externally added user-defined function to this ruleset. |
boolean |
isExecutable()
Determine whether the ruleset is executable. |
boolean |
isGlobalVariableName(java.lang.String theVariableName)
Determine whether a global variable with the specified name exists in the ruleset. |
boolean |
isImportedUserDefinedFunction(java.lang.String theImportName)
Determine whether an imported user-defined function with the specified name exists within the ruleset. |
boolean |
isInferenceTraceHigh()
Returns true if high level inference trace messages should be sent to tracer. |
boolean |
isInferenceTraceLow()
Returns true if low level inference trace messages should be sent to tracer. |
boolean |
isInferenceTraceMedium()
Returns true if medium level inference trace messages should be sent to tracer. |
boolean |
isLocalOrGlobalVariableName(java.lang.String theVariableName)
Determine whether a variable (either local or global) with the specified name exists in the ruleset. |
boolean |
isParseTraceHigh()
Returns true if high level inference trace messages should be sent to tracer. |
boolean |
isParseTraceLow()
Returns true if low level parse trace messages should be sent to tracer. |
boolean |
isParseTraceMedium()
Returns true if medium level parse trace messages should be sent to tracer. |
boolean |
isTemplate()
Returns true if this ruleset is a template ruleset, false otherwise. |
AbleRuleBlock |
parseConsultRuleBlockFromARL(java.lang.String theArlSource)
Parse and instantiate a predicate consult() ruleblock object by reading an input String containing ABLE Rule Language text source. |
AbleRd |
parseExpressionFromARL(java.lang.String theArlSource)
Parse and instantiate an AbleRd object (a Literal, Variable, or Expression) by reading an input String containing ABLE Rule Language text source. |
AbleRd |
parseExpressionFromXML(java.lang.String theArmlSource)
Parse and instantiate an AbleRd object (a Literal, Variable, or Expression) by reading an input String containing ABLE Rule Language XML source. |
void |
parseFromARL(java.io.File theFile)
Parse the ruleset object by reading a rule source file contained in the specified input file. |
void |
parseFromARL(java.io.InputStream theStream)
Parse the ruleset by reading an ARL rule source file contained in the specified input stream. |
void |
parseFromARL(java.lang.String theFileName)
Instantiate the ruleset object by reading a rule source file contained in the specified input file. |
void |
parseFromXML(java.io.File theFile)
Parse the ruleset by reading an XML rule document contained in the specified input file. |
void |
parseFromXML(java.io.InputStream theInputStream)
Instantiate the ruleset object by reading an XML rule document contained in the specified input stream. |
void |
parseFromXML(java.lang.String theFileName)
Parse the ruleset by reading an XML rule source file contained in the specified input file. |
AbleRuleBlock |
parseRuleBlockFromARL(java.lang.String theArlSource)
Parse and instantiate a complete ruleblock object by reading an input String containing ABLE Rule Language text source. |
AbleRuleBlock |
parseRuleBlockFromXML(java.lang.String theArmlSource)
Parse and instantiate a complete ruleblock object by reading an input String containing ABLE Rule Language XML source. |
AbleRule |
parseRuleFromARL(java.lang.String theArlSource,
java.lang.String theRuleBlockName,
boolean theReplacementMode)
Parse and instantiate a complete rule object by reading an input String containing ABLE Rule Language text source. |
AbleRule |
parseRuleFromXML(java.lang.String theArmlSource,
java.lang.String theRuleBlockName,
boolean theReplacementMode)
Parse and instantiate a complete rule object by reading an input String containing ABLE Rule Language XML source. |
AbleRuleSet |
parseRuleSetFromARL(java.lang.String theArlSource)
Parse and instantiate a complete ruleset object by reading an input String containing ABLE Rule Language text source. |
AbleRuleSet |
parseRuleSetFromXML(java.lang.String theArmlSource)
Parse and instantiate a complete ruleset object by reading an input String containing ABLE Rule Language XML source string. |
protected boolean |
predicateNameIsBuiltIn(java.lang.String thePredicateName)
|
void |
print(java.lang.Object theMsgText)
Write a text string to the console (System.out) without a line separator. |
void |
println(java.lang.Object theMsgText)
Write a text string to the console (System.out) followed by a line separator. |
void |
println(java.lang.Object theMsgText1,
java.lang.Object theMsgText2)
Write two text strings to the console (System.out) on the same line: msgText1 + msgText2. |
void |
process()
Perform the standard processing function performed by this object. |
void |
process(boolean reset)
|
java.lang.Object |
process(java.lang.Object theArg)
Perform the main, standard processing function performed by this bean, using the argument Object (usually passed via an AbleEvent). |
void |
processAbleEvent(AbleEvent theAbleEvent)
Process an Able event synchronously; that is, on the same thread as the caller. |
protected void |
processInput(java.util.BitSet theFactBase)
For each variable appearing in the input sequence, extract a value from the input buffer and assign it to the variable. |
void |
processOutput()
For each variable appearing in the output sequence, obtain the variable's current value and write it to the output buffer. |
void |
processTimerEvent()
This method is called from the asynch thread when the bean timer is configured to fire. |
java.lang.Object |
processWithContext(java.lang.Object theArg,
java.util.Hashtable theVars,
java.util.Hashtable theFuncs,
AbleWorkingMemory theWm)
Process this ruleset with variables, user-defined functions (externally attached UDFs only), and working memory from some other ruleset. |
void |
quitAll()
Stop all of the bean's asynchronous threads of control. |
void |
removeBreakpoint(AbleRuleBreakpoint theBreakpoint)
Remove the breakpoint from the specified location |
void |
removeRule(AbleRule theRule)
Remove an Able rule from the ruleset (and containing rule block). |
void |
removeRuleBlock(java.lang.String theRuleBlockName)
Remove the ruleblock from the ruleset. |
void |
removeRuleSetChangeListener(java.beans.PropertyChangeListener theListener)
Remove a property change listener from the ruleset. |
void |
removeUserDefinedFunction(java.lang.String theUserDefinedFunctionName,
int theArity)
Remove the named user-defined function from the master list of user-defined functions. |
void |
replaceRule(AbleRule theRule)
Replace an Able rule (any type) in the ruleset. |
AbleRule |
replaceRuleFromTemplate(AbleRuleTemplate theTemplate)
Replace an existing rule (previously generated from a template) using the template and its bound template variable values |
AbleRule |
replaceRuleFromTemplate(java.lang.String theTemplateName,
java.lang.Object[] theTemplateVarValues)
Replace an existing rule (previously generated from a template) using the template name and associated template variable values |
void |
reset()
Reset the ruleset so that rules can be fired again. |
void |
resetVariable(java.lang.String theVariableName)
Reset a global variable to its initial value (as declared in the variables section). |
void |
resetVariables(java.lang.Object[] theVariableNames)
Reset a list of global variables to their initial value (as declared in the variables section). |
void |
returnFromRuleBlock(java.lang.Object theReturnValue)
|
void |
saveAsArl(java.lang.String theFileName)
Save (write) an AbleRuleSet out as an ARL text rule file. |
void |
saveAsXml(java.lang.String theFileName)
Save (write) an AbleRuleSet out as an XML rule file. |
void |
setBaseTraceHandler(java.lang.Object handler,
long theTraceLevel)
Turn base tracing on or off. |
void |
setBaseTraceLevel(int theTraceLevel)
Turn base tracing on or off from a ruleset or, an application which need not provide its own handler for output. |
void |
setBaseTraceLevel(long theTraceLevel)
Turn ruleset tracing on or off. |
void |
setControlParameter(java.lang.String theControlParameter,
java.lang.Object theValue)
Set a single control parameter on the current inference engine. |
void |
setControlParameter(java.lang.String theRuleBlockName,
java.lang.String theControlParameter,
java.lang.Object theValue)
Set a single control parameter on the inference engine associated with the specified ruleblock. |
void |
setCurrentFactBase(java.util.BitSet theFactBase)
Set the current fact base, the set of bound variables during the course of inferencing. |
AbleRuleBlock |
setCurrentRuleBlock(java.lang.String theRuleBlockName)
Set the current rule block by name. |
void |
setDebugConsole(java.lang.Object theDebugConsole)
Set the debug console on this ruleset |
void |
setDebugLevel(int theDebugLevel)
Set the debug level for the associated inference engine |
void |
setInferenceEngine(java.lang.String theInferenceEngine)
Set the inference engine to the specified type. |
void |
setInferenceTraceHandler(java.lang.Object handler,
long theTraceLevel)
Turn inference tracing on or off. |
void |
setInferenceTraceLevel(int theTraceLevel)
Turn inference tracing on or off from a ruleset or, an application which need not provide its own handler for output. |
void |
setInferenceTraceLevel(long theTraceLevel)
Turn inference tracing on or off. |
void |
setInputBuffer(java.lang.Object theInputBuffer)
Set the input buffer to the specified object. |
void |
setOutputBuffer(java.lang.Object theOutputBuffer)
Set the output buffer to the specified object. |
void |
setParent(AbleBeanContainer theParent)
Set the containing parent of this bean. |
protected void |
setParserInErrorState(boolean theParserInErrorState)
Indicate whether any errors occurred during parsing. |
void |
setParseTraceHandler(java.lang.Object handler,
long theTraceLevel)
Turn parse tracing on or off. |
void |
setParseTraceLevel(int theTraceLevel)
Turn parse tracing on or off. |
void |
setParseTraceLevel(long theTraceLevel)
Turn parse tracing on or off. |
void |
setResourceBundleName(java.lang.String theResourceBundleName)
Set the base name of a ResourceBundle (or subclass) to be associated with this ruleset. |
void |
setRuleEnabled(java.lang.String theRuleLabel,
boolean theState)
Set a rule's enabled state. |
void |
setRulePriority(java.lang.String theRuleLabel,
double theRulePriority)
Set a rule's priority. |
void |
setRulePrompt(java.lang.String theRuleName,
java.lang.String thePrompt)
Set the Prompt string on a rule to be used by an associated UI |
void |
setRuleSetName(java.lang.String theRuleSetName)
Specify the name of the ruleset. |
void |
setRuleTemplateInfo(java.lang.String theTemplateName,
java.lang.Object[] theTemplateVarValues)
Set the rule template info for a previously generated rule. |
void |
setSerFileName(java.lang.String theSerFileName)
Specify the name of the serialized file for this ruleset. |
void |
setSrcFile(java.io.File theSrcFile)
Specify the source file object for this ruleset. |
void |
setSrcFileName(java.lang.String theSrcFileName)
Specify the name of the source file for this ruleset. |
void |
setTemplate(boolean theTemplateFlag)
Set the state of the template flag for this ruleset. |
void |
setUserDefinedFunctions(java.util.Hashtable theUserDefinedFunctions)
Set the complete master list of user-defined functions for this function manager. |
void |
setValueList(java.lang.String theVariableName,
java.util.Vector theValueList)
Set the value list on a Categorical or Discrete variable |
void |
setVariablePrompt(java.lang.String theVariableName,
java.lang.String thePrompt)
Set the Prompt string on a variable to be used by an associated UI |
void |
setWorkingMemory(AbleWorkingMemory theWorkingMemory)
Set the current workingMemory object to the specified value. |
void |
setXmlFileName(java.lang.String theXmlFileName)
Specify the name of the XML document file for this ruleset. |
void |
throwException(java.lang.Exception theException)
Throw an exception from a rule. |
static java.lang.String |
TokenType(int theItem)
|
java.lang.String |
toString()
Retrieve a string describing (the contents of) the object. |
java.lang.String |
trace(java.lang.Object theMsgObject)
Write a text string to the specified ruleset's Inference trace log. |
java.lang.String |
traceFormat(java.lang.String theFormatString,
java.lang.Object[] theInsert)
Write a formatted text string with a single insertion argument to the specified ruleset's Inference trace log. |
void |
updateCurrentFactBase(int theVarId)
Update the current fact base by setting the bit representing a newly bound variable. |
protected static java.lang.String |
wrapBraces(java.lang.String theArlString)
Take a valid ARL string and wrap any braces with single quotes for use as part of a template (text format) string |
java.lang.String |
xmlString()
Retrieve the XML representation of this rule set. |
protected java.lang.String |
xmlStringDclInnerClasses()
|
protected java.lang.String |
xmlStringDclPredicates()
|
protected java.lang.String |
xmlStringHeader()
|
protected java.lang.String |
xmlStringImports()
|
protected java.lang.String |
xmlStringInputVariables()
|
protected java.lang.String |
xmlStringLibraries()
|
protected java.lang.String |
xmlStringOutputVariables()
|
protected java.lang.String |
xmlStringRules()
|
protected java.lang.String |
xmlStringTrailer()
|
protected java.lang.String |
xmlStringUdfs()
|
protected java.lang.String |
xmlStringVariables()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String defaultName
public static final java.lang.String FileNameUntitled
public static final java.lang.String FileTypeARLSource
public static final java.lang.String FileTypeARLSerial
public static final java.lang.String FileTypeARLXml
public static final java.lang.String InferenceEngineUnknown
setInferenceEngine(java.lang.String)
public static final java.lang.String InferenceEngineForward
setInferenceEngine(java.lang.String)
public static final java.lang.String InferenceEnginePatternMatch
setInferenceEngine(java.lang.String)
public static final java.lang.String InferenceEnginePatternMatchRete
setInferenceEngine(java.lang.String)
public static final java.lang.String InferenceEngineBackward
setInferenceEngine(java.lang.String)
public static final java.lang.String InferenceEngineFuzzy
setInferenceEngine(java.lang.String)
public static final java.lang.String InferenceEnginePredicate
setInferenceEngine(java.lang.String)
public static final java.lang.String InferenceEngineScript
setInferenceEngine(java.lang.String)
public static final java.lang.String InferenceEngineMutEx
setInferenceEngine(java.lang.String)
public static final java.lang.String InferenceEngineDefault
In this implementation, the default is set to InferenceEngineScript.
setInferenceEngine(java.lang.String)
public static final int TokenTypeIsUnknown
public static final int TokenTypeIsBoolean
public static final int TokenTypeIsName
public static final int TokenTypeIsDouble
public static final int TokenTypeIsSetName
public static final int TokenTypeIsCallName
public static final int TokenTypeIsString
public static final int TokenTypeIsVarFldPair
public static final int TokenTypeIsVarMthPair
public static final int TokenTypeIsVarInxPair
public static final int TokenTypeIsInteger
public static final int TokenTypeIsPredicate
public static final int TokenTypeIsFloat
public static final int TokenTypeIsLong
public static final int TokenTypeIsNewObject
public static final int TokenTypeIsChar
public static final int TokenTypeIsTimeStamp
public static final int DEBUG_OFF
public static final int DEBUG_USER_BREAKPOINT
public static final int DEBUG_INFERENCE_CYCLE
public static final int DEBUG_RULEBLOCK
public static final int DEBUG_RULE
public static final int DEBUG_CLAUSE
protected java.lang.String myEngineType
protected java.lang.String myResourceBundleName
protected transient java.util.ResourceBundle myResourceBundle
protected java.util.Hashtable myBuiltInDataTypes
protected transient AbleARLTreeNode myARLTree
protected transient AbleARLParser myARLParser
protected int myVarId
protected java.util.Hashtable myVarList
protected java.util.Vector myVarOrder
protected java.util.Vector myDeclaredVarsIn
protected java.util.Vector myDeclaredVarsOut
protected java.util.Hashtable myLocalVars
protected java.util.Hashtable myGlobalTypedVariableFields
protected java.util.Hashtable myLocalTypedVariableFields
protected java.util.Vector myTypedVariableFieldsList
protected transient java.util.Hashtable myFieldList
protected transient java.util.HashMap myFieldGetMethods
protected transient java.util.HashMap myFieldSetMethods
protected int myRuleId
protected java.util.Hashtable myRuleList
protected java.util.HashSet myRuleLabels
protected java.util.Hashtable myRuleBlocks
protected java.util.Vector myRuleBlocksOrder
protected AbleRuleBlock myCurrentRuleBlock
protected AbleInferenceEngine myCurrentInferenceEngine
protected java.util.Hashtable myEngineList
protected java.util.Hashtable myRuleTemplateList
protected java.util.BitSet myFbInitial
protected java.util.BitSet myFbCurrent
protected java.util.Hashtable myDeclaredUdfs
protected java.util.Hashtable myRuntimeUdfs
protected java.util.Vector myDeclaredUdfLibs
protected java.util.Hashtable myImportedUdfs
protected java.util.Hashtable myBuiltInUdfs
protected java.util.Hashtable myDeclaredDataTypes
protected java.util.Vector myDeclaredDataTypesOrder
protected transient java.util.Hashtable myInnerClasses
protected java.util.Hashtable myInnerClassDefs
protected java.util.Vector myDeclaredInnerClassesOrder
protected java.util.HashSet myBuiltInPredicates
protected java.util.Hashtable myDeclaredPredicates
protected java.util.Vector myDeclaredPredicatesOrder
protected java.util.Hashtable myPredicateSymbols
protected java.util.Hashtable myNumericLiterals
protected java.util.Hashtable myFloatLiterals
protected java.util.Hashtable myIntegerLiterals
protected java.util.Hashtable myLongLiterals
protected java.util.Hashtable myStringLiterals
protected java.util.Vector myAstClauses
protected java.util.Vector myAntClauses
protected java.util.Vector myCnsClauses
protected java.util.Hashtable myExpressions
protected transient java.lang.Object myBaseTraceHandler
protected transient java.lang.Object myInferTraceHandler
protected transient java.lang.Object myParseTraceHandler
protected transient long myBaseTraceLvl
protected transient long myInferTraceLvl
protected transient long myParseTraceLvl
protected java.lang.String myIsExReason
protected java.lang.String myErrorName
protected boolean myParserInErrorState
protected java.beans.PropertyChangeSupport myChgSupport
This particular change support object is passed on to Able variables, rules, inference engines, and so on -- anything in the inferencing world, -- so that matters relating to rule processing can be followed separately from other types of change support. For example, whenever a data variable is added to a ruleset, the ruleset makes the variable use this change support object.
Change listeners can register with the ruleset using the addRuleSetChangeListener() method.
Note that at the moment, any listener registered here must be serializable, as this field is not transient.
addRuleSetChangeListener(PropertyChangeListener)
,
removeRuleSetChangeListener(PropertyChangeListener)
protected AbleWorkingMemory myWorkingMemory
protected AbleBuiltInVariable myVarThis
protected AbleBuiltInVariable myVarParent
protected AbleBuiltInVariable myVarFunctionList
protected AbleBuiltInVariable myVarVariableList
protected AbleArrayVariable myVarInputBuffer
protected AbleArrayVariable myVarOutputBuffer
protected AbleTypedVariable myVarWm
protected AbleBuiltInVariable myVarNull
protected AbleTypedVariable myVarException
protected AbleTypedVariable myVarEvent
protected java.util.Vector myVarBuiltInList
protected boolean myTemplateFlag
protected transient java.io.File mySrcFile
Note that this variable is transient. This is because serialized objects will likely be transferred from system to system with possibly different file systems and file naming conventions. When this happens, it is not likely that the source file will accompany the serialized file, and if it should, it is not likely that the source file would appear within the same directory structure as it did on the originating system!
Therefore, remember this: this variable has meaning only during a single Able Rule Editor session, and not from session to session!
protected transient java.lang.String mySrcFileName
This variable has meaning only during a single Able Editor session, and not from session to session!
protected transient java.lang.String myXmlFileName
This variable has meaning only during a single Able Editor session, and not from session to session!
protected java.lang.Object altInputBuffer
protected AbleInferenceContext myInferenceContext
protected java.util.Stack myInferenceContextStack
protected java.lang.String myGoalVariableName
protected AblePredicateQuery myPredicateQuery
protected int myDebugLevel
Note: A user-defined function library (such as AbleDebugLib) must be imported for debugging to work
Constructor Detail |
public AbleRuleSet(java.lang.String theName) throws AbleException
theName
- The initial name of this ruleset. The name may change
when the ruleset is instantiated from a source
language or XML file.
public AbleRuleSet() throws AbleException
Method Detail |
public static final java.lang.String TokenType(int theItem)
public final void checkTimePeriodPreConditions(java.util.Calendar theCurrentTime) throws AbleDataException
public void setParent(AbleBeanContainer theParent)
super.setParent() is called and then the field "myVarParent" is updated to point to the new parent.
A PropertyChangeEvent is fired.
setParent
in class AbleObject
theParent
- An ABLE bean container object in which this bean
currently resides. Note that a bean may only
have one parent at any given time, so this new parent
completely replaces the current parent.
AbleObject.parent
public void setInputBuffer(java.lang.Object theInputBuffer) throws AbleException
super.setInputBuffer() is called and then the field "myVarInputBuffer" is updated to point to the new buffer.
No PropertyChangeEvent is fired.
setInputBuffer
in class AbleObject
theInputBuffer
- Any object, such as a String[], Vector, Hashtable, and
so on, that can act as a buffer of input data. A
reference to the object is saved; the object is not
cloned. Note that once the input buffer is set,
it must not be tampered with while an AbleBean is
reading data from it.
AbleObject.inputBuffer
public void setOutputBuffer(java.lang.Object theOutputBuffer) throws AbleException
super.setOutputBuffer() is called and then the field "myVarOutputBuffer" is updated to point to the new buffer.
A PropertyChangeEvent is fired.
setOutputBuffer
in class AbleObject
theOutputBuffer
- Any object, such as a String[], Vector, Hashtable, and
so on, that can act as a buffer of output data. A
reference to the object is saved; the object is not
cloned. Note that once the output buffer is set,
it must not be tampered with while an AbleBean is
writing data to it.
AbleObject.outputBuffer
protected void addIsExReason(java.lang.String theIsExReason)
Called by the current inference engine in response to rulesetValid() to explain why the ruleset is not executable.
theIsExReason
- A string containing a reason the ruleset cannot be
processed.public void init() throws AbleException
init
in class AbleObject
com.ibm.able.AbleObject
AbleException
- If an error occurs.AbleObject.startEnabledEventProcessing()
public void process() throws AbleException
Note that input and output buffers used by this object must be object arrays: Object[].
process
in class AbleObject
AbleParException
- When any error occurs.ioBuffersOK()
,
reset()
public void process(boolean reset) throws AbleException
public java.lang.Object process(java.lang.Object theArg) throws AbleException
process
in class AbleObject
theArg
- An Object used to initialize the bean.
Note: AbleRuleSet only accepts Object[] or Vector as
arguments.
public void reset() throws AbleException
Note: This method is called as part of process() logic and does NOT have to be explicitly called between process() invocations.
reset
in class AbleObject
com.ibm.able.AbleObject
AbleException
- If an error occurs.AbleBean.reset()
public void processTimerEvent() throws AbleException
processTimerEvent
in class AbleObject
com.ibm.able.AbleObject
AbleException
- If an error occurs.public void processAbleEvent(AbleEvent theAbleEvent) throws AbleException
This method is called by our AbleEventQueue when the queue gets around to processing an asynchronous event. Note that this method also can be called directly from the handleAbleEvent() method described in the AbleEventListener interface when that method is given a synchronous event to handle.
Our AbleEventQueue "gets around to processing" an event when the following conditions are all true:
In this implementation, "process an Able event" means to obtain from the event itself the name of a method in THIS class and then call that method, passing in any optional arguments, which are also obtained directly from the event. If the invoked method returns an Object, the object is simply ignored, as there is no way to return it to the caller.
Note that the exceptions IllegalAccess, InvocationTarget, NoSuchMethod, and Security are all caught here, so that this method simply returns to the caller with no error indication. If logging is in effect, the exceptions are logged.
processAbleEvent
in class AbleObject
theAbleEvent
- The event to process.
AbleObject.setAbleEventProcessingEnabled(int)
,
AbleObject.startEnabledEventProcessing()
,
AbleObject.handleAbleEvent(AbleEvent)
public void quitAll() throws AbleException
If the bean is a simple AbleBean, this method just calls its quitEnabledEventProcessing() method; if the bean is an AbleBeanContainer, the bean additionally calls the same method on each contained bean.
quitAll
in class AbleObject
AbleObject.quitEnabledEventProcessing()
public final void dataChanged() throws AbleException
AbleObject.dataChanged(java.lang.Object)
with this ruleset
as the changed object.public void addUserDefinedFunction(AbleUserDefinedFunction theUserDefinedFunction)
addUserDefinedFunction
in interface AbleUserDefinedFunctionManager
theUserDefinedFunction
- The user-defined function to be added to the master
list.public void removeUserDefinedFunction(java.lang.String theUserDefinedFunctionName, int theArity)
removeUserDefinedFunction
in interface AbleUserDefinedFunctionManager
theUserDefinedFunctionName
- The name of the user-defined function to be removed
from the master list.
theArity
- The number of arguments expected by the named
function.public boolean containsUserDefinedFunction(java.lang.String theUserDefinedFunctionName, int theArity)
containsUserDefinedFunction
in interface AbleUserDefinedFunctionManager
theUserDefinedFunctionName
- The name of a user-defined function that might be in
the master list.
theArity
- The number of arguments expected by the named
function.
public AbleUserDefinedFunction getUserDefinedFunction(java.lang.String theUserDefinedFunctionName, int theArity)
getUserDefinedFunction
in interface AbleUserDefinedFunctionManager
theUserDefinedFunctionName
- The name of a user-defined function that might be in
the master list.
theArity
- The number of arguments expected by the named
function.
public java.lang.Object invokeUserDefinedFunction(java.lang.String theUserDefinedFunctionName, java.lang.Object[] theArgs) throws AbleException, java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException, java.lang.IllegalAccessException, java.lang.SecurityException
invokeUserDefinedFunction
in interface AbleUserDefinedFunctionManager
theUserDefinedFunctionName
- The name of the user-defined function containing an
encapsulated method.
theArgs
- An array of arguments expected by the encapsulated
method.
AbleException
- on any RMI error.java.lang.NoSuchMethodException
- the method or method signature is not defined in the
encapsulated source object.java.lang.reflect.InvocationTargetException
- if an exception was thrown by the invoked method.java.lang.SecurityException
- if the method is not public or otherwise accessible.java.lang.IllegalAccessException
- if the method is not public or otherwise accessible.public void setUserDefinedFunctions(java.util.Hashtable theUserDefinedFunctions)
setUserDefinedFunctions
in interface AbleUserDefinedFunctionManager
theUserDefinedFunctions
- A list of AbleUserDefinedFunction objects. This list
completely replaces the current list. The input list
is cloned.
public java.util.Hashtable getUserDefinedFunctions()
getUserDefinedFunctions
in interface AbleUserDefinedFunctionManager
public java.lang.Object processWithContext(java.lang.Object theArg, java.util.Hashtable theVars, java.util.Hashtable theFuncs, AbleWorkingMemory theWm) throws AbleException
theArg
- An Object used to initialize the bean.
Note: AbleRuleSet only accepts Object[] or Vector as
arguments.
theVars
- A list of variables to merge with the local context.
theFuncs
- A list of externally attached user-defined functions
to merge with the local context.
theWm
- The working memory. May be null.
AbleParException
- public java.lang.Object invokeRuleBlock(java.lang.String theRuleBlockName) throws AbleException
This method is called from an inference engine when a rule is evaluated that contains a call to this built-in.
theRuleBlockName
- The name of the rule block to process.
AbleParException
- On any processing errorspublic java.util.Calendar getCurrentDateAndTime()
public java.util.Calendar getCurrentDateAndTime(java.lang.String theTimeZoneId, java.lang.String theLanguage, java.lang.String theCountry)
theTimeZoneId
- A timezone ID string comprised of a country name and a
city; for example, "America/Los_Angeles".
theLanguage
- A string representing a valid ISO Language Code.
These codes are the lower-case two-letter codes as
defined by ISO-639. You can find a full list of these
codes at a number of sites, such as:
http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt
theCountry
- A string representing a valid ISO Country Code. These
codes are the upper-case two-letter codes as defined
by ISO-3166. You can find a full list of these codes
at a number of sites, such as:
http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
public void instantiateFrom(java.io.DataInputStream theStream, AbleLogger theTracer, boolean theStopOnAbleExceptionFlag) throws AbleParException, antlr.RecognitionException, antlr.TokenStreamException, java.io.IOException
Note that if the ruleset contains any variables and rules from a previous instantiation, these are removed from the ruleset before the source file is read. That is, the ruleset is cleared, and made to look like a newly created ruleset.
theStream
- The source from which a rule file is read.
theTracer
- A trace object, used by the parser to record
information during the parsing process.
theStopOnAbleExceptionFlag
- Indicates whether the parser is to stop immediately
when the first parsing error occurs, or if the parser
is to attempt to continue parsing the source file.
Specify true if parsing is to stop when an
error occurs; false otherwise.
AbleParException
- On any error.antlr.ParserException
- If the rule file cannot be parsed successfully.java.io.IOException
- If an error occurs while reading the source rule file.public void instantiateFrom(java.lang.String theFileName, AbleLogger theTracer, boolean theStopOnAbleExceptionFlag) throws AbleParException, antlr.RecognitionException, antlr.TokenStreamException, java.io.FileNotFoundException, java.io.IOException
Note that if the ruleset contains any variables and rules from a previous instantiation, these are removed from the ruleset before the source file is read. That is, the ruleset is cleared, and made to look like a newly created ruleset.
theFileName
- The source from which a rule file is read.
theTracer
- A trace object, used by the parser to record
information during the parsing process.
theStopOnAbleExceptionFlag
- Indicates whether the parser is to stop immediately
when the first parsing error occurs, or if the parser
is to attempt to continue parsing the source file.
Specify true if parsing is to stop when an
error occurs; false otherwise.
AbleParException
- On any error.antlr.ParserException
- If the rule file cannot be parsed successfully.java.io.FileNotFoundException
- If the specified input file cannot be found.java.io.IOException
- If an error occurs while reading the source rule file.public void instantiateFromXml(java.io.InputStream theInputStream, AbleLogger theTracer, boolean theStopOnAbleExceptionFlag) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.ClassNotFoundException, AbleParException, java.io.IOException
Note that if the ruleset contains any variables and rules from a previous instantiation, these are removed from the ruleset before the source file is read. That is, the ruleset is cleared, and made to look like a newly created ruleset.
theStream
- The source from which an XML rule document is read.
theTracer
- A trace object, used by the parser to record
information during the parsing process.
theStopOnAbleExceptionFlag
- Indicates whether the parser is to stop immediately
when the first parsing error occurs, or if the parser
is to attempt to continue parsing the source file.
Specify true if parsing is to stop when an
error occurs; false otherwise.
AbleParException
- On any XML parser error.java.io.IOException
- If an error occurs while reading the XML document.public void instantiateFromXml(java.lang.String theFileName, AbleLogger theTracer, boolean theStopOnAbleExceptionFlag) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.ClassNotFoundException, AbleParException, java.io.FileNotFoundException, java.io.IOException
Note that the ruleset is cleared of all objects before parsing.
theFileName
- The source from which a rule file is read.
theTracer
- A trace object, used by the parser to record
information during the parsing process.
theStopOnAbleExceptionFlag
- Indicates whether the parser is to stop immediately
when the first parsing error occurs, or if the parser
is to attempt to continue parsing the source file.
Specify true if parsing is to stop when an
error occurs; false otherwise.
AbleParException
- On any parser error.java.io.FileNotFoundException
- If the specified input file cannot be found.java.io.IOException
- If an error occurs while reading the XML document file.public void instantiateFromXml(java.lang.String theFileName) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.ClassNotFoundException, AbleParException, java.io.FileNotFoundException, java.io.IOException
Note that the ruleset is cleared of all objects before parsing.
theFileName
- The source from which a rule file is read.
AbleParException
- On any parser error.java.io.FileNotFoundException
- If the specified input file cannot be found.java.io.IOException
- If an error occurs while reading the XML document file.public void instantiateFromXml(java.io.File theFile, AbleLogger theTracer, boolean theStopOnAbleExceptionFlag) throws java.lang.IllegalAccessException, java.lang.InstantiationException, java.lang.ClassNotFoundException, AbleParException, java.io.FileNotFoundException, java.io.IOException
Note that if the ruleset contains any variables and rules from a previous instantiation, these are removed from the ruleset before the source file is read. That is, the ruleset is cleared, and made to look like a newly created ruleset.
theFile
- The source from which an XML rule document is read.
theTracer
- A trace object, used by the parser to record
information during the parsing process.
theStopOnAbleExceptionFlag
- Indicates whether the parser is to stop immediately
when the first parsing error occurs, or if the parser
is to attempt to continue parsing the source file.
Specify true if parsing is to stop when an
error occurs; false otherwise.
AbleParException
- On any XML parser error.java.io.FileNotFoundException
- If the specified input file cannot be found.java.io.IOException
- If an error occurs while reading the XML document file.public void parseFromARL(java.io.InputStream theStream) throws AbleParException
Note that the ruleset is cleared of all objects before parsing.
theStream
- The source from which a rule file is read.
AbleParException
- On any error.public void parseFromARL(java.lang.String theFileName) throws AbleParException
Note that the ruleset is cleared of all objects before parsing.
theFileName
- The source from which a rule file is read.
AbleParException
- On any error.public void parseFromARL(java.io.File theFile) throws AbleParException
theFileName
- The source from which a rule file is read.
AbleParException
- On any error.public AbleRuleSet parseRuleSetFromARL(java.lang.String theArlSource) throws AbleParException
Note that the entire ruleset is compiled for the source string, so data types, variables, ruleblocks and rules which are referenced in the arlSource must be defined and accessible from the CLASSPATH.
theArlSource
- The source from which a ruleset is compiled.
AbleParException
- On any error.public AbleRuleBlock parseRuleBlockFromARL(java.lang.String theArlSource) throws AbleParException
theArlSource
- The source from which a ruleblock is compiled and added to
this ruleset object.
AbleParException
- On any error.public AbleRuleBlock parseConsultRuleBlockFromARL(java.lang.String theArlSource) throws AbleParException
theArlSource
- The source from which a predicate consult() ruleblock is compiled
and added to this ruleset object.
AbleParException
- On any error.public AbleRule parseRuleFromARL(java.lang.String theArlSource, java.lang.String theRuleBlockName, boolean theReplacementMode) throws AbleParException
theArlSource
- The source from which a rule is compiled and added to
this ruleset object.
theRuleBlockName
- The name of the ruleblock to which this rule will be added.
theReplacementMode
- A boolean true value if the rule is to replace an existing rule or
false if it is to be added as a new rule to the ruleset.AbleParException
- On any error.public AbleRd parseExpressionFromARL(java.lang.String theArlSource) throws AbleException
This method is intended to be used to construct pieces of AbleRules, and is the preferred way of doing this.
parseExpressionFromARL
in interface AbleDataContext
theArlSource
- The source from which a ruleblock is compiled and added to
this ruleset object.
AbleParException
- On any error.public void parseFromXML(java.io.InputStream theInputStream) throws AbleParException
Note that the ruleset is cleared of all objects before parsing.
theStream
- The source from which an XML rule document is read.
AbleParException
- On any XML parser error.public void parseFromXML(java.io.File theFile) throws AbleParException
Note that the ruleset is cleared of all objects before parsing.
theFile
- The source from which an XML rule document is read.
AbleParException
- On any XML parser error.public void parseFromXML(java.lang.String theFileName) throws AbleParException
Note that the ruleset is cleared of all objects before parsing.
theFileName
- The source from which an XML rule file is read.
AbleParException
- On any error.public AbleRuleSet parseRuleSetFromXML(java.lang.String theArmlSource) throws AbleParException
Note that the entire ruleset is compiled for the source string, so data types, variables, ruleblocks and rules which are referenced in the arlSource must be defined and accessible from the CLASSPATH.
theArlSource
- The String from which a ruleset is compiled.
AbleParException
- On any error.public AbleRuleBlock parseRuleBlockFromXML(java.lang.String theArmlSource) throws AbleParException
Note that the ruleblock is compiled using this ruleset object as the context, so all data types, variables, ruleblocks and rules which are referenced in the arlSource must have been already added to this ruleset.
theArmlSource
- The XML source from which a ruleblock is compiled and added to
this ruleset object. See AbleRuleSet.xsd schema for format details.
AbleParException
- On any XML parserpublic AbleRule parseRuleFromXML(java.lang.String theArmlSource, java.lang.String theRuleBlockName, boolean theReplacementMode) throws AbleParException
Note that the rule is compiled using this ruleset object and the specfied ruleblock as the context, so all data types, variables, ruleblocks and rules which are referenced in the arlSource must have been already added to this ruleset.
theArmlSource
- The XML source from which a rule is compiled and added to
this ruleset object. See AbleRuleSet.xsd schema for format details.
theRuleBlockName
- The name of the ruleblock to which this rule will be added.
theReplacementMode
- A boolean true value if the rule is to replace an existing rule or
false if it is to be added as a new rule to the ruleset.AbleParException
- On any XML parser error.public AbleRd parseExpressionFromXML(java.lang.String theArmlSource) throws AbleParException
This method is intended to be used to construct pieces of AbleRules, and is the preferred way of doing this.
Note that the AbleRd object is compiled using this ruleset object as the context, so all data types, variables, ruleblocks and rules which are referenced in the arlSource must have been already added to this ruleset.
theArmlSource
- The XML source from which a ruleblock is compiled and added to
this ruleset object. See AbleRuleSet.xsd schema for format details.
AbleParException
- On any XML parser error.public void saveAsXml(java.lang.String theFileName) throws AbleException
Usage: result = saveAsXml("d:\\joe\\myRuleSet.arml");
theFileName
- A string representing a path to a destination Able Rule
Language XML file.
public void saveAsArl(java.lang.String theFileName) throws java.io.IOException, AbleException
Usage: result = saveAsArl("d:\\joe\\myRuleSet.arml");
theFileName
- A string representing a path to a destination Able Rule
Language text file.
public void throwException(java.lang.Exception theException) throws java.lang.Exception
theException
- The Exception object we want to throw
public void setRuleSetName(java.lang.String theRuleSetName) throws AbleParException
theRuleSetName
- The new name of the ruleset.
AbleParException
- If the name is null or an empty string.getRuleSetName()
public final java.lang.String getRuleSetName()
setRuleSetName(java.lang.String)
public void setInferenceEngine(java.lang.String theInferenceEngine) throws AbleParException
theInferenceEngine
- The new inference engine. Must match a declared engine type
AbleParException
- If the specified inference engine is not recognised.getInferenceEngine()
public void addVariable(AbleVariable theVariable) throws AbleParException
Note: There are side effects on the specified variable:
theVariable
- The variable to add.
AbleParException
- If a variable with the specified name already exists.public AbleVariable getVariable(java.lang.String theVariableName)
Local variables are checked first, then global variables.
theVariableName
- The name of the variable to retrieve.
public void resetVariable(java.lang.String theVariableName) throws AbleDataException
theVariableName
- The name of the global variable to reset.An
- exception that occurs during the variable reset.public void resetVariables(java.lang.Object[] theVariableNames) throws AbleDataException
theVariableNames
- The list of global variables to be reset.An
- exception that occurs during the variable reset.public java.util.Hashtable getVariables() throws AbleDataException
public java.util.Vector getFuzzyVariables() throws AbleDataException
public final int getCorrelationMethod()
getCorrelationMethod
in interface AbleDataContext
public final int getDefuzzifyMethod()
getDefuzzifyMethod
in interface AbleDataContext
public final int getFuzzyInferenceMethod()
getFuzzyInferenceMethod
in interface AbleDataContext
public java.util.Vector getVariables(java.util.BitSet theIds) throws AbleDataException
protected java.util.Vector getTemplateVariables(java.util.BitSet theIds) throws AbleDataException
public java.util.Vector getTemplateVariables() throws AbleDataException
public boolean isLocalOrGlobalVariableName(java.lang.String theVariableName)
The local name space is checked first, then the global name space.
theVariableName
- The name of a variable that might exist.
public boolean isGlobalVariableName(java.lang.String theVariableName)
theVariableName
- The name of a global variabel that might exist.public boolean isBuiltInVariableName(java.lang.String theVariableName)
theVariableName
- The name of a variable that might be built-in.
public AbleVariable declareGlobalVariable(java.lang.String theVariableName, boolean theVariableStaticFlag, java.lang.String theVariableType) throws AbleParException
theVariableName
- The name of the new global variable (must be unique in ruleset)theVariableStaticFlag
- A boolean value, true if this variable is static, false if not statictheVariableType
- The data type of the variable. Could be one of the ARL built-in types or
the name of an imported class (user-defined type).AbleParException
- If the variable name is already used, or the data type is invalidprotected void clearLocalVarList()
protected AbleVariable findOrCreateLocalPredicateVariable(java.lang.String theVariableName)
public AbleVariable addLocalVariable(java.lang.String theVariableName, java.lang.String theVariableType) throws AbleParException
theVariableName
- The unique name for this local variabletheVariableType
- The data type for the local variableprotected AbleVariable addLocalOrGlobalVariable(java.lang.String theVariableName, java.lang.String theVariableType) throws AbleParException
public void addVariableToInputSequence(java.lang.String theVariableName) throws AbleParException
Variables that are in the input sequence have their values taken from an input buffer before inferencing begins. Explicitly, all assertions are fired, variables appearing in the input sequence are assigned values from the user's supplied input buffer, and then all conditional rules are fired. In this way, data supplied at runtime always takes precedence over data "hardcoded" in a ruleset.
Note that a variable may appear in the input sequence more than once, but because the input buffer (where the values come from) is a Hashtable, this has no significance. It simply means that a variable's value is loaded more than once.
theVariableName
- The name of a variable whose value is to be taken from the
input buffer before inferencing begins.
AbleParException
- If a variable with the specified name doesn't exist.process()
public int getNumInputVars()
public void addVariableToOutputSequence(java.lang.String theVariableName) throws AbleParException
Variables that are in the output sequence have their values written to an output buffer after inferencing ends.
Note that a variable may appear in the output sequence more than once, but because the output buffer (to where the values are written) is a Hashtable, this has no significance. It simply means that a variable's value is written more than once to the same key.
theVariableName
- The name of a variable whose value is to be written to the
output buffer after inferencing ends.
AbleParException
- If a variable with the specified name doesn't exist.process()
public int getNumOutputVars()
public final java.util.Vector getOutputVars()
public java.util.BitSet getInitialFactBase()
getInitialFactBase
in interface AbleDataContext
public java.util.BitSet getCurrentFactBase()
getCurrentFactBase
in interface AbleDataContext
public void setCurrentFactBase(java.util.BitSet theFactBase)
setCurrentFactBase
in interface AbleDataContext
public void updateCurrentFactBase(int theVarId)
updateCurrentFactBase
in interface AbleDataContext
public void setWorkingMemory(AbleWorkingMemory theWorkingMemory)
theWorkingMemory
- The new working memory.
public final AbleWorkingMemory getWorkingMemory()
public final AbleWorkingMemory getWorkingMemory(java.lang.String theRuleBlockName)
theRuleBlockName
- The name of the specified rule block.public void declareUserDefinedFunction(java.lang.String theUserDefinedFunctionName) throws AbleParException
theUserDefinedFunctionName
- The name of a user-defined function that will be
available at runtime. The name must contain a slash
followed by the arity of the function. For example,
"foo/0" or "bar/3".
public java.util.Hashtable getDeclaredUserDefinedFunctions() throws AbleException
protected boolean isDeclaredUserDefinedFunctionName(java.lang.String theNameAndArity)
theNameAndArity
- The name of a user-defined function that might have
been declared to this ruleset. The name must contain
a slash followed by the arity of the function. For
example, "foo/0" or "bar/3".
public void declareUserDefinedFunctionLib(java.lang.String theUDFLibName) throws AbleParException
theUDFLibName
- The name of a user-defined function library that must
be available at runtime. The name must be a fully
qualified Java package name.
public void declareUserDefinedFunctionLib(java.lang.String theUDFLibName, java.lang.Class theUDFLibClass) throws AbleParException
theUDFLibName
- The name of a user-defined function library that must
be available at runtime. The name must be a fully
qualified Java package name.
theUDFLibClass
- The Class of a user-defined function library that must
be available at runtime.
protected boolean isDeclaredUserDefinedFunctionLibName(java.lang.String theImportLibName)
theImportLibName
- The name of a user-defined function library that might
exist.
public boolean isImportedUserDefinedFunction(java.lang.String theImportName)
theImportName
- The name of a user-defined function that might have
been imported. The name must contain a slash followed
by the arity of the function. For example, "foo/0" or
"bar/3".
public java.util.Hashtable getImportedUserDefinedFunctions()
protected boolean isBuiltInFunction(java.lang.String theName)
public void declareUserDataType(java.lang.String theUserTypeName, java.lang.String theUserTypeClass) throws AbleParException
theUserTypeName
- The name of a user-defined data type. The name can be
used to declare variables of this type.
theUserTypeClass
- The fully qualified class name to which the data type
is to be equated.
protected boolean isBuiltInDataType(java.lang.String theDataTypeName)
theDataTypeName
- The name of a data type that might exist.
protected boolean isDeclaredDataType(java.lang.String theUserTypeName)
theUserTypeName
- The name of an imported (user-defined) data type that might
exist.
public java.util.Hashtable getUserDefinedDataTypes()
public void declareInnerClass(java.lang.String theInnerClassName, java.lang.String theComment, java.util.Vector theFieldNames, java.util.Vector theFieldTypes) throws AbleParException
theInnerClassName
- The name of a Java class defined in a ruleset
which is treated as a user-defined data type. The name can be
used to declare variables of this type.
theComment
- A javadoc style comment string.
theFieldNames
- A Vector of the (String) names of each field in the class.
theFieldTypes
- A Vector of the (String) class types of each field in the class.
public java.lang.Class getInnerClass(java.lang.String theClassName)
AbleDataContext
getInnerClass
in interface AbleDataContext
public void declarePredicate(java.lang.String thePredicateName) throws AbleParException
thePredicateName
- The name of the predicate being declared.
protected boolean predicateNameIsBuiltIn(java.lang.String thePredicateName)
public boolean isDeclaredPredicateName(java.lang.String thePredicateName)
public java.util.Hashtable getDeclaredPredicates()
protected java.lang.String findOrCreatePredicateSymbol(java.lang.String thePredicateSymbol)
protected java.util.Hashtable getPredicateSymbols()
public void addRuleBlock(java.lang.String theRuleBlockName, java.lang.String theReturnType) throws AbleParException
theRuleBlockName
- The name of the current rule block found by the
parser.
AbleParException
- If a rule block with the specified name already
exists.public void removeRuleBlock(java.lang.String theRuleBlockName) throws AbleParException
theRuleBlockName
- The name of the rule block to remove.
public boolean isDeclaredRuleBlockName(java.lang.String theRuleBlockName)
theRuleBlockName
- The name of a rule block that might exist.
public void addRule(AbleRuleBlock theRuleBlock, AbleRule theRule) throws AbleParException
Note: There are side effects on the specified rule:
theRuleBlock
- theRuleBlock to which this rule should be added.theRule
- The rule to add.
public void insertRuleAt(int theIndex, AbleRuleBlock theRuleBlock, AbleRule theRule) throws AbleParException
Note: There are side effects on the specified rule:
theIndex
- The integer position where this rule should be inserted into the ruleblock.theRuleBlock
- theRuleBlock to which this rule should be added.theRule
- The rule to add.
public void removeRule(AbleRule theRule) throws AbleParException
theRule
- The rule to be removed from the ruleset.
public void replaceRule(AbleRule theRule) throws AbleParException
Note: There are side effects on the specified rule:
theRuleBlock
- theRuleBlock to which this rule should be added.theRule
- The rule to add.
public final AbleRuleBlock setCurrentRuleBlock(java.lang.String theRuleBlockName)
theRuleBlockName
- The name of the desired rule block.
public final AbleRuleBlock getRuleBlock(java.lang.String theRuleBlockName)
theRuleBlockName
- The name of the desired rule block.
public final java.util.Hashtable getRuleBlocks()
public final AbleRule getRule(java.lang.String theRuleLabel)
theRuleLabel
- The name or label of the desired rule.
public final double getRulePriority(java.lang.String theRuleLabel) throws AbleDataException
theRuleLabel
- The name or label of the desired rule.
public final void setRulePriority(java.lang.String theRuleLabel, double theRulePriority)
theRuleLabel
- The name or label of the desired rule.
The
- priority of the specified rule.public final void returnFromRuleBlock(java.lang.Object theReturnValue) throws com.ibm.able.rules.AbleRuleSet.AbleReturnException
public final boolean getRuleFired(java.lang.String theRuleLabel)
theRuleLabel
- The name or label of the desired rule.
public final boolean getRuleEnabled(java.lang.String theRuleLabel)
theRuleLabel
- The name or label of the desired rule.
public final void setRuleEnabled(java.lang.String theRuleLabel, boolean theState)
theRuleLabel
- The name or label of the desired rule.
theState
- The boolean state of the specified rule.
public boolean isDeclaredRuleLabel(java.lang.String theRuleLabel)
Note that all rule labels within a ruleset must be unique.
theRuleLabel
- Any string that might be a rule label.
public AbleRd createRdObject(int theRuleTokenType, java.lang.String theRuleToken, java.util.Vector theCallParms, AbleRd theFuzzyVar, java.lang.String theHedges, java.lang.String theFieldOrMethodName, AbleRd theIndexExpr) throws AbleParException
theRuleTokenType
- An AbleRuleSet.<TokenType> constant that
indicates the type of token found by the parser.
theRuleToken
- This string may be the name of a variable, the name of
a user-defined function that will be available at
runtime, a boolean literal, a numeric literal, or a
simple string literal. The RuleTokenType parameter
gives a clue.
theCallParms
- A list of arguments (AbleRd objects) to pass to the
function call (when tokenType is CallName), method call
(when tokenType is VarMthPair), or a new object constructor
(when tokenType is NewObject).
theFuzzyVar
- The fuzzy variable used when theRuleTokenType is SetName,
to look up fuzzy sets for the given variable.
theHedges
- A string of single character AbleFuzzySet.Hedge<constant>s.
Only used if theRuleTokenType is SetName.
theFieldOrMethodName
- The name of a field or method within the named variable. Only
used if theRuleTokenType is VarFldPair or VarMthPair.
theIndexExpr
- The array index expression object. Only
used if theRuleTokenType is VarInxPair.
AbleParException
- When any error occurs.public AbleRd createCallLiteral(java.lang.String theCallName, java.util.Vector theCallParms) throws AbleParException
theCallName
- This string must be the name of a user-defined function.
theCallParms
- A list of arguments (AbleRd objects) to pass to the user-defined
function.
AbleParException
- When any error occurs.public AbleRd createFuzzySetLiteral(java.lang.String theRuleToken, AbleRd theFuzzyVar, java.lang.String theHedges) throws AbleParException
theRuleToken
- This string must be the name of a fuzzy set on theLhs fuzzy variable.
theFuzzyVar
- An AbleFuzzyVariable object.
theHedges
- A string of single character
AbleFuzzySet.Hedge<constant>s.
AbleParException
- When any error occurs.public AbleRd createVariableFieldLiteral(java.lang.String theRuleToken, java.lang.String theFieldName) throws AbleParException
theRuleToken
- This string must be the name of a variable.
theFieldName
- The name of a field within the named variable.
AbleParException
- When any error occurs.public AbleRd createVariableMethodLiteral(java.lang.String theRuleToken, java.util.Vector theCallParms, java.lang.String theMethodName) throws AbleParException
theRuleToken
- This string must be the name of a typed variable.
theCallParms
- A list of arguments (AbleRd objects) to pass to the
method.
theMethodName
- The name of a field or method within the named variable. Only
used if theRuleTokenType is VarFieldPair or VarMethodPair.
AbleParException
- When any error occurs.public AbleRd createArrayExpressionLiteral(java.lang.String theArrayVarName, AbleRd theIndexExpr) throws AbleParException
theArrayVarName
- This string must be the name of an array variable
theIndexExpr
- The array index expression (AbleRd) object. This can be an integer literal
or an expression which evaluates to an integer.
AbleParException
- When any error occurs.public AbleRd createNewObjectLiteral(java.lang.String theDataType, java.util.Vector theCallParms, java.lang.String theFieldOrMethodName, AbleRd theIndexExpr) throws AbleParException
theDataType
- This string must be the name of a valid data type, either built-in
or imported into the ruleset.
theCallParms
- A list of arguments (AbleRd objects) to pass to the constructor.
theFieldOrMethodName
- The name of a field or method within the named variable. Only
used if theRuleTokenType is VarFieldPair or VarMethodPair.
theIndexExpr
- The array index expression object. Only
used if the data type is an array.
AbleParException
- When any error occurs.public AbleRd createLiteral(int theRuleTokenType, java.lang.String theRuleToken) throws AbleParException
theRuleTokenType
- An AbleRuleSet.<TokenType> constant that
indicates the type of token found by the parser.
It must be one of the supported simple literal types.
theRuleToken
- This string may be a boolean, char, double, float, integer,
long, string, or timestamp literal value.
The theRuleTokenType parameter identifies the literal type using one of
the AbleRuleSet.TokenTypeIs... constants.
AbleParException
- When any error occurs.protected AbleExpression findOrCreateExpression(AbleRd theLhs, int theRuleOp, AbleRd theRhs)
theLhs
- The left-hand side of the expression, either an
AbleVariable, an AbleLiteral, or another AbleExpression;
theRuleOp
- The operator used in the clause. It must be an
AbleData.<Operator> constant type.
theRhs
- The right-hand side of the expression; either an
AbleVariable, an AbleLiteral, or another AbleExpression.
protected AbleRd findOrCreateDoubleLit(java.lang.String theRuleToken) throws AbleParException
theRuleToken
- A parsed token (a string) that is used as a literal in
some clause. We turn the string into an AbleLiteral
object, and we ensure that there is only one of
each specific literal.
protected AbleRd findOrCreateFloatLit(java.lang.String theRuleToken) throws AbleParException
theRuleToken
- A parsed token (a string) that is used as a literal in
some clause. We turn the string into an AbleLiteral
object, and we ensure that there is only one of
each specific literal.
protected AbleRd findOrCreateIntegerLit(java.lang.String theRuleToken) throws AbleParException
theRuleToken
- A parsed token (a string) that is used as a literal in
some clause. We turn the string into an AbleLiteral
object, and we ensure that there is only one of
each specific literal.
protected AbleRd findOrCreateLongLit(java.lang.String theRuleToken) throws AbleParException
theRuleToken
- A parsed token (a string) that is used as a literal in
some clause. We turn the string into an AbleLiteral
object, and we ensure that there is only one of
each specific literal.
protected AbleRd findOrCreateStringLit(java.lang.String theRuleToken)
theRuleToken
- A parsed token (a string) that is used as a literal in
some clause. We turn the string into an AbleLiteral
object, and we ensure that there is only one of
each specific literal.
public AbleRd createTimeStampLit(java.lang.String theRuleToken)
theRuleToken
- A parsed token (a string) that is used as a literal in
some clause. We turn the string into a new AbleTimeStampLiteral
object.
protected AbleAssertionClause findOrCreateAssertion(AbleLhs theLhs, int theRuleOp, AbleRd theRhs)
theLhs
- The left-hand side of the clause; must be an AbleVariable.
theRuleOp
- The operator used in the clause. It must be an
AbleData.<Operator> constant of an assignment
type.
theRhs
- The right-hand side of the clause; either an
AbleVariable or an AbleLiteral.
protected AbleAntecedentClause findOrCreateAntecedent(AbleRd theLhs, int theRuleOp, AbleRd theRhs, double theRuleAntWeight)
theLhs
- The left-hand side of the clause; usually an AbleVariable.
theRuleOp
- The operator used in the clause. It must be an
AbleData.<Operator> constant of a comparison
type.
theRhs
- The right-hand side of the clause; either an
AbleVariable or an AbleLiteral.
protected AbleAntecedentClause findOrCreateAntecedent(AbleAntecedentClause theClause)
theClause
- An potential antecedent clause to be added to the ruleset.
protected AbleConsequentClause findOrCreateConsequent(AbleLhs theLhs, int theRuleOp, AbleRd theRhs)
theLhs
- The left-hand side of the clause; must be an AbleVariable.
theRuleOp
- The operator used in the clause. It must be an
AbleData.<Operator> constant of an assignment
type.
theRhs
- The right-hand side of the clause; either an
AbleVariable or an AbleLiteral.
public void createFuzzySet(AbleFuzzyVariable theFuzzyVariable, java.lang.String theSetName, java.lang.String theSetType, java.util.Vector theArgs, double theAlphaCut, boolean isComplement) throws AbleParException
theFuzzyVariable
- An AbleFuzzyVariable object
theSetName
- The name of the fuzzy set to create (or base set name, if isComplement is true) .
theSetType
- The type of fuzzy set to create. Must be one of "beta", "gaussian", "pi",
"linear", "sigmoid", "shoulder", "trapezoid", or "triangle"
theArgs
- A list of arguments to pass to the FuzzySet constructor. The number and types
must match the constructors for the respective fuzzy set types.
theAlphaCut
- The double value to use as the alphaCut parameter for this fuzzy set.
isComplement
- A boolean value that is true if the fuzzy set is the complement of an existing fuzzy set,
otherwise false.
AbleParException
- When any error occurs.public final void setSrcFile(java.io.File theSrcFile)
This, and the following few methods, are used by the Able RuleSet Editor program. When the editor is told to save the source rules, this method is called so that the source file object may be temporarily saved across editor sessions. Then, when the user selects "customize" from the Able Editor, the rule editor will be able to retrieve the file object and reload the source rule file.
If there is no source rule file, the editor will try to reconstitute the source rules from the existing instantiated ruleset variables.
Note that the variable containing the source file is transient. This is because serialized objects will likely be transferred from system to system with possibly different file systems and file naming conventions. When this happens, it is not likely that the source file will accompany the serialized file, and if it should, it is not likely that the source file would appear within the same directory structure as it did on the originating system!
theSrcFile
- The file object containing source rules.
public final java.io.File getSrcFile()
public AbleARLTreeNode getARLTree()
public AbleARLParser getARLParser()
null
.public void setSrcFileName(java.lang.String theSrcFileName)
theSrcFileName
- The name of the file containing source rules.
public final java.lang.String getSrcFileName()
public void setSerFileName(java.lang.String theSerFileName) throws AbleException
theSerFileName
- The name of the file containing a serialized able ruleset.
public final java.lang.String getSerFileName()
public void setXmlFileName(java.lang.String theXmlFileName) throws AbleException
theXmlFileName
- The name of the file containing an XML ruleset document.
public final java.lang.String getXmlFileName()
public boolean isExecutable()
The ruleset is executable if:
protected boolean ioBuffersOK() throws AbleException
public void clear()
protected void processInput(java.util.BitSet theFactBase) throws AbleDataException
Note that the input buffer was pre-verified in the process() method when ioBuffersOK() was called.
theFactBase
- Keeps track of which variables have known values.
AbleDataException
- When any error occurs.public final void processOutput() throws AbleDataException
Note that the output buffer was pre-verified in the process() method when ioBuffersOK() was called.
AbleDataException
- When any data error occurs.public java.lang.String arlString()
protected java.lang.String arlStringHeader()
protected java.lang.String arlStringLibraries()
protected java.lang.String arlStringImports()
protected java.lang.String arlStringDclPredicates()
protected java.lang.String arlStringDclInnerClasses()
protected java.lang.String arlStringVariables()
protected java.lang.String arlStringInputVariables()
protected java.lang.String arlStringOutputVariables()
protected java.lang.String arlStringUdfs()
protected java.lang.String arlStringRules()
protected java.lang.String arlStringTrailer()
public java.lang.String xmlString()
protected java.lang.String xmlStringHeader()
protected java.lang.String xmlStringLibraries()
protected java.lang.String xmlStringImports()
protected java.lang.String xmlStringDclPredicates()
protected java.lang.String xmlStringDclInnerClasses()
protected java.lang.String xmlStringVariables()
protected java.lang.String xmlStringInputVariables()
protected java.lang.String xmlStringOutputVariables()
protected java.lang.String xmlStringUdfs()
protected java.lang.String xmlStringRules()
protected java.lang.String xmlStringTrailer()
public void setBaseTraceLevel(long theTraceLevel)
theTraceValue
- Use Able.TRC_LOW_RLST, Able.TRC_MEDIUM_RLST, and
Able.TRC_HIGH_RLST to turn tracing on,
Able.TRC_NONE to turn tracing off.
public void setBaseTraceHandler(java.lang.Object handler, long theTraceLevel)
If there is no handler for base trace messages, a console handler is created.
The base trace handler is started when needed, and stopped and removed from the trace logger when turned off.
theTraceValue
- Use Able.TRC_LOW_RLST, Able.TRC_MEDIUM_RLST,
and Able.TRC_HIGH_RLST to turn tracing on,
Able.TRC_NONE to turn tracing off.
public void setBaseTraceLevel(int theTraceLevel)
If no handler for base trace messages exists, a console handler is created.
The base trace handler is started when needed, and stopped and removed from the trace logger when turned off.
theTraceValue
- Use ARL.TRC_LOW, ARL.TRC_MEDIUM,
and ARL.TRC_HIGH to turn tracing on,
ARL.TRC_NONE to turn tracing off.
public final long getBaseTraceLevel()
theTraceValue
- Use Able.TRC_LOW_RLST, Able.TRC_MEDIUM_RLST, and
Able.TRC_HIGH_RLST to turn tracing on,
Able.TRC_NONE to turn tracing off.
public final boolean isBaseTraceLow()
public final boolean isBaseTraceMedium()
public final boolean isBaseTraceHigh()
public final void declareEngineType(java.lang.String theEngineType, java.lang.String theEngineClassName)
theEngineType
- the name of the inference engine (from the using theEngineClassName
- the package.classname of the inference engine, must resolve to a subclass
of AbleInferenceEngine and be in the CLASSPATH.public final java.lang.String getInferenceEngineClassName(java.lang.String theEngineType)
theEngineType
- the name of the inference engine (from the using public final AbleInferenceEngine getInferenceEngine()
public final AbleInferenceEngine getInferenceEngine(java.lang.String theRuleBlockName)
theRuleBlockName
- The name of the rule blockpublic final void setControlParameter(java.lang.String theControlParameter, java.lang.Object theValue) throws AbleDataException
public final java.lang.Object getControlParameter(java.lang.String theControlParameter) throws AbleDataException
public final void setControlParameter(java.lang.String theRuleBlockName, java.lang.String theControlParameter, java.lang.Object theValue) throws AbleDataException
public final java.lang.Object getControlParameter(java.lang.String theRuleBlockName, java.lang.String theControlParameter) throws AbleDataException
public final void setValueList(java.lang.String theVariableName, java.util.Vector theValueList) throws AbleException
theVariable
- A Categorical or Discrete variable name.
theValueList
- A Vector of String or Double values.
public final void setVariablePrompt(java.lang.String theVariableName, java.lang.String thePrompt) throws AbleException
theVariable
- A variable name.
thePrompt
- The prompt String to be used when querying a user for a value.
public final void setRulePrompt(java.lang.String theRuleName, java.lang.String thePrompt) throws AbleException
theRuleName
- The name of the rule.
thePrompt
- The prompt String to be used when querying a user for template values.
public final AbleLogger getInferTraceLogger()
AbleDataContext
getInferTraceLogger
in interface AbleDataContext
com.ibm.able.data.AbleDataContext
public final AbleInferenceContext getInferenceContext()
public final java.util.Stack getInferenceContextStack()
public int getRulesFiredCount(java.lang.String theRuleBlockName)
public void setInferenceTraceLevel(long theTraceLevel)
theTraceValue
- Use Able.TRC_LOW_INFER, Able.TRC_MEDIUM_INFER,
and Able.TRC_HIGH_INFER to turn tracing on,
Able.TRC_NONE to turn tracing off.
public void setInferenceTraceHandler(java.lang.Object handler, long theTraceLevel)
If there is no handler, a console handler is created.
The handler is started when needed, and stopped and removed from the trace logger when turned off.
theTraceValue
- Use Able.TRC_LOW_INFER, Able.TRC_MEDIUM_INFER,
and Able.TRC_HIGH_INFER to turn tracing on,
Able.TRC_NONE to turn tracing off.
public void setInferenceTraceLevel(int theTraceLevel)
If no handler for exists, a console handler is created.
The handler is started when needed, and stopped and removed from the trace logger when turned off.
theTraceValue
- Use ARL.TRC_LOW, ARL.TRC_MEDIUM,
and ARL.TRC_HIGH to turn tracing on,
ARL.TRC_NONE to turn tracing off.
public final long getInferenceTraceLevel()
theTraceValue
- Use Able.TRC_LOW_INFER, Able.TRC_MEDIUM_INFER, and
Able.TRC_HIGH_INFER to turn tracing on,
Able.TRC_NONE to turn tracing off.
public final boolean isInferenceTraceLow()
public final boolean isInferenceTraceMedium()
public final boolean isInferenceTraceHigh()
public void setParseTraceLevel(long theTraceLevel)
theTraceValue
- Use Able.TRC_LOW_PARSE, Able.TRC_MEDIUM_PARSE,
and Able.TRC_HIGH_PARSE to turn tracing on,
Able.TRC_NONE to turn tracing off.
public void setParseTraceHandler(java.lang.Object handler, long theTraceLevel)
theTraceValue
- Use Able.TRC_LOW_PARSE, Able.TRC_MEDIUM_PARSE,
and Able.TRC_HIGH_PARSE to turn tracing on,
Able.TRC_NONE to turn tracing off.
public void setParseTraceLevel(int theTraceLevel)
If no handler for exists, a console handler is created.
The handler is started when needed, and stopped and removed from the trace logger when turned off.
theTraceValue
- Use Able.TRC_LOW_PARSE, Able.TRC_MEDIUM_PARSE,
and Able.TRC_HIGH_PARSE to turn tracing on,
Able.TRC_NONE to turn tracing off.
public final long getParseTraceLevel()
theTraceValue
- Use Able.TRC_LOW_PARSE, Able.TRC_MEDIUM_PARSE, and
Able.TRC_HIGH_PARSE to turn tracing on,
Able.TRC_NONE to turn tracing off.
public final boolean isParseTraceLow()
public final boolean isParseTraceMedium()
public final boolean isParseTraceHigh()
public void addBreakpoint(AbleRuleBreakpoint theBreakpoint)
public void removeBreakpoint(AbleRuleBreakpoint theBreakpoint)
public void setDebugLevel(int theDebugLevel)
public final int getDebugLevel()
public final void setDebugConsole(java.lang.Object theDebugConsole)
theDebugConsole
- A GUI component (JFrame) to display/control debugging.
Note that this is specified as an Object rather than a
Swing component because we want to remain free of any
cross dependencies on SWING/AWT GUI components.public final java.lang.Object getDebugConsole()
public boolean hasDebugConsole()
public final java.beans.PropertyChangeSupport getChgSupport()
protected final void setParserInErrorState(boolean theParserInErrorState)
theParserInErrorState
- true if an error occurred; false otherwise.
isExecutable()
public void setResourceBundleName(java.lang.String theResourceBundleName)
public java.lang.String getResourceBundleName()
public java.util.ResourceBundle getResourceBundle()
getResourceBundle
in interface AbleDataContext
public void setTemplate(boolean theTemplateFlag)
public boolean isTemplate()
public AbleRuleSetTemplate getRuleSetTemplate() throws AbleDataException
public AbleRule addRuleFromTemplate(java.lang.String theTemplateName, java.lang.Object[] theTemplateVarValues) throws AbleException, AbleParException
theTemplateName
- The name of the rule templatetheTemplateVarValues
- The list of Strings or AbleRd objects whose values are used to create the new rulepublic AbleRule replaceRuleFromTemplate(java.lang.String theTemplateName, java.lang.Object[] theTemplateVarValues) throws AbleDataException, AbleParException
theTemplateName
- The name of the rule templatetheTemplateVarValues
- The list of Strings or AbleRd objects whose values are used to create the new rule.public AbleRule addRuleFromTemplate(AbleRuleTemplate theTemplate) throws AbleException, AbleParException
theTemplate
- The rule templatepublic AbleRule replaceRuleFromTemplate(AbleRuleTemplate theTemplate) throws AbleDataException, AbleParException
theTemplate
- The rule templateprotected AbleRule createRuleFromTemplate(AbleRuleTemplate theTemplate, boolean theReplacementMode) throws AbleDataException, AbleParException
theTemplate
- The rule template object with bound template variablestheReplacementMode
- A boolean value, true if this rule is a replacement for an existing rule,
false if it is a new rule.public java.util.Vector getGeneratedRulesFromTemplate(java.lang.String theTemplateName) throws AbleDataException
theTemplateName
- The label of the rule templatepublic AbleRuleTemplate getRuleTemplateFromRule(java.lang.String theRuleName) throws AbleDataException
theRuleName
- The name of the rule whose template we want to retrieve.public AbleRuleSet createRuleSetFromTemplate(AbleRuleSetTemplate theTemplate) throws AbleDataException, AbleParException
theTemplate
- A ruleset template objectpublic java.util.Vector getRuleTemplates() throws AbleDataException
public void initRuleTemplates() throws AbleDataException
public void setRuleTemplateInfo(java.lang.String theTemplateName, java.lang.Object[] theTemplateVarValues) throws AbleDataException, AbleParException
theTemplateName
- The name of the rule templatetheTemplateVarValues
- The string values (or AbleRd values) to be used on the replacement variablespublic AbleRuleTemplate getRuleTemplate(java.lang.String theRuleName) throws AbleDataException
public java.lang.String getTemplateString(java.util.Vector theTemplateVars) throws AbleDataException
theTemplateVars
- An ordered list of template variables referenced by this ruleset.AbleRuleTemplate
protected java.lang.String getTemplateStringHeader(java.util.Vector theTemplateVars)
protected java.lang.String getTemplateStringDclPredicates(java.util.Vector theTemplateVars)
protected java.lang.String getTemplateStringDclInnerClasses(java.util.Vector theTemplateVars)
protected java.lang.String getTemplateStringVariables(java.util.Vector theTemplateVars)
protected java.lang.String getTemplateStringInputVariables(java.util.Vector theTemplateVars)
protected java.lang.String getTemplateStringOutputVariables(java.util.Vector theTemplateVars)
protected java.lang.String getTemplateStringUdfs(java.util.Vector theTemplateVars)
protected java.lang.String getTemplateStringRules(java.util.Vector theTemplateVars) throws AbleDataException
protected java.lang.String getTemplateStringTrailer()
public void print(java.lang.Object theMsgText)
public void println(java.lang.Object theMsgText)
public void println(java.lang.Object theMsgText1, java.lang.Object theMsgText2)
public java.lang.String trace(java.lang.Object theMsgObject) throws AbleException
theMsgObject
- The object or text to be written.
public java.lang.String traceFormat(java.lang.String theFormatString, java.lang.Object[] theInsert) throws AbleException
Uses Java MessageFormat ... traceFormat ("this is a {0} message" , new Object[] {"test"} )
theRuleSet
- The AbleRuleSet object
theFormatString
- A String with a single insertion point.
theInsert
- An object to insert into the format string.
protected static java.lang.String wrapBraces(java.lang.String theArlString)
theArlString
- An ARL text source stringprotected static java.util.Vector convertToConjunctiveNormalForm(AbleExpression theExpr, AbleRuleSet theRuleSet)
theExpr
- An AbleExpression objecttheRuleSet
- An AbleRuleSet object used for contextpublic void addRuleSetChangeListener(java.beans.PropertyChangeListener theListener) throws AbleException
theListener
- Any property change listener.
public void removeRuleSetChangeListener(java.beans.PropertyChangeListener theListener) throws AbleException
theListener
- Any previously added property change listener.
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String Copyright()
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |