Package com.bc.zarr
Class ArrayParams
- java.lang.Object
-
- com.bc.zarr.ArrayParams
-
public class ArrayParams extends Object
The class ArrayParams implements the Builder pattern. It is used on java side to imitate the pythonic default value feature for function arguments. So the recognition factor for users who are familiar with the python zarr framework should be high. E.g.: Python example:za = zarr.create( shape=(12, 10000, 5000), chunks=(12, 200, 200), dtype='>u4', compressor=Zlib(level=1), fill_value=-1)Java example:ZarrArray za = ZarrArray.create(new ArrayParams() .shape(12, 10000, 5000) .chunks(12, 200, 200) .dataType(DataType.u4) .byteOrder(ByteOrder.BIG_ENDIAN) .compressor(CompressorFactory.create("zlib", 1)) .fillValue(-1) );Shape must be given! If not given ... parameter default values are:boolean chunked = true; DataType dataType =
DataType.f8; ByteOrder byteOrder =ByteOrder.BIG_ENDIAN; Number fillValue = 0; Compressor compressor =CompressorFactory.createDefaultCompressor(); DimensionSeparator sep =DimensionSeparator.DOT;
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classArrayParams.ParamsArrayParamsbuilder static inner class.
-
Constructor Summary
Constructors Constructor Description ArrayParams()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArrayParamsbyteOrder(ByteOrder byteOrder)Sets the optionalbyteOrderand returns a reference to this Builder so that the methods can be chained together.ArrayParamschunked(boolean chunked)Sets the optionalchunkedand returns a reference to this Builder so that the methods can be chained together.ArrayParamschunks(int... chunks)Sets the optionalchunksand returns a reference to this Builder so that the methods can be chained together.ArrayParamscompressor(Compressor compressor)Sets the optionalcompressorand returns a reference to this Builder so that the methods can be chained together.ArrayParamsdataType(DataType dataType)Sets the optionaldataTypeand returns a reference to this Builder so that the methods can be chained together.ArrayParamsdimensionSeparator(DimensionSeparator sep)Sets the optionaldimension_separatorand returns a reference to this Builder so that the methods can be chained together.ArrayParamsfillValue(Number fillValue)Sets the optionalfillValueand returns a reference to this Builder so that the methods can be chained together.ArrayParamsshape(int... shape)Sets the mandatoryshapeand returns a reference to this Builder so that the methods can be chained together.
-
-
-
Method Detail
-
shape
public ArrayParams shape(int... shape)
Sets the mandatoryshapeand returns a reference to this Builder so that the methods can be chained together.- Parameters:
shape- theshapeto set- Returns:
- a reference to this Builder
-
chunks
public ArrayParams chunks(int... chunks)
Sets the optionalchunksand returns a reference to this Builder so that the methods can be chained together. The number of dimensions must be equal to the number of dimensions of the shape.- Parameters:
chunks- thechunksto set.- Returns:
- a reference to this Builder
-
chunked
public ArrayParams chunked(boolean chunked)
Sets the optionalchunkedand returns a reference to this Builder so that the methods can be chained together. If no chunks is given and chunked is true, chunks will be calculated using an heuristic algorithm. If chunked is false und no chunks are set, only one chunk with the full array shape will be created. Default value:true- Parameters:
chunked- thechunkedto set- Returns:
- a reference to this Builder
-
dataType
public ArrayParams dataType(DataType dataType)
Sets the optionaldataTypeand returns a reference to this Builder so that the methods can be chained together. Default value:DataType.f8- Parameters:
dataType- thedataTypeto set- Returns:
- a reference to this Builder
-
byteOrder
public ArrayParams byteOrder(ByteOrder byteOrder)
Sets the optionalbyteOrderand returns a reference to this Builder so that the methods can be chained together. Default value:ByteOrder.BIG_ENDIAN- Parameters:
byteOrder- thebyteOrderto set- Returns:
- a reference to this Builder
-
fillValue
public ArrayParams fillValue(Number fillValue)
Sets the optionalfillValueand returns a reference to this Builder so that the methods can be chained together. Default value:0- Parameters:
fillValue- thefillValueto set- Returns:
- a reference to this Builder
-
compressor
public ArrayParams compressor(Compressor compressor)
Sets the optionalcompressorand returns a reference to this Builder so that the methods can be chained together. An argumentnullwill be converted toCompressorFactory.nullCompressor. If this method is not used, the default compressorCompressorFactory.createDefaultCompressor()remains unchanged.- Parameters:
compressor- theCompressorto set ornull- Returns:
- a reference to this Builder
-
dimensionSeparator
public ArrayParams dimensionSeparator(DimensionSeparator sep)
Sets the optionaldimension_separatorand returns a reference to this Builder so that the methods can be chained together. An argumentnullwill be converted toDimensionSeparator.DOT. If this method is not used, the default separatorDimensionSeparator.DOTremains unchanged.- Parameters:
sep- theDimensionSeparatorto set ornull- Returns:
- a reference to this Builder
-
-