public class Group extends CDMNode implements AttributeContainer
Immutable if setImmutable() was called.
Modifier and Type | Field and Description |
---|---|
protected java.util.List<Attribute> |
attributes |
protected java.util.List<Dimension> |
dimensions |
protected java.util.List<EnumTypedef> |
enumTypedefs |
protected java.util.List<Group> |
groups |
protected NetcdfFile |
ncfile |
protected java.util.List<Attribute> |
specials |
protected java.util.List<Variable> |
variables |
annotations, dodsname, group, immutable, parentstruct, shortName, sort
Constructor and Description |
---|
Group(NetcdfFile ncfile,
Group parent,
java.lang.String shortName)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addAll(java.lang.Iterable<Attribute> atts)
Add all; replace old if has same name
|
Attribute |
addAttribute(Attribute att)
Add new Attribute; replace old if has same name.
|
void |
addDimension(Dimension d)
Add a shared Dimension
|
boolean |
addDimensionIfNotExists(Dimension d) |
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(java.lang.Object oo)
Instances which have same name and parent are equal.
|
Attribute |
findAttribute(java.lang.String name)
Find an Attribute in this Group by its name.
|
Attribute |
findAttributeIgnoreCase(java.lang.String name)
Find an Attribute in this Group by its name, ignore case.
|
Dimension |
findDimension(java.lang.String name)
Retrieve a Dimension using its (short) name.
|
Dimension |
findDimensionLocal(java.lang.String name)
Retrieve a Dimension using its (short) name, in this group only
|
EnumTypedef |
findEnumeration(java.lang.String name)
Find an Enumeration Typedef using its (short) name.
|
Group |
findGroup(java.lang.String groupShortName)
Retrieve the Group with the specified (short) name.
|
Variable |
findVariable(java.lang.String varShortName)
Find the Variable with the specified (short) name in this group.
|
Variable |
findVariableOrInParent(java.lang.String varShortName)
Find the Variable with the specified (short) name in this group or a parent group.
|
java.util.List<Attribute> |
getAttributes()
Get the set of attributes contained directly in this Group.
|
java.util.List<Dimension> |
getDimensions()
Get the Dimensions contained directly in this group.
|
java.util.List<EnumTypedef> |
getEnumTypedefs()
Get the enumerations contained directly in this group.
|
java.util.List<Group> |
getGroups()
Get the Groups contained directly in this Group.
|
java.lang.String |
getNameAndAttributes()
Get String with name and attributes.
|
NetcdfFile |
getNetcdfFile()
Get the owning NetcdfFile
|
java.lang.String |
getShortName()
Get the "short" name, unique within its parent Group.
|
java.util.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,
java.lang.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 |
removeDimension(java.lang.String dimName)
remove a Dimension using its name, in this group only
|
boolean |
removeVariable(java.lang.String shortName)
remove a Variable using its (short) name, in this group only
|
Group |
setImmutable()
Make this immutable.
|
java.lang.String |
setName(java.lang.String shortName)
Set the short name, converting to valid CDM object name if needed.
|
void |
setParentGroup(Group parent)
Set the Group's parent Group
|
java.lang.String |
toString() |
java.lang.String |
writeCDL(boolean strict)
CDL representation.
|
protected void |
writeCDL(java.util.Formatter out,
Indent indent,
boolean strict) |
annotate, getAnnotation, getAnnotations, getDODSName, getFullName, getFullNameEscaped, getGroup, getImmutable, getName, getParentGroup, getParentStructure, getSort, isMemberOfStructure, localhash, setDODSName, setImmutable, setParentStructure, setShortName, setSort, unwrap
protected NetcdfFile ncfile
protected java.util.List<Variable> variables
protected java.util.List<Dimension> dimensions
protected java.util.List<Group> groups
protected java.util.List<Attribute> attributes
protected java.util.List<Attribute> specials
protected java.util.List<EnumTypedef> enumTypedefs
public Group(NetcdfFile ncfile, Group parent, java.lang.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 java.lang.String getShortName()
getShortName
in class CDMNode
public java.util.List<Variable> getVariables()
public Variable findVariable(java.lang.String varShortName)
varShortName
- short name of Variable within this group.public Variable findVariableOrInParent(java.lang.String varShortName)
varShortName
- short name of Variable.public java.util.List<Group> getGroups()
public NetcdfFile getNetcdfFile()
public Group findGroup(java.lang.String groupShortName)
groupShortName
- short name of the nested group you are looking for.public java.util.List<Dimension> getDimensions()
public java.util.List<EnumTypedef> getEnumTypedefs()
public Dimension findDimension(java.lang.String name)
name
- Dimension name.public Dimension findDimensionLocal(java.lang.String name)
name
- Dimension name.public java.util.List<Attribute> getAttributes()
getAttributes
in interface AttributeContainer
public void addAll(java.lang.Iterable<Attribute> atts)
addAll
in interface AttributeContainer
public Attribute findAttribute(java.lang.String name)
name
- the name of the attribute.public Attribute findAttributeIgnoreCase(java.lang.String name)
name
- the name of the attributepublic EnumTypedef findEnumeration(java.lang.String name)
name
- Enumeration name.public Group commonParent(Group other)
other
- the other grouppublic boolean isParent(Group other)
other
- another Grouppublic java.lang.String getNameAndAttributes()
public java.lang.String writeCDL(boolean strict)
strict
- if true, write in strict adherence to CDL definition.protected void writeCDL(java.util.Formatter out, Indent indent, boolean strict)
public void setParentGroup(Group parent)
setParentGroup
in class CDMNode
parent
- parent group.public java.lang.String setName(java.lang.String shortName)
shortName
- set to this valuepublic Attribute addAttribute(Attribute att)
addAttribute
in interface AttributeContainer
att
- add this Attribute.public void addDimension(Dimension d)
d
- add this Dimensionpublic boolean addDimensionIfNotExists(Dimension d)
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(Attribute a)
a
- remove this Attribute.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(java.lang.String dimName)
dimName
- Dimension name.public boolean removeVariable(java.lang.String shortName)
shortName
- Variable name.public Group setImmutable()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object oo)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public void hashCodeShow(Indent indent)
hashCodeShow
in class CDMNode
public Group makeRelativeGroup(NetcdfFile ncf, java.lang.String path, boolean ignorelast)
ncf
- the containing netcdf file objectpath
- the path to the desired groupignorelast
- true => ignore last element in the path