⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bitset.hpp

📁 Java写的词法/语法分析器。可生成JAVA语言或者是C++的词法和语法分析器。并可产生语法分析树和对该树进行遍历
💻 HPP
字号:
#ifndef INC_BitSet_hpp__#define INC_BitSet_hpp__#include "antlr/config.hpp"#include <vector>#include <sys/types.h>ANTLR_BEGIN_NAMESPACE(antlr)/**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 * @author <br><a href="mailto:pete@yamuna.demon.co.uk">Pete Wells</a> */class BitSet {private:	ANTLR_USE_NAMESPACE(std)vector<bool> storage;public:	BitSet(int nbits=64);	BitSet(const unsigned long* bits_,int nlongs);	~BitSet();	void add(int el);	bool member(int el) const;	ANTLR_USE_NAMESPACE(std)vector<int> toArray() const;};ANTLR_END_NAMESPACE#endif //INC_BitSet_hpp__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -