opendap/src/main/java/opendap/servers/SDGrid.java
public void printXML(PrintWriter pw, String pad, 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 gird 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.

        if (constrained && projectedComponents(true) == 1) {
            //os.println("It's a single Array.");
            isSingle = true;
        }
        // If there are M (< N) componets (Array and Maps combined) in a N
        // component Grid, send the M components as elements of a Struture.
        // 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) {
            pw.print(pad + "<Grid ");
            if (getEncodedName() != null) {
                pw.print(" name=\"" +
                        DDSXMLParser.normalizeToXML(getEncodedName()) + "\"");
            }
            pw.println(">");
        }

        if (isStructure) {

            pw.print(pad + "<Structure");
            if (getEncodedName() != null) {
                pw.print(" name=\"" +
                        DDSXMLParser.normalizeToXML(getEncodedName()) + "\"");
            }
            pw.println(">");

        }

        Enumeration e = getAttributeNames();

        while (e.hasMoreElements()) {
            String aName = (String) e.nextElement();
            Attribute a = getAttribute(aName);
            if(a!=null)
                a.printXML(pw, pad + "\t", constrained);
        }

        ((SDArray) arrayVar).printXML(pw, pad + (isSingle ? "" : "\t"), constrained);

        if (isGrid) {

            e = mapVars.elements();
            while (e.hasMoreElements()) {
                SDArray map = (SDArray) e.nextElement();
                //Coverity[DEADCODE]
                map.printAsMapXML(pw, pad + (isSingle ? "" : "\t"), constrained);
            }

        } else {

            e = mapVars.elements();
            while (e.hasMoreElements()) {
                SDArray sda = (SDArray) e.nextElement();
                sda.printXML(pw, pad + (isSingle ? "" : "\t"), constrained);
            }

        }


        if (isStructure) {
            pw.println(pad + "</Structure>");
        } else if (isGrid) {
            pw.println(pad + "</Grid>");
        }

        return;
    }
public void printXML(PrintWriter pw, String pad, 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 gird 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.

        if (constrained && projectedComponents(true) == 1) {
            //os.println("It's a single Array.");
            isSingle = true;
        }
        // If there are M (< N) componets (Array and Maps combined) in a N
        // component Grid, send the M components as elements of a Struture.
        // 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) {
            pw.print(pad + "<Grid ");
            if (getEncodedName() != null) {
                pw.print(" name=\"" +
                        DDSXMLParser.normalizeToXML(getEncodedName()) + "\"");
            }
            pw.println(">");
        }

        if (isStructure) {

            pw.print(pad + "<Structure");
            if (getEncodedName() != null) {
                pw.print(" name=\"" +
                        DDSXMLParser.normalizeToXML(getEncodedName()) + "\"");
            }
            pw.println(">");

        }

        Enumeration e = getAttributeNames();

        while (e.hasMoreElements()) {
            String aName = (String) e.nextElement();
            Attribute a = getAttribute(aName);
            if(a!=null)
                a.printXML(pw, pad + "\t", constrained);
        }

        ((SDArray) arrayVar).printXML(pw, pad + (isSingle ? "" : "\t"), constrained);

        if (isGrid) {

            e = mapVars.elements();
            while (e.hasMoreElements()) {
                SDArray map = (SDArray) e.nextElement();
                //Coverity[DEADCODE]
                map.printAsMapXML(pw, pad + (isSingle ? "" : "\t"), constrained);
            }

        } else {

            e = mapVars.elements();
            while (e.hasMoreElements()) {
                SDArray sda = (SDArray) e.nextElement();
                sda.printXML(pw, pad + (isSingle ? "" : "\t"), constrained);
            }

        }


        if (isStructure) {
            pw.println(pad + "</Structure>");
        } else if (isGrid) {
            pw.println(pad + "</Grid>");
        }

        return;
    }
public void printXML ( PrintWriter pw , String pad , 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 gird 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. if ( constrained && projectedComponents ( true ) == 1 ) { //os.println("It's a single Array."); isSingle = true ; } // If there are M (< N) componets (Array and Maps combined) in a N // component Grid, send the M components as elements of a Struture. // 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 ) { pw . print ( pad + "<Grid " ) ; if ( getEncodedName ( ) != null ) { pw . print ( " name=\"" + DDSXMLParser . normalizeToXML ( getEncodedName ( ) ) + "\"" ) ; } pw . println ( ">" ) ; } if ( isStructure ) { pw . print ( pad + "<Structure" ) ; if ( getEncodedName ( ) != null ) { pw . print ( " name=\"" + DDSXMLParser . normalizeToXML ( getEncodedName ( ) ) + "\"" ) ; } pw . println ( ">" ) ; } Enumeration e = getAttributeNames ( ) ; while ( e . hasMoreElements ( ) ) { String aName = ( String ) e . nextElement ( ) ; Attribute a = getAttribute ( aName ) ; if ( a != null ) a . printXML ( pw , pad + "\t" , constrained ) ; } ( ( SDArray ) arrayVar ) . printXML ( pw , pad + ( isSingle ? "" : "\t" ) , constrained ) ; if ( isGrid ) { e = mapVars . elements ( ) ; while ( e . hasMoreElements ( ) ) { SDArray map = ( SDArray ) e . nextElement ( ) ; //Coverity[DEADCODE] map . printAsMapXML ( pw , pad + ( isSingle ? "" : "\t" ) , constrained ) ; } } else { e = mapVars . elements ( ) ; while ( e . hasMoreElements ( ) ) { SDArray sda = ( SDArray ) e . nextElement ( ) ; sda . printXML ( pw , pad + ( isSingle ? "" : "\t" ) , constrained ) ; } } if ( isStructure ) { pw . println ( pad + "</Structure>" ) ; } else if ( isGrid ) { pw . println ( pad + "</Grid>" ) ; } 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.

@see BaseType#printDecl(PrintWriter, String, boolean)
@opendap.ddx.experimental
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 .