Package ucar.nc2
Class Group.Builder
java.lang.Object
ucar.nc2.Group.Builder
- Enclosing class:
- Group
A builder of Groups.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAttribute(Attribute att) addAttributes(Iterable<Attribute> atts) addDimension(Dimension dim) Add Dimension with error if it already existsbooleanAdd Dimension if it doesnt already existaddDimensions(Collection<Dimension> dims) Add Dimensions with error if any already existaddEnumTypedef(EnumTypedef typedef) addEnumTypedefs(Collection<EnumTypedef> typedefs) addGroup(Group.Builder nested) Add a nested Group.addGroups(Collection<Group.Builder> groups) addVariable(Variable.Builder<?> variable) Add a Variable, throw error if one of the same name if it exists.addVariables(Collection<Variable.Builder<?>> vars) Add Variables, throw error if one of the same name if it exists.build()Build the root group, with parent = null.commonParent(Group.Builder other) Find the common parent with the other group ?booleanIs the Dimension contained within this Group or a parent GroupfindDimension(String name) Find Dimension in this Group or a parent GroupfindDimensionLocal(String name) Find Dimension local to this GroupfindEnumTypedef(String name) Find a Enumeration in this Group Builder, using its short name.findEnumTypedef(String name, boolean searchup) Find a Enumeration in this or a parent Group Builder, using its short name.findGroupLocal(String shortName) findGroupNested(String relativeName) Find a subgroup of this Group, with the specified relative name.findOrAddEnumTypedef(String name, Map<Integer, String> map) Add a EnumTypedef if it does not already exist.findSimilarEnumTypedef(EnumTypedef template, boolean searchup) Locate an enum type definition that is structurally similar to the template type def.findVariableLocal(String name) findVariableNested(String relativeName) Find a Variable, with the specified relative name.findVariableOrInParent(String varShortName) Find the Variable with the specified (short) name in this group or a parent group.Deprecated.booleanisParent(Group.Builder other) Is this group a parent of the other group ?voidmakeDimensionMap(Group.Builder parent, com.google.common.collect.Multimap<Dimension, Variable.Builder<?>> dimUsedMap) Make a multimap of Dimensions and all the variables that reference them, in this group and its nested groups.com.google.common.collect.ImmutableList<Dimension>makeDimensionsList(String dimString) Make list of dimensions by looking in this Group or parent groupsMake the full name of the this group.booleanremoveDimension(String name) Remove dimension, if it exists.voidremoveDimensionFromAllGroups(Group.Builder group, Dimension remove) Remove the given dimension from this group and any subgroupsbooleanremoveGroup(String name) Remove group, if it exists.booleanremoveVariable(String name) Remove variable, if it exists.booleanReplace dimension if it exists, else just add it.booleanreplaceVariable(Variable.Builder<?> vb) Replace variable of same name, if it exists, else just add it.setNcfile(NetcdfFile ncfile) setParentGroup(Group.Builder parentGroup)
-
Field Details
-
gbuilders
-
vbuilders
-
shortName
-
enumTypedefs
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setParentGroup
-
getParentGroup
-
addAttribute
-
addAttributes
-
getAttributeContainer
-
addDimension
Add Dimension with error if it already exists -
addDimensionIfNotExists
Add Dimension if it doesnt already exist -
addDimensions
Add Dimensions with error if any already exist -
replaceDimension
Replace dimension if it exists, else just add it.- Returns:
- true if there was an existing dimension of that name
-
removeDimension
Remove dimension, if it exists.- Returns:
- true if there was an existing dimension of that name
-
findDimensionLocal
Find Dimension local to this Group -
contains
Is the Dimension contained within this Group or a parent Group -
findDimension
Find Dimension in this Group or a parent Group -
getDimensions
-
addGroup
Add a nested Group. -
addGroups
-
removeGroup
Remove group, if it exists.- Returns:
- true if there was an existing group of that name
-
findGroupLocal
-
findGroupNested
Find a subgroup of this Group, with the specified relative name. An embedded "/" separates group names. Can have a leading "/" only if this is the root group.- Parameters:
relativeName- eg "group/subgroup/wantGroup".- Returns:
- Group or empty if not found.
-
isParent
Is this group a parent of the other group ? -
commonParent
Find the common parent with the other group ? -
findSimilarEnumTypedef
Locate an enum type definition that is structurally similar to the template type def. The Enum names are ignored.- Parameters:
template- match this enum type defsearchup- if true, then search this group and then parent groups.
-
findEnumTypedef
Find a Enumeration in this Group Builder, using its short name. -
findEnumTypedef
Find a Enumeration in this or a parent Group Builder, using its short name.- Parameters:
name- for which to searchsearchup- if true, then search this group and then parent groups.
-
addEnumTypedef
-
addEnumTypedefs
-
findOrAddEnumTypedef
Add a EnumTypedef if it does not already exist. Return new or existing. -
addVariable
Add a Variable, throw error if one of the same name if it exists. -
addVariables
Add Variables, throw error if one of the same name if it exists. -
replaceVariable
Replace variable of same name, if it exists, else just add it.- Returns:
- true if there was an existing variable of that name
-
removeVariable
Remove variable, if it exists.- Returns:
- true if there was an existing variable of that name
-
findVariableLocal
-
findVariableNested
Find a Variable, with the specified relative name. No structure members.- Parameters:
relativeName- eg "group/subgroup/varname".
-
findVariableOrInParent
Find the Variable with the specified (short) name in this group or a parent group.- Parameters:
varShortName- short name of Variable.- Returns:
- the Variable or empty.
-
setNcfile
-
setName
-
getNcfile
Deprecated. -
makeDimensionsList
public com.google.common.collect.ImmutableList<Dimension> makeDimensionsList(String dimString) throws IllegalArgumentException Make list of dimensions by looking in this Group or parent groups- Throws:
IllegalArgumentException
-
makeFullName
Make the full name of the this group. TODO In light of CF groups, we may have to start full names with '/' -
removeDimensionFromAllGroups
Remove the given dimension from this group and any subgroups -
makeDimensionMap
public void makeDimensionMap(Group.Builder parent, com.google.common.collect.Multimap<Dimension, Variable.Builder<?>> dimUsedMap) Make a multimap of Dimensions and all the variables that reference them, in this group and its nested groups. -
build
Build the root group, with parent = null.
-