1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.giraph.factories;
19
20 import static org.apache.giraph.conf.GiraphConstants.EDGE_VALUE_FACTORY_CLASS;
21 import static org.apache.giraph.conf.GiraphConstants.VERTEX_ID_FACTORY_CLASS;
22 import static org.apache.giraph.conf.GiraphConstants.VERTEX_VALUE_FACTORY_CLASS;
23
24 import org.apache.hadoop.conf.Configuration;
25 import org.apache.hadoop.io.Writable;
26 import org.apache.hadoop.io.WritableComparable;
27
28
29
30
31
32
33
34
35
36
37
38
39 public class ValueFactories<I extends WritableComparable,
40 V extends Writable, E extends Writable> {
41
42 private final VertexIdFactory<I> vertexIdFactory;
43
44 private final VertexValueFactory<V> vertexValueFactory;
45
46 private final EdgeValueFactory<E> edgeValueFactory;
47
48
49
50
51
52
53 public ValueFactories(Configuration conf) {
54 vertexIdFactory = VERTEX_ID_FACTORY_CLASS.newInstance(conf);
55 vertexValueFactory = VERTEX_VALUE_FACTORY_CLASS.newInstance(conf);
56 edgeValueFactory = EDGE_VALUE_FACTORY_CLASS.newInstance(conf);
57 }
58
59 public EdgeValueFactory<E> getEdgeValueFactory() {
60 return edgeValueFactory;
61 }
62
63 public VertexIdFactory<I> getVertexIdFactory() {
64 return vertexIdFactory;
65 }
66
67 public VertexValueFactory<V> getVertexValueFactory() {
68 return vertexValueFactory;
69 }
70 }