Enum Class ArenaSector

java.lang.Object
java.lang.Enum<ArenaSector>
gg.xp.xivsupport.models.ArenaSector
All Implemented Interfaces:
HasFriendlyName, Serializable, Comparable<ArenaSector>, Constable

public enum ArenaSector extends Enum<ArenaSector> implements HasFriendlyName
  • Enum Constant Details

    • NORTH

      public static final ArenaSector NORTH
    • NORTHEAST

      public static final ArenaSector NORTHEAST
    • EAST

      public static final ArenaSector EAST
    • SOUTHEAST

      public static final ArenaSector SOUTHEAST
    • SOUTH

      public static final ArenaSector SOUTH
    • SOUTHWEST

      public static final ArenaSector SOUTHWEST
    • WEST

      public static final ArenaSector WEST
    • NORTHWEST

      public static final ArenaSector NORTHWEST
    • CENTER

      public static final ArenaSector CENTER
      Represents the center of the arena rather than a direction.
    • UNKNOWN

      public static final ArenaSector UNKNOWN
      Represents an unknown sector.
  • Field Details

    • cardinals

      public static final List<ArenaSector> cardinals
      The list of cardinal directions.
    • quadrants

      public static final List<ArenaSector> quadrants
      The the list of intercardinal directions (or quadrants, if you prefer).
    • all

      public static final List<ArenaSector> all
      Intercardinals and cardinals. This only contains the 'real' directions (no 'center' or 'unknown'), so it is preferable to use this instead of values()
  • Method Details

    • values

      public static ArenaSector[] 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

      public static ArenaSector valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getFriendlyName

      public String getFriendlyName()
      Specified by:
      getFriendlyName in interface HasFriendlyName
      Returns:
      The full name for this sector, e.g. "Northwest" or "East"
    • getAbbreviation

      public String getAbbreviation()
      Returns:
      The abbreviation for this sector, e.g. "NW" or "E"
    • tryCombineTwoQuadrants

      @Nullable public static @Nullable ArenaSector tryCombineTwoQuadrants(List<ArenaSector> quadrants)
      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

      @Nullable public static @Nullable ArenaSector tryCombineTwoCardinals(List<ArenaSector> cardinals)
      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

      public static List<ArenaSector> tryMergeQuadrants(List<ArenaSector> quadrants)
      Like tryCombineTwoQuadrants(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

      public ArenaSector opposite()
      Returns:
      The direct opposite of this arena area. If 'this' is center or unknown, returns 'this' unmodified.
    • plusEighths

      public ArenaSector plusEighths(int eighths)
      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

      public ArenaSector plusQuads(int quads)
      Like plusEighths(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

      public int eighthsTo(ArenaSector other)
      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

      public boolean isStrictlyAdjacentTo(ArenaSector other)
      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.