00001 // Copyright (C) 2003, 2004 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 00036 class state_product : public state 00037 { 00038 public: 00044 state_product(state* left, state* right) 00045 : left_(left), 00046 right_(right) 00047 { 00048 } 00049 00051 state_product(const state_product& o); 00052 00053 virtual ~state_product(); 00054 00055 state* 00056 left() const 00057 { 00058 return left_; 00059 } 00060 00061 state* 00062 right() const 00063 { 00064 return right_; 00065 } 00066 00067 virtual int compare(const state* other) const; 00068 virtual size_t hash() const; 00069 virtual state_product* clone() const; 00070 00071 private: 00072 state* left_; 00073 state* right_; 00074 }; 00075 00076 00078 class tgba_succ_iterator_product: public tgba_succ_iterator 00079 { 00080 public: 00081 tgba_succ_iterator_product(tgba_succ_iterator* left, 00082 tgba_succ_iterator* right, 00083 bdd left_neg, bdd right_neg); 00084 00085 virtual ~tgba_succ_iterator_product(); 00086 00087 // iteration 00088 void first(); 00089 void next(); 00090 bool done() const; 00091 00092 // inspection 00093 state_product* current_state() const; 00094 bdd current_condition() const; 00095 bdd current_acceptance_conditions() const; 00096 00097 private: 00099 00100 void step_(); 00101 void next_non_false_(); 00103 00104 protected: 00105 tgba_succ_iterator* left_; 00106 tgba_succ_iterator* right_; 00107 bdd current_cond_; 00108 bdd left_neg_; 00109 bdd right_neg_; 00110 friend class tgba_product; 00111 }; 00112 00114 class tgba_product: public tgba 00115 { 00116 public: 00121 tgba_product(const tgba* left, const tgba* right); 00122 00123 virtual ~tgba_product(); 00124 00125 virtual state* get_init_state() const; 00126 00127 virtual tgba_succ_iterator_product* 00128 succ_iter(const state* local_state, 00129 const state* global_state = 0, 00130 const tgba* global_automaton = 0) const; 00131 00132 virtual bdd_dict* get_dict() const; 00133 00134 virtual std::string format_state(const state* state) const; 00135 00136 virtual std::string 00137 transition_annotation(const tgba_succ_iterator* t) const; 00138 00139 virtual state* project_state(const state* s, const tgba* t) const; 00140 00141 virtual bdd all_acceptance_conditions() const; 00142 virtual bdd neg_acceptance_conditions() const; 00143 00144 protected: 00145 virtual bdd compute_support_conditions(const state* state) const; 00146 virtual bdd compute_support_variables(const state* state) const; 00147 00148 private: 00149 bdd_dict* dict_; 00150 const tgba* left_; 00151 const tgba* right_; 00152 bdd left_acc_complement_; 00153 bdd right_acc_complement_; 00154 bdd all_acceptance_conditions_; 00155 bdd neg_acceptance_conditions_; 00156 // Disallow copy. 00157 tgba_product(const tgba_product&); 00158 tgba_product& tgba_product::operator=(const tgba_product&); 00159 }; 00160 00161 } 00162 00163 #endif // SPOT_TGBA_TGBAPRODUCT_HH