Class DisasterType


  • public class DisasterType
    extends java.lang.Object
    Helper class for random disaster generation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected double chemicals
      The average chemical number, relative to size (0 = off).
      static DisasterType[] DISASTER_TYPES
      The disaster types.
      protected double fire
      The average fire number, relative to size (0 = off).
      protected java.lang.String name
      The type name.
      protected double occurrence
      The occurrence probability.
      protected static java.util.Random random
      The random number generator.
      protected double severe
      The severity probability.
      protected int[] size
      The size range [min, max].
      protected double victims
      The average victims number, relative to size (0 = off).
    • Constructor Summary

      Constructors 
      Constructor Description
      DisasterType​(java.lang.String name, double occurrence, double severe, int[] size, double victims, double fire, double chemicals)
      Create a new disaster type.
    • Field Detail

      • DISASTER_TYPES

        public static final DisasterType[] DISASTER_TYPES
        The disaster types.
      • random

        protected static final java.util.Random random
        The random number generator.
      • name

        protected java.lang.String name
        The type name.
      • occurrence

        protected double occurrence
        The occurrence probability.
      • severe

        protected double severe
        The severity probability.
      • size

        protected int[] size
        The size range [min, max].
      • victims

        protected double victims
        The average victims number, relative to size (0 = off).
      • fire

        protected double fire
        The average fire number, relative to size (0 = off).
      • chemicals

        protected double chemicals
        The average chemical number, relative to size (0 = off).
    • Constructor Detail

      • DisasterType

        public DisasterType​(java.lang.String name,
                            double occurrence,
                            double severe,
                            int[] size,
                            double victims,
                            double fire,
                            double chemicals)
        Create a new disaster type.
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the name.
      • getOccurrence

        public double getOccurrence()
        Get the occurrence probability.
      • getSevere

        public double getSevere()
        Get the severity probability.
      • getSize

        public int[] getSize()
        Get the name.
      • getVictims

        public double getVictims()
        Get the name.
      • getFire

        public double getFire()
        Get the name.
      • getChemicals

        public double getChemicals()
        Get the name.
      • generateDisaster

        public static java.util.Map generateDisaster()
        Generate properties for a random disaster.
      • getFireLocation

        public static IVector2 getFireLocation​(ISpaceObject disaster)
        Get the position of a fire at the given disaster.
      • getChemicalsLocation

        public static IVector2 getChemicalsLocation​(ISpaceObject disaster)
        Get the position of chemicals at the given disaster.
      • getVictimLocation

        public static IVector2 getVictimLocation​(ISpaceObject disaster)
        Get the position of a victim at the given disaster.
      • getEarthquakeIncidentLocation

        public static IVector2 getEarthquakeIncidentLocation​(ISpaceObject disaster)
        Get the position of an incident at the given earthquake.
      • getExponentialSample

        public static double getExponentialSample​(double mean)
        Get an exponential sample value.