Package ucar.nc2
Class Variable.Builder<T extends Variable.Builder<T>>
- java.lang.Object
-
- ucar.nc2.Variable.Builder<T>
-
- Direct Known Subclasses:
Structure.Builder
,VariableDS.Builder
- Enclosing class:
- Variable
public abstract static class Variable.Builder<T extends Variable.Builder<T>> extends Object
A builder for Variables.
-
-
Field Summary
Fields Modifier and Type Field Description Variable.Cache
cache
DataType
dataType
NetcdfFile
ncfile
protected Group.Builder
parentBuilder
protected Structure.Builder<?>
parentStructureBuilder
ProxyReader
proxyReader
String
shortName
Object
spiObject
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description T
addAttribute(Attribute att)
T
addAttributes(Iterable<Attribute> atts)
T
addDimension(Dimension dim)
T
addDimensions(Collection<Dimension> dims)
Variable
build(Group parentGroup)
Normally this is called by Group.build()Variable.Builder<?>
copy()
T
copyFrom(Variable orgVar)
TODO Copy metadata from orgVar.T
copyFrom(Variable.Builder<?> builder)
AttributeContainerMutable
getAttributeContainer()
String
getDimensionName(int index)
Iterable<String>
getDimensionNames()
com.google.common.collect.ImmutableList<Dimension>
getDimensions()
com.google.common.collect.ImmutableSet<String>
getDimensionsAll()
int
getElementSize()
String
getEnumTypeName()
String
getFirstDimensionName()
String
getFullName()
Group.Builder
getParentGroupBuilder()
Structure.Builder<?>
getParentStructureBuilder()
int
getRank()
String
makeDimensionsString()
Variable.Builder<?>
makeSliceBuilder(int dim, int index)
Create a new Variable.Builder that is a logical slice of this one, by fixing the specified dimension at the specified index value.boolean
replaceDimensionByName(Dimension dim)
Find the dimension with the same name as dim, and replace it with dimT
resetCache()
protected abstract T
self()
T
setAutoGen(double start, double incr)
T
setCachedData(Array cacheData, boolean isMetadata)
T
setCaching(boolean caching)
T
setDataType(DataType dataType)
T
setDimensions(List<Dimension> dims)
T
setDimensionsAnonymous(int[] shape)
Set the dimensions using all anonymous (unshared) dimensionsT
setDimensionsByName(String dimString)
Set dimensions by name.T
setElementSize(int elementSize)
T
setEnumTypeName(String enumTypeName)
T
setIsScalar()
T
setName(String shortName)
T
setNcfile(NetcdfFile ncfile)
T
setParentGroupBuilder(Group.Builder parent)
T
setProxyReader(ProxyReader proxy)
T
setSPobject(Object spiObject)
String
toString()
-
-
-
Field Detail
-
shortName
public String shortName
-
dataType
public DataType dataType
-
ncfile
public NetcdfFile ncfile
-
parentBuilder
protected Group.Builder parentBuilder
-
parentStructureBuilder
protected Structure.Builder<?> parentStructureBuilder
-
spiObject
public Object spiObject
-
proxyReader
public ProxyReader proxyReader
-
cache
public Variable.Cache cache
-
-
Method Detail
-
self
protected abstract T self()
-
getAttributeContainer
public AttributeContainerMutable getAttributeContainer()
-
addDimensions
public T addDimensions(Collection<Dimension> dims)
-
replaceDimensionByName
public boolean replaceDimensionByName(Dimension dim)
Find the dimension with the same name as dim, and replace it with dim
-
setDimensionsByName
public T setDimensionsByName(String dimString)
Set dimensions by name. The parent group builder must be set.
-
getFirstDimensionName
@Nullable public String getFirstDimensionName()
-
getDimensionName
@Nullable public String getDimensionName(int index)
-
makeDimensionsString
public String makeDimensionsString()
-
setDimensionsAnonymous
public T setDimensionsAnonymous(int[] shape)
Set the dimensions using all anonymous (unshared) dimensions- Parameters:
shape
- defines the dimension lengths. must be > 0, or -1 for VLEN- Throws:
RuntimeException
- if any shape < 1 and not -1.
-
getDimensions
public com.google.common.collect.ImmutableList<Dimension> getDimensions()
-
getDimensionsAll
public com.google.common.collect.ImmutableSet<String> getDimensionsAll()
-
setIsScalar
public T setIsScalar()
-
getRank
public int getRank()
-
getEnumTypeName
public String getEnumTypeName()
-
getElementSize
public int getElementSize()
-
setElementSize
public T setElementSize(int elementSize)
-
setNcfile
public T setNcfile(NetcdfFile ncfile)
-
getFullName
public String getFullName()
-
setParentGroupBuilder
public T setParentGroupBuilder(Group.Builder parent)
-
getParentGroupBuilder
public Group.Builder getParentGroupBuilder()
-
getParentStructureBuilder
public Structure.Builder<?> getParentStructureBuilder()
-
setProxyReader
public T setProxyReader(ProxyReader proxy)
-
setAutoGen
public T setAutoGen(double start, double incr)
-
resetCache
public T resetCache()
-
setCaching
public T setCaching(boolean caching)
-
makeSliceBuilder
public Variable.Builder<?> makeSliceBuilder(int dim, int index)
Create a new Variable.Builder that is a logical slice of this one, by fixing the specified dimension at the specified index value.- Parameters:
dim
- which dimension to fixindex
- at what index value
-
copy
public Variable.Builder<?> copy()
-
copyFrom
public T copyFrom(Variable.Builder<?> builder)
-
-