public class BasePairCharType extends AbstractNativeType<BasePairCharType> implements BasePairType<BasePairCharType>
BasePairBitType.Base
enumeration.Modifier and Type | Field and Description |
---|---|
protected CharAccess |
dataAccess |
protected NativeImg<?,? extends CharAccess> |
img |
i
Constructor and Description |
---|
BasePairCharType() |
BasePairCharType(BasePairBitType.Base value) |
BasePairCharType(char value) |
BasePairCharType(NativeImg<?,? extends CharAccess> charStorage) |
Modifier and Type | Method and Description |
---|---|
byte |
baseToValue() |
int |
compareTo(BasePairCharType c) |
void |
complement() |
BasePairCharType |
copy()
|
NativeImg<BasePairCharType,? extends CharAccess> |
createSuitableNativeImg(NativeImgFactory<BasePairCharType> storageFactory,
long[] dim)
The
NativeType creates the NativeImg used for storing
image data; based on the given storage strategy and its size. |
BasePairCharType |
createVariable()
Creates a new
Type variable which can only store one value. |
BasePairCharType |
duplicateTypeOnSameNativeImg()
Creates a new
NativeType which stores in the same physical array. |
BasePairBitType.Base |
get() |
char |
getChar() |
Fraction |
getEntitiesPerPixel()
Get the number of entities in the storage array required to store one
pixel value.
|
void |
set(BasePairBitType.Base base) |
void |
set(BasePairCharType c)
Sets the value of another
Type . |
void |
setChar(char f) |
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(BasePairCharType t) |
decIndex, decIndex, getIndex, incIndex, incIndex, updateIndex
protected final NativeImg<?,? extends CharAccess> img
protected CharAccess dataAccess
public BasePairCharType(NativeImg<?,? extends CharAccess> charStorage)
public BasePairCharType(BasePairBitType.Base value)
public BasePairCharType(char value)
public BasePairCharType()
public Fraction getEntitiesPerPixel()
NativeType
getEntitiesPerPixel
in interface NativeType<BasePairCharType>
public NativeImg<BasePairCharType,? extends CharAccess> createSuitableNativeImg(NativeImgFactory<BasePairCharType> storageFactory, long[] dim)
NativeType
NativeType
creates the NativeImg
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.createSuitableNativeImg
in interface NativeType<BasePairCharType>
storageFactory
- which storage strategy is useddim
- the dimensionsNativeImg
where only the Type
knows the BasicType it contains.public void updateContainer(Object c)
NativeType
Cursor
) 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<BasePairCharType>
c
- reference to an accessor which can be passed on to the
container (which will know what to do with it).public BasePairCharType duplicateTypeOnSameNativeImg()
NativeType
NativeType
which stores in the same physical array.
This is only used internally.duplicateTypeOnSameNativeImg
in interface NativeType<BasePairCharType>
NativeType
instance working on the same
NativeImg
public char getChar()
public void setChar(char f)
public void set(BasePairBitType.Base base)
set
in interface BasePairType<BasePairCharType>
public BasePairBitType.Base get()
get
in interface BasePairType<BasePairCharType>
public void set(BasePairCharType c)
Type
Type
.set
in interface Type<BasePairCharType>
c
- the new valuepublic int compareTo(BasePairCharType c)
compareTo
in interface Comparable<BasePairCharType>
public void complement()
complement
in interface BasePairType<BasePairCharType>
public byte baseToValue()
baseToValue
in interface BasePairType<BasePairCharType>
public BasePairCharType createVariable()
Type
Type
variable which can only store one value.createVariable
in interface Type<BasePairCharType>
Type
variablepublic BasePairCharType copy()
Type
copy
in interface Type<BasePairCharType>
Type
variablepublic String toString()
toString
in class AbstractNativeType<BasePairCharType>
public boolean valueEquals(BasePairCharType t)
valueEquals
in interface ValueEquals<BasePairCharType>
Copyright © 2009–2017 ImgLib2. All rights reserved.