SheafSystem  0.0.0.0
sheaf::int_set Class Reference

An STL set representation for a set of integers. More...

#include <int_set.h>

Inheritance diagram for sheaf::int_set:

Public Member Functions

 int_set ()
 Default constructor. More...
 
 int_set (const int_set &other)
 Copy constructor. More...
 
 int_set (const int *xmbrs, int xct)
 Constructs an instance with the xct members given in xmbrs. More...
 
 ~int_set ()
 Destructor. More...
 
void insert_member (int xmbr)
 Insert member with index xmbr; just for consistency with subposet. More...
 
void remove_member (int xmbr)
 Remove member with index xmbr; just for consistency with subposet. More...
 
void insert_members (const int *xmbrs, int xct)
 Insert the members with indices in xmbrs. More...
 
void insert_members (const subposet *xmbrs)
 Insert the members with indices in xmbrs. More...
 
bool contains (int xindex) const
 True if this set contains xindex Deprecated - use contains_member(int xindex) More...
 
bool contains_member (int xindex) const
 True if this set contains xindex True if this set contains xindex. More...
 
bool is_singleton () const
 True if set contains only a single member. More...
 
bool set_includes (const int_set *other, bool this_is_much_larger=false) const
 True if this cover set includes other; If this_is_much_larger then assume this cover set is much larger than other and use an other->size()*log(size()) algorithm rather than a other->size()+ size() algorithm. More...
 
int_setset_union (const int_set *other) const
 union of this with other, auto-allocated version. More...
 
void set_union_pa (const int_set *other, int_set *result) const
 union of this with other, pre-allocated version. More...
 
void set_union_sa (const int_set *other)
 union of this with other, self-allocated version. More...
 
int_setset_intersection (const int_set *other) const
 Intersection of this with other, auto-allocated version. More...
 
void set_intersection_pa (const int_set *other, int_set *result) const
 Intersection of this with other, pre-allocated version. More...
 
void set_intersection_sa (const int_set *other)
 Intersection of this with other, self-allocated version. More...
 
int_setset_difference (const int_set *other) const
 Difference of this and other (this minus other), auto-allocated version. If this_is_much_larger then assume this cover set is much larger than other and use an other->size()*log(size()) algorithm rather than a other->size()+ size() algorithm. More...
 
void set_difference_pa (const int_set *other, int_set *result) const
 Difference of this and other (this minus other), pre-allocated version. If this_is_much_larger then assume this cover set is much larger than other and use an other->size()*log(size()) algorithm rather than a other->size()+ size() algorithm. More...
 
void set_difference_sa (int_set *other, bool this_is_much_larger=false)
 Difference of this and other (this minus other), self-allocated version. If this_is_much_larger then assume this cover set is much larger than other and use an other->size()*log(size()) algorithm rather than a other->size()+ size() algorithm. More...
 
void print () const
 Prints membership to cout. Intended for debugging. More...
 

Detailed Description

An STL set representation for a set of integers.

Definition at line 47 of file int_set.h.

Constructor & Destructor Documentation

◆ int_set() [1/3]

sheaf::int_set::int_set ( )

Default constructor.

Definition at line 31 of file int_set.cc.

Referenced by int_set(), set_difference(), set_intersection(), and set_union().

◆ int_set() [2/3]

sheaf::int_set::int_set ( const int_set other)

Copy constructor.

Definition at line 47 of file int_set.cc.

References int_set().

◆ int_set() [3/3]

sheaf::int_set::int_set ( const int *  xmbrs,
int  xct 
)

Constructs an instance with the xct members given in xmbrs.

Precondition
  • xmbrs != 0
  • xct > 0
Postcondition
  • -unexecutable( "for all i in xmbrs: this find(i) != end()" )

Definition at line 64 of file int_set.cc.

References ~int_set().

◆ ~int_set()

sheaf::int_set::~int_set ( )

Destructor.

Definition at line 92 of file int_set.cc.

References insert_members().

Referenced by int_set().

Member Function Documentation

◆ contains()

bool sheaf::int_set::contains ( int  xindex) const
inline

True if this set contains xindex Deprecated - use contains_member(int xindex)

Definition at line 104 of file int_set.h.

Referenced by tool::visualization_iterator_1_1::next(), and tool::visualization_iterator_1_3::next().

◆ contains_member()

bool sheaf::int_set::contains_member ( int  xindex) const
inline

True if this set contains xindex True if this set contains xindex.

Definition at line 115 of file int_set.h.

◆ insert_member()

void sheaf::int_set::insert_member ( int  xmbr)
inline

Insert member with index xmbr; just for consistency with subposet.

Definition at line 75 of file int_set.h.

◆ insert_members() [1/2]

void sheaf::int_set::insert_members ( const int *  xmbrs,
int  xct 
)

Insert the members with indices in xmbrs.

Precondition
  • xmbrs != 0
  • xct > 0
Postcondition
  • -unexecutable( "for all i in xmbrs: this find(i) != end()" )

Definition at line 108 of file int_set.cc.

Referenced by ~int_set().

◆ insert_members() [2/2]

void sheaf::int_set::insert_members ( const subposet xmbrs)

Insert the members with indices in xmbrs.

Precondition
  • xmbrs != 0
Postcondition
  • -unexecutable( "for all i in xmbrs: this find(i) != end()" )

Definition at line 137 of file int_set.cc.

References sheaf::index_iterator::index(), sheaf::subposet::indexed_member_iterator(), sheaf::index_iterator::is_done(), is_singleton(), sheaf::index_iterator::next(), and sheaf::scoped_index::pod().

◆ is_singleton()

bool sheaf::int_set::is_singleton ( ) const

True if set contains only a single member.

Definition at line 169 of file int_set.cc.

References set_includes().

Referenced by insert_members().

◆ print()

void sheaf::int_set::print ( ) const

Prints membership to cout. Intended for debugging.

Definition at line 561 of file int_set.cc.

References sheaf::operator<<().

Referenced by set_difference_sa().

◆ remove_member()

void sheaf::int_set::remove_member ( int  xmbr)
inline

Remove member with index xmbr; just for consistency with subposet.

Definition at line 83 of file int_set.h.

◆ set_difference()

sheaf::int_set * sheaf::int_set::set_difference ( const int_set other) const

Difference of this and other (this minus other), auto-allocated version. If this_is_much_larger then assume this cover set is much larger than other and use an other->size()*log(size()) algorithm rather than a other->size()+ size() algorithm.

Precondition
  • other != 0
Postcondition
  • result != 0

Definition at line 439 of file int_set.cc.

References int_set(), and set_difference_pa().

Referenced by set_difference_pa(), and set_intersection_sa().

◆ set_difference_pa()

void sheaf::int_set::set_difference_pa ( const int_set other,
int_set result 
) const

Difference of this and other (this minus other), pre-allocated version. If this_is_much_larger then assume this cover set is much larger than other and use an other->size()*log(size()) algorithm rather than a other->size()+ size() algorithm.

Precondition
  • other != 0
  • result != 0

Definition at line 467 of file int_set.cc.

References set_difference(), and set_difference_sa().

Referenced by set_difference().

◆ set_difference_sa()

void sheaf::int_set::set_difference_sa ( int_set other,
bool  this_is_much_larger = false 
)

Difference of this and other (this minus other), self-allocated version. If this_is_much_larger then assume this cover set is much larger than other and use an other->size()*log(size()) algorithm rather than a other->size()+ size() algorithm.

Precondition
  • other != 0

Definition at line 490 of file int_set.cc.

References print().

Referenced by set_difference_pa().

◆ set_includes()

bool sheaf::int_set::set_includes ( const int_set other,
bool  this_is_much_larger = false 
) const

True if this cover set includes other; If this_is_much_larger then assume this cover set is much larger than other and use an other->size()*log(size()) algorithm rather than a other->size()+ size() algorithm.

Precondition
  • other != 0

Definition at line 201 of file int_set.cc.

References set_union().

Referenced by is_singleton().

◆ set_intersection()

sheaf::int_set * sheaf::int_set::set_intersection ( const int_set other) const

Intersection of this with other, auto-allocated version.

Precondition
  • other != 0
Postcondition
  • result != 0

Definition at line 329 of file int_set.cc.

References int_set(), and set_intersection_pa().

Referenced by set_intersection_pa(), and set_union_sa().

◆ set_intersection_pa()

void sheaf::int_set::set_intersection_pa ( const int_set other,
int_set result 
) const

Intersection of this with other, pre-allocated version.

Precondition
  • other != 0
  • result != 0

Definition at line 357 of file int_set.cc.

References set_intersection(), and set_intersection_sa().

Referenced by set_intersection().

◆ set_intersection_sa()

void sheaf::int_set::set_intersection_sa ( const int_set other)

Intersection of this with other, self-allocated version.

Precondition
  • other != 0

Definition at line 380 of file int_set.cc.

References set_difference().

Referenced by set_intersection_pa().

◆ set_union()

sheaf::int_set * sheaf::int_set::set_union ( const int_set other) const

union of this with other, auto-allocated version.

Precondition
  • other != 0
Postcondition
  • result != 0

Definition at line 246 of file int_set.cc.

References int_set(), and set_union_pa().

Referenced by set_includes(), and set_union_pa().

◆ set_union_pa()

void sheaf::int_set::set_union_pa ( const int_set other,
int_set result 
) const

union of this with other, pre-allocated version.

Precondition
  • other != 0
  • result != 0

Definition at line 274 of file int_set.cc.

References set_union(), and set_union_sa().

Referenced by set_union().

◆ set_union_sa()

void sheaf::int_set::set_union_sa ( const int_set other)

union of this with other, self-allocated version.

Precondition
  • other != 0

Definition at line 297 of file int_set.cc.

References set_intersection().

Referenced by set_union_pa().


The documentation for this class was generated from the following files: