Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MsgList |
|
| 1.0;1 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, software | |
13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | * See the License for the specific language governing permissions and | |
16 | * limitations under the License. | |
17 | */ | |
18 | ||
19 | package org.apache.giraph.comm; | |
20 | ||
21 | import org.apache.giraph.graph.BspUtils; | |
22 | import org.apache.giraph.utils.ArrayListWritable; | |
23 | import org.apache.hadoop.io.Writable; | |
24 | ||
25 | /** | |
26 | * Wrapper around {@link ArrayListWritable} that allows the message class to | |
27 | * be set prior to calling readFields(). | |
28 | * | |
29 | * @param <M> message type | |
30 | */ | |
31 | public class MsgList<M extends Writable> extends ArrayListWritable<M> { | |
32 | /** Defining a layout version for a serializable class. */ | |
33 | private static final long serialVersionUID = 100L; | |
34 | ||
35 | /** | |
36 | * Default constructor. | |
37 | */ | |
38 | public MsgList() { | |
39 | 1536 | super(); |
40 | 1536 | } |
41 | ||
42 | /** | |
43 | * Copy constructor. | |
44 | * | |
45 | * @param msgList List of messages for writing. | |
46 | */ | |
47 | public MsgList(MsgList<M> msgList) { | |
48 | 0 | super(msgList); |
49 | 0 | } |
50 | ||
51 | @SuppressWarnings("unchecked") | |
52 | @Override | |
53 | public void setClass() { | |
54 | 0 | setClass((Class<M>) BspUtils.getMessageValueClass(getConf())); |
55 | 0 | } |
56 | } |