HElib  1.0
Implementing Homomorphic Encryption
 All Classes Files Functions Variables Friends Pages
Public Member Functions | Static Public Member Functions | List of all members
IndexSet Class Reference

A dynamic set of non-negative integers. More...

#include <IndexSet.h>

Public Member Functions

 IndexSet (long low, long high)
 
 IndexSet (long j)
 
long first () const
 Returns the first element, 0 if the set is empty.
 
long last () const
 Returns the last element, -1 if the set is empty.
 
long next (long j) const
 Returns the next element after j, if any; otherwise j+1.
 
long prev (long j) const
 
long card () const
 The cardinality of the set.
 
bool contains (long j) const
 Returns true iff the set contains j.
 
bool contains (const IndexSet &s) const
 Returns true iff the set contains s.
 
bool disjointFrom (const IndexSet &s) const
 Returns true iff the set is disjoint from s.
 
bool operator== (const IndexSet &s) const
 
bool operator!= (const IndexSet &s) const
 
void clear ()
 Set to the empty set.
 
void insert (long j)
 Add j to the set.
 
void remove (long j)
 Remove j from the set.
 
void insert (const IndexSet &s)
 Add s to the set (union)
 
void remove (const IndexSet &s)
 Remove s from the set (set minus)
 
void retain (const IndexSet &s)
 Retains only those elements that are also in s (intersection)
 

Static Public Member Functions

static const IndexSetemptySet ()
 Read-only access to an empty set.
 

Detailed Description

A dynamic set of non-negative integers.

You can iterate through a set as follows:

for (long i = s.first(); i <= s.last(); i = s.next(i)) ...
for (long i = s.last(); i >= s.first(); i = s.prev(i)) ...

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