Class EmgOperationContributor
java.lang.Object
org.eclipse.epsilon.eol.execute.operations.contributors.OperationContributor
org.eclipse.epsilon.emg.execute.operations.contributors.EmgOperationContributor
- All Implemented Interfaces:
AutoCloseable
,org.apache.commons.math3.random.RandomGenerator
,IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
public class EmgOperationContributor
extends OperationContributor
implements IEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
The Class ObjectOperationContributor delegates all the random generating
functions to a EmgRandomGenerator but overloads the nextXXXList operations to
allow the user to specify @list annotations values as listIDs.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.epsilon.emg.random.IEmgRandomGenerator
IEmgRandomGenerator.DefaultCharacterSet, IEmgRandomGenerator.Distribution
-
Field Summary
Fields inherited from class org.eclipse.epsilon.eol.execute.operations.contributors.OperationContributor
cachedMethodNames
-
Constructor Summary
ConstructorsConstructorDescriptionEmgOperationContributor
(EmgModule module) Instantiates a new emg operation contributor.EmgOperationContributor
(EmgModule module, long seed) Instantiates a new emg operation contributor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contributesTo
(Object target) long[]
Decode string to numbers.encode
(int number) Encrypt numbers to string.Gets the hasids salt.getNamedList
(String name) Gets the elements from create rules with the @list annotation with the given name parameter.nextAddTo
(int n, int m) Returns an array of n integers that addvar to m.double
nextBinomialValue
(int numberOfTrials, double probabilityOfSuccess) Next binomial value.boolean
void
nextBytes
(byte[] bytes) nextCamelCaseString
(int length, int minWordLength) Next camel case string.nextCapitalisedString
(String charSet, int length) Next capitalised string.double
nextDobule
(double upper) Next dobule.double
nextDobule
(double lower, double upper) Next dobule.double
double
nextExponentialValue
(double mean) Next exponential value.float
nextFromCollection
(Collection<?> c) Next from collection.nextFromList
(String listID) The listID is the value of a @list annotation of a create operation.nextFromListAsSample
(String listID) The listID is the value of a @list annotation of a create operation.double
nextHttpURI
(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) Next http URI.int
nextInt()
int
nextInt
(int n) int
nextInteger
(int upper) Next integer.int
nextInteger
(int lower, int upper) Next integer.long
nextLong()
long
nextLong
(long upper) Next long.long
nextLong
(long lower, long upper) Next long.nextSample
(String listID, int k) The listID is the value of a @list annotation of a create operation.nextSample
(Collection<?> c, int k) Next sample.nextString
(String charSet, int length) Next string.nextURI()
Next URI.nextURI
(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) Next URI.double
Next value.void
setHasids_salt
(String hasids_salt) Sets the hasids salt.void
setSeed
(int seed) void
setSeed
(int[] seed) void
setSeed
(long seed) void
useBinomialDistribution
(int numberOfTrials, double probabilityOfSuccess) Use binomial distribution.void
useExponentialDistribution
(double mean) Use exponential distribution.Methods inherited from class org.eclipse.epsilon.eol.execute.operations.contributors.OperationContributor
close, findContributedMethodForEvaluatedParameters, findContributedMethodForEvaluatedParameters, findContributedMethodForUnevaluatedParameters, getContext, getReflectionTarget, getTarget, includeInheritedMethods, setContext, setTarget
-
Constructor Details
-
EmgOperationContributor
Instantiates a new emg operation contributor.- Parameters:
module
- the module
-
EmgOperationContributor
Instantiates a new emg operation contributor.- Parameters:
module
- the moduleseed
- the seed
-
-
Method Details
-
contributesTo
- Specified by:
contributesTo
in classOperationContributor
-
decode
Decode string to numbers.- Parameters:
hash
- the encrypt string- Returns:
- decoded numbers
-
encode
Encrypt numbers to string.- Parameters:
number
- the number- Returns:
- the encrypt string
-
getHasids_salt
Gets the hasids salt.- Returns:
- the hasids_salt
-
getNamedList
Gets the elements from create rules with the @list annotation with the given name parameter.- Parameters:
name
- the name- Returns:
- the named list
-
nextAddTo
Description copied from interface:IEmgRandomGenerator
Returns an array of n integers that addvar to m.- Specified by:
nextAddTo
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Returns:
- Throws:
EolRuntimeException
-
nextBinomialValue
public double nextBinomialValue(int numberOfTrials, double probabilityOfSuccess) Next binomial value.- Specified by:
nextBinomialValue
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
numberOfTrials
- the number of trialsprobabilityOfSuccess
- the probability of success- Returns:
- the double
- See Also:
-
nextBoolean
public boolean nextBoolean()- Specified by:
nextBoolean
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Returns:
- See Also:
-
nextBytes
public void nextBytes(byte[] bytes) - Specified by:
nextBytes
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Parameters:
bytes
-- See Also:
-
nextCamelCaseString
Next camel case string.- Specified by:
nextCamelCaseString
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
length
- the lengthminWordLength
- the min word length- Returns:
- the string
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextCapitalisedString
Next capitalised string.- Specified by:
nextCapitalisedString
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
charSet
- the char setlength
- the length- Returns:
- the string
- See Also:
-
nextDobule
Next dobule.- Specified by:
nextDobule
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
upper
- the upper- Returns:
- the double
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextDobule
public double nextDobule(double lower, double upper) Next dobule.- Specified by:
nextDobule
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
lower
- the lowerupper
- the upper- Returns:
- the double
- See Also:
-
nextDouble
public double nextDouble()- Specified by:
nextDouble
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Returns:
- See Also:
-
nextExponentialValue
public double nextExponentialValue(double mean) Next exponential value.- Specified by:
nextExponentialValue
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
mean
- the mean- Returns:
- the double
- See Also:
-
nextFloat
public float nextFloat()- Specified by:
nextFloat
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Returns:
- See Also:
-
nextFromCollection
Next from collection.- Specified by:
nextFromCollection
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
c
- the c- Returns:
- the object
- See Also:
-
nextFromList
The listID is the value of a @list annotation of a create operation. If no create operation with that @list annotation value is found, the operation is delegated to the underlyingEmgRandomGenerator
.- Specified by:
nextFromList
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
listID
- the list ID- Returns:
- the object
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextFromListAsSample
The listID is the value of a @list annotation of a create operation. If no create operation with that @list annotation value is found, the operation is delegated to the underlyingEmgRandomGenerator
.- Specified by:
nextFromListAsSample
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
listID
- the list ID- Returns:
- the object
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
org.eclipse.epsilon.emg.random.EmgRandomGenerator#nextSampleFromList(java.lang.String)
-
nextGaussian
public double nextGaussian()- Specified by:
nextGaussian
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Returns:
- See Also:
-
nextHttpURI
public String nextHttpURI(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) throws EolRuntimeException Next http URI.- Specified by:
nextHttpURI
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
addPort
- the add portaddPath
- the add pathaddQuery
- the add queryaddFragment
- the add fragment- Returns:
- the string
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextInt
public int nextInt()- Specified by:
nextInt
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Returns:
- See Also:
-
nextInt
public int nextInt(int n) - Specified by:
nextInt
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Parameters:
n
-- Returns:
- See Also:
-
nextInteger
Next integer.- Specified by:
nextInteger
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
upper
- the upper- Returns:
- the int
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextInteger
Next integer.- Specified by:
nextInteger
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
lower
- the lowerupper
- the upper- Returns:
- the int
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextLong
public long nextLong()- Specified by:
nextLong
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Returns:
- See Also:
-
nextLong
Next long.- Specified by:
nextLong
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
upper
- the upper- Returns:
- the long
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextLong
Next long.- Specified by:
nextLong
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
lower
- the lowerupper
- the upper- Returns:
- the long
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextSample
Next sample.- Specified by:
nextSample
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
c
- the ck
- the k- Returns:
- the list
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextSample
The listID is the value of a @list annotation of a create operation. If no create operation with that @list annotation value is found, the operation is delegated to the underlyingEmgRandomGenerator
.- Specified by:
nextSample
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
listID
- the list IDk
- the k- Returns:
- the list
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextString
Next string.- Specified by:
nextString
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
charSet
- the char setlength
- the length- Returns:
- the string
- See Also:
-
nextURI
Next URI.- Specified by:
nextURI
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Returns:
- the string
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextURI
public String nextURI(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) throws EolRuntimeException Next URI.- Specified by:
nextURI
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Parameters:
addPort
- the add portaddPath
- the add pathaddQuery
- the add queryaddFragment
- the add fragment- Returns:
- the string
- Throws:
EolRuntimeException
- the eol runtime exception- See Also:
-
nextValue
public double nextValue()Next value.- Specified by:
nextValue
in interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>
- Returns:
- the double
- See Also:
-
setHasids_salt
Sets the hasids salt.- Parameters:
hasids_salt
- the hasids_salt to set
-
setSeed
public void setSeed(int seed) - Specified by:
setSeed
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Parameters:
seed
-- See Also:
-
setSeed
public void setSeed(int[] seed) - Specified by:
setSeed
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Parameters:
seed
-- See Also:
-
setSeed
public void setSeed(long seed) - Specified by:
setSeed
in interfaceorg.apache.commons.math3.random.RandomGenerator
- Parameters:
seed
-- See Also:
-
useBinomialDistribution
public void useBinomialDistribution(int numberOfTrials, double probabilityOfSuccess) Use binomial distribution.- Parameters:
numberOfTrials
- the number of trialsprobabilityOfSuccess
- the probability of success- See Also:
-
useExponentialDistribution
public void useExponentialDistribution(double mean) Use exponential distribution.- Parameters:
mean
- the mean- See Also:
-