|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.nc2.Variable
ucar.nc2.Structure
public class Structure
A Structure is a type of Variable that contains other Variables, like a struct in C. A Structure can be scalar or multidimensional.
A call to structure.read() will read all of the data in a Structure, including nested structures, and returns an Array of StructureData, with all of the data in memory.
Generally, the programmer can assume that the data in a Structure are stored together, so that it is efficient to read an entire Structure, and then access the Variable data through the Arrays in the StructureData.
| Nested Class Summary | |
|---|---|
class |
Structure.Iterator
Iterator over type StructureData. |
| Nested classes/interfaces inherited from class ucar.nc2.Variable |
|---|
Variable.Cache |
| Field Summary | |
|---|---|
protected java.util.HashMap |
memberHash
|
protected java.util.ArrayList |
memberNames
|
protected java.util.ArrayList |
members
|
| Fields inherited from class ucar.nc2.Variable |
|---|
attributes, cache, dataType, debugCaching, defaultSizeToCache, dimensions, elementSize, group, isCoordinateAxis, isMetadata, isSection, isSlice, isVlen, ncfile, orgVar, parent, scalarIndex, sectionRanges, shape, shortName, sizeToCache, sliceDim, sliceRanges |
| Constructor Summary | |
|---|---|
|
Structure(NetcdfFile ncfile,
Group group,
Structure parent,
java.lang.String shortName)
Constructor |
protected |
Structure(Structure from,
boolean reparent)
copy constructor; |
| Method Summary | |
|---|---|
void |
addMemberVariable(Variable v)
Add a member variable |
protected void |
calcElementSize()
|
protected int |
calcStructureSize()
|
Variable |
findVariable(java.lang.String shortName)
Find the Variable member with the specified (short) name, or null if not found. |
int |
getElementSize()
Get the size of one element of the Structure. |
java.lang.String |
getNameAndAttributes()
Get String with name and attributes. |
Structure.Iterator |
getStructureIterator()
Iterator over all the data in a Structure. |
Structure.Iterator |
getStructureIterator(int bufferSize)
Get an efficient iterator over all the data in the Structure. |
java.util.List |
getVariableNames()
Get the (short) names of the variables contained directly in this Structure. |
java.util.List |
getVariables()
Get the variables contained directly in this Structure. |
boolean |
isCaching()
Caching is not allowed |
StructureMembers |
makeStructureMembers()
Make the StructureMembers object corresponding to this Structure. |
StructureData |
readStructure()
Use this when this is a scalar Structure. |
StructureData |
readStructure(int index)
Use this when this is a one dimensional array of Structures. |
ArrayStructure |
readStructure(int start,
int count)
Use this when this is a one dimensional array of Structures. |
boolean |
removeMemberVariable(Variable v)
Remove a Variable : uses the variable hashCode to find it. |
boolean |
replaceMemberVariable(Variable newVar)
Replace a Variable with another that has the same name : uses the variable name to find it. |
Variable |
section(java.util.List section)
Override so it returns a Structure |
void |
setCaching(boolean caching)
Caching is not allowed |
void |
setMemberVariables(java.util.ArrayList vars)
Set the list of member variables. |
void |
setParentGroup(Group group)
Set the parent group of this Structure, and all member variables. |
java.lang.String |
toString()
String representation of Structure and nested variables. |
java.lang.String |
writeCDL(java.lang.String space,
boolean useFullName,
boolean strict)
String representation of a Variable and its attributes. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.util.HashMap memberHash
protected java.util.ArrayList members
protected java.util.ArrayList memberNames
| Constructor Detail |
|---|
public Structure(NetcdfFile ncfile,
Group group,
Structure parent,
java.lang.String shortName)
protected Structure(Structure from,
boolean reparent)
from - copy from thisreparent - : if true, reparent the members. if so, cant use 'from' anymore| Method Detail |
|---|
protected int calcStructureSize()
public boolean isCaching()
isCaching in class Variablepublic void setCaching(boolean caching)
setCaching in class Variablecaching - set if caching.
public Variable section(java.util.List section)
throws InvalidRangeException
section in interface VariableIFsection in class Variablesection - List of type ucar.ma2.Range, with size equal to getRank().
Each Range corresponds to a Dimension, and specifies the section of data to read in that Dimension.
A Range object may be null, which means use the entire dimension.
InvalidRangeExceptionpublic void addMemberVariable(Variable v)
public void setMemberVariables(java.util.ArrayList vars)
public boolean removeMemberVariable(Variable v)
public boolean replaceMemberVariable(Variable newVar)
public void setParentGroup(Group group)
setParentGroup in class Variablepublic java.util.List getVariables()
public java.util.List getVariableNames()
public Variable findVariable(java.lang.String shortName)
public StructureMembers makeStructureMembers()
public int getElementSize()
getElementSize in interface VariableIFgetElementSize in class Variableprotected void calcElementSize()
public StructureData readStructure()
throws java.io.IOException
java.io.IOException
public StructureData readStructure(int index)
throws java.io.IOException,
InvalidRangeException
java.io.IOException
InvalidRangeException
public ArrayStructure readStructure(int start,
int count)
throws java.io.IOException,
InvalidRangeException
java.io.IOException
InvalidRangeExceptionpublic Structure.Iterator getStructureIterator()
Structure.Iterator ii = structVariable.getStructureIterator();
while (ii.hasNext()) {
StructureData sdata = ii.next();
}
getStructureIterator(int bufferSize)public Structure.Iterator getStructureIterator(int bufferSize)
Example:
Structure.Iterator ii = structVariable.getStructureIterator(100 * 1000);
while (ii.hasNext()) {
StructureData sdata = ii.next();
}
bufferSize - size in bytes to buffer
public java.lang.String getNameAndAttributes()
public java.lang.String toString()
toString in class Variable
public java.lang.String writeCDL(java.lang.String space,
boolean useFullName,
boolean strict)
Variable
writeCDL in class Variablespace - start each line with this much spaceuseFullName - use full name, else use short namestrict - stictly comply with ncgen syntax
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||