|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.innig.collect.IntegralRadix
public class IntegralRadix
A radix which supports Byte, Short, Integer, and Long.
| Maturity: All the radix utilities in innig-util are completely experimental. They mostly work, but perform poorly. They may stay; they may improve; they may go away. |
| Plans: Experiment. |
Radix,
Serialized Form| Constructor Summary | |
|---|---|
IntegralRadix(int numberBits,
int digitBits,
boolean signed)
Creates a new radix for n-bit integers. |
|
| Method Summary | |
|---|---|
static int |
bitsNeeded(long n,
boolean signed)
Returns the number of bits necessary to represent n. |
int |
compare(java.lang.Object aObj,
java.lang.Object bObj)
|
int |
digit(java.lang.Object o,
int pos)
Returns the digits of the radix representation of the given number. |
boolean |
equals(java.lang.Object that)
|
static Radix |
forType(java.lang.Class numberType)
Returns a base-256 radix which handles numbers of the given type in their natural form (signed, and all bits used). |
int |
getBase()
Returns the base (the number of digit values) in this radix. |
int |
getMaxPosition(java.lang.Object o)
Returns the position of the most significant digit for this radix. |
int |
getMaxPositionForAll(java.util.Collection values)
Returns the position of the most significant digit for this radix. |
int |
getMinPosition(java.lang.Object o)
Returns zero. |
int |
getMinPositionForAll(java.util.Collection values)
Returns zero. |
int |
hashCode()
|
java.lang.Object |
objectFromDigits(int[] digits)
Constructs a number from the given digits. |
java.lang.Object |
objectFromDigits(int[] digits,
int offset,
int len)
Constructs a number from the given digits. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IntegralRadix(int numberBits,
int digitBits,
boolean signed)
numberBits - the number of bits in the integers this radix handles.
Although the standard integral types come in powers of two (e.g. 8 for Byte,
16 for Short), any number of bits between 1 and 64 is legal.digitBits - the number of bits in each digit of the radix. This parameter
allows you to split large integers into several digits, which keeps
bucket-based radix algorithms reasonable. This parameter must divide
numberBits, and must be <= 30.signed - if true, the radix treats numbers as signed, and gives the
digits of the two's complement representation.| Method Detail |
|---|
public static int bitsNeeded(long n,
boolean signed)
public static Radix forType(java.lang.Class numberType)
numberType - the class Byte, Short, Integer, or Long.
java.lang.IllegalArgumentException - if numberType is not one of these classes.public int getBase()
getBase in interface Radix
public int digit(java.lang.Object o,
int pos)
digit in interface Radixo - a Byte, Short, Integer, or Long object.pos - a digit position within o.
java.lang.ClassCastException - if o is not a Number.public int getMaxPosition(java.lang.Object o)
getMaxPosition in interface Radixpublic int getMinPosition(java.lang.Object o)
getMinPosition in interface Radixpublic int getMaxPositionForAll(java.util.Collection values)
getMaxPositionForAll in interface Radixpublic int getMinPositionForAll(java.util.Collection values)
getMinPositionForAll in interface Radixpublic java.lang.Object objectFromDigits(int[] digits)
objectFromDigits in interface Radixjava.lang.IllegalArgumentException - if the digits don't represent a valid number.
public java.lang.Object objectFromDigits(int[] digits,
int offset,
int len)
objectFromDigits in interface Radixjava.lang.IllegalArgumentException - if the digits don't represent a valid number.
public int compare(java.lang.Object aObj,
java.lang.Object bObj)
compare in interface java.util.Comparatorpublic boolean equals(java.lang.Object that)
equals in interface java.util.Comparatorequals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||