public class Group extends CDMNode implements AttributeContainer
Immutable if setImmutable() was called.
| Modifier and Type | Field and Description |
|---|---|
protected AttributeContainerHelper |
attributes |
protected List<Dimension> |
dimensions |
protected List<EnumTypedef> |
enumTypedefs |
protected List<Group> |
groups |
protected NetcdfFile |
ncfile |
protected List<Variable> |
variables |
annotations, dodsname, group, immutable, parentstruct, shortName, sort| Constructor and Description |
|---|
Group(NetcdfFile ncfile,
Group parent,
String shortName)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAll(Iterable<Attribute> atts)
Add all; replace old if has same name
|
Attribute |
addAttribute(Attribute att)
Add new or replace old if has same name
|
void |
addDimension(Dimension dim)
Adds the specified shared dimension to this group.
|
boolean |
addDimensionIfNotExists(Dimension dim)
Adds the specified shared dimension to this group, but only if another dimension with the same name doesn't
already exist.
|
void |
addEnumeration(EnumTypedef e)
Add an Enumeration
|
void |
addGroup(Group g)
Add a nested Group
|
void |
addVariable(Variable v)
Add a Variable
|
Group |
commonParent(Group other)
Get the common parent of this and the other group.
|
boolean |
equals(Object oo)
Instances which have same name and parent are equal.
|
Attribute |
findAttribute(String name) |
Attribute |
findAttributeIgnoreCase(String name) |
String |
findAttValueIgnoreCase(String attName,
String defaultValue)
Find a String-valued Attribute by Attribute name (ignore case), return the (string) value of the Attribute.
|
Dimension |
findDimension(String name)
Retrieve a Dimension using its (short) name.
|
Dimension |
findDimensionLocal(String name)
Retrieve a Dimension using its (short) name, in this group only
|
EnumTypedef |
findEnumeration(String name)
Find an Enumeration Typedef using its (short) name.
|
Group |
findGroup(String groupShortName)
Retrieve the Group with the specified (short) name.
|
Variable |
findVariable(String varShortName)
Find the Variable with the specified (short) name in this group.
|
Variable |
findVariableOrInParent(String varShortName)
Find the Variable with the specified (short) name in this group or a parent group.
|
List<Attribute> |
getAttributes()
Returns the list of attributes for this variable.
|
List<Dimension> |
getDimensions()
Get the shared Dimensions contained directly in this group.
|
List<EnumTypedef> |
getEnumTypedefs()
Get the enumerations contained directly in this group.
|
List<Group> |
getGroups()
Get the Groups contained directly in this Group.
|
String |
getNameAndAttributes()
Get String with name and attributes.
|
NetcdfFile |
getNetcdfFile()
Get the owning NetcdfFile
|
String |
getShortName()
Get the "short" name, unique within its parent Group.
|
List<Variable> |
getVariables()
Get the Variables contained directly in this group.
|
int |
hashCode()
Override Object.hashCode() to implement equals.
|
void |
hashCodeShow(Indent indent) |
boolean |
isParent(Group other)
Is this a parent of the other Group?
|
boolean |
isRoot()
Is this the root group?
|
Group |
makeRelativeGroup(NetcdfFile ncf,
String path,
boolean ignorelast)
Create groups to ensure path is defined
|
boolean |
remove(Attribute a)
Remove an Attribute : uses the attribute hashCode to find it.
|
boolean |
remove(Dimension d)
Remove an Dimension : uses the dimension hashCode to find it.
|
boolean |
remove(Group g)
Remove an Attribute : uses the Group hashCode to find it.
|
boolean |
remove(Variable v)
Remove a Variable : uses the variable hashCode to find it.
|
boolean |
removeAttribute(String attName)
Remove an Attribute by name.
|
boolean |
removeAttributeIgnoreCase(String attName)
Remove an Attribute by name, ignoring case
|
boolean |
removeDimension(String dimName)
remove a Dimension using its name, in this group only
|
boolean |
removeVariable(String shortName)
remove a Variable using its (short) name, in this group only
|
Group |
setImmutable()
Make this immutable.
|
String |
setName(String shortName)
Set the short name, converting to valid CDM object name if needed.
|
void |
setParentGroup(Group parent)
Set the Group's parent Group
|
String |
toString() |
String |
writeCDL(boolean strict)
CDL representation.
|
protected void |
writeCDL(Formatter out,
Indent indent,
boolean strict) |
annotate, annotation, getDODSName, getFullName, getFullNameEscaped, getGroup, getImmutable, getName, getParentGroup, getParentStructure, getSort, isMemberOfStructure, localhash, setDODSName, setParentStructure, setShortName, setSort, unwrapclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetNameprotected NetcdfFile ncfile
protected AttributeContainerHelper attributes
protected List<EnumTypedef> enumTypedefs
public Group(NetcdfFile ncfile, Group parent, String shortName)
ncfile - NetcdfFile owns this Groupparent - parent of Group. If null, this is the root Group.shortName - short name of Group.public boolean isRoot()
public String getShortName()
getShortName in class CDMNodepublic List<Variable> getVariables()
public Variable findVariable(String varShortName)
varShortName - short name of Variable within this group.public Variable findVariableOrInParent(String varShortName)
varShortName - short name of Variable.public List<Group> getGroups()
public NetcdfFile getNetcdfFile()
public Group findGroup(String groupShortName)
groupShortName - short name of the nested group you are looking for.public List<Dimension> getDimensions()
public List<EnumTypedef> getEnumTypedefs()
public Dimension findDimension(String name)
name - Dimension name.public Dimension findDimensionLocal(String name)
name - Dimension name.public List<Attribute> getAttributes()
AttributeContainergetAttributes in interface AttributeContainerpublic Attribute findAttribute(String name)
findAttribute in interface AttributeContainerpublic Attribute findAttributeIgnoreCase(String name)
findAttributeIgnoreCase in interface AttributeContainerpublic String findAttValueIgnoreCase(String attName, String defaultValue)
AttributeContainerfindAttValueIgnoreCase in interface AttributeContainerpublic Attribute addAttribute(Attribute att)
AttributeContaineraddAttribute in interface AttributeContaineratt - add this Attributepublic void addAll(Iterable<Attribute> atts)
AttributeContaineraddAll in interface AttributeContainerpublic boolean remove(Attribute a)
AttributeContainerremove in interface AttributeContainera - remove this attributepublic boolean removeAttribute(String attName)
AttributeContainerremoveAttribute in interface AttributeContainerattName - if exists, remove this attributepublic boolean removeAttributeIgnoreCase(String attName)
AttributeContainerremoveAttributeIgnoreCase in interface AttributeContainerattName - if exists, remove this attributepublic EnumTypedef findEnumeration(String name)
name - Enumeration name.public Group commonParent(Group other)
other - the other grouppublic boolean isParent(Group other)
other - another Grouppublic String getNameAndAttributes()
public String writeCDL(boolean strict)
strict - if true, write in strict adherence to CDL definition.public void setParentGroup(Group parent)
setParentGroup in class CDMNodeparent - parent group.public String setName(String shortName)
shortName - set to this valuepublic void addDimension(Dimension dim)
dim - the dimension to add.IllegalStateException - if this dimension is immutable.IllegalArgumentException - if dim isn't shared or a dimension with dim's name already
exists within the group.public boolean addDimensionIfNotExists(Dimension dim)
dim - the dimension to add.true if dim was successfully added to the group. Otherwise, false will be returned,
meaning that a dimension with dim's name already exists within the group.IllegalStateException - if this dimension is immutable.IllegalArgumentException - if dim isn't shared.public void addGroup(Group g)
g - add this Group.public void addEnumeration(EnumTypedef e)
e - add this Enumeration.public void addVariable(Variable v)
v - add this Variable.public boolean remove(Dimension d)
d - remove this Dimension.public boolean remove(Group g)
g - remove this Group.public boolean remove(Variable v)
v - remove this Variable.public boolean removeDimension(String dimName)
dimName - Dimension name.public boolean removeVariable(String shortName)
shortName - Variable name.public Group setImmutable()
setImmutable in class CDMNodepublic boolean equals(Object oo)
public int hashCode()
public void hashCodeShow(Indent indent)
hashCodeShow in class CDMNodepublic Group makeRelativeGroup(NetcdfFile ncf, String path, boolean ignorelast)
ncf - the containing netcdf file objectpath - the path to the desired groupignorelast - true => ignore last element in the path