public class BasePairCharType extends TypeImpl<BasePairCharType> implements BasePairType<BasePairCharType>
Constructor and Description |
---|
BasePairCharType() |
BasePairCharType(BasePairBitType.Base value) |
BasePairCharType(char value) |
BasePairCharType(DirectAccessContainer<BasePairCharType,? extends CharAccess> charStorage) |
Modifier and Type | Method and Description |
---|---|
byte |
baseToValue() |
int |
compareTo(BasePairCharType c) |
void |
complement() |
BasePairCharType |
copy()
|
BasePairCharType[] |
createArray1D(int size1)
Creates a 1d array of the generic
Type |
BasePairCharType[][] |
createArray2D(int size1,
int size2)
Creates a 2d array of the generic
Type |
BasePairCharType[][][] |
createArray3D(int size1,
int size2,
int size3)
Creates a 3d array of the generic
Type |
DirectAccessContainer<BasePairCharType,? extends CharAccess> |
createSuitableDirectAccessContainer(DirectAccessContainerFactory storageFactory,
int[] dim)
The
Type creates the DirectAccessContainer used for storing image data; based on the given storage strategy and its size. |
BasePairCharType |
createVariable()
Creates a new
Type which can only store one value. |
BasePairCharType |
duplicateTypeOnSameDirectAccessContainer()
Creates a new
Type which stores in the same physical array. |
BasePairBitType.Base |
get() |
char |
getChar() |
BasePairTypeDisplay<BasePairCharType> |
getDefaultDisplay(Image<BasePairCharType> image)
|
int |
getEntitiesPerPixel() |
void |
set(BasePairBitType.Base base) |
void |
set(BasePairCharType c)
Sets the value of another
Type . |
void |
setChar(char f) |
String |
toString() |
void |
updateContainer(Cursor<?> c)
|
decIndex, decIndex, getIndex, incIndex, incIndex, updateIndex
public BasePairCharType(DirectAccessContainer<BasePairCharType,? extends CharAccess> charStorage)
public BasePairCharType(BasePairBitType.Base value)
public BasePairCharType(char value)
public BasePairCharType()
public int getEntitiesPerPixel()
getEntitiesPerPixel
in interface Type<BasePairCharType>
public DirectAccessContainer<BasePairCharType,? extends CharAccess> createSuitableDirectAccessContainer(DirectAccessContainerFactory storageFactory, int[] dim)
Type
Type
creates the DirectAccessContainer 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 Image
and the basic types.createSuitableDirectAccessContainer
in interface Type<BasePairCharType>
storageFactory
- - Which storage strategy is useddim
- - the dimensionsType
knowns the BasicType it contains.public void updateContainer(Cursor<?> c)
Type
Cursor
s to update the data current data array
of the Type
, for example when moving from one Cell
to the next.
If it is only an Array
the Cursor
s never have to call that function.
The idea behind this concept is maybe not obvious. The Type
knows which basic type
is used (float, int, byte, ...) but does not know how it is stored (Array
, CellDirectAccessContainer
, ...) to
prevent multiple implementations of Type
.
That's why Type
asks the DataAccess
to give the actual basic array by passing the Cursor
that calls the method. The DataAccess
is also an Array
, CellDirectAccessContainer
, ... which
can then communicate with the ArrayCursor
, CellCursor
, ... and return the current basic type array.
A typical implementation of this method looks like that (this is the FloatType
implementation):
float[] v = floatStorage.getCurrentStorageArray( c );updateContainer
in interface Type<BasePairCharType>
c
- - the Cursor
gives a link to itself so that the Type
tell its DataAccess
to get the new basic type array.public BasePairCharType duplicateTypeOnSameDirectAccessContainer()
Type
Type
which stores in the same physical array. This is only used internally.duplicateTypeOnSameDirectAccessContainer
in interface Type<BasePairCharType>
Type
instance working on the same DirectAccessContainer
public BasePairTypeDisplay<BasePairCharType> getDefaultDisplay(Image<BasePairCharType> image)
Type
Type
creates the default Display
for displaying the image contents. Only Type
can do this as in Image
the Type
is only a Generic. Later the user can create its own Display
s if wanted.
This could be basically a static function.getDefaultDisplay
in interface Type<BasePairCharType>
image
- - the image to create the Display
forDisplay
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[] createArray1D(int size1)
Type
Type
createArray1D
in interface Type<BasePairCharType>
size1
- - the size of the arraypublic BasePairCharType[][] createArray2D(int size1, int size2)
Type
Type
createArray2D
in interface Type<BasePairCharType>
size1
- - the size of the arraysize2
- - the size of the arraypublic BasePairCharType[][][] createArray3D(int size1, int size2, int size3)
Type
Type
createArray3D
in interface Type<BasePairCharType>
size1
- - the size of the arraysize2
- - the size of the arraysize3
- - the size of the arraypublic BasePairCharType createVariable()
Type
Type
which can only store one value.createVariable
in interface Type<BasePairCharType>
Type
instancepublic BasePairCharType copy()
Type
copy
in interface Type<BasePairCharType>
copy
in class TypeImpl<BasePairCharType>
Type
instancepublic String toString()
toString
in class TypeImpl<BasePairCharType>
Copyright © 2015–2021 Fiji. All rights reserved.