00001 /** 00002 * @file Tools/Math/Permutation.h 00003 * Declares class Permutation 00004 * 00005 * @author <A href=mailto:sebastian.schmidt@udo.edu>Sebastian Schmidt</A> 00006 */ 00007 00008 #ifndef __Permutation_h__ 00009 #define __Permutation_h__ 00010 00011 /** 00012 * The class Permutation defines a method to calculate permutations 00013 * 00014 */ 00015 class Permutation 00016 { 00017 public: 00018 00019 /** 00020 * Calculates the next permutation to a given one. To get all permutations the data-array in the first call 00021 * should be sorted ascending. 00022 * @param data The given permutation as input and the next permutation after return. When returned false the array-data is invalid. 00023 * @param length The number of elements 00024 * @return A bool wether a next permutation could be calculated. 00025 */ 00026 static bool perm(int data[], const int& length); 00027 00028 private: 00029 00030 /** 00031 * Sort the part of the array between the positions start and end (inclusive) via a quicksort algorithm. 00032 * @param data The array 00033 * @param start The first position of the arraypart to sort. 00034 * @param end The last position of the arraypart to sort. 00035 */ 00036 static void sort(int data[], const int& start, const int& end); 00037 00038 }; 00039 00040 #endif //__Permutation_h____ 00041 00042 /* 00043 * Change log : 00044 * 00045 * $Log: Permutation.h,v $ 00046 * Revision 1.1.1.1 2004/05/22 17:37:13 cvsadm 00047 * created new repository GT2004_WM 00048 * 00049 * Revision 1.1 2003/10/07 10:13:24 cvsadm 00050 * Created GT2004 (M.J.) 00051 * 00052 * Revision 1.1.1.1 2003/07/02 09:40:28 cvsadm 00053 * created new repository for the competitions in Padova from the 00054 * tamara CVS (Tuesday 2:00 pm) 00055 * 00056 * removed unused solutions 00057 * 00058 * Revision 1.1 2003/02/27 10:07:00 schmidt 00059 * Added three variants of a SensorFusionPlayersLocator. 00060 * 00061 * 00062 */