StringScramblers.h

Go to the documentation of this file.
00001 // Contents: Classes implementing scrambling operators acting on group words (or strings)
00002 
00003 //
00004 // Principal Author: Alexei Miasnikov (2004)
00005 //
00006 // Status:
00007 //
00008 // Revision History:
00009 //
00010 
00011 #ifndef STRING_SCRAMBLER_H
00012 #define STRING_SCRAMBLER_H
00013 
00014 
00015 #include "Word.h"
00016 #include <vector>
00017 
00018 
00020 //
00021 // SCRAMBLER ABSTRACT CLASS
00022 //
00024 
00025 
00026 class StringScrambler
00027 {
00028 public:
00029   virtual Word scramble( const Word& )const  = 0;
00030   virtual double fracChanged()const = 0;
00031 };
00032 
00033 
00035 //
00036 // UNIFORM SCRAMBLER
00037 //
00039 
00040 class UniformScrambler : public StringScrambler
00041 {
00042 public:
00043   UniformScrambler( int gs, double prob ): numGens( gs ), theChangeProb( prob ),theFracChanged(0.0)  {}
00044   Word scramble( const Word& )const;
00045   double fracChanged()const { return theFracChanged; }
00046 
00047  private:
00048   double theChangeProb;
00049   double theFracChanged;
00050   int    numGens;
00051 };
00052 
00054 //
00055 // SUBWORD SCRAMBLER
00056 //
00058 
00059 class SubwordScrambler : public StringScrambler
00060 {
00061 public:
00062   SubwordScrambler( int gs, double f ): numGens( gs ), theChangeFrac( f )  {}
00063   Word scramble( const Word& )const;
00064   double fracChanged()const { return theChangeFrac; }
00065 
00066  private:
00067   double theChangeFrac;
00068   int    numGens;
00069 };
00070 
00072 //
00073 // MULTIPLY WORD SCRAMBLER
00074 //
00076 
00077 class WordMultiplyScrambler : public StringScrambler
00078 {
00079 public:
00080   WordMultiplyScrambler( int gs, double f ): numGens( gs ), theChangeFrac( f )  {}
00081   Word scramble( const Word& )const;
00082   double fracChanged()const { return theChangeFrac; }
00083   
00084  private:
00085   double theChangeFrac;
00086   int    numGens;
00087 };
00088 
00089 
00090 #endif
 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