C# 클래스 StopGuessing.DataStructures.FilterArray

A FilterArray is a bit array that contains additional methods to support probabilistic data structures that map elements (keys) to a set of deterministic, pseudorandom indexes in the bit array. These methods support data structures such as bloom filters and binomial ladder filters that store information about an element within the bits at the indexes that are pseudorandomly associated with the element.
파일 보기 프로젝트 열기: Microsoft/StopGuessing 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
BitArray System.Collections.BitArray
HashFunctionsMappingElementsToBitsInTheArray StopGuessing.EncryptionPrimitives.UniversalHashFunction[]

공개 메소드들

메소드 설명
AssignBit ( int indexOfTheBitToAssign, bool desiredValue ) : bool

Assign the bit at a given index to a desired value, and return true if and only if the bit was already set to that value.

AssignRandomBit ( int value ) : void

Assign the value of either zero or one to a randomly-selected bit of the filter array.

ClearBitToZero ( int indexOfBitToClear ) : bool

Clear the bit an in index to zero (false).

ClearRandomBitToZero ( ) : void

Clear a randomly-selected bit of the filter array to zero.

FilterArray ( int numberOfBitsInArray, int maximumBitIndexesPerElement, bool initilizeBitsOfArrayAtRandom, string saltForHashFunctions = "" ) : System

Construct a filter array.

GetIndexesAssociatedWithAnElement ( byte element, int numberOfIndexesRequested = null ) : IEnumerable

Map a element to its corresponding bits in the array.

GetIndexesAssociatedWithAnElement ( string element, int numberOfIndexesRequested = null ) : IEnumerable

Get the set of indexes associated with an element.

SetBitToOne ( int indexOfBitToSet ) : bool

Set the bit an in index to one (true).

SetRandomBitToOne ( ) : void

Set a randomly-selected bit of the filter array to one.

SwapBits ( int indexA, int indexB ) : void

Swap the values of the bits at two indexes into the filter array.

this ( int index ) : bool

Read or write bits of the filter array directly.

메소드 상세

AssignBit() 공개 메소드

Assign the bit at a given index to a desired value, and return true if and only if the bit was already set to that value.
public AssignBit ( int indexOfTheBitToAssign, bool desiredValue ) : bool
indexOfTheBitToAssign int The index of the bit to set.
desiredValue bool The value to set the bit to.
리턴 bool

AssignRandomBit() 공개 메소드

Assign the value of either zero or one to a randomly-selected bit of the filter array.
public AssignRandomBit ( int value ) : void
value int The value to be assigned. Passing 0 causes a value 0 (false) to be stored /// and passing any other value causes a one (true) to be stored in the randomly-selected bit.
리턴 void

ClearBitToZero() 공개 메소드

Clear the bit an in index to zero (false).
public ClearBitToZero ( int indexOfBitToClear ) : bool
indexOfBitToClear int The index of the bit to clear.
리턴 bool

ClearRandomBitToZero() 공개 메소드

Clear a randomly-selected bit of the filter array to zero.
public ClearRandomBitToZero ( ) : void
리턴 void

FilterArray() 공개 메소드

Construct a filter array.
public FilterArray ( int numberOfBitsInArray, int maximumBitIndexesPerElement, bool initilizeBitsOfArrayAtRandom, string saltForHashFunctions = "" ) : System
numberOfBitsInArray int The size of the array in bits.
maximumBitIndexesPerElement int The maximum (and default) number of indexes (bits) in the array to associate with elements.
initilizeBitsOfArrayAtRandom bool If set to true, the bits of the filter array will be set to 0 or 1 at random (indpendently, each with probability 0.5).
saltForHashFunctions string A salt used to generate the hash functions. /// Any two filter arrays generated with the same salt will use the same hash functions. /// The salt should be kept secret from attackerse who might try to manipulate the selection of elements, /// such as to intentionally cause bit collisions with the array.
리턴 System

GetIndexesAssociatedWithAnElement() 공개 메소드

Map a element to its corresponding bits in the array.
public GetIndexesAssociatedWithAnElement ( byte element, int numberOfIndexesRequested = null ) : IEnumerable
element byte The element to be mapped to indexes
numberOfIndexesRequested int The number of indexes to associate with the element. If not set, /// uses the MaximumBitIndexesPerElement specified in the constructor.
리턴 IEnumerable

GetIndexesAssociatedWithAnElement() 공개 메소드

Get the set of indexes associated with an element.
public GetIndexesAssociatedWithAnElement ( string element, int numberOfIndexesRequested = null ) : IEnumerable
element string The value that should be associated with a set of indexes.
numberOfIndexesRequested int The optional number of indexes to associate with the element. If not provided, /// the number of indexes returned will be equal to the default (MaximumBitIndexesPerElement) set in the constructor.
리턴 IEnumerable

SetBitToOne() 공개 메소드

Set the bit an in index to one (true).
public SetBitToOne ( int indexOfBitToSet ) : bool
indexOfBitToSet int The index of the bit to set.
리턴 bool

SetRandomBitToOne() 공개 메소드

Set a randomly-selected bit of the filter array to one.
public SetRandomBitToOne ( ) : void
리턴 void

SwapBits() 공개 메소드

Swap the values of the bits at two indexes into the filter array.
public SwapBits ( int indexA, int indexB ) : void
indexA int Index to the first of the two bits to swap.
indexB int Index to the second of the two bits to swap.
리턴 void

this() 공개 메소드

Read or write bits of the filter array directly.
public this ( int index ) : bool
index int The index of the bit to read/write.
리턴 bool

프로퍼티 상세

BitArray 보호되어 있는 프로퍼티

The bit array used by a filter
protected BitArray,System.Collections BitArray
리턴 System.Collections.BitArray

HashFunctionsMappingElementsToBitsInTheArray 보호되어 있는 프로퍼티

The hash functions used to index into the bit array to map elements to a set of bits
protected UniversalHashFunction[],StopGuessing.EncryptionPrimitives HashFunctionsMappingElementsToBitsInTheArray
리턴 StopGuessing.EncryptionPrimitives.UniversalHashFunction[]