java.lang.Object
tools.refinery.interpreter.matchers.tuple.Tuples

public class Tuples extends Object
Common static factory utilities for tuples.
Since:
1.7
  • Method Details

    • flatTupleOf

      public static Tuple flatTupleOf(Object... elements)
      Creates a flat tuple consisting of the given elements. For low-arity tuples, specialized implementations (such as FlatTuple2) will be instantiated.

      In case the exact arity is statically known, it may be more efficient for the client to instantiate the appropriate specialized implementation (via staticArityFlatTupleOf(Object, Object) etc. or wideFlatTupleOf(Object...)), instead of invoking this method. This method does a runtime arity check, and therefore also appropriate if the arity is determined at runtime.

    • leftInheritanceTupleOf

      public static Tuple leftInheritanceTupleOf(Tuple ancestor, Object... localElements)
      Creates a left inheritance tuple that extends an ancestor tuple by the given "local" elements. For locally low-arity tuples, specialized implementations (such as LeftInheritanceTuple2) will be instantiated.

      In case the exact arity is statically known, it may be more efficient for the client to instantiate the appropriate specialized implementation (via

      invalid reference
      #staticArityLeftInheritanceTupleOf(Object, Object)
      etc. or
      invalid reference
      #wideLeftInheritanceTupleOf(Object...)
      ), instead of invoking this method. This method does a runtime arity check, and therefore also appropriate if the arity is determined at runtime.
    • staticArityFlatTupleOf

      public static Tuple staticArityFlatTupleOf()
      Creates a flat tuple consisting of no elements.
    • staticArityFlatTupleOf

      public static Tuple staticArityFlatTupleOf(Object element)
      Creates a flat tuple consisting of the given single element.
    • staticArityFlatTupleOf

      public static Tuple staticArityFlatTupleOf(Object element0, Object element1)
      Creates a flat tuple consisting of the given elements.
    • staticArityFlatTupleOf

      public static Tuple staticArityFlatTupleOf(Object element0, Object element1, Object element2)
      Creates a flat tuple consisting of the given elements.
    • staticArityFlatTupleOf

      public static Tuple staticArityFlatTupleOf(Object element0, Object element1, Object element2, Object element3)
      Creates a flat tuple consisting of the given elements.
    • wideFlatTupleOf

      public static Tuple wideFlatTupleOf(Object... elements)
      Creates a flat tuple consisting of the given elements.

      Invoke this only if it is statically known that the tuple will be wide. Otherwise, use flatTupleOf(Object...).

    • staticArityLeftInheritanceTupleOf

      public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element)
      Creates a left inheritance tuple consisting of the given single local element.
    • staticArityLeftInheritanceTupleOf

      public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element0, Object element1)
      Creates a left inheritance tuple consisting of the given local elements.
    • staticArityLeftInheritanceTupleOf

      public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element0, Object element1, Object element2)
      Creates a left inheritance tuple consisting of the given local elements.
    • staticArityLeftInheritanceTupleOf

      public static Tuple staticArityLeftInheritanceTupleOf(Tuple ancestor, Object element0, Object element1, Object element2, Object element3)
      Creates a left inheritance tuple consisting of the given local elements.
    • wideLeftInheritanceTupleOf

      public static Tuple wideLeftInheritanceTupleOf(Tuple ancestor, Object... elements)
      Creates a left inheritance tuple consisting of the given local elements.

      Invoke this only if it is statically known that the tuple will be wide. Otherwise, use leftInheritanceTupleOf(Tuple, Object...).