OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
antlr::BitSet Class Reference

A BitSet to replace java.util.BitSet. More...

#include <BitSet.hpp>

Public Member Functions

 BitSet (unsigned int nbits=64)
 
 BitSet (const unsigned long *bits_, unsigned int nlongs)
 
void add (unsigned int el)
 
bool member (unsigned int el) const
 
std ::vector< unsigned int > toArray () const
 

Detailed Description

A BitSet to replace java.util.BitSet.

Primary differences are that most set operators return new sets as opposed to oring and anding "in place". Further, a number of operations were added. I cannot contain a BitSet because there is no way to access the internal bits (which I need for speed) and, because it is final, I cannot subclass to add functionality. Consider defining set degree. Without access to the bits, I must call a method n times to test the ith bit...ack!

Also seems like or() from util is wrong when size of incoming set is bigger than this.length.

This is a C++ version of the Java class described above, with only a handful of the methods implemented, because we don't need the others at runtime. It's really just a wrapper around vector<bool>, which should probably be changed to a wrapper around bitset, once bitset is more widely available.

Author
Terence Parr, MageLang Institute

Pete Wells

Definition at line 40 of file BitSet.hpp.

Constructor & Destructor Documentation

◆ BitSet() [1/2]

antlr::BitSet::BitSet ( unsigned int nbits = 64)

Definition at line 14 of file BitSet.cpp.

◆ BitSet() [2/2]

antlr::BitSet::BitSet ( const unsigned long * bits_,
unsigned int nlongs )

Definition at line 21 of file BitSet.cpp.

◆ ~BitSet()

antlr::BitSet::~BitSet ( )

Definition at line 28 of file BitSet.cpp.

Member Function Documentation

◆ add()

void antlr::BitSet::add ( unsigned int el)

Definition at line 32 of file BitSet.cpp.

◆ member()

bool antlr::BitSet::member ( unsigned int el) const

Definition at line 40 of file BitSet.cpp.

◆ toArray()

std::vector< unsigned int > antlr::BitSet::toArray ( ) const

Definition at line 48 of file BitSet.cpp.


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