GraphLib  2.0
une librairie C# pour l’exploitation de graphes en reconnaissance des formes
 All Classes Namespaces Functions Enumerations Enumerator Properties
Matching.Permutations< T > Class Template Reference

Permutations defines a meta-collection, typically a list of lists, of all possible orderings of a set of values. This list is enumerable and allows the scanning of all possible permutations using a simple foreach() loop. The MetaCollectionType parameter of the constructor allows for the creation of two types of sets, those with and without repetition in the output set when presented with repetition in the input set. More...

Inheritance diagram for Matching.Permutations< T >:
Matching.IMetaCollection< T > Matching.Permutations< T >.Enumerator

Classes

class  Enumerator
 The enumerator that enumerates each meta-collection of the enclosing Permutations class. More...
 

Public Member Functions

 Permutations (IList< T > values)
 Create a permutation set from the provided list of values. The values (T) must implement IComparable. If T does not implement IComparable use a constructor with an explict IComparer. The repetition type defaults to MetaCollectionType.WithholdRepetitionSets More...
 
 Permutations (IList< T > values, GenerateOption type)
 Create a permutation set from the provided list of values. If type is MetaCollectionType.WithholdRepetitionSets, then values (T) must implement IComparable. If T does not implement IComparable use a constructor with an explict IComparer. More...
 
 Permutations (IList< T > values, IComparer< T > comparer)
 Create a permutation set from the provided list of values. The values will be compared using the supplied IComparer. The repetition type defaults to MetaCollectionType.WithholdRepetitionSets More...
 
virtual IEnumerator GetEnumerator ()
 Gets an enumerator for collecting the list of permutations. More...
 

Protected Member Functions

 Permutations ()
 No default constructor, must at least provided a list of values. More...
 

Properties

long Count [get]
 The count of all permutations that will be returned. If type is MetaCollectionType.WithholdGeneratedSets, then this does not double count permutations with multiple identical values. I.e. count of permutations of "AAB" will be 3 instead of 6. If type is MetaCollectionType.WithRepetition, then this is all combinations and is therefore N!, where N is the number of values. More...
 
GenerateOption Type [get]
 The type of Permutations set that is generated. More...
 
int UpperIndex [get]
 The upper index of the meta-collection, equal to the number of items in the initial set. More...
 
int LowerIndex [get]
 The lower index of the meta-collection, equal to the number of items returned each iteration. For Permutation, this is always equal to the UpperIndex. More...
 
- Properties inherited from Matching.IMetaCollection< T >
long Count [get]
 The count of items in the collection. This is not inherited from ICollection since this meta-collection cannot be extended by users. More...
 
GenerateOption Type [get]
 The type of the meta-collection, determining how the collections are determined from the inputs. More...
 
int UpperIndex [get]
 The upper index of the meta-collection, which is the size of the input collection. More...
 
int LowerIndex [get]
 The lower index of the meta-collection, which is the size of each output collection. More...
 

Detailed Description

Permutations defines a meta-collection, typically a list of lists, of all possible orderings of a set of values. This list is enumerable and allows the scanning of all possible permutations using a simple foreach() loop. The MetaCollectionType parameter of the constructor allows for the creation of two types of sets, those with and without repetition in the output set when presented with repetition in the input set.

When given a input collect {A A B}, the following sets are generated: MetaCollectionType.WithRepetition => {A A B}, {A B A}, {A A B}, {A B A}, {B A A}, {B A A} MetaCollectionType.WithoutRepetition => {A A B}, {A B A}, {B A A}

When generating non-repetition sets, ordering is based on the lexicographic ordering of the lists based on the provided Comparer. If no comparer is provided, then T must be IComparable on T.

When generating repetition sets, no comparisions are performed and therefore no comparer is required and T does not need to be IComparable.

Template Parameters
TThe type of the values within the list.

Constructor & Destructor Documentation

Matching.Permutations< T >.Permutations ( )
protected

No default constructor, must at least provided a list of values.

Matching.Permutations< T >.Permutations ( IList< T >  values)

Create a permutation set from the provided list of values. The values (T) must implement IComparable. If T does not implement IComparable use a constructor with an explict IComparer. The repetition type defaults to MetaCollectionType.WithholdRepetitionSets

Parameters
valuesList of values to permute.
Matching.Permutations< T >.Permutations ( IList< T >  values,
GenerateOption  type 
)

Create a permutation set from the provided list of values. If type is MetaCollectionType.WithholdRepetitionSets, then values (T) must implement IComparable. If T does not implement IComparable use a constructor with an explict IComparer.

Parameters
valuesList of values to permute.
typeThe type of permutation set to calculate.
Matching.Permutations< T >.Permutations ( IList< T >  values,
IComparer< T >  comparer 
)

Create a permutation set from the provided list of values. The values will be compared using the supplied IComparer. The repetition type defaults to MetaCollectionType.WithholdRepetitionSets

Parameters
valuesList of values to permute.
comparerComparer used for defining the lexigraphic order.

Member Function Documentation

virtual IEnumerator Matching.Permutations< T >.GetEnumerator ( )
virtual

Gets an enumerator for collecting the list of permutations.

Returns
The enumerator.

Property Documentation

long Matching.Permutations< T >.Count
get

The count of all permutations that will be returned. If type is MetaCollectionType.WithholdGeneratedSets, then this does not double count permutations with multiple identical values. I.e. count of permutations of "AAB" will be 3 instead of 6. If type is MetaCollectionType.WithRepetition, then this is all combinations and is therefore N!, where N is the number of values.

int Matching.Permutations< T >.LowerIndex
get

The lower index of the meta-collection, equal to the number of items returned each iteration. For Permutation, this is always equal to the UpperIndex.

GenerateOption Matching.Permutations< T >.Type
get

The type of Permutations set that is generated.

int Matching.Permutations< T >.UpperIndex
get

The upper index of the meta-collection, equal to the number of items in the initial set.


The documentation for this class was generated from the following file: