Class BitString
Namespace: Platform.Collections
Assembly: Platform.Collections.dll
Syntax
public class BitString : IEquatable<BitString>
Remarks
А что если хранить карту значений, где каждый бит будет означать присутствует ли блок в 64 бит в массиве значений. 64 бита по 0 бит, будут означать отсутствие 64-х блоков по 64 бита. Т.е. упаковка 512 байт в 8 байт. Подобный принцип можно применять и к 64-ём блокам и т.п. По сути это карта значений. С помощью которой можно быстро проверять есть ли значения непосредственно далее (ниже по уровню). Или как таблица виртуальной памяти где номер блока означает его присутствие и адрес.
Constructors
| Improve this Doc View SourceBitString(BitString)
Initializes a new BitString instance.
Declaration
public BitString(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | A other.
|
BitString(Int64)
Initializes a new BitString instance.
Declaration
public BitString(long length)
Parameters
Type | Name | Description |
---|---|---|
Int64 | length | A length.
|
BitString(Int64, Boolean)
Initializes a new BitString instance.
Declaration
public BitString(long length, bool defaultValue)
Parameters
Type | Name | Description |
---|---|---|
Int64 | length | A length.
|
Boolean | defaultValue | A default value.
|
Properties
| Improve this Doc View SourceItem[Int64]
The value.
Declaration
public bool this[long index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int64 | index |
Property Value
Type | Description |
---|---|
Boolean |
Length
Gets or sets the length value.
Declaration
public long Length { get; set; }
Property Value
Type | Description |
---|---|
Int64 |
Methods
| Improve this Doc View SourceAdd(Int64)
Determines whether this instance add.
Declaration
public bool Add(long index)
Parameters
Type | Name | Description |
---|---|---|
Int64 | index | The index.
|
Returns
Type | Description |
---|---|
Boolean | The bool
|
And(BitString)
Ands the other.
Declaration
public BitString And(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
CountCommonBits(BitString)
Counts the common bits using the specified other.
Declaration
public long CountCommonBits(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
Int64 | The total.
|
CountSetBits()
Counts the set bits.
Declaration
public long CountSetBits()
Returns
Type | Description |
---|---|
Int64 | The total.
|
Equals(BitString)
Determines whether this instance equals.
Declaration
public bool Equals(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
Boolean | The bool
|
Equals(Object)
Determines whether this instance equals.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The obj.
|
Returns
Type | Description |
---|---|
Boolean | The bool
|
Get(Int64)
Determines whether this instance get.
Declaration
public bool Get(long index)
Parameters
Type | Name | Description |
---|---|---|
Int64 | index | The index.
|
Returns
Type | Description |
---|---|
Boolean | The bool
|
GetBitMaskFromIndex(Int64)
Gets the bit mask from index using the specified index.
Declaration
public static long GetBitMaskFromIndex(long index)
Parameters
Type | Name | Description |
---|---|---|
Int64 | index | The index.
|
Returns
Type | Description |
---|---|
Int64 | The long
|
GetCommonBorders(BitString, BitString, out UInt64, out UInt64)
Gets the common borders using the specified left.
Declaration
public static void GetCommonBorders(BitString left, BitString right, out ulong from, out ulong to)
Parameters
Type | Name | Description |
---|---|---|
BitString | left | The left.
|
BitString | right | The right.
|
UInt64 | from | The from.
|
UInt64 | to | The to.
|
GetCommonIndices(BitString)
Gets the common indices using the specified other.
Declaration
public List<long> GetCommonIndices(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
List<Int64> | The result.
|
GetCommonInnerBorders(BitString, BitString, out Int64, out Int64)
Gets the common inner borders using the specified left.
Declaration
public static void GetCommonInnerBorders(BitString left, BitString right, out long from, out long to)
Parameters
Type | Name | Description |
---|---|---|
BitString | left | The left.
|
BitString | right | The right.
|
Int64 | from | The from.
|
Int64 | to | The to.
|
GetCommonOuterBorders(BitString, BitString, out Int32, out Int32)
Gets the common outer borders using the specified left.
Declaration
public static void GetCommonOuterBorders(BitString left, BitString right, out int from, out int to)
Parameters
Type | Name | Description |
---|---|---|
BitString | left | The left.
|
BitString | right | The right.
|
Int32 | from | The from.
|
Int32 | to | The to.
|
GetCommonOuterBorders(BitString, BitString, out Int64, out Int64)
Gets the common outer borders using the specified left.
Declaration
public static void GetCommonOuterBorders(BitString left, BitString right, out long from, out long to)
Parameters
Type | Name | Description |
---|---|---|
BitString | left | The left.
|
BitString | right | The right.
|
Int64 | from | The from.
|
Int64 | to | The to.
|
GetCommonUInt64Indices(BitString)
Gets the common u int 64 indices using the specified other.
Declaration
public List<ulong> GetCommonUInt64Indices(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
List<UInt64> | The result.
|
GetFirstCommonBitIndex(BitString)
Gets the first common bit index using the specified other.
Declaration
public long GetFirstCommonBitIndex(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
Int64 | The long
|
GetFirstSetBitIndex()
Gets the first set bit index.
Declaration
public long GetFirstSetBitIndex()
Returns
Type | Description |
---|---|
Int64 | The long
|
GetHashCode()
Gets the hash code.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | The int
|
GetLastCommonBitIndex(BitString)
Gets the last common bit index using the specified other.
Declaration
public long GetLastCommonBitIndex(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
Int64 | The long
|
GetLastSetBitIndex()
Gets the last set bit index.
Declaration
public long GetLastSetBitIndex()
Returns
Type | Description |
---|---|
Int64 | The long
|
GetSetIndices()
Gets the set indices.
Declaration
public List<long> GetSetIndices()
Returns
Type | Description |
---|---|
List<Int64> | The result.
|
GetSetUInt64Indices()
Gets the set u int 64 indices.
Declaration
public List<ulong> GetSetUInt64Indices()
Returns
Type | Description |
---|---|
List<UInt64> | The result.
|
GetWordIndexFromIndex(Int64)
Gets the word index from index using the specified index.
Declaration
public static long GetWordIndexFromIndex(long index)
Parameters
Type | Name | Description |
---|---|---|
Int64 | index | The index.
|
Returns
Type | Description |
---|---|
Int64 | The long
|
GetWordsCountFromIndex(Int64)
Gets the words count from index using the specified index.
Declaration
public static long GetWordsCountFromIndex(long index)
Parameters
Type | Name | Description |
---|---|---|
Int64 | index | The index.
|
Returns
Type | Description |
---|---|
Int64 | The long
|
HaveCommonBits(BitString)
Determines whether this instance have common bits.
Declaration
public bool HaveCommonBits(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
Boolean | The bool
|
Not()
Nots this instance.
Declaration
public BitString Not()
Returns
Type | Description |
---|---|
BitString | The bit string
|
Or(BitString)
Ors the other.
Declaration
public BitString Or(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
ParallelAnd(BitString)
Parallels the and using the specified other.
Declaration
public BitString ParallelAnd(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
ParallelNot()
Parallels the not.
Declaration
public BitString ParallelNot()
Returns
Type | Description |
---|---|
BitString | The bit string
|
ParallelOr(BitString)
Parallels the or using the specified other.
Declaration
public BitString ParallelOr(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
ParallelVectorAnd(BitString)
Parallels the vector and using the specified other.
Declaration
public BitString ParallelVectorAnd(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
ParallelVectorNot()
Parallels the vector not.
Declaration
public BitString ParallelVectorNot()
Returns
Type | Description |
---|---|
BitString | The bit string
|
ParallelVectorOr(BitString)
Parallels the vector or using the specified other.
Declaration
public BitString ParallelVectorOr(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
ParallelVectorXor(BitString)
Parallels the vector xor using the specified other.
Declaration
public BitString ParallelVectorXor(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
ParallelXor(BitString)
Parallels the xor using the specified other.
Declaration
public BitString ParallelXor(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
Reset(Int64)
Resets the index.
Declaration
public void Reset(long index)
Parameters
Type | Name | Description |
---|---|---|
Int64 | index | The index.
|
ResetAll()
Resets the all.
Declaration
public void ResetAll()
Set(Int64)
Sets the index.
Declaration
public void Set(long index)
Parameters
Type | Name | Description |
---|---|---|
Int64 | index | The index.
|
Set(Int64, Boolean)
Sets the index.
Declaration
public void Set(long index, bool value)
Parameters
Type | Name | Description |
---|---|---|
Int64 | index | The index.
|
Boolean | value | The value.
|
SetAll()
Sets the all.
Declaration
public void SetAll()
SetAll(Boolean)
Sets the all using the specified value.
Declaration
public void SetAll(bool value)
Parameters
Type | Name | Description |
---|---|---|
Boolean | value | The value.
|
ToString()
Returns the string.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String | The string
|
TryShrinkBorders()
Determines whether this instance try shrink borders.
Declaration
public bool TryShrinkBorders()
Returns
Type | Description |
---|---|
Boolean | The borders updated.
|
VectorAnd(BitString)
Vectors the and using the specified other.
Declaration
public BitString VectorAnd(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
VectorNot()
Vectors the not.
Declaration
public BitString VectorNot()
Returns
Type | Description |
---|---|
BitString | The bit string
|
VectorOr(BitString)
Vectors the or using the specified other.
Declaration
public BitString VectorOr(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
VectorXor(BitString)
Vectors the xor using the specified other.
Declaration
public BitString VectorXor(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|
Xor(BitString)
Xors the other.
Declaration
public BitString Xor(BitString other)
Parameters
Type | Name | Description |
---|---|---|
BitString | other | The other.
|
Returns
Type | Description |
---|---|
BitString | The bit string
|