Package gg.xp.xivsupport.models
Enum Class ArenaSector
- All Implemented Interfaces:
HasFriendlyName
,Serializable
,Comparable<ArenaSector>
,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final List<ArenaSector>
Intercardinals and cardinals.static final List<ArenaSector>
The list of cardinal directions.static final List<ArenaSector>
The the list of intercardinal directions (or quadrants, if you prefer). -
Method Summary
Modifier and TypeMethodDescriptionint
eighthsTo
(ArenaSector other) Computes the rotation from one sector to another, expressed in eight-turns.boolean
boolean
boolean
boolean
isStrictlyAdjacentTo
(ArenaSector other) opposite()
plusEighths
(int eighths) Add the given number of eighth-turns (clockwise) to this sector and return the result.plusQuads
(int quads) LikeplusEighths(int)
, but quarter-turns rather than eights.static @Nullable ArenaSector
tryCombineTwoCardinals
(List<ArenaSector> cardinals) Given two cardinals, check if there is an intercardinal adjacent to both of them.static @Nullable ArenaSector
tryCombineTwoQuadrants
(List<ArenaSector> quadrants) Given two intercardinal quadrants, check if there is a cardinal adjacent to both of them.static List<ArenaSector>
tryMergeQuadrants
(List<ArenaSector> quadrants) LiketryCombineTwoQuadrants(List)
(List)}, but returns a list.static ArenaSector
Returns the enum constant of this class with the specified name.static ArenaSector[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NORTH
-
NORTHEAST
-
EAST
-
SOUTHEAST
-
SOUTH
-
SOUTHWEST
-
WEST
-
NORTHWEST
-
CENTER
Represents the center of the arena rather than a direction. -
UNKNOWN
Represents an unknown sector.
-
-
Field Details
-
cardinals
The list of cardinal directions. -
quadrants
The the list of intercardinal directions (or quadrants, if you prefer). -
all
Intercardinals and cardinals. This only contains the 'real' directions (no 'center' or 'unknown'), so it is preferable to use this instead ofvalues()
-
-
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
-
getFriendlyName
- Specified by:
getFriendlyName
in interfaceHasFriendlyName
- Returns:
- The full name for this sector, e.g. "Northwest" or "East"
-
getAbbreviation
- Returns:
- The abbreviation for this sector, e.g. "NW" or "E"
-
tryCombineTwoQuadrants
Given two intercardinal quadrants, check if there is a cardinal adjacent to both of them.r e.g. NE, NW == north; NE, SE == south; NE, SW == null
null will also be returned if the input is invalid, e.g. if the list size was not 2, or if one or more instance was not an intercard.
- Parameters:
quadrants
- The two quadrants- Returns:
- The adjacent cardinal, or null they are opposites, or if the input is invalid.
-
tryCombineTwoCardinals
Given two cardinals, check if there is an intercardinal adjacent to both of them.r e.g. W, N == NW; S, E == SE; W, E == null
null will also be returned if the input is invalid, e.g. if the list size was not 2, or if one or more instance was not a cardinal.
- Parameters:
cardinals
- The two cardinals- Returns:
- The adjacent intercardinal, or null they are opposites, or if the input is invalid.
-
tryMergeQuadrants
LiketryCombineTwoQuadrants(List)
(List)}, but returns a list. If they were combined, the list will contain the single combined instance. Otherwise, returns the original input.- Parameters:
quadrants
- The quadrants to combine.- Returns:
- The original input if no combination possible, otherwise the combination.
-
opposite
- Returns:
- The direct opposite of this arena area. If 'this' is center or unknown, returns 'this' unmodified.
-
plusEighths
Add the given number of eighth-turns (clockwise) to this sector and return the result.e.g. NORTHEAST.plusEights(2) == SOUTHEAST and NORTHEAST.plusEights(-3) == WEST
To rotate counterclockwise, supply a negative value.
If 'this' is center/unknown, returns this unmodified.
- Parameters:
eighths
- Eigth-turns. Positive is clockwise, negative is CCW.- Returns:
- The result.
-
plusQuads
LikeplusEighths(int)
, but quarter-turns rather than eights.e.g. NORTHEAST.plusQuads(1) == SOUTHEAST, NORTH.plusQuads(-1) == WEST;
- Parameters:
quads
- The number of quarter turns. Positive is clockwise, negative is CCW.- Returns:
- The result.
-
eighthsTo
Computes the rotation from one sector to another, expressed in eight-turns. Positive indicates clockwise while negative indicates CCW.e.g. NORTHEAST.eightsTo(WEST) == -3, because the shortest path from northeast to west is CCW.
- Parameters:
other
- The sector to compare to.- Returns:
- The eighth-turns to get to that sector from this.
- Throws:
IllegalArgumentException
- if 'this' or 'other' is center or unknown.
-
isStrictlyAdjacentTo
- Parameters:
other
- A sector to compare to- Returns:
- true if and only if this sector is exactly one eight-turn away from 'other'. If they are the same, it still returns false.
- Throws:
IllegalArgumentException
- if 'this' or 'other' is center or unknown.
-
isOutside
public boolean isOutside()- Returns:
- true if and only if this is an 'outside' direction, i.e. not 'center' or 'unknown'
-
isCardinal
public boolean isCardinal()- Returns:
- true if and only if this is a cardinal.
-
isIntercard
public boolean isIntercard()- Returns:
- true if and only if this is an intercardinal.
-