Class VariableGenerator
java.lang.Object
util.VariableGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanused 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.private RandomThe Random attribute of this class that allows it to randomize and generate Variable names randomly.private VariableThe Variable object that is initialized randomly. -
Constructor Summary
ConstructorsConstructorDescriptionVariableGenerator(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 TypeMethodDescriptionintcodePieces(String aPiece) decodePiece(int code) generateZeroes(int n) getRan()booleanvoidsetGenValue(boolean genValue) sets the state of objects of this classvoid
-
Field Details
-
genValue
private boolean genValueused 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
The Variable object that is initialized randomly. -
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
-
setRan
-
generateVariable
-
generateZeroes
-
codePieces
- 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
- 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
-