- 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 aStream
of allNaturalNumber
s in the range fromZero
to thisNaturalNumber
default Stream<NaturalNumber>
Returns aStream
of allNaturalNumber
s in the range fromZero
to thisNaturalNumber
minus 1default Stream<NaturalNumber>
Returns aStream
of allNaturalNumber
s in the range from thisNaturalNumber
toZero
default Stream<NaturalNumber>
Returns aStream
of allNaturalNumber
s in the range from thisNaturalNumber
toOne
default Stream<NaturalNumber>
countTo
(NaturalNumber value) Returns aStream
of allNaturalNumber
s in the range from thisNaturalNumber
to the givenNaturalNumber
default NaturalNumber
Returns the product of thisNaturalNumber
and the givenNaturalNumber
default NaturalNumber
Returns the remainder of dividing thisNaturalNumber
by the givenNaturalNumber
static NaturalNumber
of
(int i) Returns theNaturalNumber
that corresponds to the given int istatic NaturalNumber
of
(long l) Returns theNaturalNumber
that corresponds to the given long lstatic NaturalNumber
of
(BigInteger bi) Returns theNaturalNumber
that corresponds to the givenBigInteger
static NaturalNumber
Creates a newNaturalNumber
from the given stringdefault NaturalNumber
Returns the sum of thisNaturalNumber
and the givenNaturalNumber
default PositiveInteger
Returns the sum of thisNaturalNumber
and the givenPositiveInteger
default NaturalNumber
Returns the product of thisNaturalNumber
and the givenNaturalNumber
Methods 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, times
Methods inherited from interface org.zfcj.math.numbers.RationalNumber
dividedBy, isInt, isLong, minus, plus, reduce, times
Methods 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 thisNaturalNumber
and the givenNaturalNumber
- Parameters:
n
- the natural number to sum- Returns:
- the sum of natural numbers
-
plus
Returns the sum of thisNaturalNumber
and the givenPositiveInteger
- Parameters:
n
- the positive integer to sum- Returns:
- the sum of a natural number and positive integer
-
times
Returns the product of thisNaturalNumber
and the givenNaturalNumber
- Parameters:
n
- the natural number to multiply- Returns:
- the product of natural numbers
-
divide
Returns the product of thisNaturalNumber
and the givenNaturalNumber
- Parameters:
n
- the natural number to divide by- Returns:
- the quotient of natural numbers
-
modulo
Returns the remainder of dividing thisNaturalNumber
by the givenNaturalNumber
- Parameters:
n
- the natural number to modulo by- Returns:
- the remainder of dividing natural numbers
-
count0ToN
Returns aStream
of allNaturalNumber
s in the range fromZero
to thisNaturalNumber
- Returns:
- a stream of
NaturalNumber
s
-
count0ToNMinus1
Returns aStream
of allNaturalNumber
s in the range fromZero
to thisNaturalNumber
minus 1- Returns:
- a stream of
NaturalNumber
s
-
countNTo0
Returns aStream
of allNaturalNumber
s in the range from thisNaturalNumber
toZero
- Returns:
- a stream of
NaturalNumber
s
-
countNTo1
Returns aStream
of allNaturalNumber
s in the range from thisNaturalNumber
toOne
- Returns:
- a stream of
NaturalNumber
s
-
countTo
Returns aStream
of allNaturalNumber
s in the range from thisNaturalNumber
to the givenNaturalNumber
- Returns:
- a stream of
NaturalNumber
s
-
of
Returns theNaturalNumber
that corresponds to the given int i- Parameters:
i
- the int value- Returns:
- a
NaturalNumber
whose value is i - Throws:
IllegalArgumentException
- if i less than 0
-
of
Returns theNaturalNumber
that corresponds to the given long l- Parameters:
l
- the long value- Returns:
- a
NaturalNumber
whose value is l - Throws:
IllegalArgumentException
- if l less than 0
-
of
Returns theNaturalNumber
that corresponds to the givenBigInteger
- Parameters:
bi
- the big integer value- Returns:
- a
NaturalNumber
whose value is bi - Throws:
IllegalArgumentException
- if bi represents an integer less than 0
-
parse
Creates a newNaturalNumber
from 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
-