Package util

Class VariableGenerator


  • public class VariableGenerator
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      VariableGenerator​(int n)  
      VariableGenerator​(int n, boolean genValue)
      creates a new object of this class that can be used to generate Variables randomly
      VariableGenerator​(int n, double val)
      creates a new object of this class that can be used to generate Variables randomly
    • Method Summary

      Modifier and Type Method Description
      int codePieces​(java.lang.String aPiece)  
      java.lang.String decodePiece​(int code)  
      Variable generateVariable()  
      java.lang.String generateZeroes​(int n)  
      java.util.Random getRan()  
      boolean isGenValue()  
      void setGenValue​(boolean genValue)
      sets the state of objects of this class
      void setRan​(java.util.Random ran)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • 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 Detail

      • 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 java.util.Random getRan()
      • setRan

        public void setRan​(java.util.Random ran)
      • generateVariable

        public Variable generateVariable()
      • generateZeroes

        public java.lang.String generateZeroes​(int n)
      • codePieces

        public int codePieces​(java.lang.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 java.lang.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