Code Search for Developers
 
 
  

DiffMachine.h from Magnus at Krugle


Show DiffMachine.h syntax highlighted

// Copyright (C) 1994 The New York Group Theory Cooperative
// See magnus/doc/COPYRIGHT for the full notice.

// Contents: The deterministic finite state automaton class
//
// Principal Author: Sarah Rees
//
// Status: in progress
//
// Revision History:
//

#ifndef _DiffMachine_H_
#define _DiffMachine_H_

#include "Word.h"
#include "Set.h"
#include "Vector.h"
#include "FSA.h"
#include "DFSA.h"
#include "DiffMachineRep.h"

class RKBPackage;
class DiffMachine : public FSA {
// this should surely be derived from DFSA but I can't get the
// constructor to work except by doing this
  friend class RKBPackage; 
  typedef DFSARep::State State;
public:
  DiffMachine( ) : FSA( new DiffMachineRep() ) { };

  DiffMachine( const VectorOf<Chars> genNames ) :
  FSA( new DiffMachineRep( genNames) ) { }

  DiffMachine( const VectorOf<Chars> genNames,const WordOrder & word_order ) :
  FSA( new DiffMachineRep( genNames,word_order) ) { }
  
  void addDifferencesEqn
       (const Word & w1,const Word & w2,const WordOrder & word_order)
    { change()->addDifferencesEqn(w1,w2,word_order);}
  void closeUnderSubstrings(int mode,const WordOrder & word_order)
    { change()->closeUnderSubstrings(mode,word_order);}
  void closeUnderInverses(const WordOrder & word_order)
    { change()->closeUnderInverses(word_order);}
  Bool rewrite(Word & w) const { return look()->rewrite(w); }
  Bool rewrite(Word & w,const WordOrder & word_order) const
    { return look()->rewrite(w,word_order);}
  Word getDifference(State s) const { return look()->getDifference(s);}
  GroupDFSA wordAcceptor(const WordOrder & word_order) const { 
     return look()->wordAcceptor(word_order); } 
  void buildDifferenceMachine(DiffMachine & D,
   const SetOf<Word> & differences, const WordOrder & word_order){
     look()->buildDifferenceMachine(*(D.change()),differences,word_order);
  }
  void rebuildDifferenceMachine(const WordOrder & word_order) {
     change()->rebuildDifferenceMachine(word_order);
  }


protected:
  
  DiffMachine( DiffMachineRep * rep ) : FSA((FSARep *)rep) { }
  // Need to shadow inherited look() and change(), to get right ptr types.
  const DiffMachineRep *look() const { 
    return (DiffMachineRep*)FSA::look(); }
  DiffMachineRep *change() { 
    return (DiffMachineRep*)FSA::change(); }
};
#endif




See more files for this project here

Magnus

Magnus is a special purpose mathematical package for Infinite Group Theory computations

Project homepage: http://sourceforge.net/projects/magnus
Programming language(s): C,C++
License: other

  DiffHistory.h
  DiffHistoryRep.h
  DiffMachine.h
  DiffMachineRep.h
  GenMult.h
  GenMultRep.h
  KBMachine.h
  KBMachineRep.h
  KBmagPackage.h
  RKBPackage.h
  WordOrder.h
  WordOrderRep.h