- All Superinterfaces:
CardinalNumber
,Comparable<RealNumber>
,CountableNumber
,Integer
,NaturalNumber
,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
,FourOrEight
- All Known Implementing Classes:
Eight
,Eighteen
,Eleven
,Fifteen
,Five
,Four
,Fourteen
,Nine
,Nineteen
,One
,Seven
,Seventeen
,Six
,Sixteen
,Ten
,Thirteen
,Three
,Twelve
,Twenty
,Two
A
PositiveInteger
is a NaturalNumber
that isn't Zero
.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault Stream<PositiveInteger>
Returns aStream
of allPositiveInteger
s in the range fromOne
to thisPositiveInteger
default Stream<PositiveInteger>
Returns aStream
of allPositiveInteger
s in the range fromOne
to thisPositiveInteger
minus 1default Stream<NaturalNumber>
Returns aStream
of allNaturalNumber
s in the range from thisNaturalNumber
minus 1 toZero
default Stream<PositiveInteger>
Returns aStream
of allPositiveInteger
s in the range from thisPositiveInteger
to the givenPositiveInteger
default PositiveInteger
Returns the quotient of dividing thisPositiveInteger
by the givenPositiveInteger
default NaturalNumber
minusOne()
Returns theNaturalNumber
that is one less than thisPositiveInteger
static PositiveInteger
of
(int i) Creates a newPositiveInteger
whose value is the givenint
static PositiveInteger
of
(long l) Creates a newPositiveInteger
whose value is the givenlong
static PositiveInteger
of
(BigInteger bi) Creates a newPositiveInteger
whose value is the givenBigInteger
static PositiveInteger
Creates a newPositiveInteger
from the given string or throws anException
if the string does not represent aPositiveInteger
.default PositiveInteger
Returns the sum of thisPositiveInteger
and the givenPositiveInteger
default PositiveInteger
Returns the product of thisPositiveInteger
and the givenPositiveInteger
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.NaturalNumber
count0ToN, count0ToNMinus1, countNTo0, countNTo1, countTo, divide, modulo, 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
-
Field Details
-
MAX_INT
-
-
Method Details
-
plus
Returns the sum of thisPositiveInteger
and the givenPositiveInteger
- Specified by:
plus
in interfaceNaturalNumber
- Parameters:
n
- the positive integer to sum- Returns:
- the sum of positive integers
-
minusOne
Returns theNaturalNumber
that is one less than thisPositiveInteger
- Returns:
- this positive integer minus 1
-
times
Returns the product of thisPositiveInteger
and the givenPositiveInteger
- Parameters:
n
- the positive integer to multiply- Returns:
- the product of positive integers
-
divide
Returns the quotient of dividing thisPositiveInteger
by the givenPositiveInteger
- Parameters:
n
- the positive integer to divide by- Returns:
- the quotient of positive integers
-
count1ToN
Returns aStream
of allPositiveInteger
s in the range fromOne
to thisPositiveInteger
- Returns:
- a stream of
PositiveInteger
s
-
count1ToNMinus1
Returns aStream
of allPositiveInteger
s in the range fromOne
to thisPositiveInteger
minus 1- Returns:
- a stream of
PositiveInteger
s
-
countNMinus1To0
Returns aStream
of allNaturalNumber
s in the range from thisNaturalNumber
minus 1 toZero
- Returns:
- a stream of
NaturalNumber
s
-
countTo
Returns aStream
of allPositiveInteger
s in the range from thisPositiveInteger
to the givenPositiveInteger
- Parameters:
i
- the positive integer to count o- Returns:
- a stream of
PositiveInteger
s
-
of
Creates a newPositiveInteger
whose value is the givenint
- Parameters:
i
- the int value- Returns:
- a
PositiveInteger
with the given value - Throws:
IllegalArgumentException
- if i less than 1
-
of
Creates a newPositiveInteger
whose value is the givenlong
- Parameters:
l
- the int value- Returns:
- a
PositiveInteger
with the given value - Throws:
IllegalArgumentException
- if l less than 1
-
of
Creates a newPositiveInteger
whose value is the givenBigInteger
- Parameters:
bi
- the big integer value- Returns:
- a
PositiveInteger
with the given value - Throws:
IllegalArgumentException
- if bi less than 1
-
parse
Creates a newPositiveInteger
from the given string or throws anException
if the string does not represent aPositiveInteger
.- Parameters:
s
- the "positive integer" string- Returns:
- a
PositiveInteger
-