Package ru.ispras.testbase.generator
Class DataGeneratorVariable
- java.lang.Object
-
- ru.ispras.testbase.generator.DataGeneratorVariable
-
public final class DataGeneratorVariable extends java.lang.Object
TheDataGeneratorVariable
class describes a variable passed to a data generator in a query. Generated data must be assigned to variables.
-
-
Constructor Summary
Constructors Constructor Description DataGeneratorVariable(java.lang.String name, ru.ispras.fortress.expression.Node node)
Constructs a variable with the specified name described with the specifiedNode
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getName()
Returns the variable name.int
getSize()
Returns variable bit size.ru.ispras.fortress.data.DataType
getType()
Returns the variable data type.ru.ispras.fortress.expression.NodeValue
getValue()
Returns a node describing the variable value.boolean
isType(ru.ispras.fortress.data.DataType type)
Checks whether the variable has the specified type (types are compared on theDataType
level).boolean
isType(ru.ispras.fortress.data.DataTypeId typeId)
Checks whether the variable has the specified type (types are compared on theDataTypeId
level).boolean
isUnknown()
Checks whether the variable is an unknown variable that must have its value assigned.
-
-
-
Constructor Detail
-
DataGeneratorVariable
public DataGeneratorVariable(java.lang.String name, ru.ispras.fortress.expression.Node node)
Constructs a variable with the specified name described with the specifiedNode
object.- Parameters:
name
- Variable name.node
- Node describing the variable.- Throws:
java.lang.IllegalArgumentException
- if any of the parameters isnull
; if the node is not a value or a variable; if the variable data type is not a bit vector.
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the variable name.- Returns:
- Variable name.
-
getType
public ru.ispras.fortress.data.DataType getType()
Returns the variable data type.- Returns:
- Variable data type.
-
isType
public boolean isType(ru.ispras.fortress.data.DataTypeId typeId)
Checks whether the variable has the specified type (types are compared on theDataTypeId
level).- Parameters:
typeId
-DataTypeId
object the data type is to be compared to.- Returns:
true
if the variable type matches the type specified by thetypeId
argument orfalse
otherwise.
-
isType
public boolean isType(ru.ispras.fortress.data.DataType type)
Checks whether the variable has the specified type (types are compared on theDataType
level).- Parameters:
type
-DataType
object the data type is to be compared to.- Returns:
true
if the variable type matches the type specified by thetype
argument orfalse
otherwise.
-
getSize
public int getSize()
Returns variable bit size.- Returns:
- Variable bit size.
-
isUnknown
public boolean isUnknown()
Checks whether the variable is an unknown variable that must have its value assigned.- Returns:
true
if this is an unknown variable orfalse
otherwise.
-
getValue
public ru.ispras.fortress.expression.NodeValue getValue()
Returns a node describing the variable value.- Returns:
- A node describing the variable value.
- Throws:
java.lang.IllegalStateException
- if the variable has no value.
-
-