org.apache.hadoop.examples
Class PiEstimator.PiMapper
java.lang.Object
org.apache.hadoop.mapred.MapReduceBase
org.apache.hadoop.examples.PiEstimator.PiMapper
- All Implemented Interfaces:
- Closeable, JobConfigurable, Mapper<LongWritable,LongWritable,BooleanWritable,LongWritable>
- Enclosing class:
- PiEstimator
public static class PiEstimator.PiMapper
- extends MapReduceBase
- implements Mapper<LongWritable,LongWritable,BooleanWritable,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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PiEstimator.PiMapper
public PiEstimator.PiMapper()
map
public void map(LongWritable offset,
LongWritable size,
OutputCollector<BooleanWritable,LongWritable> out,
Reporter reporter)
throws IOException
- Map method.
- Specified by:
map
in interface Mapper<LongWritable,LongWritable,BooleanWritable,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:
IOException
Copyright © 2009 The Apache Software Foundation