Class Anchor

java.lang.Object
com.j3d.gen.guide.Anchor

public class Anchor extends Object
Positioning bitmasks for GuideInfo and GuidePanelAdapter.

These are just quick positioning rather than having to do coordinate calculations yourself. Used in GuideInfo.addCompAt(GuidePanelAdapter, Component, int) and GuideInfo.addCompAt(GuidePanelAdapter, Component, int, int, int) since offsets might still be needed.

Author:
Lehlogonolo Poole
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Represents the center anchor position.
    static final int
    Represents the east (right) anchor position.
    static final int
    Represents the north (top) anchor position.
    static final int
    Represents the south (bottom) anchor position.
    static final int
    Represents the west (left) anchor position.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    has(int value, int bit)
    Checks if a given combined anchor value contains a specific anchor bit.
    static boolean
    hasHorizontal(int value)
    Checks if the given combined anchor value includes either the EAST or WEST anchor bits.
    static boolean
    hasVertical(int value)
    Checks if the given combined anchor value includes either the NORTH or SOUTH anchor bits.
    static int
    offsetDown(int i)
    Creates a downward component offset of the given magnitude.
    static int
    offsetLeft(int i)
    Creates a leftward component offset of the given magnitude.
    static int
    offsetRight(int i)
    Creates a rightward component offset of the given magnitude.
    static int
    offsetUp(int i)
    Creates an upward component offset of the given magnitude.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CENTRE

      public static final int CENTRE
      Represents the center anchor position.
      See Also:
    • NORTH

      public static final int NORTH
      Represents the north (top) anchor position.
      See Also:
    • SOUTH

      public static final int SOUTH
      Represents the south (bottom) anchor position.
      See Also:
    • EAST

      public static final int EAST
      Represents the east (right) anchor position.
      See Also:
    • WEST

      public static final int WEST
      Represents the west (left) anchor position.
      See Also:
  • Constructor Details

    • Anchor

      public Anchor()
  • Method Details

    • has

      public static boolean has(int value, int bit)
      Checks if a given combined anchor value contains a specific anchor bit. This is useful for determining if a particular direction or center is part of the specified positioning.
      Parameters:
      value - The combined anchor value (e.g., NORTH | EAST).
      bit - The specific anchor bit to check for (e.g., NORTH).
      Returns:
      true if the value contains the bit, false otherwise.
    • hasVertical

      public static boolean hasVertical(int value)
      Checks if the given combined anchor value includes either the NORTH or SOUTH anchor bits.
      Parameters:
      value - The combined anchor value.
      Returns:
      true if NORTH or SOUTH is present, false otherwise.
    • hasHorizontal

      public static boolean hasHorizontal(int value)
      Checks if the given combined anchor value includes either the EAST or WEST anchor bits.
      Parameters:
      value - The combined anchor value.
      Returns:
      true if EAST or WEST is present, false otherwise.
    • offsetUp

      public static int offsetUp(int i)
      Creates an upward component offset of the given magnitude.
      Parameters:
      i - distance from anchor in pixels
      Returns:
      the offset magnitude
    • offsetDown

      public static int offsetDown(int i)
      Creates a downward component offset of the given magnitude.
      Parameters:
      i - distance from anchor in pixels
      Returns:
      the offset magnitude
    • offsetRight

      public static int offsetRight(int i)
      Creates a rightward component offset of the given magnitude.
      Parameters:
      i - distance from the anchor in pixels
      Returns:
      the offset magnitude
    • offsetLeft

      public static int offsetLeft(int i)
      Creates a leftward component offset of the given magnitude.
      Parameters:
      i - distance from the anchor in pixels
      Returns:
      the offset magnitude