opendap/src/main/java/ucar/nc2/dods/DodsV.java
static private void parseVariables(DodsV parent, Enumeration children) {
    while (children.hasMoreElements()) {
      opendap.dap.BaseType bt = (opendap.dap.BaseType) children.nextElement();

      if (bt instanceof DList) {
        String mess = "Variables of type " + bt.getClass().getName() + " are not supported.";
        logger.warn(mess);
        continue;
      }

      DodsV dodsV = new DodsV(parent, bt);

      if (bt instanceof DConstructor) {
        DConstructor dcon = (DConstructor) bt;
        java.util.Enumeration enumerate2 = dcon.getVariables();
        parseVariables(dodsV, enumerate2);

      } else if (bt instanceof DArray) {
        DArray da = (DArray) bt;

        // Check to see if the array has any zero-length dimension; if so then ignore
        for (Enumeration e = da.getDimensions(); e.hasMoreElements(); ) {
          DArrayDimension dim = (DArrayDimension) e.nextElement();
          if (dim.getSize() <= 0) return;
        }

        BaseType elemType = da.getPrimitiveVector().getTemplate();
        dodsV.bt = elemType;
        dodsV.darray = da;

        if ((elemType instanceof DGrid) || (elemType instanceof DSequence) || (elemType instanceof DList)) {
          String mess = "Arrays of type " + elemType.getClass().getName() + " are not supported.";
          logger.warn(mess);
          continue;
        }

        if (elemType instanceof DStructure) { // note that for DataDDS, cant traverse this further to find the data.
          DConstructor dcon = (DConstructor) elemType;
          java.util.Enumeration nestedVariables = dcon.getVariables();
          parseVariables(dodsV, nestedVariables);
        }
      }

      parent.children.add(dodsV);
    }
  }
static private void parseVariables(DodsV parent, Enumeration children) {
    while (children.hasMoreElements()) {
      opendap.dap.BaseType bt = (opendap.dap.BaseType) children.nextElement();

      if (bt instanceof DList) {
        String mess = "Variables of type " + bt.getClass().getName() + " are not supported.";
        logger.warn(mess);
        continue;
      }

      DodsV dodsV = new DodsV(parent, bt);

      if (bt instanceof DConstructor) {
        DConstructor dcon = (DConstructor) bt;
        java.util.Enumeration enumerate2 = dcon.getVariables();
        parseVariables(dodsV, enumerate2);

      } else if (bt instanceof DArray) {
        DArray da = (DArray) bt;

        // Check to see if the array has any zero-length dimension; if so then ignore
        for (Enumeration e = da.getDimensions(); e.hasMoreElements(); ) {
          DArrayDimension dim = (DArrayDimension) e.nextElement();
          if (dim.getSize() <= 0) return;
        }

        BaseType elemType = da.getPrimitiveVector().getTemplate();
        dodsV.bt = elemType;
        dodsV.darray = da;

        if ((elemType instanceof DGrid) || (elemType instanceof DSequence) || (elemType instanceof DList)) {
          String mess = "Arrays of type " + elemType.getClass().getName() + " are not supported.";
          logger.warn(mess);
          continue;
        }

        if (elemType instanceof DStructure) { // note that for DataDDS, cant traverse this further to find the data.
          DConstructor dcon = (DConstructor) elemType;
          java.util.Enumeration nestedVariables = dcon.getVariables();
          parseVariables(dodsV, nestedVariables);
        }
      }

      parent.children.add(dodsV);
    }
  }
static private void parseVariables ( DodsV parent , Enumeration children ) { while ( children . hasMoreElements ( ) ) { opendap . dap . BaseType bt = ( opendap . dap . BaseType ) children . nextElement ( ) ; if ( bt instanceof DList ) { String mess = "Variables of type " + bt . getClass ( ) . getName ( ) + " are not supported." ; logger . warn ( mess ) ; continue ; } DodsV dodsV = new DodsV ( parent , bt ) ; if ( bt instanceof DConstructor ) { DConstructor dcon = ( DConstructor ) bt ; java . util . Enumeration enumerate2 = dcon . getVariables ( ) ; parseVariables ( dodsV , enumerate2 ) ; } else if ( bt instanceof DArray ) { DArray da = ( DArray ) bt ; // Check to see if the array has any zero-length dimension; if so then ignore
 for ( Enumeration e = da . getDimensions ( ) ; e . hasMoreElements ( ) ; ) { DArrayDimension dim = ( DArrayDimension ) e . nextElement ( ) ; if ( dim . getSize ( ) <= 0 ) return ; } BaseType elemType = da . getPrimitiveVector ( ) . getTemplate ( ) ; dodsV . bt = elemType ; dodsV . darray = da ; if ( ( elemType instanceof DGrid ) || ( elemType instanceof DSequence ) || ( elemType instanceof DList ) ) { String mess = "Arrays of type " + elemType . getClass ( ) . getName ( ) + " are not supported." ; logger . warn ( mess ) ; continue ; } if ( elemType instanceof DStructure ) { // note that for DataDDS, cant traverse this further to find the data.
 DConstructor dcon = ( DConstructor ) elemType ; java . util . Enumeration nestedVariables = dcon . getVariables ( ) ; parseVariables ( dodsV , nestedVariables ) ; } } parent . children . add ( dodsV ) ; } }
Recursively build the dodsV tree.
1) put all Variables into a DodsV
2) unravel DConstructors (DSequence, DStructure, DGrid)
3) for Darray, we put Variable = elemType, and store the darray seperately, not in the heirarchy.

@param parent   of the tree
@param children list of BaseType
Recursively build the dodsV tree . 1 ) put all Variables into a DodsV 2 ) unravel DConstructors ( DSequence DStructure DGrid ) 3 ) for Darray we put Variable = elemType and store the darray seperately not in the heirarchy .