1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.giraph.conf;
19
20 import org.apache.giraph.graph.GraphType;
21 import org.apache.hadoop.conf.Configuration;
22
23
24
25
26 public class PerGraphTypeBooleanConfOption {
27
28 private final BooleanConfOption vertexId;
29
30 private final BooleanConfOption vertexValue;
31
32 private final BooleanConfOption edgeValue;
33
34 private final BooleanConfOption outgoingMessage;
35
36
37
38
39
40
41
42
43 public PerGraphTypeBooleanConfOption(String keyPrefix,
44 boolean defaultValue, String description) {
45 vertexId = new BooleanConfOption(keyPrefix + ".vertex.id",
46 defaultValue, description);
47 vertexValue = new BooleanConfOption(keyPrefix + ".vertex.value",
48 defaultValue, description);
49 edgeValue = new BooleanConfOption(keyPrefix + ".edge.value",
50 defaultValue, description);
51 outgoingMessage = new BooleanConfOption(keyPrefix + ".outgoing.message",
52 defaultValue, description);
53 }
54
55
56
57
58
59
60
61 public BooleanConfOption get(GraphType graphType) {
62 switch (graphType) {
63 case VERTEX_ID:
64 return vertexId;
65 case VERTEX_VALUE:
66 return vertexValue;
67 case EDGE_VALUE:
68 return edgeValue;
69 case OUTGOING_MESSAGE_VALUE:
70 return outgoingMessage;
71 default:
72 throw new IllegalArgumentException(
73 "Don't know how to handle GraphType " + graphType);
74 }
75 }
76
77
78
79
80
81
82
83
84 public void set(Configuration conf, GraphType graphType, boolean value) {
85 get(graphType).set(conf, value);
86 }
87
88 public BooleanConfOption getEdgeValue() {
89 return edgeValue;
90 }
91
92 public BooleanConfOption getOutgoingMessage() {
93 return outgoingMessage;
94 }
95
96 public BooleanConfOption getVertexId() {
97 return vertexId;
98 }
99
100 public BooleanConfOption getVertexValue() {
101 return vertexValue;
102 }
103 }
104