Public Member Functions

zeus::TPermutation Class Reference

#include <Permutation.h>

List of all members.

Public Member Functions

 TPermutation (Int iNum)
virtual ~TPermutation ()
Int64 getCount () const
void reset ()
bool hasNextPerm () const
IList< Int > & getNextPerm ()

Detailed Description

This class implements the permutation of any type T.


Constructor & Destructor Documentation

TPermutation::TPermutation ( Int  iNum )

creates a permutation object

Parameters:
iNum: number of permutations
TPermutation::~TPermutation (  ) [virtual]

Destroys the permutation object


Member Function Documentation

Int64 zeus::TPermutation::getCount (  ) const [inline]

Returns the number of permutations

IList< Int > & TPermutation::getNextPerm (  )

returns a permutation instance. We use the following algorithm to perform the iteration:

    perm:= getNextPerm()
    begin
      i:= 0;
      repeat
        it <- source.iterator[i];

        if it.hasNextUnmarkedItem then
          begin
            item <- it.nextUnmarkedItem;

            mark item;
            perm.push( item );
            i++;
          end
        else
          begin
            i--
            item = perm.pop
            unmark item
          end
      until( i = source.length and i >= 0)
    end
bool zeus::TPermutation::hasNextPerm (  ) const [inline]

Checks if there are more permutations to return

Return values:
false,:No more permutations
true,:There are more permutations
void TPermutation::reset (  )

resets the internal iterator over all permutations


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:32:27