Class Alias<T>

java.lang.Object
org.javagi.base.Alias<T>
Type Parameters:
T - The primitive value type
Direct Known Subclasses:
Bool, ClockID, ClockTime, ClockTimeDiff, Codepoint, Color, DateDay, DateYear, ElementFactoryListType, Glyph, GlyphUnit, MainContextPusher, Mask, MutexLocker, OtNameId, Pid, Position, Quark, RecMutexLocker, RefString, RWLockReaderLocker, RWLockWriterLocker, Strv, Tag, Time, TimeSpan, Type

public abstract class Alias<T> extends Object
Base class for type aliases of primitive values.
  • Constructor Details

    • Alias

      public Alias(T value)
      Create a new alias with the provided value.
      Parameters:
      value - the initial value of the alias
  • Method Details

    • setValue

      public void setValue(T value)
      Set the alias to the provided value, overwriting any existing value.
      Parameters:
      value - the new value
    • getValue

      public T getValue()
      Get the current value of the alias.
      Returns:
      the current value, or null if the value has not been set
    • toString

      public String toString()
      Return the simple class name of the alias and its value, formatted as ClassName<value>.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the alias type and value
    • equals

      public boolean equals(@Nullable Object o)
      Compare two aliases for equality. This will compare both the type of the aliases, and their values.
      Overrides:
      equals in class Object
      Parameters:
      o - the alias to compare
      Returns:
      whether the aliases are equal
    • hashCode

      public int hashCode()
      Calculate the hashcode of the value of the alias. When the value is null, this will return 0.
      Overrides:
      hashCode in class Object
      Returns:
      the hashcode of the value of the alias
    • getAddressValues

      public static MemorySegment[] getAddressValues(Alias<MemorySegment>[] array)
      Convert an array of MemorySegment Aliases into an array of MemorySegments.
      Parameters:
      array - the array of Alias objects
      Returns:
      an array of MemorySegments
    • getBooleanValues

      public static boolean[] getBooleanValues(Alias<Boolean>[] array)
      Convert an array of Boolean Aliases into an array of booleans.
      Parameters:
      array - the array of Alias objects
      Returns:
      an array of booleans
    • getByteValues

      public static byte[] getByteValues(Alias<Byte>[] array)
      Convert an array of Byte Aliases into an array of bytes.
      Parameters:
      array - the array of Alias objects
      Returns:
      an array of bytes
    • getCharacterValues

      public static char[] getCharacterValues(Alias<Character>[] array)
      Convert an array of Character Aliases into an array of chars.
      Parameters:
      array - the array of Alias objects
      Returns:
      an array of chars
    • getDoubleValues

      public static double[] getDoubleValues(Alias<Double>[] array)
      Convert an array of Double Aliases into an array of doubles.
      Parameters:
      array - the array of Alias objects
      Returns:
      an array of doubles
    • getFloatValues

      public static float[] getFloatValues(Alias<Float>[] array)
      Convert an array of Float Aliases into an array of floats.
      Parameters:
      array - the array of Alias objects
      Returns:
      an array of floats
    • getIntegerValues

      public static int[] getIntegerValues(Alias<Integer>[] array)
      Convert an array of Integer Aliases into an array of integers.
      Parameters:
      array - the array of Alias objects
      Returns:
      an array of integers.
    • getLongValues

      public static long[] getLongValues(Alias<Long>[] array)
      Convert an array of Long Aliases into an array of longs.
      Parameters:
      array - the array of Alias objects
      Returns:
      an array of longs
    • getShortValues

      public static short[] getShortValues(Alias<Short>[] array)
      Convert an array of Short Aliases into an array of shorts.
      Parameters:
      array - the array of Alias objects
      Returns:
      an array of shorts