C# Класс BitsetsNET.RLEBitset

Наследование: IBitset
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
And ( IBitset otherSet ) : IBitset
AndWith ( IBitset otherSet ) : void

Intersects an IBitset with another IBitset, modifying the first IBitset rather than creating a new IBitset

Cardinality ( ) : int

Returns the number of 1's in the uncompressed set (i.e. 1's only).

Clone ( ) : IBitset

Returns a deep copy of this RLEBitset.

CreateFrom ( BitArray bits ) : IBitset

Creates a RLEBitset from a BitArray.

CreateFrom ( int indices ) : IBitset

Creates a RLEBitset from an array of indices. Each value in the input array represents the position (i.e. index) of a 1.

CreateFrom ( int indices, int capacity ) : IBitset

Creates a RLEBitset from an array of indices and a capacity value. Each value in the input array represents the position (i.e. index) of a 1. The capity represents the length of the uncompressed data.

Deserialize ( System.Stream stream ) : RLEBitset

Read a binary serialization of a RLE bitset, as written by the Serialize method.

Difference ( IBitset otherSet ) : IBitset

Performs the set difference, defined as the set in A and not in B.

DifferenceWith ( IBitset otherSet ) : void

Performs the set difference, defined as the set in A and not in B.

Equals ( object otherSet ) : bool

Determines if the other IBitset is equal to this one.

Flip ( int index ) : void

Flips the bit at the specified index.

Flip ( int start, int end ) : void

Flips each bit in the specified range

Get ( int index ) : bool

Gets the boolean value at the given index.

GetEnumerator ( ) : IEnumerator

Get an enumerator of the set indices of this bitset. Meaning, it returns the indicies where the value is set to "true" or "1".

GetHashCode ( ) : int
GetObjectData ( SerializationInfo info, StreamingContext context ) : void
Length ( ) : int

Returns the length of the uncompressed set (i.e. 1's and 0's).

Not ( ) : IBitset

Inverts all the values in the current IBitset, so that elements set to true are changed to false, and elements set to false are changed to true.

Or ( IBitset otherSet ) : IBitset
OrWith ( IBitset otherSet ) : void
Serialize ( System.Stream stream ) : void

Write a binary serialization of this RLE bitset.

Set ( int index, bool value ) : void

Sets the bit at a specific position in the IBitset to the specified value.

Set ( int start, int end, bool value ) : void

For indices in the range [start, end] add the index to the set if the value is true, otherwise remove it.

SetRange ( int startIndex, int count, bool value ) : void

Sets all bits in the given range to the specified value.

ToBitArray ( ) : BitArray

Returns the contents of this set as a bit array where the value is set to true for each index that is a member of this set

Приватные методы

Метод Описание
AddRunToRLE ( RLEBitset &currRLE, Run runToAdd ) : void

Helper function for Or operations. Adds the given run to the run-array by. Either: a) merges it with the previous run if overlap with previous in array b) adds it as next run if no overlap with previous in array

GetRange ( int start, int end ) : List
Merge ( Run &current, Run &next, bool shouldInsert, int index ) : bool
MergeOtherRun ( RLEBitset other, Run &current, int &nextThisIndex, int &nextOtherIndex ) : void
TryCreateIntersection ( Run runA, Run runB, Run &output ) : bool
TryCreateUnion ( Run runA, Run runB, Run &output ) : bool
mergeExistingRun ( Run &current, int &nextIndex ) : void

Описание методов

And() публичный Метод

public And ( IBitset otherSet ) : IBitset
otherSet IBitset
Результат IBitset

AndWith() публичный Метод

Intersects an IBitset with another IBitset, modifying the first IBitset rather than creating a new IBitset
public AndWith ( IBitset otherSet ) : void
otherSet IBitset the other IBitset
Результат void

Cardinality() публичный Метод

Returns the number of 1's in the uncompressed set (i.e. 1's only).
public Cardinality ( ) : int
Результат int

Clone() публичный Метод

Returns a deep copy of this RLEBitset.
public Clone ( ) : IBitset
Результат IBitset

CreateFrom() публичный статический Метод

Creates a RLEBitset from a BitArray.
public static CreateFrom ( BitArray bits ) : IBitset
bits System.Collections.BitArray a BitArray
Результат IBitset

CreateFrom() публичный статический Метод

Creates a RLEBitset from an array of indices. Each value in the input array represents the position (i.e. index) of a 1.
public static CreateFrom ( int indices ) : IBitset
indices int an array of integers representing the positions of 1's
Результат IBitset

CreateFrom() публичный статический Метод

Creates a RLEBitset from an array of indices and a capacity value. Each value in the input array represents the position (i.e. index) of a 1. The capity represents the length of the uncompressed data.
public static CreateFrom ( int indices, int capacity ) : IBitset
indices int an array of integers representing the positions of 1's
capacity int the length of the uncompressed array
Результат IBitset

Deserialize() публичный статический Метод

Read a binary serialization of a RLE bitset, as written by the Serialize method.
public static Deserialize ( System.Stream stream ) : RLEBitset
stream System.Stream The stream to read from.
Результат RLEBitset

Difference() публичный Метод

Performs the set difference, defined as the set in A and not in B.
public Difference ( IBitset otherSet ) : IBitset
otherSet IBitset the other IBitset
Результат IBitset

DifferenceWith() публичный Метод

Performs the set difference, defined as the set in A and not in B.
public DifferenceWith ( IBitset otherSet ) : void
otherSet IBitset the other IBitset
Результат void

Equals() публичный Метод

Determines if the other IBitset is equal to this one.
public Equals ( object otherSet ) : bool
otherSet object the other IBitset
Результат bool

Flip() публичный Метод

Flips the bit at the specified index.
public Flip ( int index ) : void
index int Index to be flipped
Результат void

Flip() публичный Метод

Flips each bit in the specified range
public Flip ( int start, int end ) : void
start int Start of range
end int End of range
Результат void

Get() публичный Метод

Gets the boolean value at the given index.
public Get ( int index ) : bool
index int an index
Результат bool

GetEnumerator() публичный Метод

Get an enumerator of the set indices of this bitset. Meaning, it returns the indicies where the value is set to "true" or "1".
public GetEnumerator ( ) : IEnumerator
Результат IEnumerator

GetHashCode() публичный Метод

public GetHashCode ( ) : int
Результат int

GetObjectData() публичный Метод

public GetObjectData ( SerializationInfo info, StreamingContext context ) : void
info System.Runtime.Serialization.SerializationInfo
context System.Runtime.Serialization.StreamingContext
Результат void

Length() публичный Метод

Returns the length of the uncompressed set (i.e. 1's and 0's).
public Length ( ) : int
Результат int

Not() публичный Метод

Inverts all the values in the current IBitset, so that elements set to true are changed to false, and elements set to false are changed to true.
public Not ( ) : IBitset
Результат IBitset

Or() публичный Метод

public Or ( IBitset otherSet ) : IBitset
otherSet IBitset
Результат IBitset

OrWith() публичный Метод

public OrWith ( IBitset otherSet ) : void
otherSet IBitset
Результат void

Serialize() публичный Метод

Write a binary serialization of this RLE bitset.
public Serialize ( System.Stream stream ) : void
stream System.Stream The stream to write to.
Результат void

Set() публичный Метод

Sets the bit at a specific position in the IBitset to the specified value.
public Set ( int index, bool value ) : void
index int The zero-based index of the bit to set.
value bool The Boolean value to assign to the bit.
Результат void

Set() публичный Метод

For indices in the range [start, end] add the index to the set if the value is true, otherwise remove it.
public Set ( int start, int end, bool value ) : void
start int the index to start from (inclusive)
end int the index to stop at (exclusive)
value bool
Результат void

SetRange() публичный Метод

Sets all bits in the given range to the specified value.
public SetRange ( int startIndex, int count, bool value ) : void
startIndex int The zero-based start position of the range.
count int The number of bits in the range.
value bool The Boolean value to assign to the bits.
Результат void

ToBitArray() публичный Метод

Returns the contents of this set as a bit array where the value is set to true for each index that is a member of this set
public ToBitArray ( ) : BitArray
Результат System.Collections.BitArray