-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented method to compute military weather category
- Loading branch information
FrankMurmann
committed
Jan 12, 2025
1 parent
049b045
commit dbd5e80
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
metarParser-entities/src/main/java/io/github/mivek/model/MilitaryWeatherCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.github.mivek.model; | ||
|
||
import java.util.function.BiFunction; | ||
|
||
public enum MilitaryWeatherCategory implements WeatherCategory { | ||
|
||
RED((v, c) -> c < 200 && v < 0.8), | ||
AMB((v, c) -> c >= 200 && c < 300 && v >= 0.8 && v < 1.6), | ||
YLO((v, c) -> c >= 300 && c < 700 && v >= 1.6 && v < 3.7), | ||
GRN((v, c) -> c >= 700 && c < 1500 && v >= 3.7 && v < 5.0), | ||
WHT((v, c) -> c >= 1500 && c < 2500 && v >= 5.0 && v < 8.0), | ||
BLU((v, c) -> c >= 2500 && v >= 8.0); | ||
|
||
private final BiFunction<Double, Integer, Boolean> criteriaFunction; | ||
|
||
MilitaryWeatherCategory(BiFunction<Double, Integer, Boolean> criteriaFunction) { | ||
this.criteriaFunction = criteriaFunction; | ||
} | ||
|
||
public boolean isCriteriaMet(double visibility, int ceiling) { | ||
return criteriaFunction.apply(visibility, ceiling); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters