Enum StackSize

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<StackSize>

    public enum StackSize
    extends java.lang.Enum<StackSize>
    Represents the size of a Java type on the operand stack.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      DOUBLE
      A double slot stack size which is required by long and double values.
      SINGLE
      A single slot stack size.
      ZERO
      An empty stack size.
    • Enum Constant Detail

      • ZERO

        public static final StackSize ZERO
        An empty stack size.
      • SINGLE

        public static final StackSize SINGLE
        A single slot stack size.
      • DOUBLE

        public static final StackSize DOUBLE
        A double slot stack size which is required by long and double values.
    • Method Detail

      • values

        public static StackSize[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (StackSize c : StackSize.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static StackSize valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • of

        public static StackSize of​(java.lang.Class<?> type)
        Finds the operand stack size of a given Java type.
        Parameters:
        type - The type of interest.
        Returns:
        The given type's operand stack size.
      • of

        public static StackSize of​(int size)
        Represents a numeric size as a StackSize.
        Parameters:
        size - The size to represent. Must be 0, 1 or 2.
        Returns:
        A stack size representation for the given value.
      • sizeOf

        public static int sizeOf​(java.lang.Iterable<? extends java.lang.Class<?>> types)
        Returns the sum of all operand stack sizes.
        Parameters:
        types - The types of interest.
        Returns:
        The sum of their sizes.
      • getSize

        public int getSize()
        The numeric value of this stack size representation.
        Returns:
        An integer representing the operand stack size.
      • toIncreasingSize

        public StackManipulation.Size toIncreasingSize()
        Creates an instance of a StackManipulation.Size that describes a stack growth of this size.
        Returns:
        A stack size growth by the size represented by this stack size.
      • toDecreasingSize

        public StackManipulation.Size toDecreasingSize()
        Creates an instance of a StackManipulation.Size that describes a stack decrease of this size.
        Returns:
        A stack size decrease by the size represented by this stack size.
      • maximum

        public StackSize maximum​(StackSize stackSize)
        Determines the maximum of two stack size representations.
        Parameters:
        stackSize - The other stack size representation.
        Returns:
        The maximum of this and the other stack size.