public class BitInt64 extends java.lang.Object implements IEquatable<BitInt64>, java.lang.Comparable<BitInt64>
| Modifier and Type | Field and Description |
|---|---|
static int |
Log2Size
Returns the Log2(Size).
|
static int |
Size
Returns the number of bits.
|
| Constructor and Description |
|---|
BitInt64()
Initializes a new instance of the BitInt64 with
all bits set to false.
|
BitInt64(BitInt64 x)
Initializes a new instance of the BitInt64 structure
using the supplied BitInt64 value.
|
BitInt64(boolean value)
Initializes a new instance of the BitInt64 with
all bits set to the specified bit value.
|
BitInt64(int value)
Initializes a new instance of the BitInt64 with
the specified Int64 value.
|
BitInt64(long value)
Initializes a new instance of the BitInt64 with
the specified Int64 value.
|
BitInt64(java.lang.String item)
Initializes a new instance of the BitInt64 structure
using the supplied String value.
|
| Modifier and Type | Method and Description |
|---|---|
int |
Allocate(int startWith)
Locates the position of the first occurrence of a
0 bit and sets this bit to 1.
|
boolean |
Any()
Tests whether any bit is set to 1.
|
boolean |
Any(boolean value)
Tests whether any bit is set to the specified
value.
|
boolean |
Any(int first,
int last)
Tests whether any bit is set to 1 in the specified range.
|
boolean |
Any(int first,
int last,
boolean value)
Tests whether any bit is set to the specified value
in the specified range.
|
void |
AssignAnd(BitInt64 x)
Performs the bitwise AND operation and assigns the
result to the current instance.
|
void |
AssignOr(BitInt64 x)
Performs the bitwise OR operation and assigns the
result to the current instance.
|
void |
AssignXor(BitInt64 x)
Performs the bitwise eXclusive OR operation and assigns the
result to the current instance.
|
static BitInt64 |
BitwiseAnd(BitInt64 x,
BitInt64 y)
Performs the bitwise AND operation.
|
static BitInt64 |
BitwiseOr(BitInt64 x,
BitInt64 y)
Performs the bitwise OR operation.
|
static BitInt64 |
BitwiseXor(BitInt64 x,
BitInt64 y)
Performs the bitwise eXclusive OR operation.
|
int |
compareTo(BitInt64 other)
Compares this instance to a specified BitInt32 and
returns an indication of their relative values.
|
int |
Count(boolean value)
Returns the number of bits with a specified value.
|
int |
Count(int first,
int last,
boolean value)
Counts the number of bits with a specified value in
the specified range.
|
static boolean |
Equal(BitInt64 x,
BitInt64 y)
Performs a logical comparison of the two BitInt64
parameters to determine if they are equal.
|
boolean |
equals(BitInt64 other)
Tests whether this instance is equal to a specified
BitInt64.
|
boolean |
Equals(BitInt64 other)
Tests whether this instance is equal to a specified
BitInt32.
|
boolean |
equals(java.lang.Object obj)
Tests whether this instance is equal to a specified object.
|
int |
FindFirst(boolean value)
Locates the position of the first occurrence of a
bit that has a specified value.
|
int |
FindFirst(int startWith,
boolean value)
Locates the position of the first occurrence of a
bit that has a specified value.
|
int |
FindFirst(int first,
int last,
boolean value)
Locates the position of the first occurrence of a
bit that has a specified value in the specified range.
|
int |
FindLast(boolean value)
Locates the position of the last occurrence of a
bit that has a specified value.
|
int |
FindLast(int startWith,
boolean value)
Locates the position of the last occurrence of a
bit that has a specified value.
|
int |
FindLast(int first,
int last,
boolean value)
Locates the position of the last occurrence of a
bit that has a specified value in the specified range.
|
void |
Flip()
Toggles the value of every bit.
|
void |
Flip(int pos)
Toggles the value of the bit at a specified position.
|
void |
Flip(int first,
int last)
Toggles the value of every bit the range [first, last).
|
static BitInt64 |
FromInt64(long convertFrom)
Explicit conversion from Int64 to BitInt64.
|
boolean |
Get(int pos)
Gets the value of the bit at a specified position.
|
static boolean |
GreaterThan(BitInt64 x,
BitInt64 y)
Tests whether the value of a specified BitInt64
structure is greater than another value of BitInt64 structure.
|
static boolean |
GreaterThanOrEqual(BitInt64 x,
BitInt64 y)
Tests whether the value of a specified BitInt64 structure
is greater than or equal to another value of BitInt64 structure.
|
int |
hashCode()
Returns the hash code for this instance.
|
static BitInt64 |
LeftShift(BitInt64 x,
int count)
Shifts the bits in a BitInt64 to the left a specified
number of positions and returns the result.
|
void |
LeftShift(int count)
Shifts the bits in the current instance to the left
a specified number of positions.
|
static boolean |
LessThan(BitInt64 x,
BitInt64 y)
Tests whether the value of a specified BitInt64
structure is less than another value of BitInt64 structure.
|
static boolean |
LessThanOrEqual(BitInt64 x,
BitInt64 y)
Tests whether the value of a specified BitInt64 structure
is less than or equal to another value of BitInt64 structure.
|
static BitInt64 |
MaxValue()
Represents the largest possible value of BitInt64
(all bits set to 1).
|
static BitInt64 |
MinValue()
Represents the smallest possible value of BitInt64
(all bits set to 0).
|
boolean |
None()
Tests if none of the bits have been set to 1.
|
boolean |
None(boolean value)
Tests if none of the bits have been set to the specified
value.
|
boolean |
None(int first,
int last)
Tests if none of the bits have been set to 1 in the specified range.
|
boolean |
None(int first,
int last,
boolean value)
Tests if none of the bits have been set to the specified value
in the specified range.
|
static boolean |
NotEqual(BitInt64 x,
BitInt64 y)
Performs a logical comparison of the two BitInt64
parameters to determine if they are equal.
|
static BitInt64 |
OnesComplement(BitInt64 x)
Inverts all the bits in a target BitInt64 and returns
the result.
|
static BitInt64 |
Parse(java.lang.String item)
Converts the String representation of an array of bits to its
BitInt64 equivalent.
|
void |
Reset()
Sets every bit to 0.
|
void |
Reset(int pos)
Sets the bit at a specified position to 0.
|
void |
Reset(int first,
int last)
Sets every bit to 0 in the range [first, last).
|
static BitInt64 |
RightShift(BitInt64 x,
int count)
Shifts the bits in a BitInt64 to the right a specified
number of positions and returns the result.
|
void |
RightShift(int count)
Shifts the bits in the current instance to the right
a specified number of positions.
|
void |
Set()
Sets every bit to 1.
|
void |
Set(int pos)
Sets the bit at a specified position to 1.
|
void |
Set(int first,
int last)
Sets every bit to 1 in the range [first, last).
|
void |
SetValue(long value)
Sets the signed value of the BitInt32.
|
static long |
ToInt64(BitInt64 convertFrom)
Explicit conversion from BitInt64 to Int64.
|
java.lang.String |
toString()
Converts the bit values to their equivalent
String representation.
|
long |
Value()
Gets the signed value of the BitInt32.
|
public static final int Size
public static final int Log2Size
public BitInt64()
public BitInt64(boolean value)
value - The value of the bits in the
new BitInt64.public BitInt64(int value)
value - The value of the Int64 in
the new BitInt64.public BitInt64(long value)
value - The value of the Int64 in
the new BitInt64.public BitInt64(java.lang.String item)
item - The String to be converted.java.lang.RuntimeException - If the String does not
contain a parsable long.public BitInt64(BitInt64 x)
x - The BitInt64 to be copied.public long Value()
public void SetValue(long value)
value - The signed value of the BitInt32.public static BitInt64 MinValue()
public static BitInt64 MaxValue()
public boolean Get(int pos)
pos - The position of the bit to be tested for its value.java.lang.RuntimeException - Thrown when
the specified position is out of [0, Size - 1] range.public void Set()
public void Set(int pos)
pos - The position of the bit to be set to 1.java.lang.RuntimeException - Thrown when
the specified position is out of [0, Size - 1] range.public void Set(int first,
int last)
first - Position of the first bit in the range.last - Position that is one past the final
bit in the range.java.lang.RuntimeException - Thrown when first
is out of [0, Size - 1] range.public void Reset()
public void Reset(int pos)
pos - The position of the bit to be set to 0.java.lang.RuntimeException - Thrown when
the specified position is out of [0, Size - 1] range.public void Reset(int first,
int last)
first - Position of the first bit in the range.last - Position that is one past the final
bit in the range.java.lang.RuntimeException - Thrown when first
is out of [0, Size - 1] range.public void Flip()
public void Flip(int pos)
pos - The position of the bit to be toggled.java.lang.RuntimeException - Thrown when
the specified position is out of [0, Size - 1] range.public void Flip(int first,
int last)
first - Position of the first bit in the range.last - Position that is one past the final
bit in the range.java.lang.RuntimeException - Thrown when first
is out of [0, Size - 1].public int Count(boolean value)
value - The bit value to be counted.public int Count(int first,
int last,
boolean value)
first - Position of the first bit in the range.last - Position that is one past the final
bit in the range.value - The bit value to be counted.java.lang.RuntimeException - Thrown when first
is out of [0, Size - 1] range.public boolean Any()
public boolean Any(boolean value)
value - The value to be tested.public boolean Any(int first,
int last)
first - Position of the first bit in the range.last - Position that is one past the final
bit in the range.java.lang.RuntimeException - Thrown when first
is out of [0, Size - 1] range.public boolean Any(int first,
int last,
boolean value)
first - Position of the first bit in the range.last - Position that is one past the final
bit in the range.value - The value to be tested.java.lang.RuntimeException - Thrown when first
is out of [0, Size - 1] range.public boolean None()
public boolean None(boolean value)
value - The value to be tested.public boolean None(int first,
int last)
first - Position of the first bit in the range.last - Position that is one past the final
bit in the range.java.lang.RuntimeException - Thrown when first
is out of [0, Size - 1].public boolean None(int first,
int last,
boolean value)
first - Position of the first bit in the range.last - Position that is one past the final
bit in the range.value - The value to be tested.java.lang.RuntimeException - Thrown when first
is out of [0, Size - 1] range.public int FindFirst(boolean value)
value - The value to be searched for.public int FindFirst(int startWith,
boolean value)
startWith - Index of the position where the
search is to begin.value - The value to be searched for.java.lang.RuntimeException - Thrown when
the specified position is out of [0, Size - 1] range.public int FindFirst(int first,
int last,
boolean value)
value - The value to be searched for.first - Position of the first bit in the range.last - Position that is one past the final
bit in the range.java.lang.RuntimeException - Thrown when first
or last is out of [0, Size - 1] range.public int FindLast(boolean value)
value - The value to be searched for.public int FindLast(int startWith,
boolean value)
startWith - Index of the position where the
search is to begin.value - The value to be searched for.java.lang.RuntimeException - Thrown when
the specified position is out of [0, Size - 1] range.public int FindLast(int first,
int last,
boolean value)
value - The value to be searched for.first - Position of the first bit in the range.last - Position that is one past the final
bit in the range.java.lang.RuntimeException - Thrown when first
or last is out of [0, Size - 1] range.public java.lang.String toString()
Remarks: The first character in the String represents the first MSB set to one and the last character in the String represents the LSB.
toString in class java.lang.Objectpublic static BitInt64 Parse(java.lang.String item)
Remarks: The first character in the String represents the first MSB set to one and the last character in the String represents the LSB.
item - A String containing an array of bits to convert.java.lang.RuntimeException - If the String does not
contain a parsable BitInt64.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - An object to compare with this instance.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(BitInt64 other)
other - A BitInt64 to compare with this instance.public boolean Equals(BitInt64 other)
Equals in interface IEquatable<BitInt64>other - A BitInt32 to compare with this instance.public int compareTo(BitInt64 other)
compareTo in interface java.lang.Comparable<BitInt64>other - An object to compare, or a null reference.public static boolean Equal(BitInt64 x, BitInt64 y)
x - The left operand in the equality to be tested.y - The right operand in the equality to be tested.public static boolean NotEqual(BitInt64 x, BitInt64 y)
x - The left operand in the equality to be tested.y - The right operand in the equality to be tested.public static boolean LessThan(BitInt64 x, BitInt64 y)
x - The left operand in the inequality to be tested.y - The right operand in the inequality to be tested.public static boolean GreaterThan(BitInt64 x, BitInt64 y)
x - The left operand in the inequality to be tested.y - The right operand in the inequality to be tested.public static boolean LessThanOrEqual(BitInt64 x, BitInt64 y)
x - The left operand in the inequality to be tested.y - The right operand in the inequality to be tested.public static boolean GreaterThanOrEqual(BitInt64 x, BitInt64 y)
x - The left operand in the inequality to be tested.y - The right operand in the inequality to be tested.public static BitInt64 BitwiseAnd(BitInt64 x, BitInt64 y)
x - The left operand in the bitwise AND operation.y - The right operand in the bitwise AND operation.public void AssignAnd(BitInt64 x)
x - The right operand in the bitwise AND operation.public static BitInt64 BitwiseOr(BitInt64 x, BitInt64 y)
x - The left operand in the bitwise OR operation.y - The right operand in the bitwise OR operation.public void AssignOr(BitInt64 x)
x - The right operand in the bitwise OR operation.public static BitInt64 BitwiseXor(BitInt64 x, BitInt64 y)
x - The left operand in the bitwise eXclusive OR operation.y - The right operand in the bitwise eXclusive OR operation.public void AssignXor(BitInt64 x)
x - The right operand in the bitwise eXclusive OR operation.public static BitInt64 OnesComplement(BitInt64 x)
x - The operand in the bitwise complement operation.public static BitInt64 LeftShift(BitInt64 x, int count)
x - A BitInt64 object whose bit values are to be shifted.count - The number of positions to the left the bits are to be shifted.public void LeftShift(int count)
count - The number of positions to the left the bits
are to be shifted.public static BitInt64 RightShift(BitInt64 x, int count)
x - A BitInt64 object whose bit values are to be shifted.count - The number of positions to the right the bits are to be shifted.public void RightShift(int count)
count - The number of positions to the right the bits
are to be shifted.public static BitInt64 FromInt64(long convertFrom)
convertFrom - The Int64 value to be converted.public static long ToInt64(BitInt64 convertFrom)
convertFrom - The BitInt64 value to be converted.public int Allocate(int startWith)
startWith - Index of the position where the
allocate is to begin.java.lang.RuntimeException - Thrown when
the specified position is out of [0, Size - 1] range.Copyright© 2012 Progeneric Systems, Inc. All Rights Reserved.