public class Group extends CDMNode implements AttributeContainer
Modifier and Type | Class and Description |
---|---|
static class |
Group.Builder
A builder of Groups.
|
Modifier and Type | Field and Description |
---|---|
protected AttributeContainer |
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<Variable> |
variables |
annotations, dodsname, group, immutable, parentstruct, shortName, sort
Constructor and Description |
---|
Group(NetcdfFile ncfile,
Group parent,
java.lang.String shortName)
Deprecated.
Use Group.builder()
|
Modifier and Type | Method and Description |
---|---|
void |
addAll(java.lang.Iterable<Attribute> atts)
Deprecated.
Use Group.builder()
|
Attribute |
addAttribute(Attribute att)
Deprecated.
Use Group.builder()
|
void |
addDimension(Dimension dim)
Deprecated.
Use Group.builder()
|
boolean |
addDimensionIfNotExists(Dimension dim)
Deprecated.
Use Group.builder()
|
void |
addEnumeration(EnumTypedef e)
Deprecated.
Use Group.builder()
|
void |
addGroup(Group g)
Deprecated.
Use Group.builder()
|
void |
addVariable(Variable v)
Deprecated.
Use Group.builder()
|
AttributeContainer |
attributes()
The attributes contained by this Group.
|
static Group.Builder |
builder() |
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 the attribute by name, return null if not exist
|
double |
findAttributeDouble(java.lang.String attName,
double defaultValue)
Deprecated.
Use attributes().findAttributeDouble()
|
Attribute |
findAttributeIgnoreCase(java.lang.String name)
Deprecated.
Use findAttributeString()
|
int |
findAttributeInteger(java.lang.String attName,
int defaultValue)
Deprecated.
Use attributes().findAttributeInteger()
|
java.lang.String |
findAttributeString(java.lang.String attName,
java.lang.String defaultValue)
Find a String-valued Attribute by name (ignore case), return the String value of the Attribute.
|
Dimension |
findDimension(Dimension dim)
Find a Dimension in this or a parent Group, using equals.
|
Dimension |
findDimension(java.lang.String name)
Find a Dimension in this or a parent Group, matching on short name.
|
Dimension |
findDimensionLocal(java.lang.String shortName)
Find a Dimension using its (short) name, in this group only
|
EnumTypedef |
findEnumeration(java.lang.String name)
Find a Enumeration in this Group, using its short name.
|
EnumTypedef |
findEnumeration(java.lang.String name,
boolean searchup)
Find a Enumeration in this or optionally the parent Groups, using its short name.
|
Group |
findGroup(java.lang.String groupShortName)
Deprecated.
use findGroupLocal()
|
Group |
findGroupLocal(java.lang.String groupShortName)
Retrieve the Group with the specified (short) name.
|
EnumTypedef |
findSimilarEnumTypedef(EnumTypedef template,
boolean searchup)
Locate an enum type definition that is structurally
similar to the template type def.
|
Variable |
findVariable(java.lang.String varShortName)
Deprecated.
use findVariableLocal()
|
Variable |
findVariableByAttribute(java.lang.String attName,
java.lang.String attValue)
Look in this Group and in its nested Groups for a Variable with a String valued Attribute with the given name
and value.
|
Variable |
findVariableLocal(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()
Deprecated.
Use attributes()
|
java.util.List<Dimension> |
getDimensions()
Get the shared Dimensions contained directly in this group.
|
com.google.common.collect.ImmutableList<EnumTypedef> |
getEnumTypedefs()
Get the enumerations contained directly in this group.
|
java.lang.String |
getFullName()
Get the full name of this object.
|
com.google.common.collect.ImmutableList<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
|
Group |
getParentGroup()
Get the parent Group, or null if its the root group.
|
java.util.List<Variable> |
getVariables()
Get the Variables contained directly in this group.
|
int |
hashCode()
Override Object.hashCode() to implement equals.
|
boolean |
isEmpty()
Deprecated.
Use attributes()
|
boolean |
isParent(Group other)
Is this a parent of the other Group?
|
boolean |
isRoot()
Is this the root group?
|
com.google.common.collect.ImmutableList<Dimension> |
makeDimensionsList(java.lang.String dimString)
Create a dimension list using dimension names.
|
Group |
makeRelativeGroup(NetcdfFile ncf,
java.lang.String path,
boolean ignorelast)
Deprecated.
will move to dap2 in ver6
|
boolean |
remove(Attribute a)
Deprecated.
Use Group.builder()
|
boolean |
remove(Dimension d)
Deprecated.
Use Group.builder()
|
boolean |
remove(Group g)
Deprecated.
Use Group.builder()
|
boolean |
remove(Variable v)
Deprecated.
Use Group.builder()
|
boolean |
removeAttribute(java.lang.String attName)
Deprecated.
Use Group.builder()
|
boolean |
removeAttributeIgnoreCase(java.lang.String attName)
Deprecated.
Use Group.builder()
|
boolean |
removeDimension(java.lang.String dimName)
Deprecated.
Use Group.builder()
|
boolean |
removeVariable(java.lang.String shortName)
Deprecated.
Use Group.builder()
|
Group |
setImmutable()
Deprecated.
Use Group.builder()
|
java.lang.String |
setName(java.lang.String shortName)
Deprecated.
Use Group.builder()
|
void |
setParentGroup(Group parent)
Deprecated.
Use Group.builder()
|
Group.Builder |
toBuilder()
Turn into a mutable Builder.
|
java.lang.String |
toString() |
java.lang.String |
writeCDL(boolean strict)
Deprecated.
use CDLWriter
|
annotate, annotation, getDODSName, getFullNameEscaped, getGroup, getImmutable, getName, getParentStructure, getShortName, getSort, isMemberOfStructure, localhash, setDODSName, setParentStructure, setShortName, setSort, unwrap
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
filter, findAttValueIgnoreCase, getName, hasAttribute, hasAttributeIgnoreCase, iterator
protected NetcdfFile ncfile
protected java.util.List<Variable> variables
protected java.util.List<Dimension> dimensions
protected java.util.List<Group> groups
protected AttributeContainer attributes
protected java.util.List<EnumTypedef> enumTypedefs
@Deprecated 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.util.List<Variable> getVariables()
@Deprecated @Nullable public Variable findVariable(java.lang.String varShortName)
@Nullable public Variable findVariableLocal(java.lang.String varShortName)
varShortName
- short name of Variable within this group.@Nullable public Variable findVariableOrInParent(java.lang.String varShortName)
varShortName
- short name of Variable.@Nullable public Variable findVariableByAttribute(java.lang.String attName, java.lang.String attValue)
attName
- look for an Attribuite with this name.attValue
- look for an Attribuite with this value.@Nullable public Group getParentGroup()
getParentGroup
in class CDMNode
public java.lang.String getFullName()
getFullName
in class CDMNode
public com.google.common.collect.ImmutableList<Group> getGroups()
public NetcdfFile getNetcdfFile()
@Nullable public Group findGroupLocal(java.lang.String groupShortName)
groupShortName
- short name of the nested group you are looking for.@Deprecated public Group findGroup(java.lang.String groupShortName)
public java.util.List<Dimension> getDimensions()
public com.google.common.collect.ImmutableList<Dimension> makeDimensionsList(java.lang.String dimString) throws java.lang.IllegalArgumentException
dimString
- : whitespace separated list of dimension names, or '*' for Dimension.UNKNOWN, or number for anon
dimension. null or empty String is a scalar.java.lang.IllegalArgumentException
- if cant find dimension or parse error.public com.google.common.collect.ImmutableList<EnumTypedef> getEnumTypedefs()
@Nullable public Dimension findDimension(java.lang.String name)
name
- Dimension name.@Nullable public Dimension findDimension(Dimension dim)
dim
- Dimension .@Nullable public Dimension findDimensionLocal(java.lang.String shortName)
shortName
- Dimension name.public AttributeContainer attributes()
@Nullable public Attribute findAttribute(java.lang.String name)
findAttribute
in interface AttributeContainer
public java.lang.String findAttributeString(java.lang.String attName, java.lang.String defaultValue)
findAttributeString
in interface AttributeContainer
@Deprecated public java.util.List<Attribute> getAttributes()
AttributeContainer
getAttributes
in interface AttributeContainer
public boolean isEmpty()
AttributeContainer
isEmpty
in interface AttributeContainer
@Deprecated public Attribute findAttributeIgnoreCase(java.lang.String name)
AttributeContainer
findAttributeIgnoreCase
in interface AttributeContainer
@Deprecated public double findAttributeDouble(java.lang.String attName, double defaultValue)
AttributeContainer
findAttributeDouble
in interface AttributeContainer
@Deprecated public int findAttributeInteger(java.lang.String attName, int defaultValue)
AttributeContainer
findAttributeInteger
in interface AttributeContainer
@Deprecated public Attribute addAttribute(Attribute att)
AttributeContainer
addAttribute
in interface AttributeContainer
att
- add this Attribute@Deprecated public void addAll(java.lang.Iterable<Attribute> atts)
AttributeContainer
addAll
in interface AttributeContainer
@Deprecated public boolean remove(Attribute a)
AttributeContainer
remove
in interface AttributeContainer
a
- remove this attribute@Deprecated public boolean removeAttribute(java.lang.String attName)
AttributeContainer
removeAttribute
in interface AttributeContainer
attName
- if exists, remove this attribute@Deprecated public boolean removeAttributeIgnoreCase(java.lang.String attName)
AttributeContainer
removeAttributeIgnoreCase
in interface AttributeContainer
attName
- if exists, remove this attribute@Nullable public EnumTypedef findEnumeration(java.lang.String name)
@Nullable public EnumTypedef findEnumeration(java.lang.String name, boolean searchup)
public EnumTypedef findSimilarEnumTypedef(EnumTypedef template, boolean searchup)
template
- match this enum type defsearchup
- if true, then search this group and then parent groups.public Group commonParent(Group other)
other
- the other grouppublic boolean isParent(Group other)
other
- another Grouppublic java.lang.String getNameAndAttributes()
@Deprecated public java.lang.String writeCDL(boolean strict)
strict
- if true, write in strict adherence to CDL definition.@Deprecated public void setParentGroup(Group parent)
setParentGroup
in class CDMNode
parent
- parent group.@Deprecated public java.lang.String setName(java.lang.String shortName)
shortName
- set to this value@Deprecated public void addDimension(Dimension dim)
dim
- the dimension to add.java.lang.IllegalStateException
- if this dimension is immutable
.java.lang.IllegalArgumentException
- if dim
isn't shared or a dimension with dim
's name already
exists within the group.@Deprecated 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.java.lang.IllegalStateException
- if this dimension is immutable
.java.lang.IllegalArgumentException
- if dim
isn't shared.@Deprecated public void addGroup(Group g)
g
- add this Group.@Deprecated public void addEnumeration(EnumTypedef e)
e
- add this Enumeration.@Deprecated public void addVariable(Variable v)
v
- add this Variable.@Deprecated public boolean remove(Dimension d)
d
- remove this Dimension.@Deprecated public boolean remove(Group g)
g
- remove this Group.@Deprecated public boolean remove(Variable v)
v
- remove this Variable.@Deprecated public boolean removeDimension(java.lang.String dimName)
dimName
- Dimension name.@Deprecated public boolean removeVariable(java.lang.String shortName)
shortName
- Variable name.@Deprecated public Group setImmutable()
setImmutable
in class CDMNode
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
@Deprecated 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 pathpublic Group.Builder toBuilder()
public static Group.Builder builder()