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 TypeMethodDescriptionbooleancontributesTo(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.doublenextBinomialValue(int numberOfTrials, double probabilityOfSuccess) Next binomial value.booleanvoidnextBytes(byte[] bytes) nextCamelCaseString(int length, int minWordLength) Next camel case string.nextCapitalisedString(String charSet, int length) Next capitalised string.doublenextDobule(double upper) Next dobule.doublenextDobule(double lower, double upper) Next dobule.doubledoublenextExponentialValue(double mean) Next exponential value.floatnextFromCollection(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.doublenextHttpURI(boolean addPort, boolean addPath, boolean addQuery, boolean addFragment) Next http URI.intnextInt()intnextInt(int n) intnextInteger(int upper) Next integer.intnextInteger(int lower, int upper) Next integer.longnextLong()longnextLong(long upper) Next long.longnextLong(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.doubleNext value.voidsetHasids_salt(String hasids_salt) Sets the hasids salt.voidsetSeed(int seed) voidsetSeed(int[] seed) voidsetSeed(long seed) voiduseBinomialDistribution(int numberOfTrials, double probabilityOfSuccess) Use binomial distribution.voiduseExponentialDistribution(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:
contributesToin 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:IEmgRandomGeneratorReturns an array of n integers that addvar to m.- Specified by:
nextAddToin interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>- Returns:
- Throws:
EolRuntimeException
-
nextBinomialValue
public double nextBinomialValue(int numberOfTrials, double probabilityOfSuccess) Next binomial value.- Specified by:
nextBinomialValuein interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>- Parameters:
numberOfTrials- the number of trialsprobabilityOfSuccess- the probability of success- Returns:
- the double
- See Also:
-
nextBoolean
public boolean nextBoolean()- Specified by:
nextBooleanin interfaceorg.apache.commons.math3.random.RandomGenerator- Returns:
- See Also:
-
nextBytes
public void nextBytes(byte[] bytes) - Specified by:
nextBytesin interfaceorg.apache.commons.math3.random.RandomGenerator- Parameters:
bytes-- See Also:
-
nextCamelCaseString
Next camel case string.- Specified by:
nextCamelCaseStringin 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:
nextCapitalisedStringin interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>- Parameters:
charSet- the char setlength- the length- Returns:
- the string
- See Also:
-
nextDobule
Next dobule.- Specified by:
nextDobulein 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:
nextDobulein interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>- Parameters:
lower- the lowerupper- the upper- Returns:
- the double
- See Also:
-
nextDouble
public double nextDouble()- Specified by:
nextDoublein interfaceorg.apache.commons.math3.random.RandomGenerator- Returns:
- See Also:
-
nextExponentialValue
public double nextExponentialValue(double mean) Next exponential value.- Specified by:
nextExponentialValuein interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>- Parameters:
mean- the mean- Returns:
- the double
- See Also:
-
nextFloat
public float nextFloat()- Specified by:
nextFloatin interfaceorg.apache.commons.math3.random.RandomGenerator- Returns:
- See Also:
-
nextFromCollection
Next from collection.- Specified by:
nextFromCollectionin 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:
nextFromListin 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:
nextFromListAsSamplein 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:
nextGaussianin 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:
nextHttpURIin 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:
nextIntin interfaceorg.apache.commons.math3.random.RandomGenerator- Returns:
- See Also:
-
nextInt
public int nextInt(int n) - Specified by:
nextIntin interfaceorg.apache.commons.math3.random.RandomGenerator- Parameters:
n-- Returns:
- See Also:
-
nextInteger
Next integer.- Specified by:
nextIntegerin interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>- Parameters:
upper- the upper- Returns:
- the int
- Throws:
EolRuntimeException- the eol runtime exception- See Also:
-
nextInteger
Next integer.- Specified by:
nextIntegerin 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:
nextLongin interfaceorg.apache.commons.math3.random.RandomGenerator- Returns:
- See Also:
-
nextLong
Next long.- Specified by:
nextLongin interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>- Parameters:
upper- the upper- Returns:
- the long
- Throws:
EolRuntimeException- the eol runtime exception- See Also:
-
nextLong
Next long.- Specified by:
nextLongin 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:
nextSamplein 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:
nextSamplein 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:
nextStringin interfaceIEmgRandomGenerator<IEmgRandomGenerator.DefaultCharacterSet>- Parameters:
charSet- the char setlength- the length- Returns:
- the string
- See Also:
-
nextURI
Next URI.- Specified by:
nextURIin 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:
nextURIin 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:
nextValuein 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:
setSeedin interfaceorg.apache.commons.math3.random.RandomGenerator- Parameters:
seed-- See Also:
-
setSeed
public void setSeed(int[] seed) - Specified by:
setSeedin interfaceorg.apache.commons.math3.random.RandomGenerator- Parameters:
seed-- See Also:
-
setSeed
public void setSeed(long seed) - Specified by:
setSeedin 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:
-