opendap/src/main/java/opendap/dap/DGrid.java
public int elementCount(boolean leaves) {
        if (!leaves)
            return mapVars.size() + 1; // Number of Maps plus 1 Array component
        else {
            int count = 0;
            for (Enumeration e = mapVars.elements(); e.hasMoreElements();) {
                BaseType bt = (BaseType) e.nextElement();
                count += bt.elementCount(leaves);
            }
            count += arrayVar.elementCount(leaves);
            return count;
        }
    }
public int elementCount(boolean leaves) {
        if (!leaves)
            return mapVars.size() + 1; // Number of Maps plus 1 Array component
        else {
            int count = 0;
            for (Enumeration e = mapVars.elements(); e.hasMoreElements();) {
                BaseType bt = (BaseType) e.nextElement();
                count += bt.elementCount(leaves);
            }
            count += arrayVar.elementCount(leaves);
            return count;
        }
    }
public int elementCount ( boolean leaves ) { if ( ! leaves ) return mapVars . size ( ) + 1 ; // Number of Maps plus 1 Array component
 else { int count = 0 ; for ( Enumeration e = mapVars . elements ( ) ; e . hasMoreElements ( ) ; ) { BaseType bt = ( BaseType ) e . nextElement ( ) ; count += bt . elementCount ( leaves ) ; } count += arrayVar . elementCount ( leaves ) ; return count ; } }
Returns the number of variables contained in this object. For simple and
vector type variables, it always returns 1. To count the number
of simple-type variable in the variable tree rooted at this variable, set
<code>leaves</code> to <code>true</code>.

@param leaves If true, count all the simple types in the `tree' of
variables rooted at this variable.
@return the number of contained variables.
Returns the number of variables contained in this object . For simple and vector type variables it always returns 1 . To count the number of simple - type variable in the variable tree rooted at this variable set <code > leaves< / code > to <code > true< / code > .