20 #ifndef POSET_TRAVERSER_H 21 #include "SheafSystem/poset_traverser.h" 24 #include "SheafSystem/assert_contract.h" 27 #include "SheafSystem/poset.h" 30 #ifndef POSET_MEMBER_H 31 #include "SheafSystem/total_poset_member.h" 34 #ifndef POSET_MEMBER_ITERATOR_H 35 #include "SheafSystem/poset_member_iterator.h" 39 #include "SheafSystem/zn_to_bool.h" 49 result = result && (
_host != 0);
75 result = (other != 0) && (other->
host() ==
host());
79 ensure(result == ( (other != 0) && (other->
host() ==
host()) ));
221 bool result = (*_visited)[xmbr->
index().
pod()];
262 ensure(result == unexecutable(no member is marked visited));
283 while(result && !itr.
is_done())
285 result = result && (*_visited)[itr.
index().
pod()];
293 ensure(unexecutable(result
if and only
if every member is marked visited))
bool no_members_visited() const
True if no members have been visited.
poset_state_handle * host() const
The poset which this is a handle to a component of.
virtual bool invariant() const
Class invariant.
const pod_type & pod() const
The "plain old data" storage of this; the value in the external id space.
bool has_been_visited(const abstract_poset_member *xmbr) const
True if xmbr has been previously visited.
void make_false_sa()
Constant function false, self-allocated. Note on terminology: "false" is a keyword, so this function can not be just "false"
zn_to_bool * _visited
The markers for previously visited members.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
bool _in_down_set
True if traversing down from anchor().
void traverse(const abstract_poset_member *xanchor, bool down, bool reset_markers=true)
Traverse the down set (down == true) or up set (down == false) of xanchor. If reset_markers, reset all visited markers to false before begining.
A client handle for a general, abstract partially order set.
const scoped_index & index() const
The current item in the subset.
virtual abstract_poset_member * anchor()
The member which is the starting point of this traversal (mutable verison).
virtual void private_traverse()=0
Implements the traversal.
int ub() const
The upper bound for the domain index.
void mark_members_not_visited()
Sets the visited markers false for all members.
Features shared by poset_member and subposet. Subposet and poset_member objects can be attached...
const scoped_index & index() const
The index of the component state this handle is attached to.
~poset_traverser()
Destructor.
void ensure_visited_ub()
Ensures the visited bit vector is large enough.
void next()
Makes item the next member of the subset.
A map from Zn (the integers mod n) to bools. A characteristic function used to represent subsets of Z...
bool has_same_host(const poset_component *other) const
True if other is not void and is attached to the same host as this.
An index within the external ("client") scope of a given id space.
virtual bool is_attached() const
True if this handle is attached to a non-void state.
poset_traverser(const poset_state_handle *xanchor)
Constructor.
abstract_poset_member * _anchor
The member which is the starting point of this traversal.
bool all_members_visited() const
True if all members have been visited.
Iterates over the subset of Zn defined by the characteristic function host().
void mark_visited(const abstract_poset_member *xmbr)
Sets the visited marker true for xmbr.
poset_state_handle * host()
The poset being traversed (mutable version).
bool is_false() const
True if function is false evrywhere on domain.
virtual scoped_index member_index_ub() const
The upper bound on the member_index;.
bool is_done() const
True if iteration finished.
poset_state_handle * _host
The poset being traversed.
scoped_index member_index_ub() const
The upper bound on the member index.
An abstract client handle for a member of a poset.
index_iterator member_iterator() const
void force(int i, bool value)
Sets the i-th member to value, extends the upper bound if necessary.