Interface PositiveInteger

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

public interface PositiveInteger extends NaturalNumber
A PositiveInteger is a NaturalNumber that isn't Zero.
  • Field Details

  • Method Details

    • plus

      default PositiveInteger plus(PositiveInteger n)
      Returns the sum of this PositiveInteger and the given PositiveInteger
      Specified by:
      plus in interface NaturalNumber
      Parameters:
      n - the positive integer to sum
      Returns:
      the sum of positive integers
    • minusOne

      default NaturalNumber minusOne()
      Returns the NaturalNumber that is one less than this PositiveInteger
      Returns:
      this positive integer minus 1
    • times

      default PositiveInteger times(PositiveInteger n)
      Returns the product of this PositiveInteger and the given PositiveInteger
      Parameters:
      n - the positive integer to multiply
      Returns:
      the product of positive integers
    • divide

      default PositiveInteger divide(PositiveInteger n)
      Returns the quotient of dividing this PositiveInteger by the given PositiveInteger
      Parameters:
      n - the positive integer to divide by
      Returns:
      the quotient of positive integers
    • count1ToN

      default Stream<PositiveInteger> count1ToN()
      Returns a Stream of all PositiveIntegers in the range from One to this PositiveInteger
      Returns:
      a stream of PositiveIntegers
    • count1ToNMinus1

      default Stream<PositiveInteger> count1ToNMinus1()
      Returns a Stream of all PositiveIntegers in the range from One to this PositiveInteger minus 1
      Returns:
      a stream of PositiveIntegers
    • countNMinus1To0

      default Stream<NaturalNumber> countNMinus1To0()
      Returns a Stream of all NaturalNumbers in the range from this NaturalNumber minus 1 to Zero
      Returns:
      a stream of NaturalNumbers
    • countTo

      default Stream<PositiveInteger> countTo(PositiveInteger i)
      Returns a Stream of all PositiveIntegers in the range from this PositiveInteger to the given PositiveInteger
      Parameters:
      i - the positive integer to count o
      Returns:
      a stream of PositiveIntegers
    • of

      static PositiveInteger of(int i)
      Creates a new PositiveInteger whose value is the given int
      Parameters:
      i - the int value
      Returns:
      a PositiveInteger with the given value
      Throws:
      IllegalArgumentException - if i less than 1
    • of

      static PositiveInteger of(long l)
      Creates a new PositiveInteger whose value is the given long
      Parameters:
      l - the int value
      Returns:
      a PositiveInteger with the given value
      Throws:
      IllegalArgumentException - if l less than 1
    • of

      static PositiveInteger of(BigInteger bi)
      Creates a new PositiveInteger whose value is the given BigInteger
      Parameters:
      bi - the big integer value
      Returns:
      a PositiveInteger with the given value
      Throws:
      IllegalArgumentException - if bi less than 1
    • parse

      static PositiveInteger parse(String s)
      Creates a new PositiveInteger from the given string or throws an Exception if the string does not represent a PositiveInteger.
      Parameters:
      s - the "positive integer" string
      Returns:
      a PositiveInteger