Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

/magnus/back_end/KB/include/DiffMachine.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: DiffMachine.h,v 1.2 1996/08/15 18:55:38 bormotov Exp $
00003  */
00004 
00005 // Copyright (C) 1994 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 
00008 // Contents: The deterministic finite state automaton class
00009 //
00010 // Principal Author: Sarah Rees
00011 //
00012 // Status: in progress
00013 //
00014 // Revision History:
00015 //
00016 
00017 #ifndef _DiffMachine_H_
00018 #define _DiffMachine_H_
00019 
00020 #include "Word.h"
00021 #include "Set.h"
00022 #include "Vector.h"
00023 #include "FSA.h"
00024 #include "DFSA.h"
00025 #include "DiffMachineRep.h"
00026 
00027 class RKBPackage;
00028 class DiffMachine : public FSA {
00029 // this should surely be derived from DFSA but I can't get the
00030 // constructor to work except by doing this
00031   friend class RKBPackage; 
00032   typedef DFSARep::State State;
00033 public:
00034   DiffMachine( ) : FSA( new DiffMachineRep() ) { };
00035 
00036   DiffMachine( const VectorOf<Chars> genNames ) :
00037   FSA( new DiffMachineRep( genNames) ) { }
00038 
00039   DiffMachine( const VectorOf<Chars> genNames,const WordOrder & word_order ) :
00040   FSA( new DiffMachineRep( genNames,word_order) ) { }
00041   
00042   void addDifferencesEqn
00043        (const Word & w1,const Word & w2,const WordOrder & word_order)
00044     { change()->addDifferencesEqn(w1,w2,word_order);}
00045   void closeUnderSubstrings(int mode,const WordOrder & word_order)
00046     { change()->closeUnderSubstrings(mode,word_order);}
00047   void closeUnderInverses(const WordOrder & word_order)
00048     { change()->closeUnderInverses(word_order);}
00049   Bool rewrite(Word & w) const { return look()->rewrite(w); }
00050   Bool rewrite(Word & w,const WordOrder & word_order) const
00051     { return look()->rewrite(w,word_order);}
00052   Word getDifference(State s) const { return look()->getDifference(s);}
00053   GroupDFSA wordAcceptor(const WordOrder & word_order) const { 
00054      return look()->wordAcceptor(word_order); } 
00055   void buildDifferenceMachine(DiffMachine & D,
00056    const SetOf<Word> & differences, const WordOrder & word_order){
00057      look()->buildDifferenceMachine(*(D.change()),differences,word_order);
00058   }
00059   void rebuildDifferenceMachine(const WordOrder & word_order) {
00060      change()->rebuildDifferenceMachine(word_order);
00061   }
00062 
00063 
00064 protected:
00065   
00066   DiffMachine( DiffMachineRep * rep ) : FSA((FSARep *)rep) { }
00067   // Need to shadow inherited look() and change(), to get right ptr types.
00068   const DiffMachineRep *look() const { 
00069     return (DiffMachineRep*)FSA::look(); }
00070   DiffMachineRep *change() { 
00071     return (DiffMachineRep*)FSA::change(); }
00072 };
00073 #endif

Generated at Tue Jun 19 09:49:36 2001 for Magnus Classes by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001