C# 클래스 CyrusBuilt.MonoPi.BitSet

상속: ICloneable
파일 보기 프로젝트 열기: cyrusbuilt/MonoPi 1 사용 예제들

공개 메소드들

메소드 설명
And ( BitSet bs ) : void

Performs a logical AND of this target bit set with the argument bit set. This bit set is modified so that each bit in it has the value true if and only if it both initially had the value true and the corresponding bit in the specified bit set also had the value true.

AndNot ( BitSet bs ) : void

Clears all of the bits in this bit set whose corresponding bit is set in the specified bit set.

BitSet ( ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.BitSet class. This is the default constructor.

BitSet ( Int32 nBits ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.BitSet class whose intial size is large enough to explicitly represent bits with indices in the range of 0 through nBits - 1. All bits are intially false.

BitSet ( long words ) : System

Initializes a new instance of the CyrusBuilt.MonoPi.BitSet class from the specified array (words) as the internal representation. The last word (if there is one) must be non-zero.

Cardinality ( ) : Int32

Returns the number of bits set to true in this bit set.

Clear ( ) : void

Sets all of the bits in this CyrusBuilt.MonoPi.BitSet instance to false.

Clear ( Int32 pos ) : void

Sets the bit at the specified position (index) to false.

Clear ( Int32 from, Int32 to ) : void

Sets the bits from the specified from index (inclusive) to the specified to index (exclusive) to false.

Clone ( ) : Object

Creates a new object that is a copy of the current instance.

ContainsAll ( BitSet other ) : System.Boolean

This method is used by EnumSet for efficiency. It checks to see if this instance contains all the same bits as the specified bit set.

Equals ( object obj ) : bool

Determines whether the specified System.Object is equal to the current CyrusBuilt.MonoPi.BitSet.

Flip ( Int32 index ) : void

Sets the bit at the specified index to the compliment of its current value.

Flip ( Int32 from, Int32 to ) : void

Sets each bit from the specified from (inclusive) to the specified to (exclusive) to the complement of its current value.

Get ( Int32 from, Int32 to ) : BitSet

Returns a new bit set composed of bits from this bit set from the specified from index (inclusive) to the to index (exclusive).

Get ( Int32 pos ) : System.Boolean

Gets the value of the bit at the specified index.

GetHashCode ( ) : int

Gets a hash code value for this bit set. The hash code depends only on which bits are set within this instance.

Intersects ( BitSet bs ) : System.Boolean

Returns true if the specified bit set has any bits set to true that are also set to true in this bit set.

NextClearBit ( Int32 from ) : Int32

Returns the index of the first bit that is set to false that occurs on or after the specified starting index.

NextSetBit ( Int32 from ) : Int32

Returns the index of the first bit that is set to true that occurs on or after the specified starting index.

Or ( BitSet bs ) : void

Performs a logical OR of this bit set with the specified bit set. This bit set is modified so that a bit in it has the value true if and only if either it already had the value true or the corresponding bit in the specified bit set has the value true.

PreviousClearBit ( Int32 fromIndex ) : Int32

Returns the index of the nearest bit that is set to false that occurs on or before the specified starting index.

PreviousSetBit ( Int32 fromIndex ) : Int32

Returns the index of the nearest bit that is set to true that occurs on or before the specified starting index.

Set ( Int32 index ) : void

Sets the bit at the specified index to true.

Set ( Int32 index, System.Boolean value ) : void

Sets the bit at the specified index to the specified value.

Set ( Int32 from, Int32 to ) : void

Sets the bits from the specified from index (inclusive) to the specified to index (exclusive) to true.

Set ( Int32 from, Int32 to, System.Boolean value ) : void

Sets the bits from the specified from index (inclusive) to the specified to index (exclusive) to the specified value.

ToByteArray ( ) : Byte[]

Returns a new byte array containing all the bits in this bit set instance.

ToLongArray ( ) : long[]

Returns a new array of longs containing all the bits in this bit set instance.

ToString ( ) : string

Returns a System.String that represents the current CyrusBuilt.MonoPi.BitSet. For every index for which this bit set contains a bit in the set state, the decimal representation of that index is included in the result. Such indices are listed in order from lowest to highest, separated by ", " (a comma and a space) and surrounded by braces, resulting in the usual mathematical notation for a set of integers.

ValueOf ( Byte bytes ) : BitSet

Returns a new bit set containing all the bits in the specified byte array.

ValueOf ( long words ) : BitSet

Returns a new bit set containing all the bits in the specified array of longs.

XOr ( BitSet bs ) : void

Performs a logical XOR of this bit set with the specified bit set. This bit set is modified so that a bit in it has the value true if and only if one of the following statements holds true:
- The bit initially has the value true, and the corresponding bit in the specified bit set has the value false.

- Thi bit initially has the value false, and the corresponding bit in the specified bit set has the value true.

비공개 메소드들

메소드 설명
CheckInvariants ( ) : void

Every public method must preserve the invariants. This method checks to see if this is true using assertions.

CheckRange ( Int32 fromIndex, Int32 toIndex ) : void

Checks to see if the specified "from" index and "to" index is a valid range of bit indices.

EnsureCapacity ( Int32 lastElt ) : void

Ensures that this BitSet can hold enough words.

ExpandTo ( Int32 wordIndex ) : void

Ensures that the BitSet can accomodate a given word index, temporarily violating the invariants. The caller must restore the invariants before returning to the user, possibly using CyrusBuilt.MonoPi.BitSet.RecalculateWordsInUse().

NumberOfTrailingZeros ( long n ) : Int32

Gets the number of trailing zeros in the specified long.

RecalculateWordsInUse ( ) : void

Sets the internal word use count field to the logical size in words of the bit set. WARNING: This method assumes that the number of words actually in use is less than or equal to the current value of the words in use field!!!

TrimToSize ( ) : void

Attempts to reduce internal storage used for the bits in this bit set. Calling this method may, but is not required to, affect the value returned by a subsequent call to the CyrusBuilt.MonoPi.BitSet.Size property.

WordIndex ( Int32 bitIndex ) : Int32

Given the specified bit index, returns the word index containing it.

메소드 상세

And() 공개 메소드

Performs a logical AND of this target bit set with the argument bit set. This bit set is modified so that each bit in it has the value true if and only if it both initially had the value true and the corresponding bit in the specified bit set also had the value true.
/// cannot be null. ///
public And ( BitSet bs ) : void
bs BitSet /// A bit set. ///
리턴 void

AndNot() 공개 메소드

Clears all of the bits in this bit set whose corresponding bit is set in the specified bit set.
/// cannot be null. ///
public AndNot ( BitSet bs ) : void
bs BitSet /// The bit set with which to mask this instance. ///
리턴 void

BitSet() 공개 메소드

Initializes a new instance of the CyrusBuilt.MonoPi.BitSet class. This is the default constructor.
public BitSet ( ) : System
리턴 System

BitSet() 공개 메소드

Initializes a new instance of the CyrusBuilt.MonoPi.BitSet class whose intial size is large enough to explicitly represent bits with indices in the range of 0 through nBits - 1. All bits are intially false.
/// cannot be negative. ///
public BitSet ( Int32 nBits ) : System
nBits System.Int32 /// The initial size of the bit set. ///
리턴 System

BitSet() 공개 메소드

Initializes a new instance of the CyrusBuilt.MonoPi.BitSet class from the specified array (words) as the internal representation. The last word (if there is one) must be non-zero.
public BitSet ( long words ) : System
words long /// The array (words) to compose this instance from. ///
리턴 System

Cardinality() 공개 메소드

Returns the number of bits set to true in this bit set.
public Cardinality ( ) : Int32
리턴 System.Int32

Clear() 공개 메소드

Sets all of the bits in this CyrusBuilt.MonoPi.BitSet instance to false.
public Clear ( ) : void
리턴 void

Clear() 공개 메소드

Sets the bit at the specified position (index) to false.
/// cannot be less than zero. ///
public Clear ( Int32 pos ) : void
pos System.Int32 /// The index of the bit to be cleared. ///
리턴 void

Clear() 공개 메소드

Sets the bits from the specified from index (inclusive) to the specified to index (exclusive) to false.
/// is less than zero - or - /// is less than zero - or - /// is greater than . ///
public Clear ( Int32 from, Int32 to ) : void
from System.Int32 /// The index of the first bit to be cleared. ///
to System.Int32 /// The index after the last bit to be cleared. ///
리턴 void

Clone() 공개 메소드

Creates a new object that is a copy of the current instance.
public Clone ( ) : Object
리턴 Object

ContainsAll() 공개 메소드

This method is used by EnumSet for efficiency. It checks to see if this instance contains all the same bits as the specified bit set.
public ContainsAll ( BitSet other ) : System.Boolean
other BitSet /// The bit set to check. ///
리턴 System.Boolean

Equals() 공개 메소드

Determines whether the specified System.Object is equal to the current CyrusBuilt.MonoPi.BitSet.
public Equals ( object obj ) : bool
obj object /// The to compare with the current . ///
리턴 bool

Flip() 공개 메소드

Sets the bit at the specified index to the compliment of its current value.
/// cannot be less than zero. ///
public Flip ( Int32 index ) : void
index System.Int32 /// The index of the bit to flip. ///
리턴 void

Flip() 공개 메소드

Sets each bit from the specified from (inclusive) to the specified to (exclusive) to the complement of its current value.
/// is less than zero - or - /// is less than zero - or - /// is greater than . ///
public Flip ( Int32 from, Int32 to ) : void
from System.Int32 /// The index of the first bit to flip. ///
to System.Int32 /// The index after the last bit to flip. ///
리턴 void

Get() 공개 메소드

Returns a new bit set composed of bits from this bit set from the specified from index (inclusive) to the to index (exclusive).
/// is less than zero - or - /// is less than zero - or - /// is greater than . ///
public Get ( Int32 from, Int32 to ) : BitSet
from System.Int32 /// The index of the first bit to include. ///
to System.Int32 /// The index after the last bit to include. ///
리턴 BitSet

Get() 공개 메소드

Gets the value of the bit at the specified index.
/// cannot be less than zero. ///
public Get ( Int32 pos ) : System.Boolean
pos System.Int32 /// The index at which to get the bit value. ///
리턴 System.Boolean

GetHashCode() 공개 메소드

Gets a hash code value for this bit set. The hash code depends only on which bits are set within this instance.
public GetHashCode ( ) : int
리턴 int

Intersects() 공개 메소드

Returns true if the specified bit set has any bits set to true that are also set to true in this bit set.
public Intersects ( BitSet bs ) : System.Boolean
bs BitSet /// The bit set to intersect with. ///
리턴 System.Boolean

NextClearBit() 공개 메소드

Returns the index of the first bit that is set to false that occurs on or after the specified starting index.
/// cannot be less than zero. ///
public NextClearBit ( Int32 from ) : Int32
from System.Int32 /// The index to start checking from (inclusive). ///
리턴 System.Int32

NextSetBit() 공개 메소드

Returns the index of the first bit that is set to true that occurs on or after the specified starting index.
/// cannot be less than zero. ///
public NextSetBit ( Int32 from ) : Int32
from System.Int32 /// The index to start checking from (inclusive). ///
리턴 System.Int32

Or() 공개 메소드

Performs a logical OR of this bit set with the specified bit set. This bit set is modified so that a bit in it has the value true if and only if either it already had the value true or the corresponding bit in the specified bit set has the value true.
/// cannot be null. ///
public Or ( BitSet bs ) : void
bs BitSet /// A bit set. ///
리턴 void

PreviousClearBit() 공개 메소드

Returns the index of the nearest bit that is set to false that occurs on or before the specified starting index.
/// cannot be less than zero. ///
public PreviousClearBit ( Int32 fromIndex ) : Int32
fromIndex System.Int32 /// The index to start checking from (inclusive). ///
리턴 System.Int32

PreviousSetBit() 공개 메소드

Returns the index of the nearest bit that is set to true that occurs on or before the specified starting index.
/// cannot be less than zero. ///
public PreviousSetBit ( Int32 fromIndex ) : Int32
fromIndex System.Int32 /// The index to start checking from (inclusive). ///
리턴 System.Int32

Set() 공개 메소드

Sets the bit at the specified index to true.
/// cannot be less than zero. ///
public Set ( Int32 index ) : void
index System.Int32 /// The index of the bit to set. ///
리턴 void

Set() 공개 메소드

Sets the bit at the specified index to the specified value.
/// cannot be less than zero. ///
public Set ( Int32 index, System.Boolean value ) : void
index System.Int32 /// The index of the bit to set. ///
value System.Boolean /// The value to set. ///
리턴 void

Set() 공개 메소드

Sets the bits from the specified from index (inclusive) to the specified to index (exclusive) to true.
/// is less than zero - or - /// is less than zero - or - /// is greater than . ///
public Set ( Int32 from, Int32 to ) : void
from System.Int32 /// The index of the first bit to set. ///
to System.Int32 /// The index after the last bit to set. ///
리턴 void

Set() 공개 메소드

Sets the bits from the specified from index (inclusive) to the specified to index (exclusive) to the specified value.
/// is less than zero - or - /// is less than zero - or - /// is greater than . ///
public Set ( Int32 from, Int32 to, System.Boolean value ) : void
from System.Int32 /// The index of the first bit to set. ///
to System.Int32 /// The index after the last bit to set. ///
value System.Boolean /// The value to set. ///
리턴 void

ToByteArray() 공개 메소드

Returns a new byte array containing all the bits in this bit set instance.
public ToByteArray ( ) : Byte[]
리턴 Byte[]

ToLongArray() 공개 메소드

Returns a new array of longs containing all the bits in this bit set instance.
public ToLongArray ( ) : long[]
리턴 long[]

ToString() 공개 메소드

Returns a System.String that represents the current CyrusBuilt.MonoPi.BitSet. For every index for which this bit set contains a bit in the set state, the decimal representation of that index is included in the result. Such indices are listed in order from lowest to highest, separated by ", " (a comma and a space) and surrounded by braces, resulting in the usual mathematical notation for a set of integers.
public ToString ( ) : string
리턴 string

ValueOf() 공개 정적인 메소드

Returns a new bit set containing all the bits in the specified byte array.
public static ValueOf ( Byte bytes ) : BitSet
bytes Byte /// A byte array containing a little-endian representation of a /// sequence of bits to be used as the intial set of the new bit set. ///
리턴 BitSet

ValueOf() 공개 정적인 메소드

Returns a new bit set containing all the bits in the specified array of longs.
public static ValueOf ( long words ) : BitSet
words long /// A long array containing a little-endian representation of a /// sequence of bits to be used as the intial bits of the new /// bit set. ///
리턴 BitSet

XOr() 공개 메소드

Performs a logical XOR of this bit set with the specified bit set. This bit set is modified so that a bit in it has the value true if and only if one of the following statements holds true:
- The bit initially has the value true, and the corresponding bit in the specified bit set has the value false.

- Thi bit initially has the value false, and the corresponding bit in the specified bit set has the value true.
/// cannot be null. ///
public XOr ( BitSet bs ) : void
bs BitSet /// A bit set. ///
리턴 void