java.lang.Object
org.kink_lang.kink.internal.num.NumOperations
Number operations used in Kink.
- 
Method Summary
Modifier and TypeMethodDescriptionstatic intgetElemIndex(BigDecimal num, int size) Returns the exact int value of the num, if the num is a proper element index in the sequence which has the sizesize, otherwise returns -1.static intgetElemIndex(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 sizesize, otherwise returns -1.static BigIntegergetExactBigInteger(Val val) Returns an exact BigInteger from the val, if the val is a NumVal and it represents an int number.static OptionalIntgetExactInt(Val val) Returns an exact int number from the val, if the val is a NumVal and it represents the exact int number.static OptionalLonggetExactLongBetween(Val val, long min, long max) Returns an exact long number from the val, if the val is a NumVal and it represents the exact long number betweenminandmax.static intgetPosIndex(BigDecimal num, int size) Returns the exact int value of the num, if the num is a proper pos index in the sequence which has the sizesize, otherwise returns -1.static intgetPosIndex(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 sizesize, otherwise returns -1.static inthash(BigDecimal num) Returns num.hash.static booleanisRangePair(BigDecimal from, BigDecimal to, int size) Returns whetherfromandtoare proper range indexes of the sequence which has the sizesize. 
- 
Method Details
- 
hash
Returns num.hash.- Parameters:
 num- the num to hash.- Returns:
 - the hash used in Kink.
 
 - 
getElemIndex
Returns the exact int value of the num, if the num is a proper element index in the sequence which has the sizesize, otherwise returns -1.- Parameters:
 num- the num.size- the size of a sequence.- Returns:
 - the exact int value of the num, or -1.
 
 - 
getElemIndex
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 sizesize, 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
Returns the exact int value of the num, if the num is a proper pos index in the sequence which has the sizesize, otherwise returns -1.- Parameters:
 num- the num.size- the size of a sequence.- Returns:
 - the exact int value of the num, or -1.
 
 - 
getPosIndex
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 sizesize, 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.
 
 - 
getExactInt
Returns an exact int number from the val, if the val is a NumVal and it represents the exact int number.- Parameters:
 val- the val from which the int number is extracted.- Returns:
 - the exact int number, or empty.
 
 - 
getExactLongBetween
Returns an exact long number from the val, if the val is a NumVal and it represents the exact long number betweenminandmax.- Parameters:
 val- the val the long number from which is extracted.min- the minimum of the range.max- the maximum of the range.- Returns:
 - the exact long number, or empty.
 
 - 
getExactBigInteger
Returns an exact BigInteger from the val, if the val is a NumVal and it represents an int number.- Parameters:
 val- the val from which the BigInteger is extracted.- Returns:
 - the exact BigInteger, or null.
 
 - 
isRangePair
Returns whetherfromandtoare proper range indexes of the sequence which has the sizesize.- Parameters:
 from- the from index.to- the to index.size- the size of a sequence.- Returns:
 - true if 
fromandtoare proper range indexes. 
 
 -