Class IntPair

java.lang.Object
org.apache.calcite.util.mapping.IntPair

public class IntPair extends Object
An immutable pair of integers.
See Also:
  • Field Details

    • SWAP

      @Deprecated public static final com.google.common.base.Function<IntPair,IntPair> SWAP
      Deprecated.
      Function that swaps source and target fields of an IntPair.
    • ORDERING

      public static final com.google.common.collect.Ordering<IntPair> ORDERING
      Ordering that compares pairs lexicographically: first by their source, then by their target.
    • LEFT

      @Deprecated public static final com.google.common.base.Function<IntPair,Integer> LEFT
      Deprecated.
      Function that returns the left (source) side of a pair.
    • source

      public final int source
    • target

      public final int target
  • Constructor Details

    • IntPair

      public IntPair(int source, int target)
  • Method Details

    • of

      public static IntPair of(int left, int right)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • zip

      public static List<IntPair> zip(List<? extends Number> lefts, List<? extends Number> rights)
      Converts two lists into a list of IntPairs, whose length is the lesser of the lengths of the source lists.
      Parameters:
      lefts - Left list
      rights - Right list
      Returns:
      List of pairs
    • zip

      public static List<IntPair> zip(List<? extends Number> lefts, List<? extends Number> rights, boolean strict)
      Converts two lists into a list of IntPairs.

      The length of the combined list is the lesser of the lengths of the source lists. But typically the source lists will be the same length.

      Parameters:
      lefts - Left list
      rights - Right list
      strict - Whether to fail if lists have different size
      Returns:
      List of pairs
    • left

      public static List<Integer> left(List<IntPair> pairs)
      Returns the left side of a list of pairs.
    • right

      public static List<Integer> right(List<IntPair> pairs)
      Returns the right side of a list of pairs.