Enhanced C#
Language of your choice: library documentation
Properties | Public Member Functions | Protected fields | List of all members
Loyc.SymbolSet Class Reference

A set of symbols. More...


Source file:
Inheritance diagram for Loyc.SymbolSet:

Remarks

A set of symbols.

Stored with a small bloom filter, so that a membership test tends to be fast if the item tested is not in the set. Thus, it is useful when the items to be tested are most often not in the set.

This class is designed for small sets of perhaps 5 to 20 items. Its efficiency decreases as its size increases, and is O(N) in in the limit for all operations. TODO: implement sorting at larger sizes to improve query performance of large sets. At small sizes, though (say, Count less than 10) I don't think binary search is any faster.

Properties

int Count [get]
 
bool IsReadOnly [get]
 
bool IsEmpty [get]
 

Public Member Functions

 SymbolSet (int capacity)
 
 SymbolSet (ICollection< Symbol > copy)
 
 SymbolSet (params Symbol[] list)
 
 SymbolSet (params ICollection< Symbol >[] sets)
 
bool MayContain (Symbol item)
 Returns whether the bloom filter indicates that this set may contain the specified item. If this function returns false, the item is definitely not in the set. More...
 
void AddRange (ICollection< Symbol > copy)
 
void Add (Symbol item)
 
void Clear ()
 
bool Contains (Symbol item)
 
void CopyTo (Symbol[] array, int arrayIndex)
 
bool Remove (Symbol item)
 
IEnumerator< SymbolGetEnumerator ()
 

Protected fields

InternalList< Symbol_list = InternalList<Symbol>.Empty
 
BloomFilterM64K2 _bloom
 

Member Function Documentation

◆ MayContain()

bool Loyc.SymbolSet.MayContain ( Symbol  item)
inline

Returns whether the bloom filter indicates that this set may contain the specified item. If this function returns false, the item is definitely not in the set.