public class Unsigned128BitType extends AbstractIntegerType<Unsigned128BitType> implements NativeType<Unsigned128BitType>
Type with a bit depth of 128. Each value is stored in two adjacent
long in an array, with the lower long first, then the upper long. Currently
the math methods defined in the superinterface NumericType are
implemented using BigInteger and BigDecimal. This class is
not Thread-safe; do a copy() first to operate on a different
Thread.| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
bytes |
protected LongAccess |
dataAccess |
protected NativeImg<?,? extends LongAccess> |
img |
| Constructor and Description |
|---|
Unsigned128BitType() |
Unsigned128BitType(BigInteger value) |
Unsigned128BitType(LongAccess access) |
Unsigned128BitType(long lower,
long upper) |
Unsigned128BitType(NativeImg<?,? extends LongAccess> bitStorage) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Unsigned128BitType t)
Relies on
BigInteger.add(BigInteger). |
int |
compareTo(Unsigned128BitType t) |
Unsigned128BitType |
copy()
|
Unsigned128BitType |
createVariable()
Creates a new
Type variable which can only store one value. |
void |
dec() |
void |
div(Unsigned128BitType t)
Relies on
BigInteger.divide(BigInteger). |
Unsigned128BitType |
duplicateTypeOnSameNativeImg()
Creates a new
NativeType which stores in the same physical array. |
boolean |
equals(Object obj) |
BigInteger |
get() |
BigInteger |
getBigInteger() |
int |
getBitsPerPixel() |
Fraction |
getEntitiesPerPixel()
Get the number of entities in the storage array required to store one
pixel value.
|
int |
getInteger()
Return the lowest 32 bits, like
BigInteger.intValue(). |
long |
getIntegerLong()
Return the lowest 64 bits, like
BigInteger.intValue(). |
BigInteger |
getMaxBigIntegerValue()
The true maximum value, unlike
getMaxValue() which cannot
represent it in a double. |
double |
getMaxValue()
The maximum value that can be stored is
Math.pow(2, 128) -1,
which cannot be represented with precision using a double |
double |
getMinValue() |
NativeTypeFactory<Unsigned128BitType,LongAccess> |
getNativeTypeFactory() |
double |
getRealDouble() |
float |
getRealFloat() |
int |
hashCode() |
void |
inc() |
Index |
index()
Get the (modifiable) index into the current data array.
|
void |
mul(double c)
Implemented using
BigDecimal.multiply(BigDecimal) and
BigDecimal.toBigInteger(). |
void |
mul(float c)
See
mul(double). |
void |
mul(Unsigned128BitType t)
Relies on
BigInteger.multiply(BigInteger). |
void |
pow(double power) |
void |
pow(Unsigned128BitType t) |
void |
set(BigInteger value) |
void |
set(byte[] bytes)
The first byte is the most significant byte, like in
BigInteger.toByteArray(). |
void |
set(long lower,
long upper) |
void |
setBigInteger(BigInteger b) |
void |
setInteger(int value) |
void |
setInteger(long value) |
void |
setOne() |
void |
setReal(double real) |
void |
setReal(float real) |
void |
setZero() |
void |
sub(Unsigned128BitType t)
Relies on
BigInteger.subtract(BigInteger). |
String |
toString() |
void |
updateContainer(Object c)
This method is used by an accessor (e.g., a
Cursor) to request an
update of the current data array. |
boolean |
valueEquals(Unsigned128BitType t) |
getMinIncrementgetImaginaryDouble, getImaginaryFloat, getPhaseDouble, getPhaseFloat, getPowerDouble, getPowerFloat, set, setImaginary, setImaginarycomplexConjugate, setComplexNumber, setComplexNumberclone, finalize, getClass, notify, notifyAll, wait, wait, waitdecIndex, decIndex, getIndex, incIndex, incIndex, updateIndexcomplexConjugate, getImaginaryDouble, getImaginaryFloat, getPhaseDouble, getPhaseFloat, getPowerDouble, getPowerFloat, setComplexNumber, setComplexNumber, setImaginary, setImaginaryprotected final NativeImg<?,? extends LongAccess> img
protected final byte[] bytes
protected LongAccess dataAccess
public Unsigned128BitType(NativeImg<?,? extends LongAccess> bitStorage)
public Unsigned128BitType(long lower,
long upper)
public Unsigned128BitType(BigInteger value)
public Unsigned128BitType(LongAccess access)
public Unsigned128BitType()
public void updateContainer(Object c)
NativeTypeCursor) to request an
update of the current data array.
As an example consider a CellCursor moving on a CellImg.
The cursor maintains a NativeType which provides access to the
image data. When the cursor moves from one cell to the next, the
underlying data array of the NativeType must be switched to the
data array of the new cell.
To achieve this, the CellCursor calls updateContainer()
with itself as the argument. updateContainer() in turn will call
NativeImg.update(Object) on it's container, passing along the
reference to the cursor. In this example, the container would be a
CellImg. While the NativeType does not know about the
type of the cursor, the container does. CellImg knows that it is
passed a CellCursor instance, which can be used to figure out the
current cell and the underlying data array, which is then returned to the
NativeType.
The idea behind this concept is maybe not obvious. The NativeType
knows which basic type is used (float, int, byte, ...). However, it does
not know how the data is stored (ArrayImg, CellImg, ...).
This prevents the need for multiple implementations of NativeType
.
updateContainer in interface NativeType<Unsigned128BitType>c - reference to an accessor which can be passed on to the
container (which will know what to do with it).public Index index()
NativeTypeindex in interface NativeType<Unsigned128BitType>public Unsigned128BitType duplicateTypeOnSameNativeImg()
NativeTypeNativeType which stores in the same physical array.
This is only used internally.duplicateTypeOnSameNativeImg in interface NativeType<Unsigned128BitType>NativeType instance working on the same
NativeImgpublic NativeTypeFactory<Unsigned128BitType,LongAccess> getNativeTypeFactory()
getNativeTypeFactory in interface NativeType<Unsigned128BitType>public void set(byte[] bytes)
BigInteger.toByteArray(). Only the last 16 bytes are read, if
there are more.public BigInteger get()
public void set(BigInteger value)
public void set(long lower,
long upper)
public int getInteger()
BigInteger.intValue().getInteger in interface IntegerType<Unsigned128BitType>public long getIntegerLong()
BigInteger.intValue().getIntegerLong in interface IntegerType<Unsigned128BitType>public BigInteger getBigInteger()
getBigInteger in interface IntegerType<Unsigned128BitType>public float getRealFloat()
getRealFloat in interface ComplexType<Unsigned128BitType>getRealFloat in class AbstractIntegerType<Unsigned128BitType>public double getRealDouble()
getRealDouble in interface ComplexType<Unsigned128BitType>getRealDouble in class AbstractIntegerType<Unsigned128BitType>public void setInteger(int value)
setInteger in interface IntegerType<Unsigned128BitType>public void setInteger(long value)
setInteger in interface IntegerType<Unsigned128BitType>public void setBigInteger(BigInteger b)
setBigInteger in interface IntegerType<Unsigned128BitType>public void setReal(float real)
setReal in interface ComplexType<Unsigned128BitType>setReal in class AbstractIntegerType<Unsigned128BitType>public void setReal(double real)
setReal in interface ComplexType<Unsigned128BitType>setReal in class AbstractIntegerType<Unsigned128BitType>public double getMaxValue()
Math.pow(2, 128) -1,
which cannot be represented with precision using a doublegetMaxValue in interface RealType<Unsigned128BitType>public BigInteger getMaxBigIntegerValue()
getMaxValue() which cannot
represent it in a double.public double getMinValue()
getMinValue in interface RealType<Unsigned128BitType>public Unsigned128BitType createVariable()
TypeType variable which can only store one value.createVariable in interface Type<Unsigned128BitType>Type variablepublic Unsigned128BitType copy()
Typecopy in interface Type<Unsigned128BitType>Type variablepublic Fraction getEntitiesPerPixel()
NativeTypegetEntitiesPerPixel in interface NativeType<Unsigned128BitType>public int getBitsPerPixel()
getBitsPerPixel in interface RealType<Unsigned128BitType>public void inc()
inc in interface RealType<Unsigned128BitType>inc in class AbstractIntegerType<Unsigned128BitType>public void dec()
dec in interface RealType<Unsigned128BitType>dec in class AbstractIntegerType<Unsigned128BitType>public void setZero()
setZero in interface SetZerosetZero in class AbstractIntegerType<Unsigned128BitType>public void setOne()
setOne in interface SetOnesetOne in class AbstractIntegerType<Unsigned128BitType>public void mul(float c)
mul(double).mul in interface MulFloatingPointmul in class AbstractRealType<Unsigned128BitType>public void mul(double c)
BigDecimal.multiply(BigDecimal) and
BigDecimal.toBigInteger().mul in interface MulFloatingPointmul in class AbstractRealType<Unsigned128BitType>public void add(Unsigned128BitType t)
BigInteger.add(BigInteger).add in interface Add<Unsigned128BitType>add in class AbstractRealType<Unsigned128BitType>public void sub(Unsigned128BitType t)
BigInteger.subtract(BigInteger).sub in interface Sub<Unsigned128BitType>sub in class AbstractRealType<Unsigned128BitType>public void mul(Unsigned128BitType t)
BigInteger.multiply(BigInteger).mul in interface Mul<Unsigned128BitType>mul in class AbstractRealType<Unsigned128BitType>public void div(Unsigned128BitType t)
BigInteger.divide(BigInteger).div in interface Div<Unsigned128BitType>div in class AbstractRealType<Unsigned128BitType>public void pow(Unsigned128BitType t)
pow in interface Pow<Unsigned128BitType>pow in class AbstractRealType<Unsigned128BitType>public void pow(double power)
pow in interface PowFloatingPointpow in class AbstractRealType<Unsigned128BitType>public int compareTo(Unsigned128BitType t)
compareTo in interface Comparable<Unsigned128BitType>compareTo in class AbstractIntegerType<Unsigned128BitType>public boolean valueEquals(Unsigned128BitType t)
valueEquals in interface ValueEquals<Unsigned128BitType>valueEquals in class AbstractIntegerType<Unsigned128BitType>public boolean equals(Object obj)
equals in class AbstractIntegerType<Unsigned128BitType>public int hashCode()
hashCode in class AbstractIntegerType<Unsigned128BitType>public String toString()
toString in class AbstractIntegerType<Unsigned128BitType>Copyright © 2015–2022 ImgLib2. All rights reserved.