Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PartitionMessage |
|
| 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 | package org.apache.giraph.comm.messages.queue; | |
19 | ||
20 | import org.apache.giraph.utils.VertexIdMessages; | |
21 | import org.apache.hadoop.io.Writable; | |
22 | import org.apache.hadoop.io.WritableComparable; | |
23 | ||
24 | /** | |
25 | * Small wrapper that holds a reference to vertex message | |
26 | * and knows partition id. | |
27 | * @param <I> vertexId type parameter | |
28 | * @param <M> message type parameter | |
29 | */ | |
30 | public class PartitionMessage<I extends WritableComparable, | |
31 | M extends Writable> { | |
32 | /** partition id */ | |
33 | private int partitionId; | |
34 | /** vertext message */ | |
35 | private VertexIdMessages<I, M> message; | |
36 | ||
37 | /** | |
38 | * Constructs wrapper from partitino id and vertext message | |
39 | * object. | |
40 | * @param partitionId destination partition id | |
41 | * @param message message object | |
42 | */ | |
43 | 0 | public PartitionMessage(int partitionId, VertexIdMessages<I, M> message) { |
44 | 0 | this.partitionId = partitionId; |
45 | 0 | this.message = message; |
46 | 0 | } |
47 | ||
48 | /** | |
49 | * Partition id | |
50 | * @return destination partition id. | |
51 | */ | |
52 | public int getPartitionId() { | |
53 | 0 | return partitionId; |
54 | } | |
55 | ||
56 | /** | |
57 | * Message | |
58 | * @return vertex message | |
59 | */ | |
60 | public VertexIdMessages<I, M> getMessage() { | |
61 | 0 | return message; |
62 | } | |
63 | ||
64 | @Override | |
65 | public String toString() { | |
66 | 0 | return "PartitionMessage{" + |
67 | "partitionId=" + partitionId + | |
68 | ", message=" + message + | |
69 | '}'; | |
70 | } | |
71 | } |