ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.data
Class AbleTypedVariableMethodLiteral

java.lang.Object
  |
  +--com.ibm.able.data.AbleLiteral
        |
        +--com.ibm.able.data.AbleCallLiteral
              |
              +--com.ibm.able.data.AbleTypedVariableMethodLiteral
All Implemented Interfaces:
AbleRd, java.io.Serializable

public class AbleTypedVariableMethodLiteral
extends AbleCallLiteral

This class performs a method invocation to a specific method in a AbleTypedVariable. The constructor uses introspection to try to find a constructor method on the AbleTypedVariable datatype class that matches the specified argument types. This literal behaves somewhat differently from other AbleLiterals, in that is not strictly a constant, it invokes the same method on the same typed variable, but the underlying Object being invoked may change during the course of a ruleset evaluation.

Any dot notation method call gets parsed and turned in the an instance of this class. Any number of arguments may appear in the source statement.

See Also:
Serialized Form

Field Summary
protected  AbleTypedVariable myTypedVariable
          The typed variable to which this method belongs.
protected  AbleUserDefinedFunction myUserDefinedFunction
          The internal user defined function.
 
Fields inherited from class com.ibm.able.data.AbleCallLiteral
myArgs, myArity, myCallee, myUdfMgr, myValue
 
Constructor Summary
AbleTypedVariableMethodLiteral(AbleTypedVariableMethodLiteral theLiteral, AbleTypedVariable theReplacementVariable, java.util.Vector theArgs)
          Create a copy of this method literal with replacement args
AbleTypedVariableMethodLiteral(AbleTypedVariable theTypedVariable, java.lang.String theMethod, java.util.Vector theArgs)
          Create a new Able data method object with the specified information.
 
Method Summary
 java.lang.String arlCRdString()
          Return a formal ARL "clause read" string that describes this data object.
 boolean equals(java.lang.Object otherObject)
           
static java.lang.Class[] getArgClasses(java.util.Vector theArgs)
           
 int getDataType()
          Retrieve the data type of this data object.
 java.util.BitSet getReferents()
          Retrieve the Ids of the variables to which this data object refers, if any.
 java.lang.Class getReturnType()
          Get the data type of the value returned from the associated method invocation.
 java.lang.String getTemplateString(java.util.Vector theTemplateVars)
          Retrieve a text format string for use by rule templates.
 AbleTypedVariable getTypedVariable()
          Retrieve the typed variable
 java.util.HashSet getVariableReferences()
          Retrieve the set of variables (if any) referenced by this expression (and subexpressions)
protected  void performCall()
           
 java.lang.String traceString(int theTraceStringFlavor)
          Retrieve a string describing (the contents of) the object.
protected  java.lang.String trcString(int theTraceStringFlavor)
           
 java.lang.String xmlCRdString()
          Return a formal XML "clause read" string that describes this data object.
 
Methods inherited from class com.ibm.able.data.AbleCallLiteral
cmpEq, cmpGt, cmpGtEq, cmpLt, cmpLtEq, cmpNeq, compDivide, compMinus, compMultiply, compPlus, compUnaryMinus, cvtArgs, getArgs, getArity, getBooleanValue, getCallee, getCalleeWithArgs, getCalleeWithArity, getDataTypeClass, getDataTypeClassName, getFuzzyValue, getGenericValue, getNumericValue, getRawValue, getStringValue, getValue, isConstant, logicalAND, logicalNOT, logicalOR
 
Methods inherited from class com.ibm.able.data.AbleLiteral
bitwiseAND, bitwiseNOT, bitwiseOR, bitwiseShiftLeft, bitwiseShiftRight, bitwiseShiftRightZeroFill, bitwiseXOR, cmpIs, compModulo, Copyright, getDataTypeAsString, getReferent, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myTypedVariable

protected AbleTypedVariable myTypedVariable
The typed variable to which this method belongs.

This field is initialized to null and changed by the constructor when a new typed variable method is created.


myUserDefinedFunction

protected AbleUserDefinedFunction myUserDefinedFunction
The internal user defined function.

This field is initialized to null and changed by the constructor when a new typed variable method is created.

Constructor Detail

AbleTypedVariableMethodLiteral

public AbleTypedVariableMethodLiteral(AbleTypedVariable theTypedVariable,
                                      java.lang.String theMethod,
                                      java.util.Vector theArgs)
                               throws AbleDataException
Create a new Able data method object with the specified information. The initial value of this literal is null, and it remains null until this literal is requested to give up a value. At that time, the method is called to produce a value. Each time a value is requested from this literal, the method is recalled; be aware that the current value may thus change from time to time.
Parameters:
theTypedVariable - A typed variable that contains the following field.

theMethod - A specific method within the above typed variable.

theArgs - A list of AbleRd objects whose runtime values will be passed to the user-defined function as arguments. Each converted argument will be a Boolean, a Double, a String, or an Object, depending on the type of each AbleRd object in the argument list. The list can be empty, but it must never be null.


AbleTypedVariableMethodLiteral

public AbleTypedVariableMethodLiteral(AbleTypedVariableMethodLiteral theLiteral,
                                      AbleTypedVariable theReplacementVariable,
                                      java.util.Vector theArgs)
                               throws AbleDataException
Create a copy of this method literal with replacement args
Method Detail

arlCRdString

public java.lang.String arlCRdString()
Return a formal ARL "clause read" string that describes this data object.
Overrides:
arlCRdString in class AbleCallLiteral
Returns:
A String describing the data object in formal rule language.

xmlCRdString

public java.lang.String xmlCRdString()
Return a formal XML "clause read" string that describes this data object.
Overrides:
xmlCRdString in class AbleCallLiteral
Returns:
A String describing the data object in XML.

getTemplateString

public java.lang.String getTemplateString(java.util.Vector theTemplateVars)
Retrieve a text format string for use by rule templates. The string contains "{n}" strings, where the index 'n' corresponds to the template variables defined in the rule template. This string is based on the standard arlString() representation of the rule. After replacement of the template variable values, the resulting string must be a valid ARL format string that can be parsed.
Overrides:
getTemplateString in class AbleCallLiteral
Parameters:
theTemplateVars - An ordered list of template variables referenced by this rule.
Returns:
A Text format string used to create a new rule instance.

getReferents

public java.util.BitSet getReferents()
Retrieve the Ids of the variables to which this data object refers, if any. Must be overriden by subclasses which can refer to variables.
Overrides:
getReferents in class AbleCallLiteral
Returns:
The Ids of the variables to which this data object refers, or AbleData.VarIdNull if the data object is a literal and therefore refers to no variable.

performCall

protected void performCall()
                    throws AbleDataException
Overrides:
performCall in class AbleCallLiteral

getTypedVariable

public AbleTypedVariable getTypedVariable()
Retrieve the typed variable

getReturnType

public java.lang.Class getReturnType()
                              throws java.rmi.RemoteException
Get the data type of the value returned from the associated method invocation.
Overrides:
getReturnType in class AbleCallLiteral
Returns:
The class representing the return type of the method

getArgClasses

public static java.lang.Class[] getArgClasses(java.util.Vector theArgs)
                                       throws AbleDataException

traceString

public java.lang.String traceString(int theTraceStringFlavor)
Retrieve a string describing (the contents of) the object.
Overrides:
traceString in class AbleCallLiteral
Parameters:
theFlavor - An Able.TraceStringFlavor value.

Returns:
A String containing the current contents of the object.

trcString

protected java.lang.String trcString(int theTraceStringFlavor)
Overrides:
trcString in class AbleCallLiteral

getDataType

public int getDataType()
Description copied from class: AbleLiteral
Retrieve the data type of this data object.
Overrides:
getDataType in class AbleCallLiteral
See Also:
AbleRd.getDataType()

equals

public boolean equals(java.lang.Object otherObject)
Overrides:
equals in class java.lang.Object

getVariableReferences

public java.util.HashSet getVariableReferences()
Retrieve the set of variables (if any) referenced by this expression (and subexpressions)
Overrides:
getVariableReferences in class AbleCallLiteral

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003