MCpiData is the object that is written to the Farm to tell the processes the operation they are to undertake. It has a property instances that indicates the number of objects of this class that are to be generated in an Emit process. It has a further two properties , iterations and within that are used to indicate the number of iterations this object created and then count the number of points thereby created that are within the unit circle.
instances
- the number of objects of this type to be generated and emitted into the process Farmiterations
- the number of iterations used, each one generating a new pointwithin
- the number of such points that are within the unit circleinstance
- the running count of the instances generated so farerrorState
- the error code returned by this class should an error occuropcode
- the operation code used in the invoke methodConstructor and description |
---|
MCpiData
() |
Type | Name and description |
---|---|
int |
createInstance(List d) Create an instance of this class and increments instance |
def |
getWithin(List d) Calculates for each iteration an x and y random value 0.0 <= v < 1.0 Then determines if the sum of the squares of x and y are <= 1.0 and adds 1 to within if so. |
int |
initClass(List p) Initialises the class such that instances is set equal to the value of p |
Create an instance of this class and increments instance
d
- the number of iteration to be undertakenCalculates for each iteration an x and y random value 0.0 <= v < 1.0 Then determines if the sum of the squares of x and y are <= 1.0 and adds 1 to within if so.
Initialises the class such that instances is set equal to the value of p
p
- a list containing one element with the number of instancesGPP - Groovy Parallel Patterns generated test by Jon Kerridge, Edinburgh Napier University - j.kerridge@napier.ac.uk