public abstract class DataGeneratorBase extends java.lang.Object implements DataGenerator
DataGeneratorBase
class provides a basic implementation of a data generator.Constructor and Description |
---|
DataGeneratorBase(java.lang.String name)
Constructs a data generator with the specified name applicable to all instructions.
|
DataGeneratorBase(java.lang.String name,
java.util.Set<java.lang.String> instructions)
Constructs a data generator with the specified name applicable to the specified
instructions.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
generate(DataGeneratorQuery query)
Generates data for the specified data generator query.
|
Iterator<TestData> |
generate(TestBaseQuery query)
Generates data for the specified query.
|
java.lang.String |
getName()
Returns data generator name.
|
boolean |
isSuitable(TestBaseQuery query)
Checks whether the data generator is capable of generating data
for the specified query.
|
protected void |
setValue(DataGeneratorVariable variable,
java.math.BigInteger value)
Assigns a
BigInteger value to the specified variable. |
protected void |
setValue(DataGeneratorVariable variable,
ru.ispras.fortress.data.types.bitvector.BitVector value)
Assigns a
BitVector value to the specified variable. |
protected void |
setValue(DataGeneratorVariable variable,
ru.ispras.fortress.data.Data value)
Assigns a
Data value to the specified variable. |
protected void |
setValue(DataGeneratorVariable variable,
int value)
Assigns an integer value to the specified variable.
|
protected void |
setValue(DataGeneratorVariable variable,
Iterator<ru.ispras.fortress.expression.NodeValue> values)
Assigns a
NodeValue iterator to the specified variable. |
protected void |
setValue(DataGeneratorVariable variable,
long value)
Assigns a long integer value to the specified variable
The value is zero-extended to suit the variable size.
|
protected void |
setValue(DataGeneratorVariable variable,
ru.ispras.fortress.expression.NodeValue value)
Assigns a
NodeValue value to the specified variable. |
public DataGeneratorBase(java.lang.String name, java.util.Set<java.lang.String> instructions)
name
- Data generator name.instructions
- Names of instructions the generator is applicable to. If it equals
null
, the generator is applicable to all instructions.java.lang.IllegalArgumentException
- if name
is null
.public DataGeneratorBase(java.lang.String name)
name
- Data generator name.java.lang.IllegalArgumentException
- if name
is null
.public final java.lang.String getName()
public boolean isSuitable(TestBaseQuery query)
The generator is considered suitable if two conditions are satisfied:
null
).isSuitable
in interface DataGenerator
query
- Query to be processed.true
if the query can be handled by the generator or
false
otherwise.public final Iterator<TestData> generate(TestBaseQuery query)
DataGenerator
generate
in interface DataGenerator
query
- Query to be processed.protected abstract void generate(DataGeneratorQuery query)
query
- Data generator query to be processed.protected final void setValue(DataGeneratorVariable variable, int value)
variable
- Variable to be assigned a value.value
- Value to be assigned.java.lang.IllegalArgumentException
- if the variable
argument is null
;
if the variable already has a value;
if the value type does not match the variable type.protected final void setValue(DataGeneratorVariable variable, long value)
variable
- Variable to be assigned a value.value
- Value to be assigned.java.lang.IllegalArgumentException
- if the variable
argument is null
;
if the variable already has a value;
if the value type does not match the variable type.protected final void setValue(DataGeneratorVariable variable, java.math.BigInteger value)
BigInteger
value to the specified variable.variable
- Variable to be assigned a value.value
- Value to be assigned.java.lang.IllegalArgumentException
- if any of the arguments is null
;
if the variable already has a value;
if the value type does not match the variable type.protected final void setValue(DataGeneratorVariable variable, ru.ispras.fortress.data.types.bitvector.BitVector value)
BitVector
value to the specified variable.variable
- Variable to be assigned a value.value
- Value to be assigned.java.lang.IllegalArgumentException
- if any of the arguments is null
;
if the variable already has a value;
if the value size does not match the variable size.protected final void setValue(DataGeneratorVariable variable, ru.ispras.fortress.data.Data value)
Data
value to the specified variable.variable
- Variable to be assigned a value.value
- Value to be assigned.java.lang.IllegalArgumentException
- if the argument is null
;
if the variable already has a value;
if the value type does not match the variable type.protected final void setValue(DataGeneratorVariable variable, ru.ispras.fortress.expression.NodeValue value)
NodeValue
value to the specified variable.variable
- Variable to be assigned a value.value
- Value to be assigned.java.lang.IllegalArgumentException
- if any of the arguments is null
;
if the variable already has a value.protected final void setValue(DataGeneratorVariable variable, Iterator<ru.ispras.fortress.expression.NodeValue> values)
NodeValue
iterator to the specified variable.variable
- Variable to be assigned a value.values
- Value iterator to be assigned.java.lang.IllegalArgumentException
- if any of the arguments is null
;
if the variable already has a value;
if the value iterator is empty.