Class IntPermutationsWithPriority

java.lang.Object
cc.redberry.combinatorics.IntPermutationsWithPriority
All Implemented Interfaces:
IntCombinatorialPort, Serializable

public final class IntPermutationsWithPriority extends Object implements IntCombinatorialPort
Iterator over all possible permutations of specified that allows to adjust the "niceness" of particular permutations, such they will appear earlier in the iteration if iterator was reset via reset().
Since:
1.0
See Also:
  • Field Details

  • Constructor Details

    • IntPermutationsWithPriority

      public IntPermutationsWithPriority(int dimension)
    • IntPermutationsWithPriority

      public IntPermutationsWithPriority(int[] initialPermutation)
  • Method Details

    • take

      public int[] take()
      Description copied from interface: IntCombinatorialPort
      Calculates and returns the next combination or null, if no more combinations exist.
      Specified by:
      take in interface IntCombinatorialPort
      Returns:
      the next combination or null, if no more combinations exist
    • nice

      public void nice()
      Increase niceness of the last returned permutation.
    • reset

      public void reset()
      Description copied from interface: IntCombinatorialPort
      Resets the iteration
      Specified by:
      reset in interface IntCombinatorialPort
    • getReference

      public int[] getReference()
      Description copied from interface: IntCombinatorialPort
      Returns the reference to the current iteration element
      Specified by:
      getReference in interface IntCombinatorialPort
      Returns:
      the reference to the current iteration element
    • swap

      private void swap(int i, int j)