de.caff.generics.util.combi

## Class IntPartitions

- java.lang.Object
- - de.caff.generics.util.combi.IntPartitions

-     public class IntPartitions
      extends java.lang.Object

  Partition of a positive integer value.

  An integer partition contains all sets of numbers which add up to this value. This class allows to iterate over all unique partitions sequencing from higher to lower numbers.

  E.g. for the number 4 this will return the following sequence of indexables of `IntPartitions.Part`s:

  Result (count*number,...) | Meaning
  --- | ---
  `1*4` | `4 = 4`
  `1*3,1*1` | `4 = 3 + 1`
  `2*2` | `4 = 2 + 2`
  `1*2,2*2` | `4 = 2 + 1 + 1`
  `4*1` | `4 = 1 + 1 + 1 + 1`

  Since:
    May 25, 2023
  Author:
    Rammi

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `IntPartitions.Part` One part of a partition.
    `static class` | `IntPartitions.Partition` One partition.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IntPartitions()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `main(java.lang.String[] args)` Test partitioning.
    `static java.lang.Iterable<IntPartitions.Partition>` | `of(int n)` Get an iterable iterating over the integer partitions of the given number.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IntPartitions

          public IntPartitions()

  - ### Method Detail

    - #### of

          @NotNull
          public static java.lang.Iterable<IntPartitions.Partition> of(int n)

      Get an iterable iterating over the integer partitions of the given number.
      Parameters:
        `n` - a positive number
      Returns:
        an iterable which will iterate over the given partitions

    - #### main

          public static void main(@NotNull
                                  java.lang.String[] args)

      Test partitioning.
      Parameters:
        `args` - at least one positive number