Enum PlayerColor

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<PlayerColor>

    public enum PlayerColor
    extends java.lang.Enum<PlayerColor>
    Models the notion of a color a player can pick. This is not just the actual color of the markers, but also the names used for it (long and short version) as well as a suitable foreground color. The marker color itself is available through the {getBackgroundColor() method.
    • Field Detail

      • name

        private final java.lang.String name
      • shortName

        private final java.lang.String shortName
      • mnemonic

        private final int mnemonic
      • backgroundColor

        private final java.awt.Color backgroundColor
      • foregroundColor

        private final java.awt.Color foregroundColor
    • Constructor Detail

      • PlayerColor

        private PlayerColor​(java.lang.String name,
                            java.lang.String shortName,
                            int mnemonic)
    • Method Detail

      • values

        public static PlayerColor[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (PlayerColor c : PlayerColor.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static PlayerColor valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getMnemonic

        public int getMnemonic()
      • getName

        public java.lang.String getName()
      • getShortName

        public java.lang.String getShortName()
      • getBackgroundColor

        public java.awt.Color getBackgroundColor()
      • getForegroundColor

        public java.awt.Color getForegroundColor()
      • getByName

        public static PlayerColor getByName​(java.lang.String name)
      • getByShortName

        public static PlayerColor getByShortName​(java.lang.String shortName)
      • getByName

        public static java.util.List<PlayerColor> getByName​(java.util.List<java.lang.String> names)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<PlayerColor>