1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.giraph.utils;
20
21 import org.apache.giraph.conf.ImmutableClassesGiraphConfiguration;
22 import org.apache.giraph.edge.Edge;
23 import org.apache.hadoop.io.Writable;
24 import org.apache.hadoop.io.WritableComparable;
25
26 import java.io.IOException;
27
28
29
30
31
32
33
34 @SuppressWarnings("unchecked")
35 public class ByteArrayVertexIdEdges<I extends WritableComparable,
36 E extends Writable> extends ByteArrayVertexIdData<I, Edge<I,
37 E>> implements VertexIdEdges<I, E> {
38
39
40
41
42
43
44 @Override
45 public ImmutableClassesGiraphConfiguration<I, ?, E> getConf() {
46 return (ImmutableClassesGiraphConfiguration<I, ?, E>) super.getConf();
47 }
48
49 @Override
50 public Edge<I, E> createData() {
51 return getConf().createReusableEdge();
52 }
53
54 @Override
55 public void writeData(ExtendedDataOutput out, Edge<I, E> edge)
56 throws IOException {
57 WritableUtils.writeEdge(out, edge);
58 }
59
60 @Override
61 public void readData(ExtendedDataInput in, Edge<I, E> edge)
62 throws IOException {
63 WritableUtils.readEdge(in, edge);
64 }
65
66 @Override
67 public ByteStructVertexIdEdgeIterator<I, E> getVertexIdEdgeIterator() {
68 return new ByteStructVertexIdEdgeIterator<>(this);
69 }
70 }
71