opendap/src/main/java/opendap/dap/DGrid.java
public void checkSemantics(boolean all) throws BadSemanticsException {
        super.checkSemantics(all);

        Util.uniqueNames(mapVars, getEncodedName(), getTypeName());

        if (arrayVar == null)
            throw new BadSemanticsException("DGrid.checkSemantics(): Null grid base array in `"
                    + getEncodedName() + "'");

        // check semantics of array variable
        arrayVar.checkSemantics(all);

        // enough maps?
        if (mapVars.size() != arrayVar.numDimensions())
            throw new BadSemanticsException("DGrid.checkSemantics(): The number of map variables for grid `"
                    + getEncodedName() + "' does not match the number of dimensions of `"
                    + arrayVar.getEncodedName() + "'");

        //----- I added this next test 12/3/99. As soon as I did I questioned whether or not
        //----- it adds any value. ie: Can it ever happen that this test fails? I don't think
        //----- so now that I have written it...  ndp 12/3/99

        // Is the size of the maps equal to the size of the cooresponding dimensions?
        Enumeration emap = mapVars.elements();

        Enumeration edims = arrayVar.getDimensions();
        int dim = 0;
        while (emap.hasMoreElements() && edims.hasMoreElements()) {

            DArray thisMapArray = (DArray) emap.nextElement();
            Enumeration ema = thisMapArray.getDimensions();
            DArrayDimension thisMapDim = (DArrayDimension) ema.nextElement();

            DArrayDimension thisArrayDim = (DArrayDimension) edims.nextElement();

            if (thisMapDim.getSize() != thisArrayDim.getSize()) {

                throw new BadSemanticsException("In grid '" +
                        getEncodedName() +
                        " The size of dimension " +
                        dim + " in the array component '" +
                        arrayVar.getEncodedName() +
                        "is not equal to the size of the coresponding map vector '" +
                        thisMapArray.getEncodedName() + ".");
            }
            dim++;
        }
        //----- end  ndp 12/3/99

    }
public void checkSemantics(boolean all) throws BadSemanticsException {
        super.checkSemantics(all);

        Util.uniqueNames(mapVars, getEncodedName(), getTypeName());

        if (arrayVar == null)
            throw new BadSemanticsException("DGrid.checkSemantics(): Null grid base array in `"
                    + getEncodedName() + "'");

        // check semantics of array variable
        arrayVar.checkSemantics(all);

        // enough maps?
        if (mapVars.size() != arrayVar.numDimensions())
            throw new BadSemanticsException("DGrid.checkSemantics(): The number of map variables for grid `"
                    + getEncodedName() + "' does not match the number of dimensions of `"
                    + arrayVar.getEncodedName() + "'");

        //----- I added this next test 12/3/99. As soon as I did I questioned whether or not
        //----- it adds any value. ie: Can it ever happen that this test fails? I don't think
        //----- so now that I have written it...  ndp 12/3/99

        // Is the size of the maps equal to the size of the cooresponding dimensions?
        Enumeration emap = mapVars.elements();

        Enumeration edims = arrayVar.getDimensions();
        int dim = 0;
        while (emap.hasMoreElements() && edims.hasMoreElements()) {

            DArray thisMapArray = (DArray) emap.nextElement();
            Enumeration ema = thisMapArray.getDimensions();
            DArrayDimension thisMapDim = (DArrayDimension) ema.nextElement();

            DArrayDimension thisArrayDim = (DArrayDimension) edims.nextElement();

            if (thisMapDim.getSize() != thisArrayDim.getSize()) {

                throw new BadSemanticsException("In grid '" +
                        getEncodedName() +
                        " The size of dimension " +
                        dim + " in the array component '" +
                        arrayVar.getEncodedName() +
                        "is not equal to the size of the coresponding map vector '" +
                        thisMapArray.getEncodedName() + ".");
            }
            dim++;
        }
        //----- end  ndp 12/3/99

    }
Checks for internal consistency.  For <code>DGrid</code>, verify that
the map variables have unique names and match the number of dimensions
of the array variable.

@param all for complex constructor types, this flag indicates whether to
check the semantics of the member variables, too.
@throws BadSemanticsException if semantics are bad, explains why.
@see BaseType#checkSemantics(boolean)