|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.erights.e.meta.java.math.BigIntegerSugar
Untamed: A sweetener defining extra messages that may be e-sent to an integer.
Field Summary | |
(package private) static String |
BASE64
|
Constructor Summary | |
private |
BigIntegerSugar()
prevent instantiation |
Method Summary | |
static boolean |
aboveZero(BigInteger self)
Enabled: Used in the expansion of E's ">" operator |
static double |
approxDivide(double self,
double arg)
Enabled: Always gives back a Double This corresponds to the Java floating-point "/" operator and the E "/" operator. |
static char |
asChar(BigInteger self)
Enabled: Returns the Unicode character with this character code. |
static double |
asFloat64(double self)
Enabled: Returns the "best" IEEE double precision floating point equivalent to this number. |
static boolean |
atLeastZero(BigInteger self)
Enabled: Used in the expansion of E's ">=" operator |
static boolean |
atMostZero(BigInteger self)
Enabled: Used in the expansion of E's "<=" operator |
static boolean |
belowZero(BigInteger self)
Enabled: Used in the expansion of E's "<" operator |
static BigInteger |
butNot(BigInteger self,
BigInteger arg)
Enabled: In E, andNot() is called butNot() |
static BigInteger |
ceil(BigInteger self)
Enabled: Defined both here and in DoubleSugar, so you can use this to get a ceil'ed integer no matter what kind of number you start with. |
static int |
compareTo(BigInteger self,
Object o)
Enabled: Overrides the inherited 'compareTo' to coerce 'o' to a BigInteger |
static BigInteger |
complement(BigInteger val)
Deprecated. Use BigInteger.not() instead. |
static BigInteger |
cryptoHash(BigInteger self)
Enabled: Actually, a SHA hash |
static BigInteger |
floor(BigInteger self)
Enabled: Defined both here and in DoubleSugar, so you can use this to get a floor'ed integer no matter what kind of number you start with. |
static BigInteger |
floorDivide(BigInteger self,
BigInteger arg)
Enabled: Always gives an integer, resulting from rounding towards negative infinity, ie, flooring. |
static boolean |
isNaN(BigInteger self)
Enabled: All integers are numbers, so this is always false |
static boolean |
isZero(BigInteger self)
Enabled: Used for arithmetic equality |
static BigInteger |
mod(BigInteger self,
BigInteger arg)
Enabled: Remainder from the floorDivide operation. |
static BigInteger |
next(BigInteger self)
Enabled: The next higher integer |
static BigInteger |
previous(BigInteger self)
Enabled: The next lower integer |
static BigInteger |
round(BigInteger self)
Enabled: Defined both here and in DoubleSugar, so you can use this to get round'ed integer no matter what kind of number you start with. |
static String |
toString64(BigInteger self)
Enabled: Convert an integer to a base 64 string, with an optional leading minus sign. |
static BigInteger |
truncate(BigInteger self)
Enabled: Defined both here and in DoubleSugar, so you can use this to get truncate'd integer no matter what kind of number you start with. |
static BigInteger |
truncDivide(BigInteger self,
BigInteger arg)
Enabled: Always gives an integer resulting from rounding towards zero, ie, truncating. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static final String BASE64
Constructor Detail |
private BigIntegerSugar()
Method Detail |
public static double approxDivide(double self, double arg)
public static char asChar(BigInteger self)
public static double asFloat64(double self)
public static boolean aboveZero(BigInteger self)
public static boolean atLeastZero(BigInteger self)
public static boolean atMostZero(BigInteger self)
public static boolean belowZero(BigInteger self)
public static boolean isZero(BigInteger self)
public static boolean isNaN(BigInteger self)
public static BigInteger ceil(BigInteger self)
public static int compareTo(BigInteger self, Object o)
public static BigInteger complement(BigInteger val)
BigInteger.not()
instead.
However, the E style, supported by other set-like abstractions, is to use unary "!" instead.
public static BigInteger floor(BigInteger self)
public static BigInteger floorDivide(BigInteger self, BigInteger arg)
public static BigInteger butNot(BigInteger self, BigInteger arg)
public static BigInteger mod(BigInteger self, BigInteger arg)
(a floorDivide b)*b + (a modulo b) == a [ 5, 3]: ( 1* 3) + 2 == 5 [ 5,-3]: (-2*-3) + -1 == 5 [-5, 3]: (-2* 3) + 1 == -5 [-5,-3]: ( 1*-3) + -2 == -5
Therefore, if the result is non-zero, the sign of the result must be the same as the sign of b, and so the result ranges from 0 inclusive to b exclusive. This corresponds to the E "%%" operator. When b >= 0, it also corresponds to Java's BigInteger.mod().
public static BigInteger round(BigInteger self)
public static BigInteger truncate(BigInteger self)
public static BigInteger truncDivide(BigInteger self, BigInteger arg)
(a truncDivide b)*b + (a remainder b) == a [ 5, 3]: ( 1* 3) + 2 == 5 [ 5,-3]: (-1*-3) + 2 == 5 [-5, 3]: (-1* 3) + -2 == -5 [-5,-3]: ( 1*-3) + -2 == -5
Therefore, if the result is non-zero, the sign of the result must be the same as the sign of a. This corresponds to the Java and E "%" operator.
public static BigInteger next(BigInteger self)
public static BigInteger previous(BigInteger self)
public static String toString64(BigInteger self)
A negative integer is encoded as a "-" followed by the encoding of the absolute magnitude. For a positive integer, the encoded length will be (4 * b.length)/3, rounded up to the next integral (non-fractional) character length.
Each base 64 digit is encoded by one of the characters
public static BigInteger cryptoHash(BigInteger self)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |