Class ActionHelper


  • public class ActionHelper
    extends Object
    ActionHelper class to supply functions for the implementations.
    • Constructor Detail

      • ActionHelper

        public ActionHelper()
    • Method Detail

      • getPossibleActions

        public static List<Action> getPossibleActions​(Round round)
        Get all possible actions from the given round.
        Parameters:
        round - The given round instance
        Returns:
        List of all Actions that are possible with the given round.
      • getCitiesWithOnePathogen

        public static Map<City,​Pathogen> getCitiesWithOnePathogen​(Round round)
        Get the cities with only one pathogen.
        Parameters:
        round - The given round instance
        Returns:
        A Map, where key is the city and value is Pathogen and the cities have only one pathogen.
      • findDeadlyPathogen

        public static Pathogen findDeadlyPathogen​(Iterable<Pathogen> pathogens)
        Find the deadliest pathogen from the given pathogens.
        Parameters:
        pathogens - A collection of pathogens.
        Returns:
        The pathogen, that is the dangerous from the given collection.
      • findFastlyPathogen

        public static Pathogen findFastlyPathogen​(Iterable<Pathogen> pathogens)
        Find the fastes pathogen from the given pathogens.
        Parameters:
        pathogens - A collection of pathogens.
        Returns:
        The pathogen, that is the fastes from the given collection.
      • findSlowlyPathogen

        public static Pathogen findSlowlyPathogen​(Iterable<Pathogen> pathogens)
        Find the slowest pathogen from the given pathogens.
        Parameters:
        pathogens - A collection of pathogens.
        Returns:
        The pathogen, that is the slowest from the given collection.
      • pathogensNotInQuarantine

        public static List<Pathogen> pathogensNotInQuarantine​(Round round)
        Get all pathogens that are not in quarantine.
        Parameters:
        round - The given round instance
        Returns:
        A list of pathogens, where the pathogens are not "in quarantine".
      • isVaccineInDevelopment

        public static boolean isVaccineInDevelopment​(Round round,
                                                     Pathogen pathogen)
        Check, if a vaccine for the given pathogen is in development.
        Parameters:
        round - The given round instance.
        pathogen - The pathogen for the vaccine.
        Returns:
        True, if the vaccine for the given pathogen is in development, otherwise false.
      • isVaccineAvailable

        public static boolean isVaccineAvailable​(Round round,
                                                 Pathogen pathogen)
        Check, if a vaccine for the given pathogen is available.
        Parameters:
        round - The given round instance.
        pathogen - The pathogen for the vaccine.
        Returns:
        True, if the vaccine for the given pathogen is available, otherwise false.
      • isVaccineDeployed

        public static boolean isVaccineDeployed​(City city,
                                                Pathogen pathogen)
        Check, if a vaccine for the given pathogen is deployed in the city.
        Parameters:
        city - The given city instance.
        pathogen - The pathogen for the vaccine.
        Returns:
        True, if the vaccine for the given pathogen is deployed in the city, otherwise false.
      • isCityInfectedWithPathogen

        public static boolean isCityInfectedWithPathogen​(City city,
                                                         Pathogen pathogen)
        Check, if the given city has the pathogen (infected).
        Parameters:
        city - The given city instance.
        pathogen - The given pathogen instance.
        Returns:
        True, if the given city is infected with the given pathogen, otherwise false.
      • isMedicationInDevelopment

        public static boolean isMedicationInDevelopment​(Round round,
                                                        Pathogen pathogen)
        Check, if a medication for the given pathogen is in development.
        Parameters:
        round - The given round instance.
        pathogen - The pathogen for the medication.
        Returns:
        True, if the medication for the given pathogen is in development, otherwise false.
      • isMedicationAvailable

        public static boolean isMedicationAvailable​(Round round,
                                                    Pathogen pathogen)
        Check, if a medication for the given pathogen is available.
        Parameters:
        round - The given round instance.
        pathogen - The pathogen for the medication.
        Returns:
        True, if the medication for the given pathogen is available, otherwise false.
      • isMedicationDeployed

        public static boolean isMedicationDeployed​(City city,
                                                   Pathogen pathogen)
        Check, if a medication for the given pathogen is deployed in the city.
        Parameters:
        city - The given city instance.
        pathogen - The pathogen for the medication.
        Returns:
        True, if the medication for the given pathogen is deployed in the city, otherwise false.
      • findHighestPathogenRound

        public static int findHighestPathogenRound​(Iterable<City> cities,
                                                   Pathogen pathogen)
        Find the highest amount of rounds that a pathogen has in the given city collection.
        Parameters:
        cities - A given collection of cities.
        pathogen - The given pathogen.
        Returns:
        The highest round counter that the given pathogen has in one of the cities in the given city collection.
      • findHighestPathogenRound

        public static int findHighestPathogenRound​(Iterable<City> cities,
                                                   Pathogen pathogen,
                                                   BiPredicate<City,​Pathogen> cityPredicate)
        Find the highest amount of rounds that a pathogen has in the given city collection.
        Parameters:
        cities - A given collection of cities.
        pathogen - The given pathogen.
        cityPredicate - Filter function to restrict cities (e.g. VaccineEvents, MedicationEvents). The city will be skipped, if the cityPredicate returns true.
        Returns:
        The highest round counter that the given pathogen has in one of the cities and the cityPredicate returned false for that, in the given city collection.
      • getCitiesWithGivenOutbreakRound

        public static List<City> getCitiesWithGivenOutbreakRound​(int round,
                                                                 Iterable<City> cities)
        Find the cities, where the round of the OutbreakEvent is the same as the given round.
        Parameters:
        round - The round counter for the pathogen
        cities - A given collection of cities.
        Returns:
        A list of cities, where the round of the OutbreakEvent is the same as the given round.
      • getStartPathogens

        public static List<Pathogen> getStartPathogens​(Round round)