A dynamic set of non-negative integers. More...
#include <IndexSet.h>
Classes | |
| class | iterator |
Public Member Functions | |
| IndexSet () | |
| IndexSet (long low, long high) | |
| IndexSet (long j) | |
| long | first () const |
| Returns the first element, 0 if the set is empty. More... | |
| long | last () const |
| Returns the last element, -1 if the set is empty. More... | |
| long | next (long j) const |
| Returns the next element after j, if any; otherwise j+1. More... | |
| long | prev (long j) const |
| long | card () const |
| The cardinality of the set. More... | |
| bool | contains (long j) const |
| Returns true iff the set contains j. More... | |
| bool | contains (const IndexSet &s) const |
| Returns true iff the set contains s. More... | |
| bool | disjointFrom (const IndexSet &s) const |
| Returns true iff the set is disjoint from s. More... | |
| bool | operator== (const IndexSet &s) const |
| bool | operator!= (const IndexSet &s) const |
| void | clear () |
| Set to the empty set. More... | |
| void | insert (long j) |
| Add j to the set. More... | |
| void | remove (long j) |
| Remove j from the set. More... | |
| void | insert (const IndexSet &s) |
| Add s to the set (union) More... | |
| void | remove (const IndexSet &s) |
| Remove s from the set (set minus) More... | |
| void | retain (const IndexSet &s) |
| Retains only those elements that are also in s (intersection) More... | |
| bool | isInterval () const |
| Is this set a contiguous interval? More... | |
| void | writeTo (std::ostream &str) const |
Write out the IndexSet object in binary format. More... | |
| void | writeToJSON (std::ostream &str) const |
Write out the IndexSet object to the output stream using JSON format. More... | |
| JsonWrapper | writeToJSON () const |
Write out the IndexSet object to a JsonWrapper. More... | |
| iterator | begin () const |
| iterator | end () const |
Static Public Member Functions | |
| static const IndexSet & | emptySet () |
| Read-only access to an empty set. More... | |
| static IndexSet | readFrom (std::istream &str) |
Read from the stream the serialized IndexSet object in binary format. More... | |
| static IndexSet | readFromJSON (std::istream &str) |
Read from the stream the serialized IndexSet object using JSON format. More... | |
| static IndexSet | readFromJSON (const JsonWrapper &j) |
Read from the JsonWrapper the serialized IndexSet object. More... | |
Detailed Description
A dynamic set of non-negative integers.
You can iterate through a set as follows:
Constructor & Destructor Documentation
◆ IndexSet() [1/3]
|
inline |
◆ IndexSet() [2/3]
|
inline |
◆ IndexSet() [3/3]
|
inlineexplicit |
Member Function Documentation
◆ begin()
|
inline |
◆ card()
|
inline |
The cardinality of the set.
◆ clear()
| void helib::IndexSet::clear | ( | ) |
Set to the empty set.
◆ contains() [1/2]
| bool helib::IndexSet::contains | ( | const IndexSet & | s | ) | const |
Returns true iff the set contains s.
◆ contains() [2/2]
| bool helib::IndexSet::contains | ( | long | j | ) | const |
Returns true iff the set contains j.
◆ disjointFrom()
| bool helib::IndexSet::disjointFrom | ( | const IndexSet & | s | ) | const |
Returns true iff the set is disjoint from s.
◆ emptySet()
|
static |
Read-only access to an empty set.
◆ end()
|
inline |
◆ first()
|
inline |
Returns the first element, 0 if the set is empty.
◆ insert() [1/2]
| void helib::IndexSet::insert | ( | const IndexSet & | s | ) |
Add s to the set (union)
◆ insert() [2/2]
| void helib::IndexSet::insert | ( | long | j | ) |
Add j to the set.
◆ isInterval()
|
inline |
Is this set a contiguous interval?
◆ last()
|
inline |
Returns the last element, -1 if the set is empty.
◆ next()
| long helib::IndexSet::next | ( | long | j | ) | const |
Returns the next element after j, if any; otherwise j+1.
◆ operator!=()
|
inline |
◆ operator==()
| bool helib::IndexSet::operator== | ( | const IndexSet & | s | ) | const |
◆ prev()
| long helib::IndexSet::prev | ( | long | j | ) | const |
◆ readFrom()
|
static |
◆ readFromJSON() [1/2]
|
static |
Read from the JsonWrapper the serialized IndexSet object.
- Parameters
-
j The JsonWrappercontaining the serializedIndexSetobject.
- Returns
- The deserialized
IndexSetobject.
◆ readFromJSON() [2/2]
|
static |
◆ remove() [1/2]
| void helib::IndexSet::remove | ( | const IndexSet & | s | ) |
Remove s from the set (set minus)
◆ remove() [2/2]
| void helib::IndexSet::remove | ( | long | j | ) |
Remove j from the set.
◆ retain()
| void helib::IndexSet::retain | ( | const IndexSet & | s | ) |
Retains only those elements that are also in s (intersection)
◆ writeTo()
| void helib::IndexSet::writeTo | ( | std::ostream & | str | ) | const |
Write out the IndexSet object in binary format.
- Parameters
-
str Output std::ostream.
◆ writeToJSON() [1/2]
| JsonWrapper helib::IndexSet::writeToJSON | ( | ) | const |
Write out the IndexSet object to a JsonWrapper.
- Returns
- The
JsonWrapper.
◆ writeToJSON() [2/2]
| void helib::IndexSet::writeToJSON | ( | std::ostream & | str | ) | const |
Write out the IndexSet object to the output stream using JSON format.
- Parameters
-
str Output std::ostream.
1.9.1