org.apache.hadoop.examples
Class PiEstimator.PiMapper
java.lang.Object
org.apache.hadoop.mapred.MapReduceBase
org.apache.hadoop.examples.PiEstimator.PiMapper
- All Implemented Interfaces:
- java.io.Closeable, JobConfigurable, Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.BooleanWritable,org.apache.hadoop.io.LongWritable>
- Enclosing class:
- PiEstimator
public static class PiEstimator.PiMapper
- extends MapReduceBase
- implements Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.BooleanWritable,org.apache.hadoop.io.LongWritable>
Mapper class for Pi estimation.
Generate points in a unit square
and then count points inside/outside of the inscribed circle of the square.
Method Summary |
void |
map(org.apache.hadoop.io.LongWritable offset,
org.apache.hadoop.io.LongWritable size,
OutputCollector<org.apache.hadoop.io.BooleanWritable,org.apache.hadoop.io.LongWritable> out,
Reporter reporter)
Map method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.Closeable |
close |
PiEstimator.PiMapper
public PiEstimator.PiMapper()
map
public void map(org.apache.hadoop.io.LongWritable offset,
org.apache.hadoop.io.LongWritable size,
OutputCollector<org.apache.hadoop.io.BooleanWritable,org.apache.hadoop.io.LongWritable> out,
Reporter reporter)
throws java.io.IOException
- Map method.
- Specified by:
map
in interface Mapper<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.BooleanWritable,org.apache.hadoop.io.LongWritable>
- Parameters:
offset
- samples starting from the (offset+1)th sample.size
- the number of samples for this mapout
- output {ture->numInside, false->numOutside}reporter
-
- Throws:
java.io.IOException
Copyright © 2009 The Apache Software Foundation