FreeGroup.h

Go to the documentation of this file.
00001 // Copyright (C) 2005 Alexander Ushakov
00002 // Contents: Definition of class FreeGroup
00003 //
00004 // Principal Authors: Alexander Ushakov
00005 //
00006 // Revision History:
00007 //
00008 
00009 
00010 #ifndef _FreeGroup_h_
00011 #define _FreeGroup_h_
00012 
00013 
00014 #include "SubgroupFG.h"
00015 #include "Alphabet.h"
00016 #include "Word.h"
00017 
00018 
00019 //---------------------------------------------------------------------------//
00020 //-------------------------------- FreeGroup --------------------------------//
00021 //---------------------------------------------------------------------------//
00022 
00023 
00024 class FreeGroup
00025 {
00027   //                                                     //
00028   //  Constructors:                                      //
00029   //                                                     //
00031   
00032  public:
00033 
00035   FreeGroup( int rank );
00036   FreeGroup( const FiniteAlphabet& a );
00037   
00038 
00040   //                                                     //
00041   //  Accessors:                                         //
00042   //                                                     //
00044 
00045  public:
00046 
00048   bool isPrimitive( const Word& w ) const;
00049 
00051   bool isAlmostPrimitive( const Word& w ) const;
00052 
00054   bool doesContain( const SubgroupFG& sbgp , const Word& w ) const;
00055 
00056   const FiniteAlphabet& getAlphabet()const { return theAlphabet; }
00057   
00059   //                                                     //
00060   //  I/O operators                                      //
00061   //                                                     //
00063 
00065   friend ostream& operator << ( ostream& out, const FreeGroup& g ){
00066     cout << "< ";
00067     for (int i=0;i<g.theRank-1;i++)
00068       out << g.theAlphabet.getLetter(i+1) << ", ";
00069 
00070     cout << g.theAlphabet.getLetter(g.theRank) << " >" << flush;
00071     return out;
00072   }
00073   
00075   friend istream& operator >> ( istream& in,  FreeGroup& g ){
00076     FiniteAlphabet a;
00077     in >> a;
00078     g.theAlphabet = a;
00079     g.theRank = a.size();
00080     return in;
00081   }
00082 
00084   //                                                     //
00085   //  Data members:                                      //
00086   //                                                     //
00088 
00089  private:
00090 
00091   int theRank;
00092   FiniteAlphabet theAlphabet;
00093   bool useDefaultAlphabet;
00094 
00095 };
00096 
00097 #endif
00098 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Mon Sep 26 18:43:45 2011 for CRyptography And Groups (CRAG) by  doxygen 1.6.1