List<Dimension> constructDimensions(Group group, opendap.dap.DArray dodsArray) {
    if (group == null) group = rootGroup;

    List<Dimension> dims = new ArrayList<Dimension>();
    Enumeration enumerate = dodsArray.getDimensions();
    while (enumerate.hasMoreElements()) {
      opendap.dap.DArrayDimension dad = (opendap.dap.DArrayDimension) enumerate.nextElement();
      String name = dad.getEncodedName();
      if (name != null)
        name = StringUtil2.unescape(name);

      Dimension myd;

      if (name == null) { // if no name, make an anonymous dimension
        myd = new Dimension(null, dad.getSize(), false);

      } else { // see if shared
        if (RC.getUseGroups()) {
          if (name.indexOf('/') >= 0) {// place dimension in proper group
            group = group.makeRelativeGroup(this, name, true);
            // change our name
            name = name.substring(name.lastIndexOf('/') + 1);
          }
        }
        myd = group.findDimension(name);
        if (myd == null) { // add as shared
          myd = new Dimension(name, dad.getSize());
          group.addDimension(myd);
        } else if (myd.getLength() != dad.getSize()) { // make a non-shared dimension
          myd = new Dimension(name, dad.getSize(), false);
        } // else use existing, shared dimension
      }
      dims.add(myd); // add it to the list
    }

    return dims;
  }
List < Dimension > constructDimensions ( Group group , opendap . dap . DArray dodsArray ) { if ( group == null ) group = rootGroup ; List < Dimension > dims = new ArrayList < Dimension > ( ) ; Enumeration enumerate = dodsArray . getDimensions ( ) ; while ( enumerate . hasMoreElements ( ) ) { opendap . dap . DArrayDimension dad = ( opendap . dap . DArrayDimension ) enumerate . nextElement ( ) ; String name = dad . getEncodedName ( ) ; if ( name != null ) name = StringUtil2 . unescape ( name ) ; Dimension myd ; if ( name == null ) { myd = new Dimension ( null , dad . getSize ( ) , false ) ; } else { if ( RC . getUseGroups ( ) ) { if ( name . indexOf ( '/' ) >= 0 ) { group = group . makeRelativeGroup ( this , name , true ) ; name = name . substring ( name . lastIndexOf ( '/' ) + 1 ) ; } } myd = group . findDimension ( name ) ; if ( myd == null ) { myd = new Dimension ( name , dad . getSize ( ) ) ; group . addDimension ( myd ) ; } else if ( myd . getLength ( ) != dad . getSize ( ) ) { myd = new Dimension ( name , dad . getSize ( ) , false ) ; } } dims . add ( myd ) ; } return dims ; }
construct list of dimensions to use