Class StdTypeList

All Implemented Interfaces:
TypeList, ToHuman

public final class StdTypeList extends FixedSizeList implements TypeList
Standard implementation of TypeList.
  • Field Details

    • EMPTY

      public static final StdTypeList EMPTY
      non-null; no-element instance
    • INT

      public static final StdTypeList INT
      non-null; the list [int]
    • LONG

      public static final StdTypeList LONG
      non-null; the list [long]
    • FLOAT

      public static final StdTypeList FLOAT
      non-null; the list [float]
    • DOUBLE

      public static final StdTypeList DOUBLE
      non-null; the list [double]
    • OBJECT

      public static final StdTypeList OBJECT
      non-null; the list [Object]
    • RETURN_ADDRESS

      public static final StdTypeList RETURN_ADDRESS
      non-null; the list [ReturnAddress]
    • THROWABLE

      public static final StdTypeList THROWABLE
      non-null; the list [Throwable]
    • INT_INT

      public static final StdTypeList INT_INT
      non-null; the list [int, int]
    • LONG_LONG

      public static final StdTypeList LONG_LONG
      non-null; the list [long, long]
    • FLOAT_FLOAT

      public static final StdTypeList FLOAT_FLOAT
      non-null; the list [float, float]
    • DOUBLE_DOUBLE

      public static final StdTypeList DOUBLE_DOUBLE
      non-null; the list [double, double]
    • OBJECT_OBJECT

      public static final StdTypeList OBJECT_OBJECT
      non-null; the list [Object, Object]
    • INT_OBJECT

      public static final StdTypeList INT_OBJECT
      non-null; the list [int, Object]
    • LONG_OBJECT

      public static final StdTypeList LONG_OBJECT
      non-null; the list [long, Object]
    • FLOAT_OBJECT

      public static final StdTypeList FLOAT_OBJECT
      non-null; the list [float, Object]
    • DOUBLE_OBJECT

      public static final StdTypeList DOUBLE_OBJECT
      non-null; the list [double, Object]
    • LONG_INT

      public static final StdTypeList LONG_INT
      non-null; the list [long, int]
    • INTARR_INT

      public static final StdTypeList INTARR_INT
      non-null; the list [int[], int]
    • LONGARR_INT

      public static final StdTypeList LONGARR_INT
      non-null; the list [long[], int]
    • FLOATARR_INT

      public static final StdTypeList FLOATARR_INT
      non-null; the list [float[], int]
    • DOUBLEARR_INT

      public static final StdTypeList DOUBLEARR_INT
      non-null; the list [double[], int]
    • OBJECTARR_INT

      public static final StdTypeList OBJECTARR_INT
      non-null; the list [Object[], int]
    • BOOLEANARR_INT

      public static final StdTypeList BOOLEANARR_INT
      non-null; the list [boolean[], int]
    • BYTEARR_INT

      public static final StdTypeList BYTEARR_INT
      non-null; the list [byte[], int]
    • CHARARR_INT

      public static final StdTypeList CHARARR_INT
      non-null; the list [char[], int]
    • SHORTARR_INT

      public static final StdTypeList SHORTARR_INT
      non-null; the list [short[], int]
    • INT_INTARR_INT

      public static final StdTypeList INT_INTARR_INT
      non-null; the list [int, int[], int]
    • LONG_LONGARR_INT

      public static final StdTypeList LONG_LONGARR_INT
      non-null; the list [long, long[], int]
    • FLOAT_FLOATARR_INT

      public static final StdTypeList FLOAT_FLOATARR_INT
      non-null; the list [float, float[], int]
    • DOUBLE_DOUBLEARR_INT

      public static final StdTypeList DOUBLE_DOUBLEARR_INT
      non-null; the list [double, double[], int]
    • OBJECT_OBJECTARR_INT

      public static final StdTypeList OBJECT_OBJECTARR_INT
      non-null; the list [Object, Object[], int]
    • INT_BOOLEANARR_INT

      public static final StdTypeList INT_BOOLEANARR_INT
      non-null; the list [int, boolean[], int]
    • INT_BYTEARR_INT

      public static final StdTypeList INT_BYTEARR_INT
      non-null; the list [int, byte[], int]
    • INT_CHARARR_INT

      public static final StdTypeList INT_CHARARR_INT
      non-null; the list [int, char[], int]
    • INT_SHORTARR_INT

      public static final StdTypeList INT_SHORTARR_INT
      non-null; the list [int, short[], int]
  • Constructor Details

    • StdTypeList

      public StdTypeList(int size)
      Constructs an instance. All indices initially contain null.
      Parameters:
      size - the size of the list
  • Method Details

    • make

      public static StdTypeList make(Type type)
      Makes a single-element instance.
      Parameters:
      type - non-null; the element
      Returns:
      non-null; an appropriately-constructed instance
    • make

      public static StdTypeList make(Type type0, Type type1)
      Makes a two-element instance.
      Parameters:
      type0 - non-null; the first element
      type1 - non-null; the second element
      Returns:
      non-null; an appropriately-constructed instance
    • make

      public static StdTypeList make(Type type0, Type type1, Type type2)
      Makes a three-element instance.
      Parameters:
      type0 - non-null; the first element
      type1 - non-null; the second element
      type2 - non-null; the third element
      Returns:
      non-null; an appropriately-constructed instance
    • make

      public static StdTypeList make(Type type0, Type type1, Type type2, Type type3)
      Makes a four-element instance.
      Parameters:
      type0 - non-null; the first element
      type1 - non-null; the second element
      type2 - non-null; the third element
      type3 - non-null; the fourth element
      Returns:
      non-null; an appropriately-constructed instance
    • toHuman

      public static String toHuman(TypeList list)
      Returns the given list as a comma-separated list of human forms. This is a static method so as to work on arbitrary TypeList instances.
      Parameters:
      list - non-null; the list to convert
      Returns:
      non-null; the human form
    • hashContents

      public static int hashContents(TypeList list)
      Returns a hashcode of the contents of the given list. This is a static method so as to work on arbitrary TypeList instances.
      Parameters:
      list - non-null; the list to inspect
      Returns:
      non-null; the hash code
    • equalContents

      public static boolean equalContents(TypeList list1, TypeList list2)
      Compares the contents of the given two instances for equality. This is a static method so as to work on arbitrary TypeList instances.
      Parameters:
      list1 - non-null; one list to compare
      list2 - non-null; another list to compare
      Returns:
      whether the two lists contain corresponding equal elements
    • compareContents

      public static int compareContents(TypeList list1, TypeList list2)
      Compares the contents of the given two instances for ordering. This is a static method so as to work on arbitrary TypeList instances.
      Parameters:
      list1 - non-null; one list to compare
      list2 - non-null; another list to compare
      Returns:
      the order of the two lists
    • getType

      public Type getType(int n)
      Gets the indicated element. It is an error to call this with the index for an element which was never set; if you do that, this will throw NullPointerException.
      Specified by:
      getType in interface TypeList
      Parameters:
      n - >= 0, < size(); which element
      Returns:
      non-null; the indicated element
    • getWordCount

      public int getWordCount()
      Gets the number of 32-bit words required to hold instances of all the elements of this list. This is a sum of the widths (categories) of all the elements.
      Specified by:
      getWordCount in interface TypeList
      Returns:
      >= 0; the required number of words
    • withAddedType

      public TypeList withAddedType(Type type)
      Returns a new instance which is identical to this one, except that the given item is appended to the end and it is guaranteed to be immutable.
      Specified by:
      withAddedType in interface TypeList
      Parameters:
      type - non-null; item to append
      Returns:
      non-null; an appropriately-constructed instance
    • get

      public Type get(int n)
      Gets the indicated element. It is an error to call this with the index for an element which was never set; if you do that, this will throw NullPointerException.
      Parameters:
      n - >= 0, < size(); which element
      Returns:
      non-null; the indicated element
    • set

      public void set(int n, Type type)
      Sets the type at the given index.
      Parameters:
      n - >= 0, < size(); which element
      type - non-null; the type to store
    • withFirst

      public StdTypeList withFirst(Type type)
      Returns a new instance, which is the same as this instance, except that it has an additional type prepended to the original.
      Parameters:
      type - non-null; the new first element
      Returns:
      non-null; an appropriately-constructed instance