Commit db4693b3 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

Downcase a couple of misnamed class names.

* src/misc/acccompl.hh, src/misc/acccompl.cc (AccCompl): Rename to
acc_compl.
* src/tgbaalgos/simulation.cc (AccComplAutomaton, Simulation): Rename
to acc_compl_automaton and direct_simulation.  At the same time,
reindent the whole file.
* src/sanity/style.test: Detect capitalized class names.
* src/kripke/kripkeexplicit.hh (KripkePrint): Remove useless
predeclaration.
* src/tgbaalgos/simulation.hh: Typo in comment.
parent dadfbdad
// Copyright (C) 2011 Laboratoire de Recherche et Developpement
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
......@@ -29,10 +30,7 @@
namespace spot
{
// Define in kripkeprint.hh
class KripkeVisitor;
/// \brief Concrete class for kripke states.
/// \brief Concrete class for kripke states.
class state_kripke : public state
{
friend class kripke_explicit;
......
......@@ -34,7 +34,7 @@ namespace spot
// we need to know wich one is go to one when true. So we are looping
// through the conditions until bdd_high is true.
// Once found, we keep only it.
bdd AccCompl::complement(const bdd acc)
bdd acc_compl::complement(const bdd acc)
{
bdd_cache_t::const_iterator it = cache_.find(acc);
if (it != cache_.end())
......@@ -70,7 +70,7 @@ namespace spot
}
bdd AccCompl::reverse_complement(const bdd acc)
bdd acc_compl::reverse_complement(const bdd acc)
{
// We are sure that if we have no acceptance condition
// the result is all_.
......
......@@ -30,14 +30,14 @@
namespace spot
{
/// \brief Help class to convert a bdd of an automaton into
/// its complement.
/// This is used when you need to complement all the acceptance
/// conditions in an automaton. For example in the simulation.
class AccCompl
/// \brief Helper class to convert acceptance conditions into promises
///
/// A set of acceptance conditions represented by the sum "à la Spot",
/// is converted into a product of promises.
class acc_compl
{
public:
AccCompl(bdd all, bdd neg)
acc_compl(bdd all, bdd neg)
: all_(all),
neg_(neg)
{
......
......@@ -67,6 +67,9 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do
case $file in
*.test);;
*)
grep -E '[^<]class[ \t]+[A-Z]' $tmp &&
diag 'Use lower case class names.'
grep '[ ]if(' $tmp &&
diag 'Missing space after "if"'
......
......@@ -60,7 +60,7 @@
// state. This function is `update_sig'.
// - Enter in a double loop to adapt the partial order, and set
// 'relation_' accordingly. This function is `update_po'.
// 3. Rename the class (to actualize the name in the previous_it_class and
// 3. Rename the class (to actualize the name in the previous_class and
// in relation_).
// 4. Building an automaton with the result, with the condition:
// "a transition in the original automaton appears in the simulated one
......@@ -101,11 +101,11 @@ namespace spot
// This class takes an automaton and creates a copy with all
// acceptance conditions complemented.
class AccComplAutomaton:
class acc_compl_automaton:
public tgba_reachable_iterator_depth_first
{
public:
AccComplAutomaton(const tgba* a)
acc_compl_automaton(const tgba* a)
: tgba_reachable_iterator_depth_first(a),
size(0),
out_(new tgba_explicit_number(a->get_dict())),
......@@ -124,7 +124,7 @@ namespace spot
if (state2int.find(s) == state2int.end())
{
state2int[s] = ++current_max;
previous_it_class_[out_->add_state(current_max)] = bddfalse;
previous_class_[out_->add_state(current_max)] = bddfalse;
}
return state2int[s];
......@@ -155,7 +155,7 @@ namespace spot
++size;
}
~AccComplAutomaton()
~acc_compl_automaton()
{
init_->destroy();
}
......@@ -163,28 +163,28 @@ namespace spot
public:
size_t size;
tgba_explicit_number* out_;
map_state_bdd previous_it_class_;
map_state_bdd previous_class_;
private:
const tgba* ea_;
AccCompl ac_;
acc_compl ac_;
map_state_unsigned state2int;
unsigned current_max;
state* init_;
};
class Simulation
class direct_simulation
{
// Shortcut used in update_po and go_to_next_it.
typedef std::map<bdd, bdd, bdd_less_than> map_bdd_bdd;
public:
Simulation(const tgba* t)
direct_simulation(const tgba* t)
: a_(0),
po_size_(0),
all_class_var_(bddtrue)
{
AccComplAutomaton
acc_compl_automaton
acc_compl(t);
// We'll start our work by replacing all the acceptance
......@@ -195,7 +195,7 @@ namespace spot
// We use the previous run to know the size of the
// automaton, and to class all the reachable states in the
// map previous_it_class_.
// map previous_class_.
size_a_ = acc_compl.size;
// Now, we have to get the bdd which will represent the
......@@ -211,15 +211,15 @@ namespace spot
used_var_.push_back(init);
all_class_var_ = init;
// We fetch the result the run of AccComplAutomaton which
// We fetch the result the run of acc_compl_automaton which
// has recorded all the state in a hash table, and we set all
// to init.
for (map_state_bdd::iterator it
= acc_compl.previous_it_class_.begin();
it != acc_compl.previous_it_class_.end();
= acc_compl.previous_class_.begin();
it != acc_compl.previous_class_.end();
++it)
{
previous_it_class_[it->first] = init;
previous_class_[it->first] = init;
}
// Put all the anonymous variable in a queue, and record all
......@@ -239,19 +239,19 @@ namespace spot
// Reverse all the acceptance condition at the destruction of
// this object, because it occurs after the return of the
// function simulation.
~Simulation()
~direct_simulation()
{
delete a_;
}
// We update the name of the class.
void update_previous_it_class()
void update_previous_class()
{
std::list<bdd>::iterator it_bdd = used_var_.begin();
// We run through the map bdd/list<state>, and we update
// the previous_it_class_ with the new data.
// the previous_class_ with the new data.
it_bdd = used_var_.begin();
for (map_bdd_lstate::iterator it = bdd_lstate_.begin();
it != bdd_lstate_.end();
......@@ -268,9 +268,9 @@ namespace spot
// by removing a transition which has as a destination a
// state with no outgoing transition.
if (it->first == bddfalse)
previous_it_class_[*it_s] = bddfalse;
previous_class_[*it_s] = bddfalse;
else
previous_it_class_[*it_s] = *it_bdd;
previous_class_[*it_s] = *it_bdd;
}
++it_bdd;
}
......@@ -284,7 +284,7 @@ namespace spot
while (nb_partition_before != bdd_lstate_.size()
|| nb_po_before != po_size_)
{
update_previous_it_class();
update_previous_class();
nb_partition_before = bdd_lstate_.size();
bdd_lstate_.clear();
nb_po_before = po_size_;
......@@ -293,7 +293,7 @@ namespace spot
go_to_next_it();
}
update_previous_it_class();
update_previous_class();
return build_result();
}
......@@ -312,7 +312,7 @@ namespace spot
// the label of the transition and the class of the
// destination and all the class it implies.
bdd to_add = acc & sit->current_condition()
& relation_[previous_it_class_[dst]];
& relation_[previous_class_[dst]];
res |= to_add;
dst->destroy();
......@@ -325,16 +325,16 @@ namespace spot
void update_sig()
{
// At this time, current_class_ must be empty. It implies
// that the "previous_it_class_ = current_class_" must be
// that the "previous_class_ = current_class_" must be
// done before.
assert(current_class_.empty());
// Here we suppose that previous_it_class_ always contains
// Here we suppose that previous_class_ always contains
// all the reachable states of this automaton. We do not
// have to make (again) a traversal. We just have to run
// through this map.
for (map_state_bdd::iterator it = previous_it_class_.begin();
it != previous_it_class_.end();
for (map_state_bdd::iterator it = previous_class_.begin();
it != previous_class_.end();
++it)
{
const state* src = it->first;
......@@ -388,7 +388,7 @@ namespace spot
update_po(now_to_next);
}
// This function computes the new po with previous_it_class_
// This function computes the new po with previous_class_
// and the argument. `now_to_next' contains the relation
// between the signature and the future name of the class.
void update_po(const map_bdd_bdd& now_to_next)
......@@ -445,7 +445,7 @@ namespace spot
// transition. We *must* keep the complemented because it
// is easy to know if an acceptance condition is maximal or
// not.
AccCompl reverser(all_acceptance_conditions,
acc_compl reverser(all_acceptance_conditions,
a_->neg_acceptance_conditions());
typedef tgba_explicit_number::transition trs;
......@@ -463,7 +463,7 @@ namespace spot
it != bdd_lstate_.end(); ++it)
{
res->add_state(++current_max);
bdd part = previous_it_class_[*it->second.begin()];
bdd part = previous_class_[*it->second.begin()];
// The difference between the two next lines is:
// the first says "if you see A", the second "if you
......@@ -523,21 +523,23 @@ namespace spot
bdd acc = bdd_existcomp(cond_acc_dest, sup_all_acc);
// Keep the other !
bdd cond = bdd_existcomp(cond_acc_dest, sup_all_atomic_prop);
bdd cond = bdd_existcomp(cond_acc_dest,
sup_all_atomic_prop);
// Because we have complemented all the acceptance condition
// on the input automaton, we must re invert them to create
// a new transition.
// Because we have complemented all the acceptance
// condition on the input automaton, we must re
// invert them to create a new transition.
acc = reverser.reverse_complement(acc);
// Take the id of the source and destination.
// To know the source, we must take a random state in the
// list which is in the class we currently work on.
int src = bdd2state[previous_it_class_[*it->second.begin()]];
// Take the id of the source and destination. To
// know the source, we must take a random state in
// the list which is in the class we currently
// work on.
int src = bdd2state[previous_class_[*it->second.begin()]];
int dst = bdd2state[dest];
// src or dst == 0 means "dest" or "prev..." isn't in the map.
// so it is a bug.
// src or dst == 0 means "dest" or "prev..." isn't
// in the map. so it is a bug.
assert(src != 0);
assert(dst != 0);
......@@ -551,7 +553,7 @@ namespace spot
}
}
res->set_init_state(bdd2state[previous_it_class_
res->set_init_state(bdd2state[previous_class_
[a_->get_init_state()]]);
res->merge_transitions();
return res;
......@@ -583,8 +585,8 @@ namespace spot
std::cerr << "\nPrevious iteration\n" << std::endl;
for (map_state_bdd::const_iterator it = previous_it_class_.begin();
it != previous_it_class_.end();
for (map_state_bdd::const_iterator it = previous_class_.begin();
it != previous_class_.end();
++it)
{
std::cerr << a_->format_state(it->first)
......@@ -607,7 +609,7 @@ namespace spot
map_bdd_bdd relation_;
// Represent the class of each state at the previous iteration.
map_state_bdd previous_it_class_;
map_state_bdd previous_class_;
// The class at the current iteration.
map_state_bdd current_class_;
......@@ -638,7 +640,7 @@ namespace spot
tgba*
simulation(const tgba* t)
{
Simulation simul(t);
direct_simulation simul(t);
return simul.run();
}
......
......@@ -35,7 +35,7 @@ namespace spot
/// When the language recognized by one state is included in the
/// language recognized by an another one, the first one is merged
/// with the second. The algorithm is based on the following
/// paper, but generalized to handled TGBA directly.
/// paper, but generalized to handle TGBA directly.
///
/// \verbatim
/// @InProceedings{ etessami.00.concur,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment