20 #include "SheafSystem/poset_slicer.h" 21 #include "SheafSystem/assert_contract.h" 22 #include "SheafSystem/poset.h" 23 #include "SheafSystem/subposet.h" 24 #include "SheafSystem/subposet_member_iterator.h" 25 #include "SheafSystem/total_poset_member.h" 47 layer_contains_member(
const abstract_poset_member* xmbr)
54 slice_contains_member(abstract_poset_member* xmbr)
61 insert_member(abstract_poset_member* xmbr)
136 find_pa(xanchor, xlayer, xdown, result, xmode);
142 ensure(unexecutable(result is intersection(xmode members of xdown
set 143 of xanchor, xlayer)));
167 _select_only_shallowest = only_shallowest();
168 _select_only_deepest = only_deepest();
169 _depth_below_shallowest = -1;
170 _height_above_deepest = -1;
183 ensure(unexecutable(result is xmode members of
union(intersection(xdown
set 184 of xanchor, xlayer), old result)));
207 find_pa(xanchor, xlayer, xdown, result, xmode);
213 ensure(unexecutable(result is intersection(xmode memberss of xdown
set 214 of xanchor, xlayer)));
240 _select_only_shallowest = only_shallowest();
241 _select_only_deepest = only_deepest();
242 _depth_below_shallowest = -1;
243 _height_above_deepest = -1;
275 ensure(unexecutable(result is xmode members of
union(intersection(xdown
set 276 of xanchor, xlayer), old result) ));
304 ensure(unexecutable(result is xmode jims of xanchor));
327 find_pa(xanchor, jims,
true, result, xmode);
332 ensure(unexecutable(result is xmode members of
union(jims of xanchor, old result)));
359 ensure(unexecutable(result is xmode jims of xanchor));
385 _select_only_shallowest = only_shallowest();
386 _select_only_deepest = only_deepest();
387 _depth_below_shallowest = -1;
388 _height_above_deepest = -1;
421 ensure(unexecutable(result is xmode members of
union(jims of xanchor, old result)));
449 ensure(unexecutable(result is xmode members of down
set 470 find_pa(xanchor, 0,
true, result, xmode);
475 ensure(unexecutable(result is
union(xmode members of down
set 476 of xanchor, old result)));
504 ensure(unexecutable(result is xmode members of up
set 526 find_pa(xanchor, 0,
false, result, xmode);
531 ensure(unexecutable(result is xmode members of
union(up
set 532 of xanchor, old result)));
559 ensure(unexecutable(result is xmode members of down
set 581 vertical_set_pa(xanchor, result, xmode,
true);
586 ensure(unexecutable(result is xmode members of
union(down
set 587 of xanchor, old result)));
614 ensure(unexecutable(result is xmode members of up
set 636 vertical_set_pa(xanchor, result, xmode,
false);
641 ensure(unexecutable(result is xmode members of
union(up
set 642 of xanchor, old result)));
651 sheaf::poset_slicer::
666 _select_only_shallowest = only_shallowest();
667 _select_only_deepest = only_deepest();
668 _depth_below_shallowest = -1;
669 _height_above_deepest = -1;
701 ensure(unexecutable(result is xmode members of
union(xdown
set 702 of xanchor, old result)));
710 sheaf::poset_slicer::
725 if(_depth_below_shallowest >= 0)
726 _depth_below_shallowest++;
730 _height_above_deepest = -1;
734 if( ( (_mode == ALL) || (_select_only_shallowest && ( _depth_below_shallowest < 0)) ) &&
735 layer_contains_member(xmbr) )
744 _depth_below_shallowest = 0;
756 sheaf::poset_slicer::
768 if( (_select_only_shallowest && (_depth_below_shallowest >= 0)) && slice_contains_member(linked_mbr))
772 else if( (_select_only_deepest && (_height_above_deepest < 0)) && slice_contains_member(linked_mbr))
774 _height_above_deepest = 1;
786 sheaf::poset_slicer::
796 if(_depth_below_shallowest >= 0)
797 _depth_below_shallowest--;
801 if(_height_above_deepest >= 0)
802 _height_above_deepest++;
806 if(_select_only_deepest && (_height_above_deepest < 0) && layer_contains_member(xmbr) )
815 _height_above_deepest = 0;
837 require(
host()->contains_members(xanchor));
846 _select_only_shallowest = only_shallowest();
847 _select_only_deepest = only_deepest();
848 _depth_below_shallowest = -1;
849 _height_above_deepest = -1;
862 for(
int i=0; i < xanchor.
ct(); i++)
884 ensure(unexecutable(result is xmode members of
union(intersection(xdown
set 885 of xanchor, xlayer), old result) ));
void find_pa(abstract_poset_member *xanchor, subposet *xlayer, bool xdown, subposet *result, slice_mode xmode=ALL)
Finds the intersection of the down set (up set) of xanchor with xlayer if xdown (!xdown), pre-allocated.
poset_state_handle * host() const
The poset which this is a handle to a component of.
A client handle for a subposet.
subposet * up_set(abstract_poset_member *xanchor, slice_mode xmode=ALL)
find the up set of the poset member xanchor, auto-allocated
virtual bool invariant() const
Class invariant.
size_type ct() const
The number of items currently in use.
bool has_been_visited(const abstract_poset_member *xmbr) const
True if xmbr has been previously visited.
subposet_member_iterator * member_iterator() const
An iterator for members of this poset; handle version.
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.
virtual bool invariant() const
Class invariant.
virtual bool contains_member(pod_index_type xmbr_hub_id) const
True if this poset contains poset member with hub id xmbr_hub_id.
bool is_same_state(const poset_state_handle *xhost, pod_index_type xhub_id) const
True is this is attached to state with hub id xhub_id in host xhost.
void mark_members_not_visited()
Sets the visited markers false for all members.
poset_slicer(const poset_state_handle *xhost)
Constructor.
subposet * find_jims(abstract_poset_member *xanchor, slice_mode xmode=ALL)
Find jims in the down set of the poset member xanchor, auto-allocated.
void find_jims_pa(abstract_poset_member *xanchor, subposet *result, slice_mode xmode=ALL)
Find jims in the down set of the poset member xanchor, pre-allocated.
subposet * down_set(abstract_poset_member *xanchor, slice_mode xmode=ALL)
find the down set of the poset member xanchor, auto-allocated
bool has_same_host(const poset_component *other) const
True if other is not void and is attached to the same host as this.
void up_set_pa(abstract_poset_member *xanchor, subposet *result, slice_mode xmode=ALL)
find the up set of the poset member xanchor, pre-allocated
virtual bool is_attached() const
True if this handle is attached to a non-void state.
virtual void insert_member(pod_index_type xmbr_hub_id)
Inserts the member of host() with hub id xmbr_hub_id.
abstract_poset_member * _anchor
The member which is the starting point of this traversal.
virtual void next()=0
Makes this the next member of the subset.
void down_set_pa(abstract_poset_member *xanchor, subposet *result, slice_mode xmode=ALL)
find the down set of the poset member xanchor, pre-allocated
virtual bool is_done() const =0
True if iteration finished.
~poset_slicer()
Destructor.
virtual void detach_from_state()
Detach this handle from its state, if any.
slice_mode
Include only maximal, minimal, or all members in slice.
poset_state_handle * host()
The poset being traversed (mutable version).
virtual void remove_member(pod_index_type xmbr_hub_id)
Removes the member of host() with hub id xmbr_hub_id.
virtual subposet & jims()
The subset of all jims (mutable version)
poset_state_handle * _host
The poset being traversed.
bool is_same_state(const poset_state_handle *xother) const
True if this is attached to the same state as xother.
void attach_to_state(const namespace_poset *xns, const poset_path &xpath, bool xauto_access=true)
Attach to the state specified by path xpath in the namespace xns.
An abstract client handle for a member of a poset.
subposet * find(abstract_poset_member *xanchor, subposet *xlayer, bool xdown, slice_mode xmode=ALL)
Finds the intersection of the down set (up set) of xanchor with xlayer if xdown (!xdown), auto-allocated.
Abstract traverser (internal iterator) for poset which traverses the cover relation graph in depth fi...
A client handle for an unrestricted member of a poset. A total_poset_member is guaranteed not to be r...