Package com.adobe.xfa.formcalc
Class CalcSymbol
- java.lang.Object
-
- com.adobe.xfa.formcalc.CalcSymbol
-
public final class CalcSymbol extends java.lang.Object
Class CalcSymbol defines objects which are the typed-values used by theCalcParser
(FormCalc scripting engine).Each CalcSymbol have but two properties: a type, and depending on the type, a value. and a storage type. Some types of CalcSymbols have extra values.
This is the implementation of the fundamental class of objects manipulated by FormCalc parser and interpreter. Objects of this class populate both the data symbol table, and the builtin symbol table, the runtime stack, and constitute the operands of some instructions, as well as the final result of every FormCalc parser/interpreter operation.
@author Paul Imerson, Mike P. Tardif
-
-
Field Summary
Fields Modifier and Type Field Description static int
TypeAccessor
static int
TypeBuiltin
static int
TypeDouble
static int
TypeError
static int
TypeFunction
static int
TypeNull
static int
TypeParameter
static int
TypeReference
static int
TypeReturn
static int
TypeString
static int
TypeVariable
-
Constructor Summary
Constructors Constructor Description CalcSymbol()
Instantiates a CalcSymbol of type TypeNull.CalcSymbol(double dVal)
Instantiates a CalcSymbol of type TypeDouble if the value of the given double is finite, and of type TypeError if the value of the given double is not finite.CalcSymbol(int nVal)
Instantiates a CalcSymbol of type TypeDouble.CalcSymbol(CalcSymbol oSym)
Instantiates a CalcSymbol as a copy of the given CalcSymbol.CalcSymbol(Obj oObj, java.lang.String sName)
Instantiates a CalcSymbol of type TypeReference.CalcSymbol(java.lang.reflect.Method func)
Instantiates a CalcSymbol of type TypeBuiltin.CalcSymbol(java.lang.String sVal)
Instantiates a CalcSymbol of type TypeString.CalcSymbol(java.lang.String sVal, boolean bIsError, int nErrorLine, int nErrorResId)
Instantiates a CalcSymbol of type TypeString if the given boolean isError is false, and a CalcSymbol of type * TypeError is the given boolean is true.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object object)
Compares the given CalcSymbol for equality.java.lang.String
getErrorValue(IntegerHolder oErrorLine, IntegerHolder oErrorCode)
Gets this TypeError's error value.int
getIdxValue()
Gets this TypeParameter's stack index.java.lang.String
getName()
Gets this object's name.double
getNumericValue()
Gets this TypeDouble's numeric value.Obj
getObjValue()
Gets this TypeReference's object handle.java.lang.String
getStringValue()
Gets this TypeString's string value.int
getType()
Gets this object's type.int
hashCode()
Returns a hash code value for the object.
-
-
-
Field Detail
-
TypeError
public static final int TypeError
Enumeration of all possible CalcSymbol types. Most are internal to the FormCalc scripting engine. Applications would only deal with types:typedef enum TypeEnum { TypeError = 0, TypeNull, TypeString, TypeDouble, TypeBuiltin, TypeVariable, TypeReference, TypeParameter, TypeFunction, TypeAccessor, TypeReturn } int;
- TypeString,
- TypeError,
- TypeNull.
- See Also:
- Constant Field Values
-
TypeNull
public static final int TypeNull
- See Also:
- Constant Field Values
-
TypeString
public static final int TypeString
- See Also:
- Constant Field Values
-
TypeDouble
public static final int TypeDouble
- See Also:
- Constant Field Values
-
TypeBuiltin
public static final int TypeBuiltin
- See Also:
- Constant Field Values
-
TypeVariable
public static final int TypeVariable
- See Also:
- Constant Field Values
-
TypeReference
public static final int TypeReference
- See Also:
- Constant Field Values
-
TypeParameter
public static final int TypeParameter
- See Also:
- Constant Field Values
-
TypeFunction
public static final int TypeFunction
- See Also:
- Constant Field Values
-
TypeAccessor
public static final int TypeAccessor
- See Also:
- Constant Field Values
-
TypeReturn
public static final int TypeReturn
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CalcSymbol
public CalcSymbol()
Instantiates a CalcSymbol of type TypeNull.
-
CalcSymbol
public CalcSymbol(int nVal)
Instantiates a CalcSymbol of type TypeDouble.- Parameters:
nVal
- the numeric value of the CalcSymbol.
-
CalcSymbol
public CalcSymbol(double dVal)
Instantiates a CalcSymbol of type TypeDouble if the value of the given double is finite, and of type TypeError if the value of the given double is not finite.- Parameters:
dVal
- the double value of the CalcSymbol.
-
CalcSymbol
public CalcSymbol(java.lang.String sVal, boolean bIsError, int nErrorLine, int nErrorResId)
Instantiates a CalcSymbol of type TypeString if the given boolean isError is false, and a CalcSymbol of type * TypeError is the given boolean is true.- Parameters:
sVal
- the string value of the CalcSymbol if the given boolean isError is false, and the error value of the CalcSymbol if the given boolean is true.bIsError
- a boolean indicating if the instantiated CalcSymbol is to be of type TypeError, or of type TypeString. The defaults is for the CalcSymbol to be of type TypeString.nErrorLine
- if bIsError is true, this contains the associated line number in the context of syntax errors (not run-time errors). if the value of the given boolean is false, and an error-valued CalcSymbol if the value of the given boolean is true.nErrorResId
- - if bIsError is TRUE, this contains the associated resource ID of the error.
-
CalcSymbol
public CalcSymbol(java.lang.String sVal)
Instantiates a CalcSymbol of type TypeString.- Parameters:
sVal
- the string value of the CalcSymbol.
-
CalcSymbol
public CalcSymbol(java.lang.reflect.Method func)
Instantiates a CalcSymbol of type TypeBuiltin.- Parameters:
func
- the builtin function.
-
CalcSymbol
public CalcSymbol(Obj oObj, java.lang.String sName)
Instantiates a CalcSymbol of type TypeReference.- Parameters:
oObj
- the object handle.sName
- optionally, the object name.
-
CalcSymbol
public CalcSymbol(CalcSymbol oSym)
Instantiates a CalcSymbol as a copy of the given CalcSymbol.- Parameters:
oSym
- the CalcSymbol to copy.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object object)
Compares the given CalcSymbol for equality.- Overrides:
equals
in classjava.lang.Object
- Parameters:
object
- the CalcSymbol being compared with.- Returns:
- boolean true if equal, and false otherwise.
-
hashCode
public int hashCode()
Returns a hash code value for the object.- Overrides:
hashCode
in classjava.lang.Object
-
getName
public java.lang.String getName()
Gets this object's name.- Returns:
- the object's name.
-
getType
public int getType()
Gets this object's type.- Returns:
- the object's type.
-
getObjValue
public Obj getObjValue()
Gets this TypeReference's object handle.- Returns:
- the object's object handle.
-
getIdxValue
public int getIdxValue()
Gets this TypeParameter's stack index.- Returns:
- the object's stack index.
-
getStringValue
public java.lang.String getStringValue()
Gets this TypeString's string value. This method presumes the CalcSymbol if of type TypeString. Otherwise, the result is indeterminate.- Returns:
- the object's string value.
-
getNumericValue
public double getNumericValue()
Gets this TypeDouble's numeric value. This method presumes the CalcSymbol if of type TypeDouble. Otherwise, the result is indeterminate.- Returns:
- the object's numeric value.
-
getErrorValue
public java.lang.String getErrorValue(IntegerHolder oErrorLine, IntegerHolder oErrorCode)
Gets this TypeError's error value. This method presumes the CalcSymbol if of type TypeError. Otherwise, the result is indeterminate.- Parameters:
oErrorLine
- if non-null, populated with the line number of the error, in the context of syntax errors (not run-time errors).oErrorCode
- - if non-NULL, populated with the error code of the error, in the context of syntax errors (not run-time errors).- Returns:
- the object's error value.
-
-