⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rules.h

📁 这是个很好的源代码,有用的
💻 H
字号:
// ==============================================================
//
//  Copyright (c) 2002-2003 by Alex Vinokur.
//
//  For conditions of distribution and use, see
//  copyright notice in version.h
//
// ==============================================================


// ##############################################################
//
//  SOFTWARE : Turing Machine (C++ Implementation)
//  FILE     : rules.h
//
//  DESCRIPTION :
//         Classes CurSituation & NextSituation (Definition)
//
// ##############################################################




// ###############
#ifndef _RULES_H
#define _RULES_H

#include "defs.h"


// =========
class CurSituation
{
friend bool operator< (const CurSituation& inst1_i, const CurSituation& inst2_i);
  private :
    const state_t		cur_state_;
    const vector<symbol_t>	cur_symbols_;	// cur_symbols_.size() == number of tapes

  public :
    CurSituation ();
    CurSituation (const state_t& cur_state_i, const vector<symbol_t>& cur_symbols_i);
    ~CurSituation ();

   state_t	get_state () const;
   symbol_t	get_symbol (size_t index_i) const;
   size_t	get_total_symbols () const;
   string	getstr_symbols (size_t max_symbol_size_i = 0) const;
};

// =========
class SymbolAndShift 
{ 
friend class NextSituation;
  private :
    symbol_t symbol_; 
    shift_t shift_; 

  public :
    SymbolAndShift (const symbol_t& symbol_i, shift_t shift_i) : symbol_ (symbol_i), shift_ (shift_i) {}
    ~SymbolAndShift () {} 
};

// =========
class NextSituation
{
  private :
    const state_t			next_state_;
    const vector<SymbolAndShift>	next_symbols_and_shifts_;	// next_symbol_and_shift_.size() == number of tapes

  public :
    NextSituation ();
    NextSituation (const state_t& next_state_i, const vector<SymbolAndShift>& next_symbols_and_shifts_i);
    ~NextSituation ();	

   state_t	get_state () const;
   symbol_t	get_symbol (size_t index_i) const;
   shift_t	get_shift (size_t index_i) const;
   size_t	get_total_symbols () const;
   string	getstr_symbols_and_shifts(size_t max_symbol_size_i = 0) const;
};



#endif	// _RULES_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -