1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
package org.apache.giraph.block_app.framework.piece.global_comm; |
19 | |
|
20 | |
import org.apache.hadoop.io.DoubleWritable; |
21 | |
import org.apache.hadoop.io.FloatWritable; |
22 | |
import org.apache.hadoop.io.IntWritable; |
23 | |
import org.apache.hadoop.io.LongWritable; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 0 | public class ReduceUtilsObject { |
30 | 0 | private final DoubleWritable reusableDouble = new DoubleWritable(); |
31 | 0 | private final FloatWritable reusableFloat = new FloatWritable(); |
32 | 0 | private final LongWritable reusableLong = new LongWritable(); |
33 | 0 | private final IntWritable reusableInt = new IntWritable(); |
34 | |
|
35 | |
|
36 | |
public void reduceDouble( |
37 | |
ReducerHandle<DoubleWritable, ?> reduceHandle, double value) { |
38 | 0 | DoubleWritable tmp = reusableDouble; |
39 | 0 | tmp.set(value); |
40 | 0 | reduceHandle.reduce(tmp); |
41 | 0 | } |
42 | |
|
43 | |
public void reduceFloat( |
44 | |
ReducerHandle<FloatWritable, ?> reduceHandle, float value) { |
45 | 0 | FloatWritable tmp = reusableFloat; |
46 | 0 | tmp.set(value); |
47 | 0 | reduceHandle.reduce(tmp); |
48 | 0 | } |
49 | |
|
50 | |
public void reduceLong( |
51 | |
ReducerHandle<LongWritable, ?> reduceHandle, long value) { |
52 | 0 | LongWritable tmp = reusableLong; |
53 | 0 | tmp.set(value); |
54 | 0 | reduceHandle.reduce(tmp); |
55 | 0 | } |
56 | |
|
57 | |
public void reduceInt(ReducerHandle<IntWritable, ?> reduceHandle, int value) { |
58 | 0 | IntWritable tmp = reusableInt; |
59 | 0 | tmp.set(value); |
60 | 0 | reduceHandle.reduce(tmp); |
61 | 0 | } |
62 | |
} |