tgba: move boolean properties from tgba_digraph to tgba
* src/tgba/tgbagraph.hh: Remove the set_bprop/get_bprop interface. * src/tgba/tgba.cc, src/tgba/tgba.hh: Add a new interface for setting/querying/copying the following properties: single_acc_set, state_based_acc, inherently_weak, deterministic. * src/dstarparse/dra2ba.cc, src/dstarparse/nra2nba.cc, src/neverparse/neverclaimparse.yy, src/saba/sabacomplementtgba.cc, src/tgba/tgbagraph.cc, src/tgbaalgos/degen.cc, src/tgbaalgos/dotty.cc, src/tgbaalgos/isdet.cc, src/tgbaalgos/lbtt.cc, src/tgbaalgos/minimize.cc, src/tgbaalgos/neverclaim.cc, src/tgbaalgos/postproc.cc, src/tgbaalgos/sccfilter.cc, src/tgbaalgos/simulation.cc, src/tgbatest/degenlskip.test, src/tgbatest/ltl2tgba.cc: Adjust to the new interface, or use it to bypass some useless work.
This commit is contained in:
parent
e3b5119f25
commit
b43f75e917
19 changed files with 160 additions and 87 deletions
|
|
@ -29,6 +29,7 @@ namespace spot
|
|||
last_support_conditions_input_(0),
|
||||
num_acc_(-1)
|
||||
{
|
||||
props = 0U;
|
||||
}
|
||||
|
||||
tgba::~tgba()
|
||||
|
|
|
|||
|
|
@ -251,6 +251,89 @@ namespace spot
|
|||
private:
|
||||
mutable bdd last_support_conditions_output_;
|
||||
mutable int num_acc_;
|
||||
|
||||
protected:
|
||||
|
||||
// Boolean properties. Beware: true means that the property
|
||||
// holds, but false means the property is unknown.
|
||||
struct bprop
|
||||
{
|
||||
bool single_acc_set:1; // A single acceptance set.
|
||||
bool state_based_acc:1; // State-based acceptance.
|
||||
bool inherently_weak:1; // Weak automaton.
|
||||
bool deterministic:1; // Deterministic automaton.
|
||||
};
|
||||
union
|
||||
{
|
||||
unsigned props;
|
||||
bprop is;
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
bool has_single_acc_set() const
|
||||
{
|
||||
return is.single_acc_set;
|
||||
}
|
||||
|
||||
void prop_single_acc_set(bool val = true)
|
||||
{
|
||||
is.single_acc_set = val;
|
||||
}
|
||||
|
||||
bool has_state_based_acc() const
|
||||
{
|
||||
return is.state_based_acc;
|
||||
}
|
||||
|
||||
void prop_state_based_acc(bool val = true)
|
||||
{
|
||||
is.state_based_acc = val;
|
||||
}
|
||||
|
||||
bool is_sba() const
|
||||
{
|
||||
return has_state_based_acc() && has_single_acc_set();
|
||||
}
|
||||
|
||||
bool is_inherently_weak() const
|
||||
{
|
||||
return is.inherently_weak;
|
||||
}
|
||||
|
||||
void prop_inherently_weak(bool val = true)
|
||||
{
|
||||
is.inherently_weak = val;
|
||||
}
|
||||
|
||||
bool is_deterministic() const
|
||||
{
|
||||
return is.deterministic;
|
||||
}
|
||||
|
||||
void prop_deterministic(bool val = true)
|
||||
{
|
||||
is.deterministic = val;
|
||||
}
|
||||
|
||||
// This is no default value here on purpose. This way any time we
|
||||
// add a new property we cannot to update every call to prop_copy().
|
||||
void prop_copy(const const_tgba_ptr& other,
|
||||
bool state_based,
|
||||
bool single_acc,
|
||||
bool inherently_weak,
|
||||
bool deterministic)
|
||||
{
|
||||
if (state_based)
|
||||
prop_state_based_acc(other->has_state_based_acc());
|
||||
if (single_acc)
|
||||
prop_single_acc_set(other->has_single_acc_set());
|
||||
if (inherently_weak)
|
||||
prop_inherently_weak(other->is_inherently_weak());
|
||||
if (deterministic)
|
||||
prop_deterministic(other->is_deterministic());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/// \addtogroup tgba_representation TGBA representations
|
||||
|
|
|
|||
|
|
@ -39,10 +39,7 @@ namespace spot
|
|||
all_acceptance_conditions_ =
|
||||
compute_all_acceptance_conditions(neg_acceptance_conditions_);
|
||||
|
||||
if (number_of_acceptance_conditions() == 1)
|
||||
set_bprop(tgba_digraph::SingleAccSet);
|
||||
else
|
||||
clear_bprop(tgba_digraph::SingleAccSet);
|
||||
prop_single_acc_set(number_of_acceptance_conditions() == 1);
|
||||
}
|
||||
|
||||
bdd tgba_digraph::set_single_acceptance_set()
|
||||
|
|
@ -50,7 +47,8 @@ namespace spot
|
|||
if (all_acceptance_conditions_ != bddfalse)
|
||||
dict_->unregister_all_typed_variables(bdd_dict::acc, this);
|
||||
|
||||
set_bprop(tgba_digraph::SingleAccSet);
|
||||
prop_single_acc_set();
|
||||
|
||||
int accvar =
|
||||
dict_->register_acceptance_variable(ltl::constant::true_instance(),
|
||||
this);
|
||||
|
|
|
|||
|
|
@ -390,34 +390,9 @@ namespace spot
|
|||
/// extremities and acceptance.
|
||||
void merge_transitions();
|
||||
|
||||
protected:
|
||||
unsigned bprops_ = 0;
|
||||
|
||||
public:
|
||||
enum bprop {
|
||||
StateBasedAcc = 1,
|
||||
SingleAccSet = 2,
|
||||
SBA = StateBasedAcc | SingleAccSet,
|
||||
};
|
||||
|
||||
bool get_bprop(bprop p) const
|
||||
{
|
||||
return (bprops_ & p) == p;
|
||||
}
|
||||
|
||||
void set_bprop(bprop p)
|
||||
{
|
||||
bprops_ |= p;
|
||||
}
|
||||
|
||||
void clear_bprop(bprop p)
|
||||
{
|
||||
bprops_ &= ~p;
|
||||
}
|
||||
|
||||
bool state_is_accepting(unsigned s) const
|
||||
{
|
||||
assert(get_bprop(StateBasedAcc));
|
||||
assert(has_state_based_acc());
|
||||
for (auto& t: g_.out(s))
|
||||
// Stop at the first transition, since the remaining should be
|
||||
// labeled identically.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue