00001 // Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6), 00002 // département Systèmes Répartis Coopératifs (SRC), Université Pierre 00003 // et Marie Curie. 00004 // 00005 // This file is part of Spot, a model checking library. 00006 // 00007 // Spot is free software; you can redistribute it and/or modify it 00008 // under the terms of the GNU General Public License as published by 00009 // the Free Software Foundation; either version 2 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // Spot is distributed in the hope that it will be useful, but WITHOUT 00013 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00014 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00015 // License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with Spot; see the file COPYING. If not, write to the Free 00019 // Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00020 // 02111-1307, USA. 00021 00022 #ifndef SPOT_TGBA_TGBAPRODUCT_HH 00023 # define SPOT_TGBA_TGBAPRODUCT_HH 00024 00025 #include "tgba.hh" 00026 #include "statebdd.hh" 00027 00028 namespace spot 00029 { 00030 00035 class state_product : public state 00036 { 00037 public: 00043 state_product(state* left, state* right) 00044 : left_(left), 00045 right_(right) 00046 { 00047 } 00048 00050 state_product(const state_product& o); 00051 00052 virtual ~state_product(); 00053 00054 state* 00055 left() const 00056 { 00057 return left_; 00058 } 00059 00060 state* 00061 right() const 00062 { 00063 return right_; 00064 } 00065 00066 virtual int compare(const state* other) const; 00067 virtual size_t hash() const; 00068 virtual state_product* clone() const; 00069 00070 private: 00071 state* left_; 00072 state* right_; 00073 }; 00074 00075 00077 class tgba_succ_iterator_product: public tgba_succ_iterator 00078 { 00079 public: 00080 tgba_succ_iterator_product(tgba_succ_iterator* left, 00081 tgba_succ_iterator* right, 00082 bdd left_neg, bdd right_neg); 00083 00084 virtual ~tgba_succ_iterator_product(); 00085 00086 // iteration 00087 void first(); 00088 void next(); 00089 bool done() const; 00090 00091 // inspection 00092 state_product* current_state() const; 00093 bdd current_condition() const; 00094 bdd current_acceptance_conditions() const; 00095 00096 private: 00098 00099 void step_(); 00100 void next_non_false_(); 00102 00103 protected: 00104 tgba_succ_iterator* left_; 00105 tgba_succ_iterator* right_; 00106 bdd current_cond_; 00107 bdd left_neg_; 00108 bdd right_neg_; 00109 }; 00110 00112 class tgba_product: public tgba 00113 { 00114 public: 00119 tgba_product(const tgba* left, const tgba* right); 00120 00121 virtual ~tgba_product(); 00122 00123 virtual state* get_init_state() const; 00124 00125 virtual tgba_succ_iterator_product* 00126 succ_iter(const state* local_state, 00127 const state* global_state = 0, 00128 const tgba* global_automaton = 0) const; 00129 00130 virtual bdd_dict* get_dict() const; 00131 00132 virtual std::string format_state(const state* state) const; 00133 00134 virtual state* project_state(const state* s, const tgba* t) const; 00135 00136 virtual bdd all_acceptance_conditions() const; 00137 virtual bdd neg_acceptance_conditions() const; 00138 00139 protected: 00140 virtual bdd compute_support_conditions(const state* state) const; 00141 virtual bdd compute_support_variables(const state* state) const; 00142 00143 private: 00144 bdd_dict* dict_; 00145 const tgba* left_; 00146 const tgba* right_; 00147 bdd left_acc_complement_; 00148 bdd right_acc_complement_; 00149 bdd all_acceptance_conditions_; 00150 bdd neg_acceptance_conditions_; 00151 // Disallow copy. 00152 tgba_product(const tgba_product&); 00153 tgba_product& tgba_product::operator=(const tgba_product&); 00154 }; 00155 00156 } 00157 00158 #endif // SPOT_TGBA_TGBAPRODUCT_HH