Package picasso.generator
Class RandomExpressionGenerator
- java.lang.Object
-
- picasso.generator.RandomExpressionGenerator
-
public class RandomExpressionGenerator extends Object
Generates random Picasso expressions
-
-
Constructor Summary
Constructors Constructor Description RandomExpressionGenerator()Creates a RandomExpressionGenerator with a random seedRandomExpressionGenerator(long seed)Creates a RandomExpressionGenerator with a specific seed Same seed will produce the same sequence of expressionsRandomExpressionGenerator(long seed, boolean allowRandom)Creates a RandomExpressionGenerator with a specific seed and random control
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringgenerate()Generates a random expression with a randomly determined depth (1-15)StringgenerateExpression(int depth)Generates a random expression with the given depthstatic List<String>getImageFunctions()Returns imageFunctions.static List<String>getNoArgFunctions()Returns noArgFunctions.static List<String>getOperations()Returns operations.static List<String>getUnaryFunctions()Returns unaryFunctions.booleanisAllowRandom()Returns whether random() is allowed in generated expressionsvoidsetAllowRandom(boolean allowRandom)Sets whether random() function is allowed in generated expressionsvoidsetSeed(long seed)Sets the seed for the random number generator.
-
-
-
Constructor Detail
-
RandomExpressionGenerator
public RandomExpressionGenerator()
Creates a RandomExpressionGenerator with a random seed
-
RandomExpressionGenerator
public RandomExpressionGenerator(long seed)
Creates a RandomExpressionGenerator with a specific seed Same seed will produce the same sequence of expressions- Parameters:
seed- the seed value
-
RandomExpressionGenerator
public RandomExpressionGenerator(long seed, boolean allowRandom)Creates a RandomExpressionGenerator with a specific seed and random control- Parameters:
seed- the seed valueallowRandom- if false, random() won't appear in generated expressions
-
-
Method Detail
-
setSeed
public void setSeed(long seed)
Sets the seed for the random number generator.- Parameters:
seed- the seed value
-
setAllowRandom
public void setAllowRandom(boolean allowRandom)
Sets whether random() function is allowed in generated expressions- Parameters:
allowRandom- true to allow random(), false to exclude it
-
isAllowRandom
public boolean isAllowRandom()
Returns whether random() is allowed in generated expressions- Returns:
- true if random() is allowed
-
getNoArgFunctions
public static List<String> getNoArgFunctions()
Returns noArgFunctions.- Returns:
- noArgFunctions.
-
getUnaryFunctions
public static List<String> getUnaryFunctions()
Returns unaryFunctions.- Returns:
- unaryFunctions.
-
getImageFunctions
public static List<String> getImageFunctions()
Returns imageFunctions.- Returns:
- imageFunctions.
-
generate
public String generate()
Generates a random expression with a randomly determined depth (1-15)- Returns:
- a randomly generated Picasso expression string
-
generateExpression
public String generateExpression(int depth)
Generates a random expression with the given depth- Parameters:
depth- the maximum nesting depth- Returns:
- a randomly generated Picasso expression string
-
-