Enum Class Social
- All Implemented Interfaces:
Serializable
,Comparable<Social>
,Constable
This enumeration defines a wide range of traits that can be associated with a person's personality. Traits are characterized as either "positive" or not and can optionally be "major" traits. The enumeration also handles metadata such as retrieving localized labels and descriptions.
Some traits, referred to as "Major Traits," denote stronger personality attributes and are to be handled distinctly. These traits are always listed at the end of the enumeration.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The index at which major traits begin within the enumeration.static final int
Defines the number of individual description variants available for each trait. -
Method Summary
Modifier and TypeMethodDescriptionstatic Social
fromString
(String text) Converts the given string into an instance of theSocial
enum.getDescription
(int socialDescriptionIndex, megamek.common.enums.Gender gender, String givenName) Generates a localized and personalized description for the current enumeration value.getLabel()
Retrieves the label associated with the current enumeration value.getRoninMessage
(String commanderAddress) Retrieves the message displayed when a Ronin warrior expresses interest in joining the campaign.boolean
isNone()
boolean
boolean
toString()
static Social
Returns the enum constant of this class with the specified name.static Social[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
-
APATHETIC
-
AUTHENTIC
-
BLUNT
-
CALLOUS
-
CONDESCENDING
-
CONSIDERATE
-
DISINGENUOUS
-
DISMISSIVE
-
ENCOURAGING
-
ERRATIC
-
EMPATHETIC
-
FRIENDLY
-
INSPIRING
-
INDIFFERENT
-
INTROVERTED
-
IRRITABLE
-
NEGLECTFUL
-
PETTY
-
PERSUASIVE
-
RECEPTIVE
-
SINCERE
-
SUPPORTIVE
-
TACTFUL
-
UNTRUSTWORTHY
-
SCHEMING
-
ALTRUISTIC
-
COMPASSIONATE
-
GREGARIOUS
-
NARCISSISTIC
-
POMPOUS
-
-
Field Details
-
MAXIMUM_VARIATIONS
public static final int MAXIMUM_VARIATIONSDefines the number of individual description variants available for each trait.- See Also:
-
MAJOR_TRAITS_START_INDEX
public static final int MAJOR_TRAITS_START_INDEXThe index at which major traits begin within the enumeration.- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getLabel
Retrieves the label associated with the current enumeration value.The label is determined based on the resource bundle for the application, utilizing the enum name combined with a specific key suffix to fetch the relevant localized string.
- Returns:
- the localized label string corresponding to the enumeration value.
-
getDescription
public String getDescription(int socialDescriptionIndex, megamek.common.enums.Gender gender, String givenName) Generates a localized and personalized description for the current enumeration value.This method retrieves a description using the enumeration's name and a specific key suffix derived from the given ambition description index. The description is further customized using the provided gender-specific pronouns, the individual's given name, and other localized text from the resource bundle.
- Parameters:
socialDescriptionIndex
- an index representing the type/variation of the description. This value is clamped to ensure it falls within a valid range.gender
- theGender
of the individual, used to determine appropriate pronouns for the description.givenName
- the given name of the person. This MUST use 'person.getGivenName()' and NOT 'person.getFirstName()'- Returns:
- a formatted description string based on the enum, the individual's gender, name, and aggression description index.
-
getRoninMessage
Retrieves the message displayed when a Ronin warrior expresses interest in joining the campaign.This method formats a message using a resource key derived from the current object and includes the commander's address as part of the message formatting.
- Parameters:
commanderAddress
- the address or name of the commander to include in the message.- Returns:
- the formatted Ronin message as a
String
.
-
isTraitPositive
public boolean isTraitPositive()- Returns:
true
if the personality trait is considered positive,false
otherwise.
-
isTraitMajor
public boolean isTraitMajor()- Returns:
true
if the personality trait is considered a major trait,false
otherwise.
-
isNone
public boolean isNone() -
fromString
Converts the given string into an instance of theSocial
enum. The method tries to interpret the string as both a name of an enumeration constant and as an ordinal index. If neither interpretation succeeds, it logs an error and returnsNONE
.- Parameters:
text
- the string representation of the social; can be either the name of an enumeration constant or the ordinal string.- Returns:
- the corresponding
Social
enum instance if the string is a valid name or ordinal; otherwise, returnsNONE
.
-
toString
-