gt:     if (hashOfIcons == null) {
context: package org.openRealmOfStars.gui.icons;
  
  import java.awt.image.BufferedImage;
  import java.awt.image.RasterFormatException;
  import java.util.ArrayList;
  import java.util.HashMap;
  
  import org.openRealmOfStars.utilities.IOUtilities;
  
  /**
   *
   * Open Realm of Stars game project
   * Copyright (C) 2016-2021 Tuomo Untinen
   *
   * This program is free software; you can redistribute it and/or
   * modify it under the terms of the GNU General Public License
   * as published by the Free Software Foundation; either version 2
   * of the License, or (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, see http://www.gnu.org/licenses/
   *
   *
   * Class for handling Icons
   *
   */
  
  public final class Icons {
  
    /**
     * Just hiding the constructor
     */
    private Icons() {
      // Nothing to do
    }
    /**
     * Mine icon
     */
    public static final String ICON_MINE = "Mine";
    /**
     * Minus icon
     */
    public static final String ICON_MINUS = "Minus";
    /**
     * Minus pressed icon
     */
    public static final String ICON_MINUS_PRESSED = "Minus_Pressed";
    /**
     * Plus icon
     */
    public static final String ICON_PLUS = "Plus";
    /**
     * Plus pressed icon
     */
    public static final String ICON_PLUS_PRESSED = "Plus_Pressed";
    /**
     * Factory icon
     */
    public static final String ICON_FACTORY = "Factory";
    /**
     * Farm icon
     */
    public static final String ICON_FARM = "Farm";
    /**
     * Research icon
     */
    public static final String ICON_RESEARCH = "Research";
    /**
     * Culture icon
     */
    public static final String ICON_CULTURE = "Culture";
    /**
     * People icon
     */
    public static final String ICON_PEOPLE = "People";
    /**
     * No More People icon
     */
    public static final String ICON_NO_MORE_PEOPLE = "NoMorePeople";
    /**
     * Death aka skull icon
     */
    public static final String ICON_DEATH = "Death";
    /**
     * Credit or money icon
     */
    public static final String ICON_CREDIT = "Credit";
    /**
     * Mined metal icon
     */
    public static final String ICON_METAL = "Metal";
    /**
     * Metal ore icon
     */
    public static final String ICON_METAL_ORE = "MetalOre";
    /**
     * Maintenance icon aka credit goes away
     */
    public static final String ICON_MAINTENANCE = "Maintenance";
    /**
     * Tax icon aka credit goes in
     */
    public static final String ICON_TAX = "Tax";
    /**
     * Combat tech icon aka big gun
     */
    public static final String ICON_COMBAT_TECH = "CombatTech";
    /**
     * Defense tech icon aka bunker
     */
    public static final String ICON_DEFENSE_TECH = "DefenseTech";
    /**
     * Hull tech icon aka space ship
     */
    public static final String ICON_HULL_TECH = "HullTech";
    /**
     * Improvement tech icon aka construction tower
     */
    public static final String ICON_IMPROVEMENT_TECH = "ImprovementTech";
    /**
     * Propulsion tech icon aka futuristic engine core
     */
    public static final String ICON_PROPULSION_TECH = "PropulsionTech";
    /**
     * Electronics tech icon aka old computer
     */
    public static final String ICON_ELECTRONICS_TECH = "ElectronicsTech";
    /**
     * Arrow up icon
     */
    public static final String ICON_ARROWUP = "ArrowUp";
    /**
     * Arrow up icon pressed
     */
    public static final String ICON_ARROWUP_PRESSED = "ArrowUp_Pressed";
    /**
     * Arrow up icon disabled
     */
    public static final String ICON_ARROWUP_DISABLED = "ArrowUp_Disabled";
    /**
     * Empty icon so nothing to draw
     */
    public static final String ICON_EMPTY = "Empty";
    /**
     * Scroll bar up arrow
     */
    public static final String ICON_SCROLL_UP = "ScrollUp";
    /**
     * Scroll bar down arrow
     */
    public static final String ICON_SCROLL_DOWN = "ScrollDown";
    /**
     * Scroll bar left arrow
     */
    public static final String ICON_SCROLL_LEFT = "ScrollLeft";
    /**
     * Scroll bar right arrow
     */
    public static final String ICON_SCROLL_RIGHT = "ScrollRight";
    /**
     * Scroll bar up arrow pressed
     */
    public static final String ICON_SCROLL_UP_PRESSED = "ScrollUpPressed";
    /**
     * Scroll bar down arrow pressed
     */
    public static final String ICON_SCROLL_DOWN_PRESSED = "ScrollDownPressed";
    /**
     * Scroll bar left arrow pressed
     */
    public static final String ICON_SCROLL_LEFT_PRESSED = "ScrollLeftPressed";
    /**
     * Scroll bar right arrow pressed
     */
    public static final String ICON_SCROLL_RIGHT_PRESSED = "ScrollRightPressed";
    /**
     * Missile icon
     */
    public static final String ICON_MISSILE = "Missile";
    /**
     * Scanner icon
     */
    public static final String ICON_SCANNER = "Scanner";
    /**
     * Armor icon
     */
    public static final String ICON_ARMOR = "Armor";
    /**
     * Force field icon
     */
    public static final String ICON_SHIELD = "Shield";
    /**
     * Cloaked ship icon
     */
    public static final String ICON_CLOACKING_DEVICE = "CloackingDevice";
    /**
     * Troops icon
     */
    public static final String ICON_TROOPS = "Troops";
    /**
     * Laser gun icon
     */
    public static final String ICON_LASERGUN = "LaserGun";
    /**
     * Bomb icon
     */
    public static final String ICON_BOMB = "Bomb";
    /**
     * Mushroom cloud icon
     */
    public static final String ICON_NUKE = "Nuke";
    /**
     * Planetary turret icon
     */
    public static final String ICON_PLANETARY_TURRET = "PlanetaryTurret";
    /**
     * Satellite icon
     */
    public static final String ICON_STARBASE = "StarBase";
    /**
     * Radar beam icon
     */
    public static final String ICON_LR_SCANNER = "LRScanner";
    /**
     * Circuit board icon
     */
    public static final String ICON_CIRCUIT_BOARD = "CircuitBoard";
    /**
     * Radiation icon
     */
    public static final String ICON_RADIATION = "Radiation";
    /**
     * Power core icon
     */
    public static final String ICON_POWERSOURCE = "PowerSource";
    /**
     * Arrow down icon
     */
    public static final String ICON_ARROWDOWN = "ArrowDown";
    /**
     * Green tick for OK icon
     */
    public static final String ICON_OK = "IconOk";
    /**
     * Circle with line crossing it icon
     */
    public static final String ICON_DELETE = "IconDelete";
    /**
     * Battery icon
     */
    public static final String ICON_BATTERY = "IconBattery";
  
    /**
     * Checkbox icon
     */
    public static final String ICON_CHECKBOX = "IconCheckBox";
    /**
     * Checkbox tick icon
     */
    public static final String ICON_CHECKBOX_TICK = "IconCheckBoxTick";
    /**
     * Spy goggles icon
     */
    public static final String ICON_SPY_GOGGLES = "IconSpyGoggles";
  
    /**
     * Music Icon
     */
    public static final String ICON_MUSIC = "IconMusic";
  
    /**
     * Sound icon
     */
    public static final String ICON_SOUND = "IconSound";
  
    /**
     * Very happy face
     */
    public static final String ICON_VERY_HAPPY = "IconVeryHappy";
  
    /**
     * Happy face
     */
    public static final String ICON_HAPPY = "IconHappy";
  
    /**
     * Okay face
     */
    public static final String ICON_OKAY = "IconOkayFace";
  
    /**
     * Sad face
     */
    public static final String ICON_SAD = "IconSadFace";
    /**
     * Very sad face
     */
    public static final String ICON_VERY_SAD = "IconVerySadFace";
    /**
     * Planet icon
     */
    public static final String ICON_PLANET = "IconPlanet";
    /**
     * Stats icon
     */
    public static final String ICON_STATS = "IconStats";
    /**
     * Closed icon
     */
    public static final String ICON_CLOSED = "IconClosed";
    /**
     * News icon
     */
    public static final String ICON_NEWS = "IconNews";
    /**
     * Antenna icon
     */
    public static final String ICON_ANTENNA = "IconAntenna";
    /**
     * Map icon
     */
    public static final String ICON_MAP = "IconMap";
    /**
     * Ancient Checkbox icon
     */
    public static final String ICON_ANCIENT_BOX = "IconAncient";
    /**
     * Anceint Checkbox tick icon
     */
    public static final String ICON_ANCIENT_BOX_TICK = "IconAncientTick";
    /**
     * Tutorial icon
     */
    public static final String ICON_TUTORIAL = "IconTutorial";
    /**
     * Arrow right icon
     */
    public static final String ICON_ARROW_RIGHT = "IconArrowRight";
    /**
     * Node expanded icon
     */
    public static final String ICON_EXPANDED = "IconExpanded";
    /**
     * Node collabsed icon
     */
    public static final String ICON_COLLAPSED = "IconCollabsed";
    /**
     * AirLock open icon
     */
    public static final String ICON_AIRLOCK_OPEN = "IconAirLockOpen";
    /**
     * Leader too young icon
     */
    public static final String ICON_TOO_YOUNG = "IconTooYoung";
    /**
     * Leaders icon
     */
    public static final String ICON_LEADERS = "IconLeaders";
    /**
     * Governor leader
     */
    public static final String ICON_GOVERNOR = "IconGovernor";
    /**
     * Commander leader
     */
    public static final String ICON_COMMANDER = "IconCommander";
    /**
     * Ruler leader
     */
    public static final String ICON_RULER = "IconRuler";
    /**
     * Tractor beam
     */
    public static final String ICON_TRACTOR_BEAM = "IconTractorBeam";
    /**
     * Solar armor
     */
    public static final String ICON_SOLAR_ARMOR = "IconSolarArmor";
    /**
     * Organic armor
     */
    public static final String ICON_ORGANIC_ARMOR = "IconOrganicArmor";
    /**
     * Plasma cannon
     */
    public static final String ICON_PLASMA_CANNON = "IconPlasmaCannon";
    /**
     * Ion cannon
     */
    public static final String ICON_ION_CANNON = "IconIonCannon";
    /**
     * Distortion shield
     */
    public static final String ICON_DISTORTION_SHIELD = "IconDistortionShield";
    /**
     * Photon torpedo
     */
    public static final String ICON_PHOTON_TORPEDO = "IconPhotonTorpedo";
    /**
     * Prison icon
     */
    public static final String ICON_PRISON = "IconPrison";
    /**
     * Orbital elevator
     */
    public static final String ICON_ORBITAL_ELEVATOR = "IconOrbitalElevator";
    /**
     * Space fin
     */
    public static final String ICON_SPACE_FIN = "IconSpaceFin";
    /**
     * Heart
     */
    public static final String ICON_HEART = "IconHeart";
    /**
     * Mouth
     */
    public static final String ICON_MOUTH = "IconMount";
    /**
     * Tentacle
     */
    public static final String ICON_TENTACLE = "IconTentacle";
    /**
     * Multicannon
     */
    public static final String ICON_MULTI_CANNON = "IconMultiCannon";
  
    /**
     * List of Icon
     */
    private static ArrayList<Icon16x16> listOfIcons;
    /**
     * Hash map with Icon name to Icon
     */
    private static HashMap<String, Icon16x16> hashOfIcons;
  
    /**
     * Get Icon with index. Initializes icons if they are uninitialized
     * @param index for icon
     * @return Icon Always returns a tile, If not found icon then first index is
     * returned.
     */
    public static Icon16x16 getIconByIndex(final int index) {
      if (listOfIcons == null) {
        initIcons();
      }
      if (index > 0 && index < listOfIcons.size()) {
        return listOfIcons.get(index);
      }
      return listOfIcons.get(0);
    }
  
    /**
     * Get icon by name. Initializes icons if they are uninitialized.
     * @param name For search the icon
     * @return Always returns an icon if not found tile then first index is
     * returned.
     */
    public static Icon16x16 getIconByName(final String name) {
      if (hashOfIcons == null) {
        initIcons();
      }
      Icon16x16 icon = hashOfIcons.get(name);
      if (icon == null) {
        return getIconByIndex(0);
      }
      return icon;
    }
  
    /**
     * Get happy face icon by happiness.
     * @param happyValue Happiness value
     * @return Always returns an happy face icon.
     */
    public static Icon16x16 getHappyFace(final int happyValue) {
  