Package util

Class VariableGenerator

java.lang.Object
util.VariableGenerator

public class VariableGenerator extends Object
  • Field Details

    • genValue

      private boolean genValue
      used to set the state of objects of this class.That is, if or not they will generate a number value randomly to set as its value.
    • var

      private Variable var
      The Variable object that is initialized randomly.
    • ran

      private Random ran
      The Random attribute of this class that allows it to randomize and generate Variable names randomly.
  • Constructor Details

    • VariableGenerator

      public VariableGenerator(int n)
    • VariableGenerator

      public VariableGenerator(int n, boolean genValue)
      creates a new object of this class that can be used to generate Variables randomly
      Parameters:
      n - determines the number of characters that the Variable name will have.
      genValue - variable that determines if the client needs the randomly generated variable to have a randomly specified value too.
    • VariableGenerator

      public VariableGenerator(int n, double val)
      creates a new object of this class that can be used to generate Variables randomly
      Parameters:
      n - determines the number of characters that the Variable name will have.
      val - client specified value for the new Variable to have a randomly specified value too.
  • Method Details

    • isGenValue

      public boolean isGenValue()
      Returns:
      the state of objects of this class that is whether or not they will randomly generate values for Variable objects.
    • setGenValue

      public void setGenValue(boolean genValue)
      sets the state of objects of this class
      Parameters:
      genValue - the state of the object:that is whether or not they will randomly generate values for Variable objects.
    • getRan

      public Random getRan()
    • setRan

      public void setRan(Random ran)
    • generateVariable

      public Variable generateVariable()
    • generateZeroes

      public String generateZeroes(int n)
    • codePieces

      public int codePieces(String aPiece)
      Parameters:
      aPiece - takes a String character that can form a valid part of the name of an object of class Variable and encodes it
      Returns:
      the code of the character
    • decodePiece

      public String decodePiece(int code)
      Parameters:
      code - the number code that hides a character or symbol that can form part of a Variable object's name property.
      Returns:
      returns the String character associated with a number code where the character is one that can form a part of the name of an object of class Variable