opendap/src/main/java/opendap/servers/SDGrid.java
public void printDecl(PrintWriter os, String space, boolean print_semi, boolean constrained) {

        // BEWARE! Since printDecl()is (multiple) overloaded in BaseType
        // and all of the different signatures of printDecl() in BaseType
        // lead to one signature, we must be careful to override that
        // SAME signature here. That way all calls to printDecl() for
        // this object lead to this implementation.


        boolean isSingle = false;
        boolean isStructure = false;
        boolean isGrid = false;
        boolean psemi = true;

        //os.println("The grid contains "+projectedComponents(true)+" projected components");

        if (constrained && projectedComponents(true) == 0)
            return;

        // If we are printing the declaration of a constrained Grid then check for
        // the case where the projection removes all but one component; the
        // resulting object is a simple array.
        // 2013-2-26: Heimbigner : this is incorrect, even single
        // projected components should be in a structure.

        /* Wrong
            if (constrained && projectedComponents(true) == 1) {
            //os.println("It's a single Array.");
            isSingle = true;
            psemi = print_semi;
        } */

        // If there are M (< N) components (Array and Maps combined) in a N
        // component Grid, send the M components as elements of a Structure.
        // This will preserve the grouping without violating the rules for a
        // Grid.
        else if (constrained && !projectionYieldsGrid(true)) {
            //os.println("It's a Structure.");
            isStructure = true;
        } else {
            // The number of elements in the (projected) Grid must be such that
            // we have a valid Grid object; send it as such.
            //os.println("It's a Grid.");
            isGrid = true;
        }

        if (isGrid) os.println(space + getTypeName() + " {");
        if (isGrid) os.println(space + " ARRAY:");

        if (isStructure) os.println(space + "Structure {");

        ((SDArray) arrayVar).printDecl(os, space + "    ", psemi, constrained);

        if (isGrid) os.println(space + " MAPS:");
        for (Enumeration e = mapVars.elements(); e.hasMoreElements();) {
            SDArray sda = (SDArray) e.nextElement();
            sda.printDecl(os, space + "    ", psemi, constrained);
        }

        if (isStructure || isGrid) {
            os.print(space + "} " + getEncodedName());
            if (print_semi)
                os.println(";");
        }

        return;
    }
public void printDecl(PrintWriter os, String space, boolean print_semi, boolean constrained) {

        // BEWARE! Since printDecl()is (multiple) overloaded in BaseType
        // and all of the different signatures of printDecl() in BaseType
        // lead to one signature, we must be careful to override that
        // SAME signature here. That way all calls to printDecl() for
        // this object lead to this implementation.


        boolean isSingle = false;
        boolean isStructure = false;
        boolean isGrid = false;
        boolean psemi = true;

        //os.println("The grid contains "+projectedComponents(true)+" projected components");

        if (constrained && projectedComponents(true) == 0)
            return;

        // If we are printing the declaration of a constrained Grid then check for
        // the case where the projection removes all but one component; the
        // resulting object is a simple array.
        // 2013-2-26: Heimbigner : this is incorrect, even single
        // projected components should be in a structure.

        /* Wrong
            if (constrained && projectedComponents(true) == 1) {
            //os.println("It's a single Array.");
            isSingle = true;
            psemi = print_semi;
        } */

        // If there are M (< N) components (Array and Maps combined) in a N
        // component Grid, send the M components as elements of a Structure.
        // This will preserve the grouping without violating the rules for a
        // Grid.
        else if (constrained && !projectionYieldsGrid(true)) {
            //os.println("It's a Structure.");
            isStructure = true;
        } else {
            // The number of elements in the (projected) Grid must be such that
            // we have a valid Grid object; send it as such.
            //os.println("It's a Grid.");
            isGrid = true;
        }

        if (isGrid) os.println(space + getTypeName() + " {");
        if (isGrid) os.println(space + " ARRAY:");

        if (isStructure) os.println(space + "Structure {");

        ((SDArray) arrayVar).printDecl(os, space + "    ", psemi, constrained);

        if (isGrid) os.println(space + " MAPS:");
        for (Enumeration e = mapVars.elements(); e.hasMoreElements();) {
            SDArray sda = (SDArray) e.nextElement();
            sda.printDecl(os, space + "    ", psemi, constrained);
        }

        if (isStructure || isGrid) {
            os.print(space + "} " + getEncodedName());
            if (print_semi)
                os.println(";");
        }

        return;
    }
Write the variable's declaration in a C-style syntax. This
function is used to create textual representation of the Data
Descriptor Structure (DDS).  See <em>The OPeNDAP User Manual</em> for
information about this structure.

@param os         The <code>PrintWriter</code> on which to print the
declaration.
@param space      Each line of the declaration will begin with the
characters in this string.  Usually used for leading spaces.
@param print_semi a boolean value indicating whether to print a
semicolon at the end of the declaration.
@see BaseType#printDecl(PrintWriter, String, boolean)