共用方式為


BitSet Class

Definition

This class implements a vector of bits that grows as needed.

[Android.Runtime.Register("java/util/BitSet", DoNotGenerateAcw=true)]
public class BitSet : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable, Java.Lang.ICloneable
[<Android.Runtime.Register("java/util/BitSet", DoNotGenerateAcw=true)>]
type BitSet = class
    inherit Object
    interface ISerializable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface ICloneable
Inheritance
BitSet
Attributes
Implements

Remarks

This class implements a vector of bits that grows as needed. Each component of the bit set has a boolean value. The bits of a BitSet are indexed by nonnegative integers. Individual indexed bits can be examined, set, or cleared. One BitSet may be used to modify the contents of another BitSet through logical AND, logical inclusive OR, and logical exclusive OR operations.

By default, all bits in the set initially have the value false.

Every bit set has a current size, which is the number of bits of space currently in use by the bit set. Note that the size is related to the implementation of a bit set, so it may change with implementation. The length of a bit set relates to logical length of a bit set and is defined independently of implementation.

Unless otherwise noted, passing a null parameter to any of the methods in a BitSet will result in a NullPointerException.

A BitSet is not safe for multithreaded use without external synchronization.

Added in 1.0.

Java documentation for java.util.BitSet.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

BitSet()

Creates a new bit set.

BitSet(Int32)

Creates a bit set whose initial size is large enough to explicitly represent bits with indices in the range 0 through nbits-1.

BitSet(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsEmpty

Returns true if this BitSet contains no bits that are set to true.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

And(BitSet)

Performs a logical <b>AND</b> of this target bit set with the argument bit set.

AndNot(BitSet)

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

Cardinality()

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

Clear()

Sets all of the bits in this BitSet to false.

Clear(Int32, Int32)

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

Clear(Int32)

Sets the bit specified by the index to false.

Clone()

Cloning this BitSet produces a new BitSet that is equal to it.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
Flip(Int32, Int32)

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

Flip(Int32)

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

Get(Int32, Int32)

Returns a new BitSet composed of bits from this BitSet from fromIndex (inclusive) to toIndex (exclusive).

Get(Int32)

Returns the value of the bit with the specified index.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
Intersects(BitSet)

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

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Length()

Returns the "logical size" of this BitSet: the index of the highest set bit in the BitSet plus one.

NextClearBit(Int32)

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

NextSetBit(Int32)

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

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Or(BitSet)

Performs a logical <b>OR</b> of this bit set with the bit set argument.

PreviousClearBit(Int32)

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

PreviousSetBit(Int32)

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

Set(Int32, Boolean)

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

Set(Int32, Int32, Boolean)

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

Set(Int32, Int32)

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

Set(Int32)

Sets the bit at the specified index to true.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Size()

Returns the number of bits of space actually in use by this BitSet to represent bit values.

ToArray<T>() (Inherited from Object)
ToByteArray()

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

ToLongArray()

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

ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
ValueOf(Byte[])

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

ValueOf(ByteBuffer)

Returns a new bit set containing all the bits in the given byte buffer between its position and limit.

ValueOf(Int64[])

Returns a new bit set containing all the bits in the given long array.

ValueOf(LongBuffer)

Returns a new bit set containing all the bits in the given long buffer between its position and limit.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Xor(BitSet)

Performs a logical <b>XOR</b> of this bit set with the bit set argument.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to