Class DataGeneratorBase

    • Constructor Summary

      Constructors 
      Constructor 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.
    • Constructor Detail

      • DataGeneratorBase

        public 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.
        Parameters:
        name - Data generator name.
        instructions - Names of instructions the generator is applicable to. If it equals null, the generator is applicable to all instructions.
        Throws:
        java.lang.IllegalArgumentException - if name is null.
      • DataGeneratorBase

        public DataGeneratorBase​(java.lang.String name)
        Constructs a data generator with the specified name applicable to all instructions.
        Parameters:
        name - Data generator name.
        Throws:
        java.lang.IllegalArgumentException - if name is null.
    • Method Detail

      • getName

        public final java.lang.String getName()
        Returns data generator name.
        Returns:
        Name identifying the data generator.
      • isSuitable

        public boolean isSuitable​(TestBaseQuery query)
        Checks whether the data generator is capable of generating data for the specified query.

        The generator is considered suitable if two conditions are satisfied:

        1. the generator name matches the test case name specified in the query;
        2. the instruction name specified in the query is in the set of supported instructions (skipped if the set is null).
        Specified by:
        isSuitable in interface DataGenerator
        Parameters:
        query - Query to be processed.
        Returns:
        true if the query can be handled by the generator or false otherwise.
      • generate

        protected abstract void generate​(DataGeneratorQuery query)
        Generates data for the specified data generator query. Generated values are assigned to the query variables.
        Parameters:
        query - Data generator query to be processed.
      • setValue

        protected final void setValue​(DataGeneratorVariable variable,
                                      int value)
        Assigns an integer value to the specified variable. The value is zero-extended to suit the variable size.
        Parameters:
        variable - Variable to be assigned a value.
        value - Value to be assigned.
        Throws:
        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.
      • setValue

        protected final 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.
        Parameters:
        variable - Variable to be assigned a value.
        value - Value to be assigned.
        Throws:
        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.
      • setValue

        protected final void setValue​(DataGeneratorVariable variable,
                                      java.math.BigInteger value)
        Assigns a BigInteger value to the specified variable.
        Parameters:
        variable - Variable to be assigned a value.
        value - Value to be assigned.
        Throws:
        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.
      • setValue

        protected final void setValue​(DataGeneratorVariable variable,
                                      ru.ispras.fortress.data.types.bitvector.BitVector value)
        Assigns a BitVector value to the specified variable.
        Parameters:
        variable - Variable to be assigned a value.
        value - Value to be assigned.
        Throws:
        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.
      • setValue

        protected final void setValue​(DataGeneratorVariable variable,
                                      ru.ispras.fortress.data.Data value)
        Assigns a Data value to the specified variable.
        Parameters:
        variable - Variable to be assigned a value.
        value - Value to be assigned.
        Throws:
        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.
      • setValue

        protected final void setValue​(DataGeneratorVariable variable,
                                      ru.ispras.fortress.expression.NodeValue value)
        Assigns a NodeValue value to the specified variable.
        Parameters:
        variable - Variable to be assigned a value.
        value - Value to be assigned.
        Throws:
        java.lang.IllegalArgumentException - if any of the arguments is null; if the variable already has a value.
      • setValue

        protected final void setValue​(DataGeneratorVariable variable,
                                      Iterator<ru.ispras.fortress.expression.NodeValue> values)
        Assigns a NodeValue iterator to the specified variable.
        Parameters:
        variable - Variable to be assigned a value.
        values - Value iterator to be assigned.
        Throws:
        java.lang.IllegalArgumentException - if any of the arguments is null; if the variable already has a value; if the value iterator is empty.