Java Code Examples for java.time.Month#APRIL
The following examples show how to use
java.time.Month#APRIL .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StringColumnMonthMapper.java From jadira with Apache License 2.0 | 6 votes |
@Override public Month fromNonNullValue(String s) { switch(s) { case "JANUARY" : return Month.JANUARY; case "FEBRUARY" : return Month.FEBRUARY; case "MARCH" : return Month.MARCH; case "APRIL" : return Month.APRIL; case "MAY" : return Month.MAY; case "JUNE" : return Month.JUNE; case "JULY" : return Month.JULY; case "AUGUST" : return Month.AUGUST; case "SEPTEMBER" : return Month.SEPTEMBER; case "OCTOBER" : return Month.OCTOBER; case "NOVEMBER" : return Month.NOVEMBER; case "DECEMBER" : return Month.DECEMBER; default: throw new IllegalArgumentException("Seen unexpected Month: " + s); } }
Example 2
Source File: MergeBotFactory.java From skara with GNU General Public License v2.0 | 5 votes |
private static Month toMonth(String s) { switch (s.toLowerCase()) { case "january": return Month.JANUARY; case "february": return Month.FEBRUARY; case "march": return Month.MARCH; case "april": return Month.APRIL; case "may": return Month.MAY; case "june": return Month.JUNE; case "july": return Month.JULY; case "august": return Month.AUGUST; case "september": return Month.SEPTEMBER; case "october": return Month.OCTOBER; case "november": return Month.NOVEMBER; case "december": return Month.DECEMBER; default: throw new IllegalArgumentException("Unknown month: " + s); } }
Example 3
Source File: Chapter04Functional.java From Java-11-Cookbook-Second-Edition with MIT License | 5 votes |
public static void demo2_API() { Traffic api = new TrafficImpl(Month.APRIL, DayOfWeek.FRIDAY, 17, "USA", "Denver", "Main103S"); double timeSec = 10.0; int trafficUnitsNumber = 10; api.speedAfterStart(timeSec, trafficUnitsNumber); SpeedModel speedModel = (t, wp, hp) -> { double weightPower = 2.0 * hp * 746 * 32.174 / wp; return Math.round(Math.sqrt(t * weightPower) * 0.68); }; api.speedAfterStart(timeSec, trafficUnitsNumber, speedModel); Predicate<TrafficUnit> limitTraffic = tu -> (tu.getHorsePower() < 250 && tu.getVehicleType() == Vehicle.VehicleType.CAR) || (tu.getHorsePower() < 400 && tu.getVehicleType() == Vehicle.VehicleType.TRUCK); Predicate<TrafficUnit> limitTraffic2 = tu -> tu.getRoadCondition() == RoadCondition.WET && tu.getTireCondition() == SpeedModel.TireCondition.NEW && tu.getTemperature() > 65; api.speedAfterStart(timeSec, trafficUnitsNumber, speedModel, limitTraffic); BiPredicate<TrafficUnit, Double> limitTrafficAndSpeed = (tu, sp) -> (sp > (tu.getSpeedLimitMph() + 8.0) && tu.getRoadCondition() == RoadCondition.DRY) || (sp > (tu.getSpeedLimitMph() + 5.0) && tu.getRoadCondition() == RoadCondition.WET) || (sp > (tu.getSpeedLimitMph() + 0.0) && tu.getRoadCondition() == RoadCondition.SNOW); api.speedAfterStart(timeSec, trafficUnitsNumber, speedModel, limitTrafficAndSpeed); BiConsumer<TrafficUnit, Double> printResults = (tm, sp) -> System.out.println("Road " + tm.getRoadCondition() + ", tires " + tm.getTireCondition() + ": " + tm.getVehicleType().getType() + " speedMph (" + timeSec + " sec)=" + sp + " mph"); api.speedAfterStart(timeSec, trafficUnitsNumber, speedModel, limitTrafficAndSpeed, printResults); }
Example 4
Source File: Chapter04Functional.java From Java-9-Cookbook with MIT License | 5 votes |
public static void demo2_API() { Traffic api = new TrafficImpl(Month.APRIL, DayOfWeek.FRIDAY, 17, "USA", "Denver", "Main103S"); double timeSec = 10.0; int trafficUnitsNumber = 10; api.speedAfterStart(timeSec, trafficUnitsNumber); SpeedModel speedModel = (t, wp, hp) -> { double weightPower = 2.0 * hp * 746 * 32.174 / wp; return Math.round(Math.sqrt(t * weightPower) * 0.68); }; api.speedAfterStart(timeSec, trafficUnitsNumber, speedModel); Predicate<TrafficUnit> limitTraffic = tu -> (tu.getHorsePower() < 250 && tu.getVehicleType() == Vehicle.VehicleType.CAR) || (tu.getHorsePower() < 400 && tu.getVehicleType() == Vehicle.VehicleType.TRUCK); Predicate<TrafficUnit> limitTraffic2 = tu -> tu.getRoadCondition() == RoadCondition.WET && tu.getTireCondition() == SpeedModel.TireCondition.NEW && tu.getTemperature() > 65; api.speedAfterStart(timeSec, trafficUnitsNumber, speedModel, limitTraffic); BiPredicate<TrafficUnit, Double> limitTrafficAndSpeed = (tu, sp) -> (sp > (tu.getSpeedLimitMph() + 8.0) && tu.getRoadCondition() == RoadCondition.DRY) || (sp > (tu.getSpeedLimitMph() + 5.0) && tu.getRoadCondition() == RoadCondition.WET) || (sp > (tu.getSpeedLimitMph() + 0.0) && tu.getRoadCondition() == RoadCondition.SNOW); api.speedAfterStart(timeSec, trafficUnitsNumber, speedModel, limitTrafficAndSpeed); BiConsumer<TrafficUnit, Double> printResults = (tm, sp) -> System.out.println("Road " + tm.getRoadCondition() + ", tires " + tm.getTireCondition() + ": " + tm.getVehicleType().getType() + " speedMph (" + timeSec + " sec)=" + sp + " mph"); api.speedAfterStart(timeSec, trafficUnitsNumber, speedModel, limitTrafficAndSpeed, printResults); }
Example 5
Source File: AbstractLuckPermsPlugin.java From LuckPerms with MIT License | 5 votes |
public static String getPluginName() { LocalDate date = LocalDate.now(); if (date.getMonth() == Month.APRIL && date.getDayOfMonth() == 1) { return "LuckyPerms"; } return "LuckPerms"; }
Example 6
Source File: StreamFindAndMatch.java From levelup-java-examples with Apache License 2.0 | 5 votes |
@Test public void stream_findAny() { Predicate<HiddenObjectGame> releaseDateInApril = p -> Month.APRIL == p .getReleaseDate().getMonth(); Optional<HiddenObjectGame> hiddenGameReleaseInApril = games.stream() .filter(releaseDateInApril).findAny(); assertFalse(hiddenGameReleaseInApril.isPresent()); }
Example 7
Source File: Chapter07Concurrency04.java From Java-11-Cookbook-Second-Edition with MIT License | 4 votes |
private static AverageSpeed createTask(){ DateLocation dateLocation = new DateLocation(Month.APRIL, DayOfWeek.FRIDAY, 17, "USA", "Denver", "Main103S"); return new AverageSpeed(dateLocation, 10, 1001, 100); }
Example 8
Source File: Chapter07Concurrency04.java From Java-9-Cookbook with MIT License | 4 votes |
private static AverageSpeed createTask(){ DateLocation dateLocation = new DateLocation(Month.APRIL, DayOfWeek.FRIDAY, 17, "USA", "Denver", "Main103S"); return new AverageSpeed(dateLocation, 10, 1001, 100); }
Example 9
Source File: PackedLocalDateTime.java From tablesaw with Apache License 2.0 | 4 votes |
public static boolean isInQ2(long packedDateTime) { if (packedDateTime == missingValueIndicator()) return false; Month month = getMonth(packedDateTime); return month == Month.APRIL || month == Month.MAY || month == Month.JUNE; }
Example 10
Source File: PackedLocalDateTime.java From tablesaw with Apache License 2.0 | 4 votes |
public static boolean isInApril(long packedDateTime) { return (packedDateTime != missingValueIndicator()) && getMonth(packedDateTime) == Month.APRIL; }
Example 11
Source File: PackedLocalDateTime.java From tablesaw with Apache License 2.0 | 4 votes |
public static boolean isInQ2(long packedDateTime) { if (packedDateTime == missingValueIndicator()) return false; Month month = getMonth(packedDateTime); return month == Month.APRIL || month == Month.MAY || month == Month.JUNE; }
Example 12
Source File: PackedLocalDateTime.java From tablesaw with Apache License 2.0 | 4 votes |
public static boolean isInApril(long packedDateTime) { return (packedDateTime != missingValueIndicator()) && getMonth(packedDateTime) == Month.APRIL; }