Package net.imglib2.type.numeric.integer
Class UnsignedLongType
- java.lang.Object
-
- net.imglib2.type.numeric.complex.AbstractComplexType<T>
-
- net.imglib2.type.numeric.real.AbstractRealType<T>
-
- net.imglib2.type.numeric.integer.AbstractIntegerType<T>
-
- net.imglib2.type.numeric.integer.GenericLongType<UnsignedLongType>
-
- net.imglib2.type.numeric.integer.UnsignedLongType
-
- All Implemented Interfaces:
java.lang.Comparable<UnsignedLongType>
,NativeType<UnsignedLongType>
,ComplexType<UnsignedLongType>
,IntegerType<UnsignedLongType>
,NumericType<UnsignedLongType>
,RealType<UnsignedLongType>
,Add<UnsignedLongType>
,Div<UnsignedLongType>
,Mul<UnsignedLongType>
,MulFloatingPoint
,SetOne
,SetZero
,Sub<UnsignedLongType>
,ValueEquals<UnsignedLongType>
,Type<UnsignedLongType>
public class UnsignedLongType extends GenericLongType<UnsignedLongType>
TODO- Author:
- Stephan Preibisch, Stephan Saalfeld, Albert Cardona, Mark Hiner
-
-
Field Summary
-
Fields inherited from class net.imglib2.type.numeric.integer.GenericLongType
dataAccess, img
-
-
Constructor Summary
Constructors Constructor Description UnsignedLongType()
UnsignedLongType(long value)
UnsignedLongType(java.math.BigInteger value)
UnsignedLongType(LongAccess access)
UnsignedLongType(NativeImg<?,? extends LongAccess> img)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(UnsignedLongType c)
static int
compare(long a, long b)
int
compareTo(UnsignedLongType c)
UnsignedLongType
copy()
NativeImg<UnsignedLongType,? extends LongAccess>
createSuitableNativeImg(NativeImgFactory<UnsignedLongType> storageFactory, long[] dim)
TheNativeType
creates theNativeImg
used for storing image data; based on the given storage strategy and its size.UnsignedLongType
createVariable()
Creates a newType
variable which can only store one value.void
dec()
void
div(UnsignedLongType c)
static long
divide(long d1, long d2)
Unsigned division ofd1
byd2
.UnsignedLongType
duplicateTypeOnSameNativeImg()
Creates a newNativeType
which stores in the same physical array.long
get()
This method returns the value of the UnsignedLongType as a signed long.java.math.BigInteger
getBigInteger()
This method returns the unsigned representation of this UnsignedLongType as aBigInteger
.int
getInteger()
long
getIntegerLong()
java.math.BigInteger
getMaxBigIntegerValue()
Returns the true maximum value as a BigInteger, since it cannot be precisely represented as adouble
.double
getMaxValue()
The maximum value that can be stored isMath.pow( 2, 64 ) - 1
, which can't be represented with exact precision using a doubledouble
getMinValue()
int
hashCode()
void
inc()
void
mul(double c)
void
mul(float c)
void
mul(UnsignedLongType c)
void
set(long value)
void
set(java.math.BigInteger bi)
void
setBigInteger(java.math.BigInteger b)
void
setInteger(int f)
void
setInteger(long f)
void
setOne()
void
setZero()
void
sub(UnsignedLongType c)
java.lang.String
toString()
-
Methods inherited from class net.imglib2.type.numeric.integer.GenericLongType
decIndex, decIndex, getBitsPerPixel, getEntitiesPerPixel, getIndex, getLong, getValue, incIndex, incIndex, set, setLong, setValue, updateContainer, updateIndex, valueEquals
-
Methods inherited from class net.imglib2.type.numeric.integer.AbstractIntegerType
getMinIncrement, getRealDouble, getRealFloat, setReal, setReal
-
Methods inherited from class net.imglib2.type.numeric.real.AbstractRealType
equals, getImaginaryDouble, getImaginaryFloat, getPhaseDouble, getPhaseFloat, getPowerDouble, getPowerFloat, setImaginary, setImaginary
-
Methods inherited from class net.imglib2.type.numeric.complex.AbstractComplexType
complexConjugate, setComplexNumber, setComplexNumber
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.imglib2.type.numeric.ComplexType
complexConjugate, getImaginaryDouble, getImaginaryFloat, getPhaseDouble, getPhaseFloat, getPowerDouble, getPowerFloat, setComplexNumber, setComplexNumber, setImaginary, setImaginary
-
-
-
-
Constructor Detail
-
UnsignedLongType
public UnsignedLongType(NativeImg<?,? extends LongAccess> img)
-
UnsignedLongType
public UnsignedLongType(long value)
-
UnsignedLongType
public UnsignedLongType(java.math.BigInteger value)
-
UnsignedLongType
public UnsignedLongType(LongAccess access)
-
UnsignedLongType
public UnsignedLongType()
-
-
Method Detail
-
createSuitableNativeImg
public NativeImg<UnsignedLongType,? extends LongAccess> createSuitableNativeImg(NativeImgFactory<UnsignedLongType> storageFactory, long[] dim)
Description copied from interface:NativeType
TheNativeType
creates theNativeImg
used for storing image data; based on the given storage strategy and its size. It basically only decides here which BasicType it uses (float, int, byte, bit, ...) and how many entities per pixel it needs (e.g. 2 floats per pixel for a complex number). This enables the separation of containers and the basic types.
-
duplicateTypeOnSameNativeImg
public UnsignedLongType duplicateTypeOnSameNativeImg()
Description copied from interface:NativeType
Creates a newNativeType
which stores in the same physical array. This is only used internally.- Returns:
- a new
NativeType
instance working on the sameNativeImg
-
mul
public void mul(float c)
- Specified by:
mul
in interfaceMulFloatingPoint
- Overrides:
mul
in classGenericLongType<UnsignedLongType>
-
mul
public void mul(double c)
- Specified by:
mul
in interfaceMulFloatingPoint
- Overrides:
mul
in classGenericLongType<UnsignedLongType>
-
add
public void add(UnsignedLongType c)
- Specified by:
add
in interfaceAdd<UnsignedLongType>
- Overrides:
add
in classGenericLongType<UnsignedLongType>
-
div
public void div(UnsignedLongType c)
- Specified by:
div
in interfaceDiv<UnsignedLongType>
- Overrides:
div
in classGenericLongType<UnsignedLongType>
- See Also:
divide(long, long)
-
divide
public static final long divide(long d1, long d2)
Unsigned division ofd1
byd2
. See "Division by Invariant Integers using Multiplication", by Torbjorn Granlund and Peter L. Montgomery, 1994. http://gmplib.org/~tege/divcnst-pldi94.pdf- Throws:
java.lang.ArithmeticException
- when c equals zero.
-
mul
public void mul(UnsignedLongType c)
- Specified by:
mul
in interfaceMul<UnsignedLongType>
- Overrides:
mul
in classGenericLongType<UnsignedLongType>
-
sub
public void sub(UnsignedLongType c)
- Specified by:
sub
in interfaceSub<UnsignedLongType>
- Overrides:
sub
in classGenericLongType<UnsignedLongType>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classGenericLongType<UnsignedLongType>
-
setOne
public void setOne()
- Specified by:
setOne
in interfaceSetOne
- Overrides:
setOne
in classGenericLongType<UnsignedLongType>
-
setZero
public void setZero()
- Specified by:
setZero
in interfaceSetZero
- Overrides:
setZero
in classGenericLongType<UnsignedLongType>
-
inc
public void inc()
- Specified by:
inc
in interfaceRealType<UnsignedLongType>
- Overrides:
inc
in classGenericLongType<UnsignedLongType>
-
dec
public void dec()
- Specified by:
dec
in interfaceRealType<UnsignedLongType>
- Overrides:
dec
in classGenericLongType<UnsignedLongType>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classGenericLongType<UnsignedLongType>
-
get
public long get()
This method returns the value of the UnsignedLongType as a signed long. To get the unsigned value, usegetBigInteger()
.
-
getBigInteger
public java.math.BigInteger getBigInteger()
This method returns the unsigned representation of this UnsignedLongType as aBigInteger
.
-
set
public void set(long value)
-
getInteger
public int getInteger()
-
getIntegerLong
public long getIntegerLong()
-
setInteger
public void setInteger(int f)
-
setInteger
public void setInteger(long f)
-
setBigInteger
public void setBigInteger(java.math.BigInteger b)
-
set
public void set(java.math.BigInteger bi)
-
getMaxValue
public double getMaxValue()
The maximum value that can be stored isMath.pow( 2, 64 ) - 1
, which can't be represented with exact precision using a double
-
getMaxBigIntegerValue
public java.math.BigInteger getMaxBigIntegerValue()
Returns the true maximum value as a BigInteger, since it cannot be precisely represented as adouble
.
-
getMinValue
public double getMinValue()
-
compareTo
public int compareTo(UnsignedLongType c)
- Specified by:
compareTo
in interfacejava.lang.Comparable<UnsignedLongType>
- Overrides:
compareTo
in classGenericLongType<UnsignedLongType>
-
compare
public static final int compare(long a, long b)
- Parameters:
a
-b
-- Returns:
- -1 if
a < b
, 0 ifa == b
, 1 ifa > b
.
-
createVariable
public UnsignedLongType createVariable()
Description copied from interface:Type
Creates a newType
variable which can only store one value.- Returns:
- a new
Type
variable
-
copy
public UnsignedLongType copy()
Description copied from interface:Type
- Returns:
- a new
Type
variable
-
-