Class NumOperations

java.lang.Object
org.kink_lang.kink.internal.num.NumOperations

public final class NumOperations extends Object
Number operations used in Kink.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    getElemIndex(Val val, int size)
    Returns the exact int value of the val, if the val is a NumVal and it represents a valid element index exactly in the sequence which has the size size, otherwise returns -1.
    static int
    getPosIndex(Val val, int size)
    Returns the exact int value of the val, if the val is a NumVal and it represents a valid position index exactly in the sequence which has the size size, otherwise returns -1.
    static boolean
    isRangePair(NumVal from, NumVal to, int size)
    Returns whether from and to are proper range indexes of the sequence which has the size size.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getElemIndex

      public static int getElemIndex(Val val, int size)
      Returns the exact int value of the val, if the val is a NumVal and it represents a valid element index exactly in the sequence which has the size size, otherwise returns -1.
      Parameters:
      val - the val from which the index is extracted.
      size - the size of a sequence.
      Returns:
      the exact int number of the val, or -1.
    • getPosIndex

      public static int getPosIndex(Val val, int size)
      Returns the exact int value of the val, if the val is a NumVal and it represents a valid position index exactly in the sequence which has the size size, otherwise returns -1.
      Parameters:
      val - the val from which the index is extracted.
      size - the size of a sequence.
      Returns:
      the exact int number of the val, or -1.
    • isRangePair

      public static boolean isRangePair(NumVal from, NumVal to, int size)
      Returns whether from and to are proper range indexes of the sequence which has the size size.
      Parameters:
      from - the from index.
      to - the to index.
      size - the size of a sequence.
      Returns:
      true if from and to are proper range indexes.