public class BasePairBitType extends TypeImpl<BasePairBitType> implements BasePairType<BasePairBitType>
Modifier and Type | Class and Description |
---|---|
static class |
BasePairBitType.Base |
Constructor and Description |
---|
BasePairBitType() |
BasePairBitType(BasePairBitType.Base value) |
BasePairBitType(DirectAccessContainer<BasePairBitType,? extends BitAccess> bitStorage) |
Modifier and Type | Method and Description |
---|---|
byte |
baseToValue() |
int |
compareTo(BasePairBitType c) |
void |
complement() |
BasePairBitType |
copy()
|
BasePairBitType[] |
createArray1D(int size1)
Creates a 1d array of the generic
Type |
BasePairBitType[][] |
createArray2D(int size1,
int size2)
Creates a 2d array of the generic
Type |
BasePairBitType[][][] |
createArray3D(int size1,
int size2,
int size3)
Creates a 3d array of the generic
Type |
DirectAccessContainer<BasePairBitType,? extends BitAccess> |
createSuitableDirectAccessContainer(DirectAccessContainerFactory storageFactory,
int[] dim)
The
Type creates the DirectAccessContainer used for storing image data; based on the given storage strategy and its size. |
BasePairBitType |
createVariable()
Creates a new
Type which can only store one value. |
void |
decIndex()
Decreases the array index,
this is called by the
Cursor s which iterate over the image. |
void |
decIndex(int decrement)
Decreases the index by increment steps,
this is called by the
Cursor s which iterate over the image. |
BasePairBitType |
duplicateTypeOnSameDirectAccessContainer()
Creates a new
Type which stores in the same physical array. |
BasePairBitType.Base |
get() |
Display<BasePairBitType> |
getDefaultDisplay(Image<BasePairBitType> image)
|
int |
getEntitiesPerPixel() |
void |
incIndex()
Increases the array index,
this is called by the
Cursor s which iterate over the image. |
void |
incIndex(int increment)
Increases the index by increment steps,
this is called by the
Cursor s which iterate over the image. |
void |
set(BasePairBitType.Base base) |
void |
set(BasePairBitType c)
Sets the value of another
Type . |
String |
toString() |
void |
updateContainer(Cursor<?> c)
|
void |
updateIndex(int i)
Set the array position of the
Type . |
public BasePairBitType(DirectAccessContainer<BasePairBitType,? extends BitAccess> bitStorage)
public BasePairBitType(BasePairBitType.Base value)
public BasePairBitType()
public int getEntitiesPerPixel()
getEntitiesPerPixel
in interface Type<BasePairBitType>
public DirectAccessContainer<BasePairBitType,? extends BitAccess> 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<BasePairBitType>
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<BasePairBitType>
c
- - the Cursor
gives a link to itself so that the Type
tell its DataAccess
to get the new basic type array.public BasePairBitType duplicateTypeOnSameDirectAccessContainer()
Type
Type
which stores in the same physical array. This is only used internally.duplicateTypeOnSameDirectAccessContainer
in interface Type<BasePairBitType>
Type
instance working on the same DirectAccessContainer
public void updateIndex(int i)
Type
Type
.updateIndex
in interface Type<BasePairBitType>
updateIndex
in class TypeImpl<BasePairBitType>
i
- - index valuepublic void incIndex()
Type
Cursor
s which iterate over the image.incIndex
in interface Type<BasePairBitType>
incIndex
in class TypeImpl<BasePairBitType>
public void incIndex(int increment)
Type
Cursor
s which iterate over the image.incIndex
in interface Type<BasePairBitType>
incIndex
in class TypeImpl<BasePairBitType>
increment
- - how many stepspublic void decIndex()
Type
Cursor
s which iterate over the image.decIndex
in interface Type<BasePairBitType>
decIndex
in class TypeImpl<BasePairBitType>
public void decIndex(int decrement)
Type
Cursor
s which iterate over the image.decIndex
in interface Type<BasePairBitType>
decIndex
in class TypeImpl<BasePairBitType>
public Display<BasePairBitType> getDefaultDisplay(Image<BasePairBitType> 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<BasePairBitType>
image
- - the image to create the Display
forDisplay
public void set(BasePairBitType.Base base)
set
in interface BasePairType<BasePairBitType>
public BasePairBitType.Base get()
get
in interface BasePairType<BasePairBitType>
public int compareTo(BasePairBitType c)
compareTo
in interface Comparable<BasePairBitType>
public void complement()
complement
in interface BasePairType<BasePairBitType>
public byte baseToValue()
baseToValue
in interface BasePairType<BasePairBitType>
public void set(BasePairBitType c)
Type
Type
.set
in interface Type<BasePairBitType>
c
- - the new valuepublic BasePairBitType[] createArray1D(int size1)
Type
Type
createArray1D
in interface Type<BasePairBitType>
size1
- - the size of the arraypublic BasePairBitType[][] createArray2D(int size1, int size2)
Type
Type
createArray2D
in interface Type<BasePairBitType>
size1
- - the size of the arraysize2
- - the size of the arraypublic BasePairBitType[][][] createArray3D(int size1, int size2, int size3)
Type
Type
createArray3D
in interface Type<BasePairBitType>
size1
- - the size of the arraysize2
- - the size of the arraysize3
- - the size of the arraypublic BasePairBitType createVariable()
Type
Type
which can only store one value.createVariable
in interface Type<BasePairBitType>
Type
instancepublic BasePairBitType copy()
Type
copy
in interface Type<BasePairBitType>
copy
in class TypeImpl<BasePairBitType>
Type
instancepublic String toString()
toString
in class TypeImpl<BasePairBitType>
Copyright © 2015–2021 Fiji. All rights reserved.