public final class DynamicOps
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
DynamicOps.ReturnType
Data types to return from dynamic function.
|
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String |
CHAR_TYPE
character type in Progress
|
Constructor and Description |
---|
DynamicOps() |
Modifier and Type | Method and Description |
---|---|
private static BaseDataType |
characterToNumber(BaseDataType bdt,
DynamicOps.ReturnType type)
Helper method to make transformation attempt from character data type into numeric one.
|
static NumberType |
divide(BaseDataType op1,
BaseDataType op2)
Implements the binary divide operator whose result will differ based on the types of the
operands, which will not be known until runtime.
|
private static void |
IncompatibleDataTypesInExpression()
Error message to display for incompatible types.
|
static int64 |
length(BaseDataType bdt)
Returns the length of the given
BaseDataType instance. |
static int64 |
length(BaseDataType bdt,
character type)
Returns the length of the given
BaseDataType instance. |
static int64 |
length(BaseDataType bdt,
java.lang.String type)
Returns the length of the given
BaseDataType instance. |
static BaseDataType |
minus(BaseDataType op1,
BaseDataType op2)
Implements the minus binary operator whose result will differ based on the types of the
operands, which will not be known until runtime.
|
static NumberType |
modulo(BaseDataType op1,
BaseDataType op2)
Implements the binary modulo operator whose result will differ based on the types of the
operands, which will not be known until runtime.
|
static NumberType |
multiply(BaseDataType op1,
BaseDataType op2)
Implements the binary multiply operator whose result will differ based on the types of the
operands, which will not be known until runtime.
|
static NumberType |
multiply(BaseDataType op1,
NumberType op2)
Implements the binary multiply operator whose result will differ based on the types of the
operands, which will not be known until runtime.
|
static NumberType |
multiply(NumberType op1,
BaseDataType op2)
Implements the binary multiply operator whose result will differ based on the types of the
operands, which will not be known until runtime.
|
static NumberType |
negate(BaseDataType op)
Implements the unary negate operator whose result will differ based on the types of the
operands, which will not be known until runtime.
|
static BaseDataType |
plus(BaseDataType op1,
BaseDataType op2)
Implements the binary plus operator whose result will differ based on the types of the
operands, which will not be known until runtime.
|
static final java.lang.String CHAR_TYPE
public static BaseDataType plus(BaseDataType op1, BaseDataType op2)
If either operand is the unknown value
, the result will
be the unknown value
.
op1
- The left operand.op2
- The right operand.public static BaseDataType minus(BaseDataType op1, BaseDataType op2)
If either operand is the unknown value
, the result will
be the unknown value
.
op1
- The left operand.op2
- The right operand.private static void IncompatibleDataTypesInExpression()
public static int64 length(BaseDataType bdt, character type)
BaseDataType
instance. This method is called
when P2J is unable to resolve the type of the first parameter at conversion time and this
is postponed to runtime when the actual type of bdt
will be determined
dynamically.bdt
- The instance to test.type
- The measuring unit (CHARACTER or RAW, COLUMN not supported yet).unknown
value if the instance is unknown
.public static int64 length(BaseDataType bdt, java.lang.String type)
BaseDataType
instance. This method is called
when P2J is unable to resolve the type of the first parameter at conversion time and this
is postponed to runtime when the actual type of bdt
will be determined
dynamically.bdt
- The instance to test.type
- The measuring unit (CHARACTER or RAW, COLUMN not supported yet).
"character" is supposed to be the default measurement unit
for the LENGTH builtin function (when type is null)unknown
value if the instance is unknown
.public static int64 length(BaseDataType bdt)
BaseDataType
instance. This method is called
when P2J is unable to resolve the type of the first parameter at conversion time and this
is postponed to runtime when the actual type of bdt
will be determined
dynamically.bdt
- The instance to test.unknown
value if the instance is unknown
.public static NumberType divide(BaseDataType op1, BaseDataType op2)
If either operand is the unknown value
, the result will
be the unknown value
.
op1
- The left operand.op2
- The right operand.public static NumberType multiply(BaseDataType op1, NumberType op2)
If either operand is the unknown value
, the result will
be the unknown value
.
op1
- The left operand. If it is character attempt to convert to numeric happens.op2
- The right operand.public static NumberType multiply(NumberType op1, BaseDataType op2)
If either operand is the unknown value
, the result will
be the unknown value
.
op1
- The left operand.op2
- The right operand. If it is character attempt to convert to numeric happens.public static NumberType multiply(BaseDataType op1, BaseDataType op2)
If either operand is the unknown value
, the result will
be the unknown value
.
op1
- The left operand.op2
- The right operand.public static NumberType modulo(BaseDataType op1, BaseDataType op2)
If either operand is the unknown value
, the result will
be the unknown value
.
op1
- The left operand.op2
- The right operand.public static NumberType negate(BaseDataType op)
If either operand is the unknown value
, the result will
be the unknown value
.
op
- The operand.private static BaseDataType characterToNumber(BaseDataType bdt, DynamicOps.ReturnType type)
Can be used as last resort if for some reasons operant types are not compatible.
bdt
- The value to convert.type
- The converted variable type.