Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PrimitiveRefs |
|
| 1.0;1 | ||||
PrimitiveRefs$DoubleRef |
|
| 1.0;1 | ||||
PrimitiveRefs$FloatRef |
|
| 1.0;1 | ||||
PrimitiveRefs$IntRef |
|
| 1.0;1 | ||||
PrimitiveRefs$LongRef |
|
| 1.0;1 | ||||
PrimitiveRefs$ObjRef |
|
| 1.0;1 | ||||
PrimitiveRefs$ShortRef |
|
| 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.function.primitive; | |
19 | ||
20 | /** | |
21 | * Convenience classes holding primitive values - a reference | |
22 | * to a mutable value. | |
23 | * For use when lambdas need to mutate capturing primitive local variable. | |
24 | * (since lambdas cannot capture and modify local variables) | |
25 | */ | |
26 | public interface PrimitiveRefs { | |
27 | ||
28 | // Have public field for convenience, since classes have no logic inside | |
29 | // CHECKSTYLE: stop VisibilityModifierCheck | |
30 | ||
31 | /** | |
32 | * Convenience class holding int value, | |
33 | * for use when lambdas need to mutate capturing int local variable. | |
34 | */ | |
35 | public class IntRef { | |
36 | /** value */ | |
37 | public int value; | |
38 | ||
39 | /** | |
40 | * Constructor | |
41 | * @param value initial value | |
42 | */ | |
43 | 0 | public IntRef(int value) { |
44 | 0 | this.value = value; |
45 | 0 | } |
46 | } | |
47 | ||
48 | /** | |
49 | * Convenience class holding long value, | |
50 | * for use when lambdas need to mutate capturing long local variable. | |
51 | */ | |
52 | public class LongRef { | |
53 | /** value */ | |
54 | public long value; | |
55 | ||
56 | /** | |
57 | * Constructor | |
58 | * @param value initial value | |
59 | */ | |
60 | 0 | public LongRef(long value) { |
61 | 0 | this.value = value; |
62 | 0 | } |
63 | } | |
64 | ||
65 | /** | |
66 | * Convenience class holding int value, | |
67 | * for use when lambdas need to mutate capturing int local variable. | |
68 | */ | |
69 | public class ShortRef { | |
70 | /** value */ | |
71 | public short value; | |
72 | ||
73 | /** | |
74 | * Constructor | |
75 | * @param value initial value | |
76 | */ | |
77 | 0 | public ShortRef(short value) { |
78 | 0 | this.value = value; |
79 | 0 | } |
80 | } | |
81 | ||
82 | ||
83 | /** | |
84 | * Convenience class holding float value, | |
85 | * for use when lambdas need to mutate capturing float local variable. | |
86 | */ | |
87 | public class FloatRef { | |
88 | /** value */ | |
89 | public float value; | |
90 | ||
91 | /** | |
92 | * Constructor | |
93 | * @param value initial value | |
94 | */ | |
95 | 0 | public FloatRef(float value) { |
96 | 0 | this.value = value; |
97 | 0 | } |
98 | } | |
99 | ||
100 | /** | |
101 | * Convenience class holding double value, | |
102 | * for use when lambdas need to mutate capturing double local variable. | |
103 | */ | |
104 | public class DoubleRef { | |
105 | /** value */ | |
106 | public double value; | |
107 | ||
108 | /** | |
109 | * Constructor | |
110 | * @param value initial value | |
111 | */ | |
112 | 0 | public DoubleRef(double value) { |
113 | 0 | this.value = value; |
114 | 0 | } |
115 | } | |
116 | ||
117 | /** | |
118 | * Convenience class holding object values, | |
119 | * for use when lambdas need to mutate capturing object local variable. | |
120 | */ | |
121 | public class ObjRef<O> { | |
122 | /** value */ | |
123 | public O value; | |
124 | ||
125 | /** | |
126 | * Constructor | |
127 | * @param value initial value | |
128 | */ | |
129 | 0 | public ObjRef(O value) { |
130 | 0 | this.value = value; |
131 | 0 | } |
132 | } | |
133 | ||
134 | // CHECKSTYLE: resume VisibilityModifierCheck | |
135 | } |