org.apache.hadoop.examples
Class PiEstimator.PiMapper

java.lang.Object
  extended by org.apache.hadoop.mapred.MapReduceBase
      extended by 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.


Constructor Summary
PiEstimator.PiMapper()
           
 
Method Summary
 void map(LongWritable offset, LongWritable size, OutputCollector<BooleanWritable,LongWritable> out, Reporter reporter)
          Map method.
 
Methods inherited from class org.apache.hadoop.mapred.MapReduceBase
close, configure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.mapred.JobConfigurable
configure
 
Methods inherited from interface java.io.Closeable
close
 

Constructor Detail

PiEstimator.PiMapper

public PiEstimator.PiMapper()
Method Detail

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 map
out - output {ture->numInside, false->numOutside}
reporter -
Throws:
IOException


Copyright © 2009 The Apache Software Foundation