Skip to content

Commit 3257dc5

Browse files
author
Varun Rathore
committed
fix indentation
1 parent 95910ad commit 3257dc5

File tree

8 files changed

+349
-417
lines changed

8 files changed

+349
-417
lines changed

src/main/java/com/google/firebase/remoteconfig/ConditionEvaluator.java

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
import org.slf4j.Logger;
4141
import org.slf4j.LoggerFactory;
42-
42+
4343
final class ConditionEvaluator {
4444
private static final int MAX_CONDITION_RECURSION_DEPTH = 10;
4545
private static final Logger logger = LoggerFactory.getLogger(ConditionEvaluator.class);
@@ -49,7 +49,7 @@ final class ConditionEvaluator {
4949
* Evaluates server conditions and assigns a boolean value to each condition.
5050
*
5151
* @param conditions List of conditions which are to be evaluated.
52-
* @param context A map with additional metadata used during evaluation.
52+
* @param context A map with additional metadata used during evaluation.
5353
* @return A map of condition to evaluated value.
5454
*/
5555
@NonNull
@@ -58,19 +58,17 @@ Map<String, Boolean> evaluateConditions(
5858
@Nullable KeysAndValues context) {
5959
checkNotNull(conditions, "List of conditions must not be null.");
6060
checkArgument(!conditions.isEmpty(), "List of conditions must not be empty.");
61-
if(context == null || conditions.isEmpty()){
61+
if (context == null || conditions.isEmpty()) {
6262
return ImmutableMap.of();
6363
}
64-
KeysAndValues evaluationContext = context != null
65-
? context
64+
KeysAndValues evaluationContext = context != null
65+
? context
6666
: new KeysAndValues.Builder().build();
6767

6868
Map<String, Boolean> evaluatedConditions = conditions.stream()
6969
.collect(ImmutableMap.toImmutableMap(
7070
ServerCondition::getName,
71-
condition ->
72-
evaluateCondition(condition.getCondition(), evaluationContext, /* nestingLevel= */0)
73-
));
71+
condition -> evaluateCondition(condition.getCondition(), evaluationContext, /* nestingLevel= */0)));
7472

7573
return evaluatedConditions;
7674
}
@@ -99,7 +97,6 @@ private boolean evaluateCondition(OneOfCondition condition, KeysAndValues contex
9997
return false;
10098
}
10199

102-
103100
private boolean evaluateOrCondition(OrCondition condition, KeysAndValues context,
104101
int nestingLevel) {
105102
return condition.getConditions().stream()
@@ -251,9 +248,8 @@ private BigInteger hashSeededRandomizationId(String seededRandomizationId) {
251248
}
252249

253250
private boolean compareStrings(ImmutableList<String> targetValues, String customSignal,
254-
BiPredicate<String, String> compareFunction) {
255-
return targetValues.stream().anyMatch(targetValue ->
256-
compareFunction.test(customSignal, targetValue));
251+
BiPredicate<String, String> compareFunction) {
252+
return targetValues.stream().anyMatch(targetValue -> compareFunction.test(customSignal, targetValue));
257253
}
258254

259255
private boolean compareStringRegex(String customSignal, String targetSignal) {
@@ -265,7 +261,7 @@ private boolean compareStringRegex(String customSignal, String targetSignal) {
265261
}
266262

267263
private boolean compareNumbers(ImmutableList<String> targetValues, String customSignal,
268-
IntPredicate compareFunction) {
264+
IntPredicate compareFunction) {
269265
if (targetValues.size() != 1) {
270266
logger.warn(String.format(
271267
"Target values must contain 1 element for numeric operations. Target Value: %s",
@@ -286,8 +282,8 @@ private boolean compareNumbers(ImmutableList<String> targetValues, String custom
286282
}
287283

288284
private boolean compareSemanticVersions(ImmutableList<String> targetValues,
289-
String customSignal,
290-
IntPredicate compareFunction) {
285+
String customSignal,
286+
IntPredicate compareFunction) {
291287
if (targetValues.size() != 1) {
292288
logger.warn(String.format("Target values must contain 1 element for semantic operation."));
293289
return false;
@@ -320,8 +316,8 @@ private int compareSemanticVersions(List<Integer> version1, List<Integer> versio
320316

321317
for (int i = 0; i < maxLength; i++) {
322318
// Default to 0 if segment is missing
323-
int v1 = i < version1Size ? version1.get(i) : 0;
324-
int v2 = i < version2Size ? version2.get(i) : 0;
319+
int v1 = i < version1Size ? version1.get(i) : 0;
320+
int v2 = i < version2Size ? version2.get(i) : 0;
325321

326322
int comparison = Integer.compare(v1, v2);
327323
if (comparison != 0) {
@@ -334,8 +330,8 @@ private int compareSemanticVersions(List<Integer> version1, List<Integer> versio
334330

335331
private List<Integer> parseSemanticVersion(String versionString) {
336332
return Arrays.stream(versionString.split("\\."))
337-
.map(Integer::parseInt)
338-
.collect(Collectors.toList());
333+
.map(Integer::parseInt)
334+
.collect(Collectors.toList());
339335
}
340336

341337
private boolean validateSemanticVersion(String version) {

src/main/java/com/google/firebase/remoteconfig/Value.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,3 @@ ValueSource getSource() {
133133
return source;
134134
}
135135
}
136-

src/main/java/com/google/firebase/remoteconfig/internal/ServerTemplateResponse.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import java.util.Map;
2626

2727
/**
28-
* The Data Transfer Object for parsing Remote Config template responses from the Remote Config
28+
* The Data Transfer Object for parsing Remote Config template responses from
29+
* the Remote Config
2930
* service.
3031
*/
3132
public final class ServerTemplateResponse {
@@ -94,7 +95,8 @@ public ServerTemplateResponse setEtag(String etag) {
9495
}
9596

9697
/**
97-
* The Data Transfer Object for parsing Remote Config condition responses from the Remote Config
98+
* The Data Transfer Object for parsing Remote Config condition responses from
99+
* the Remote Config
98100
* service.
99101
*/
100102
public static final class ServerConditionResponse {
@@ -164,7 +166,7 @@ public OneOfConditionResponse setAndCondition(AndConditionResponse andCondition)
164166
}
165167

166168
public OneOfConditionResponse setCustomSignalCondition(
167-
CustomSignalConditionResponse customSignalCondition) {
169+
CustomSignalConditionResponse customSignalCondition) {
168170
this.customSignalCondition = customSignalCondition;
169171
return this;
170172
}
@@ -276,7 +278,7 @@ public PercentConditionResponse setMicroPercent(int microPercent) {
276278
}
277279

278280
public PercentConditionResponse setMicroPercentRange(
279-
MicroPercentRangeResponse microPercentRange) {
281+
MicroPercentRangeResponse microPercentRange) {
280282
this.microPercentRange = microPercentRange;
281283
return this;
282284
}
@@ -318,4 +320,3 @@ public MicroPercentRangeResponse setMicroPercentUpperBound(int microPercentUpper
318320
}
319321
}
320322
}
321-

0 commit comments

Comments
 (0)