tgba.cc 2.7 KB
Newer Older
1
2
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2014 Laboratoire de Recherche et Developpement de
3
// l'EPITA (LRDE).
4
// Copyright (C) 2003, 2004, 2005  Laboratoire d'Informatique de Paris 6 (LIP6),
5
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
6
7
8
9
10
11
// et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
12
// the Free Software Foundation; either version 3 of the License, or
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
13
14
15
16
17
18
19
20
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
21
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
22

23
24
25
26
27
#include "tgba.hh"

namespace spot
{
  tgba::tgba()
28
29
    : iter_cache_(nullptr),
      last_support_conditions_input_(0),
30
31
      last_support_variables_input_(0),
      num_acc_(-1)
32
33
  {
  }
34

35
36
  tgba::~tgba()
  {
37
38
39
40
    if (last_support_conditions_input_)
      last_support_conditions_input_->destroy();
    if (last_support_variables_input_)
      last_support_variables_input_->destroy();
41
    delete iter_cache_;
42
  }
43
44

  bdd
45
46
  tgba::support_conditions(const state* state) const
  {
47
    if (!last_support_conditions_input_
48
49
	|| last_support_conditions_input_->compare(state) != 0)
      {
50
	last_support_conditions_output_ = compute_support_conditions(state);
51
52
	if (last_support_conditions_input_)
	  last_support_conditions_input_->destroy();
53
54
55
56
57
58
59
60
	last_support_conditions_input_ = state->clone();
      }
    return last_support_conditions_output_;
  }

  bdd
  tgba::support_variables(const state* state) const
  {
61
    if (!last_support_variables_input_
62
63
	|| last_support_variables_input_->compare(state) != 0)
      {
64
	last_support_variables_output_ = compute_support_variables(state);
65
66
	if (last_support_variables_input_)
	  last_support_variables_input_->destroy();
67
68
69
70
71
	last_support_variables_input_ = state->clone();
      }
    return last_support_variables_output_;
  }

72
73
74
75
76
77
78
79
  state*
  tgba::project_state(const state* s, const tgba* t) const
  {
    if (t == this)
      return s->clone();
    return 0;
  }

80
81
82
83
84
85
  std::string
  tgba::transition_annotation(const tgba_succ_iterator*) const
  {
    return "";
  }

86
  unsigned int
87
88
89
90
91
  tgba::number_of_acceptance_conditions() const
  {
    if (num_acc_ < 0)
      {
	bdd all = all_acceptance_conditions();
92
	unsigned int n = 0;
93
94
95
96
97
98
99
100
101
102
	while (all != bddfalse)
	  {
	    ++n;
	    all -= bdd_satone(all);
	  }
	num_acc_ = n;
      }
    return num_acc_;
  }

103
}