Package util
Class VariableGenerator
java.lang.Object
util.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 randomlyVariableGenerator(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 intcodePieces(java.lang.String aPiece)java.lang.StringdecodePiece(int code)VariablegenerateVariable()java.lang.StringgenerateZeroes(int n)java.util.RandomgetRan()booleanisGenValue()voidsetGenValue(boolean genValue)sets the state of objects of this classvoidsetRan(java.util.Random ran)
-
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 java.util.Random getRan() -
setRan
public void setRan(java.util.Random ran) -
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
-