Class BasePairCharType
- java.lang.Object
-
- net.imglib2.type.AbstractNativeType<BasePairCharType>
-
- net.imglib2.type.label.BasePairCharType
-
- All Implemented Interfaces:
java.lang.Comparable<BasePairCharType>,BasePairType<BasePairCharType>,NativeType<BasePairCharType>,ValueEquals<BasePairCharType>,Type<BasePairCharType>
public class BasePairCharType extends AbstractNativeType<BasePairCharType> implements BasePairType<BasePairCharType>
Representation of base pairs using one char per entry, supported characters: gap, N, A, T, G, C, U Bases are handled using theBasePairBitType.Baseenumeration.
-
-
Field Summary
Fields Modifier and Type Field Description protected CharAccessdataAccessprotected NativeImg<?,? extends CharAccess>imgprivate static NativeTypeFactory<BasePairCharType,CharAccess>typeFactory-
Fields inherited from class net.imglib2.type.AbstractNativeType
i
-
-
Constructor Summary
Constructors Constructor Description BasePairCharType()BasePairCharType(char value)BasePairCharType(NativeImg<?,? extends CharAccess> charStorage)BasePairCharType(BasePairBitType.Base value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description bytebaseToValue()intcompareTo(BasePairCharType c)voidcomplement()BasePairCharTypecopy()BasePairCharTypecreateVariable()Creates a newTypevariable which can only store one value.BasePairCharTypeduplicateTypeOnSameNativeImg()Creates a newNativeTypewhich stores in the same physical array.BasePairBitType.Baseget()chargetChar()FractiongetEntitiesPerPixel()Get the number of entities in the storage array required to store one pixel value.NativeTypeFactory<BasePairCharType,CharAccess>getNativeTypeFactory()voidset(BasePairBitType.Base base)voidset(BasePairCharType c)Sets the value of anotherType.voidsetChar(char f)java.lang.StringtoString()voidupdateContainer(java.lang.Object c)This method is used by an accessor (e.g., aCursor) to request an update of the current data array.booleanvalueEquals(BasePairCharType t)-
Methods inherited from class net.imglib2.type.AbstractNativeType
index
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.imglib2.type.NativeType
decIndex, decIndex, getIndex, incIndex, incIndex, updateIndex
-
-
-
-
Field Detail
-
img
protected final NativeImg<?,? extends CharAccess> img
-
dataAccess
protected CharAccess dataAccess
-
typeFactory
private static final NativeTypeFactory<BasePairCharType,CharAccess> typeFactory
-
-
Constructor Detail
-
BasePairCharType
public BasePairCharType(NativeImg<?,? extends CharAccess> charStorage)
-
BasePairCharType
public BasePairCharType(BasePairBitType.Base value)
-
BasePairCharType
public BasePairCharType(char value)
-
BasePairCharType
public BasePairCharType()
-
-
Method Detail
-
getEntitiesPerPixel
public Fraction getEntitiesPerPixel()
Description copied from interface:NativeTypeGet the number of entities in the storage array required to store one pixel value. A pixel value may be spread over several or less than one entity. For example, a complex number may require 2 entries of a float[] array to store one pixel. Or a 12-bit type might need 12/64th entries of a long[] array.- Specified by:
getEntitiesPerPixelin interfaceNativeType<BasePairCharType>- Returns:
- the number of storage type entities required to store one pixel value.
-
updateContainer
public void updateContainer(java.lang.Object c)
Description copied from interface:NativeTypeThis method is used by an accessor (e.g., aCursor) to request an update of the current data array.As an example consider a
CellCursormoving on aCellImg. The cursor maintains aNativeTypewhich provides access to the image data. When the cursor moves from one cell to the next, the underlying data array of theNativeTypemust be switched to the data array of the new cell.To achieve this, the
CellCursorcallsupdateContainer()with itself as the argument.updateContainer()in turn will callNativeImg.update(Object)on it's container, passing along the reference to the cursor. In this example, the container would be aCellImg. While theNativeTypedoes not know about the type of the cursor, the container does.CellImgknows that it is passed aCellCursorinstance, which can be used to figure out the current cell and the underlying data array, which is then returned to theNativeType.The idea behind this concept is maybe not obvious. The
NativeTypeknows 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 ofNativeType.- Specified by:
updateContainerin interfaceNativeType<BasePairCharType>- Parameters:
c- reference to an accessor which can be passed on to the container (which will know what to do with it).
-
duplicateTypeOnSameNativeImg
public BasePairCharType duplicateTypeOnSameNativeImg()
Description copied from interface:NativeTypeCreates a newNativeTypewhich stores in the same physical array. This is only used internally.- Specified by:
duplicateTypeOnSameNativeImgin interfaceNativeType<BasePairCharType>- Returns:
- a new
NativeTypeinstance working on the sameNativeImg
-
getNativeTypeFactory
public NativeTypeFactory<BasePairCharType,CharAccess> getNativeTypeFactory()
- Specified by:
getNativeTypeFactoryin interfaceNativeType<BasePairCharType>
-
getChar
public char getChar()
-
setChar
public void setChar(char f)
-
set
public void set(BasePairBitType.Base base)
- Specified by:
setin interfaceBasePairType<BasePairCharType>
-
get
public BasePairBitType.Base get()
- Specified by:
getin interfaceBasePairType<BasePairCharType>
-
set
public void set(BasePairCharType c)
Description copied from interface:TypeSets the value of anotherType.- Specified by:
setin interfaceType<BasePairCharType>- Parameters:
c- the new value
-
compareTo
public int compareTo(BasePairCharType c)
- Specified by:
compareToin interfacejava.lang.Comparable<BasePairCharType>
-
complement
public void complement()
- Specified by:
complementin interfaceBasePairType<BasePairCharType>
-
baseToValue
public byte baseToValue()
- Specified by:
baseToValuein interfaceBasePairType<BasePairCharType>
-
createVariable
public BasePairCharType createVariable()
Description copied from interface:TypeCreates a newTypevariable which can only store one value.- Specified by:
createVariablein interfaceType<BasePairCharType>- Returns:
- a new
Typevariable
-
copy
public BasePairCharType copy()
Description copied from interface:Type- Specified by:
copyin interfaceType<BasePairCharType>- Returns:
- a new
Typevariable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
valueEquals
public boolean valueEquals(BasePairCharType t)
- Specified by:
valueEqualsin interfaceValueEquals<BasePairCharType>
-
-