Documentation of 'org.ddogleg.combinatorics.Permute' Java class
Permute
org.ddogleg.combinatorics

Class Permute<T>

  • Type Parameters:
    T -


    public class Permute<T>
    extends java.lang.Object

    Exhaustively computes all the permutations of a set, without recursion. Designed to be memory and speed efficient.

    Example for the set "0123".

     
     0123
     0132
     0213
     0231
     0321
     0312
     1023
     1032
     1203
     1230
     1320
     1302
     2103
     2130
     2013
     2031
     2301
     2310
     3120
     3102
     3210
     3201
     3021
     3012
     
     
    • Constructor Summary

      Constructors 
      Constructor and Description
      Permute() 
      Permute(java.util.List<T> list)
      Permute the elements in the list provided
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      T get(int i)
      Returns element 'i' in the current permutation
      java.util.List<T> getPermutation(java.util.List<T> storage)
      Returns a list containing the current permutation.
      int getTotalPermutations()
      Returns the total number of permutations
      static void main(java.lang.String[] args) 
      boolean next()
      This will permute the list once
      boolean previous()
      This will undo a permutation.
      int size()
      Returns the size of the list being premuted
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Permute

        public Permute(java.util.List<T> list)
        Permute the elements in the list provided
      • Permute

        public Permute()
    • Method Detail

      • getTotalPermutations

        public int getTotalPermutations()
        Returns the total number of permutations
      • next

        public boolean next()
        This will permute the list once
      • previous

        public boolean previous()
        This will undo a permutation.
      • size

        public int size()
        Returns the size of the list being premuted
        Returns:
        list size
      • get

        public T get(int i)
        Returns element 'i' in the current permutation
        Parameters:
        i - index
        Returns:
        element in permuted list
      • getPermutation

        public java.util.List<T> getPermutation(java.util.List<T> storage)
        Returns a list containing the current permutation.
        Parameters:
        storage - Optional storage. If null a new list will be declared.
        Returns:
        Current permutation
      • main

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

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.