Package net.imglib2.type.numeric.integer
Class UnsignedVariableBitLengthType
- java.lang.Object
-
- net.imglib2.type.AbstractBitType<T>
-
- net.imglib2.type.AbstractBit64Type<UnsignedVariableBitLengthType>
-
- net.imglib2.type.numeric.integer.UnsignedVariableBitLengthType
-
- All Implemented Interfaces:
java.lang.Comparable<UnsignedVariableBitLengthType>,NativeType<UnsignedVariableBitLengthType>,ComplexType<UnsignedVariableBitLengthType>,IntegerType<UnsignedVariableBitLengthType>,NumericType<UnsignedVariableBitLengthType>,RealType<UnsignedVariableBitLengthType>,Add<UnsignedVariableBitLengthType>,Div<UnsignedVariableBitLengthType>,Mul<UnsignedVariableBitLengthType>,MulFloatingPoint,Pow<UnsignedVariableBitLengthType>,PowFloatingPoint,SetOne,SetZero,Sub<UnsignedVariableBitLengthType>,ValueEquals<UnsignedVariableBitLengthType>,Type<UnsignedVariableBitLengthType>
public class UnsignedVariableBitLengthType extends AbstractBit64Type<UnsignedVariableBitLengthType> implements IntegerType<UnsignedVariableBitLengthType>
ATypewith arbitrary bit depth up to maximum 64 bits. The behavior beyond 64 bits is undefined. The performance of this type is traded off for the gain in memory storage. Theset(long)operation takes have the time as theget()operation. The performance may degrade very slightly with increasing bit depth, but the decrease is barely noticeable.
-
-
Field Summary
Fields Modifier and Type Field Description private NativeTypeFactory<UnsignedVariableBitLengthType,LongAccess>typeFactory-
Fields inherited from class net.imglib2.type.AbstractBitType
dataAccess, i, img, nBits
-
-
Constructor Summary
Constructors Constructor Description UnsignedVariableBitLengthType(int nBits)UnsignedVariableBitLengthType(long value, int nBits)UnsignedVariableBitLengthType(LongAccess access, int nBits)UnsignedVariableBitLengthType(NativeImg<?,? extends LongAccess> bitStorage, int nBits)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(UnsignedVariableBitLengthType t)intcompareTo(UnsignedVariableBitLengthType t)voidcomplexConjugate()UnsignedVariableBitLengthTypecopy()UnsignedVariableBitLengthTypecreateVariable()Creates a newTypevariable which can only store one value.voiddec()voiddiv(UnsignedVariableBitLengthType t)UnsignedVariableBitLengthTypeduplicateTypeOnSameNativeImg()Creates a newNativeTypewhich stores in the same physical array.booleanequals(java.lang.Object obj)longget()java.math.BigIntegergetBigInteger()intgetBitsPerPixel()doublegetImaginaryDouble()floatgetImaginaryFloat()intgetInteger()longgetIntegerLong()doublegetMaxValue()The maximum value that can be stored isMath.pow(2, nBits) -1.doublegetMinIncrement()doublegetMinValue()NativeTypeFactory<UnsignedVariableBitLengthType,LongAccess>getNativeTypeFactory()doublegetPhaseDouble()floatgetPhaseFloat()doublegetPowerDouble()floatgetPowerFloat()doublegetRealDouble()floatgetRealFloat()inthashCode()voidinc()voidmul(double c)voidmul(float c)voidmul(UnsignedVariableBitLengthType t)voidpow(double power)voidpow(UnsignedVariableBitLengthType c)voidset(long value)voidset(UnsignedVariableBitLengthType c)Sets the value of anotherType.voidsetBigInteger(java.math.BigInteger b)voidsetComplexNumber(double r, double i)voidsetComplexNumber(float r, float i)voidsetImaginary(double complex)voidsetImaginary(float complex)voidsetInteger(int f)voidsetInteger(long f)voidsetOne()voidsetReal(double real)voidsetReal(float real)voidsetZero()voidsub(UnsignedVariableBitLengthType t)java.lang.StringtoString()booleanvalueEquals(UnsignedVariableBitLengthType t)Default test at long precision.-
Methods inherited from class net.imglib2.type.AbstractBit64Type
getBits, setBits
-
Methods inherited from class net.imglib2.type.AbstractBitType
getEntitiesPerPixel, index, updateContainer
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.imglib2.type.NativeType
decIndex, decIndex, getIndex, incIndex, incIndex, updateIndex
-
-
-
-
Field Detail
-
typeFactory
private final NativeTypeFactory<UnsignedVariableBitLengthType,LongAccess> typeFactory
-
-
Constructor Detail
-
UnsignedVariableBitLengthType
public UnsignedVariableBitLengthType(NativeImg<?,? extends LongAccess> bitStorage, int nBits)
-
UnsignedVariableBitLengthType
public UnsignedVariableBitLengthType(long value, int nBits)
-
UnsignedVariableBitLengthType
public UnsignedVariableBitLengthType(LongAccess access, int nBits)
-
UnsignedVariableBitLengthType
public UnsignedVariableBitLengthType(int nBits)
-
-
Method Detail
-
set
public void set(long value)
-
get
public long get()
-
set
public void set(UnsignedVariableBitLengthType c)
Description copied from interface:TypeSets the value of anotherType.- Specified by:
setin interfaceType<UnsignedVariableBitLengthType>- Parameters:
c- the new value
-
duplicateTypeOnSameNativeImg
public UnsignedVariableBitLengthType duplicateTypeOnSameNativeImg()
Description copied from interface:NativeTypeCreates a newNativeTypewhich stores in the same physical array. This is only used internally.- Specified by:
duplicateTypeOnSameNativeImgin interfaceNativeType<UnsignedVariableBitLengthType>- Returns:
- a new
NativeTypeinstance working on the sameNativeImg
-
getNativeTypeFactory
public NativeTypeFactory<UnsignedVariableBitLengthType,LongAccess> getNativeTypeFactory()
- Specified by:
getNativeTypeFactoryin interfaceNativeType<UnsignedVariableBitLengthType>- Specified by:
getNativeTypeFactoryin classAbstractBitType<UnsignedVariableBitLengthType>
-
createVariable
public UnsignedVariableBitLengthType createVariable()
Description copied from interface:TypeCreates a newTypevariable which can only store one value.- Specified by:
createVariablein interfaceType<UnsignedVariableBitLengthType>- Returns:
- a new
Typevariable
-
copy
public UnsignedVariableBitLengthType copy()
Description copied from interface:Type- Specified by:
copyin interfaceType<UnsignedVariableBitLengthType>- Returns:
- a new
Typevariable
-
div
public void div(UnsignedVariableBitLengthType t)
- Specified by:
divin interfaceDiv<UnsignedVariableBitLengthType>- See Also:
UnsignedLongType.divide(long, long)
-
mul
public void mul(float c)
- Specified by:
mulin interfaceMulFloatingPoint
-
mul
public void mul(double c)
- Specified by:
mulin interfaceMulFloatingPoint
-
getRealFloat
public float getRealFloat()
- Specified by:
getRealFloatin interfaceComplexType<UnsignedVariableBitLengthType>
-
getRealDouble
public double getRealDouble()
- Specified by:
getRealDoublein interfaceComplexType<UnsignedVariableBitLengthType>
-
setReal
public void setReal(float real)
- Specified by:
setRealin interfaceComplexType<UnsignedVariableBitLengthType>
-
setReal
public void setReal(double real)
- Specified by:
setRealin interfaceComplexType<UnsignedVariableBitLengthType>
-
getBitsPerPixel
public int getBitsPerPixel()
- Specified by:
getBitsPerPixelin interfaceRealType<UnsignedVariableBitLengthType>
-
getMinIncrement
public double getMinIncrement()
- Specified by:
getMinIncrementin interfaceRealType<UnsignedVariableBitLengthType>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getInteger
public int getInteger()
- Specified by:
getIntegerin interfaceIntegerType<UnsignedVariableBitLengthType>
-
getIntegerLong
public long getIntegerLong()
- Specified by:
getIntegerLongin interfaceIntegerType<UnsignedVariableBitLengthType>
-
getBigInteger
public java.math.BigInteger getBigInteger()
- Specified by:
getBigIntegerin interfaceIntegerType<UnsignedVariableBitLengthType>
-
setInteger
public void setInteger(int f)
- Specified by:
setIntegerin interfaceIntegerType<UnsignedVariableBitLengthType>
-
setInteger
public void setInteger(long f)
- Specified by:
setIntegerin interfaceIntegerType<UnsignedVariableBitLengthType>
-
setBigInteger
public void setBigInteger(java.math.BigInteger b)
- Specified by:
setBigIntegerin interfaceIntegerType<UnsignedVariableBitLengthType>
-
getMaxValue
public double getMaxValue()
The maximum value that can be stored isMath.pow(2, nBits) -1.- Specified by:
getMaxValuein interfaceRealType<UnsignedVariableBitLengthType>
-
getMinValue
public double getMinValue()
- Specified by:
getMinValuein interfaceRealType<UnsignedVariableBitLengthType>
-
inc
public void inc()
- Specified by:
incin interfaceRealType<UnsignedVariableBitLengthType>
-
dec
public void dec()
- Specified by:
decin interfaceRealType<UnsignedVariableBitLengthType>
-
add
public void add(UnsignedVariableBitLengthType t)
- Specified by:
addin interfaceAdd<UnsignedVariableBitLengthType>
-
sub
public void sub(UnsignedVariableBitLengthType t)
- Specified by:
subin interfaceSub<UnsignedVariableBitLengthType>
-
mul
public void mul(UnsignedVariableBitLengthType t)
- Specified by:
mulin interfaceMul<UnsignedVariableBitLengthType>
-
pow
public void pow(UnsignedVariableBitLengthType c)
- Specified by:
powin interfacePow<UnsignedVariableBitLengthType>
-
pow
public void pow(double power)
- Specified by:
powin interfacePowFloatingPoint
-
getImaginaryFloat
public float getImaginaryFloat()
- Specified by:
getImaginaryFloatin interfaceComplexType<UnsignedVariableBitLengthType>
-
getImaginaryDouble
public double getImaginaryDouble()
- Specified by:
getImaginaryDoublein interfaceComplexType<UnsignedVariableBitLengthType>
-
setImaginary
public void setImaginary(float complex)
- Specified by:
setImaginaryin interfaceComplexType<UnsignedVariableBitLengthType>
-
setImaginary
public void setImaginary(double complex)
- Specified by:
setImaginaryin interfaceComplexType<UnsignedVariableBitLengthType>
-
getPhaseFloat
public float getPhaseFloat()
- Specified by:
getPhaseFloatin interfaceComplexType<UnsignedVariableBitLengthType>
-
getPhaseDouble
public double getPhaseDouble()
- Specified by:
getPhaseDoublein interfaceComplexType<UnsignedVariableBitLengthType>
-
getPowerFloat
public float getPowerFloat()
- Specified by:
getPowerFloatin interfaceComplexType<UnsignedVariableBitLengthType>
-
getPowerDouble
public double getPowerDouble()
- Specified by:
getPowerDoublein interfaceComplexType<UnsignedVariableBitLengthType>
-
setComplexNumber
public void setComplexNumber(float r, float i)- Specified by:
setComplexNumberin interfaceComplexType<UnsignedVariableBitLengthType>
-
setComplexNumber
public void setComplexNumber(double r, double i)- Specified by:
setComplexNumberin interfaceComplexType<UnsignedVariableBitLengthType>
-
complexConjugate
public void complexConjugate()
- Specified by:
complexConjugatein interfaceComplexType<UnsignedVariableBitLengthType>
-
compareTo
public int compareTo(UnsignedVariableBitLengthType t)
- Specified by:
compareToin interfacejava.lang.Comparable<UnsignedVariableBitLengthType>
-
valueEquals
public boolean valueEquals(UnsignedVariableBitLengthType t)
Default test at long precision. Please override for types longer than 64bit.- Specified by:
valueEqualsin interfaceValueEquals<UnsignedVariableBitLengthType>- Parameters:
t-- Returns:
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-