- All Superinterfaces:
CardinalNumber,Comparable<RealNumber>,CountableNumber,Integer,Number,RationalNumber,RealNumber
- All Known Subinterfaces:
AtLeastEight,AtLeastEighteen,AtLeastEleven,AtLeastFifteen,AtLeastFive,AtLeastFour,AtLeastFourteen,AtLeastNine,AtLeastNineteen,AtLeastOne,AtLeastSeven,AtLeastSeventeen,AtLeastSix,AtLeastSixteen,AtLeastTen,AtLeastThirteen,AtLeastThree,AtLeastTwelve,AtLeastTwenty,AtLeastTwo,AtLeastZero,FourOrEight,PositiveInteger
- All Known Implementing Classes:
Eight,Eighteen,Eleven,Fifteen,Five,Four,Fourteen,Nine,Nineteen,One,Seven,Seventeen,Six,Sixteen,Ten,Thirteen,Three,Twelve,Twenty,Two,Zero
A
NaturalNumber is a non-negative Integer-
Method Summary
Modifier and TypeMethodDescriptiondefault Stream<NaturalNumber>Returns aStreamof allNaturalNumbers in the range fromZeroto thisNaturalNumberdefault Stream<NaturalNumber>Returns aStreamof allNaturalNumbers in the range fromZeroto thisNaturalNumberminus 1default Stream<NaturalNumber>Returns aStreamof allNaturalNumbers in the range from thisNaturalNumbertoZerodefault Stream<NaturalNumber>Returns aStreamof allNaturalNumbers in the range from thisNaturalNumbertoOnedefault Stream<NaturalNumber>countTo(NaturalNumber value) Returns aStreamof allNaturalNumbers in the range from thisNaturalNumberto the givenNaturalNumberdefault NaturalNumberReturns the product of thisNaturalNumberand the givenNaturalNumberdefault NaturalNumberReturns the remainder of dividing thisNaturalNumberby the givenNaturalNumberstatic NaturalNumberof(int i) Returns theNaturalNumberthat corresponds to the given int istatic NaturalNumberof(long l) Returns theNaturalNumberthat corresponds to the given long lstatic NaturalNumberof(BigInteger bi) Returns theNaturalNumberthat corresponds to the givenBigIntegerstatic NaturalNumberCreates a newNaturalNumberfrom the given stringdefault NaturalNumberReturns the sum of thisNaturalNumberand the givenNaturalNumberdefault PositiveIntegerReturns the sum of thisNaturalNumberand the givenPositiveIntegerdefault NaturalNumberReturns the product of thisNaturalNumberand the givenNaturalNumberMethods inherited from interface org.zfcj.math.numbers.Integer
bigIntegerValue, compareTo, countTo, denominator, divide, doubleValue, greaterThan, greaterThanOrEqualTo, intDenominator, intNumerator, intValue, lessThan, lessThanOrEqualTo, longDenominator, longNumerator, longValue, minus, modulo, numerator, plus, timesMethods inherited from interface org.zfcj.math.numbers.RationalNumber
dividedBy, isInt, isLong, minus, plus, reduce, timesMethods inherited from interface org.zfcj.math.numbers.RealNumber
abs, almostEquals, almostEquals, bigDecimalValue, dividedBy, greaterThan, greaterThanOrEqualTo, isDouble, lessThan, lessThanOrEqualTo, minus, modulo, plus, pow, times, truncate
-
Method Details
-
plus
Returns the sum of thisNaturalNumberand the givenNaturalNumber- Parameters:
n- the natural number to sum- Returns:
- the sum of natural numbers
-
plus
Returns the sum of thisNaturalNumberand the givenPositiveInteger- Parameters:
n- the positive integer to sum- Returns:
- the sum of a natural number and positive integer
-
times
Returns the product of thisNaturalNumberand the givenNaturalNumber- Parameters:
n- the natural number to multiply- Returns:
- the product of natural numbers
-
divide
Returns the product of thisNaturalNumberand the givenNaturalNumber- Parameters:
n- the natural number to divide by- Returns:
- the quotient of natural numbers
-
modulo
Returns the remainder of dividing thisNaturalNumberby the givenNaturalNumber- Parameters:
n- the natural number to modulo by- Returns:
- the remainder of dividing natural numbers
-
count0ToN
Returns aStreamof allNaturalNumbers in the range fromZeroto thisNaturalNumber- Returns:
- a stream of
NaturalNumbers
-
count0ToNMinus1
Returns aStreamof allNaturalNumbers in the range fromZeroto thisNaturalNumberminus 1- Returns:
- a stream of
NaturalNumbers
-
countNTo0
Returns aStreamof allNaturalNumbers in the range from thisNaturalNumbertoZero- Returns:
- a stream of
NaturalNumbers
-
countNTo1
Returns aStreamof allNaturalNumbers in the range from thisNaturalNumbertoOne- Returns:
- a stream of
NaturalNumbers
-
countTo
Returns aStreamof allNaturalNumbers in the range from thisNaturalNumberto the givenNaturalNumber- Returns:
- a stream of
NaturalNumbers
-
of
Returns theNaturalNumberthat corresponds to the given int i- Parameters:
i- the int value- Returns:
- a
NaturalNumberwhose value is i - Throws:
IllegalArgumentException- if i less than 0
-
of
Returns theNaturalNumberthat corresponds to the given long l- Parameters:
l- the long value- Returns:
- a
NaturalNumberwhose value is l - Throws:
IllegalArgumentException- if l less than 0
-
of
Returns theNaturalNumberthat corresponds to the givenBigInteger- Parameters:
bi- the big integer value- Returns:
- a
NaturalNumberwhose value is bi - Throws:
IllegalArgumentException- if bi represents an integer less than 0
-
parse
Creates a newNaturalNumberfrom the given string- Parameters:
s- the "natural number" string- Returns:
- the natural number represented by the string
- Throws:
IllegalArgumentException- if the string does not represent a natural number
-