dap4/d4lib/src/main/java/dap4/dap4lib/DSPPrinter.java
protected void
    printCompoundInstance(DataCursor datav)
            throws DapException
    {
        //Index index = datav.getIndex();
        DapStructure dstruct = (DapStructure) ((DapVariable) datav.getTemplate()).getBaseType();
        switch (datav.getScheme()) {
        case STRUCTURE:
        case RECORD:
            List<DapVariable> dfields = dstruct.getFields();
            for(int f = 0; f < dfields.size(); f++) {
                DapVariable field = dfields.get(f);
                List<Slice> fieldslices = this.ce.getConstrainedSlices(field);
                DataCursor fdata = datav.readField(f);
                printVariable(fdata,fieldslices);
            }
            break;

        case SEQUENCE:
            DapSequence dseq = (DapSequence)dstruct;
            long count = datav.getRecordCount();
            for(long r = 0; r < count; r++) {
                DataCursor dr = datav.readRecord(r);
                printer.marginPrint("[");
                printer.eol();
                printer.indent();
                printCompoundInstance(dr);
                printer.outdent();
                printer.marginPrint("]");
            }
            break;
        default:
            throw new DapException("Unexpected data cursor scheme:" + datav.getScheme());
        }
    }
protected void
    printCompoundInstance(DataCursor datav)
            throws DapException
    {
        //Index index = datav.getIndex();
        DapStructure dstruct = (DapStructure) ((DapVariable) datav.getTemplate()).getBaseType();
        switch (datav.getScheme()) {
        case STRUCTURE:
        case RECORD:
            List<DapVariable> dfields = dstruct.getFields();
            for(int f = 0; f < dfields.size(); f++) {
                DapVariable field = dfields.get(f);
                List<Slice> fieldslices = this.ce.getConstrainedSlices(field);
                DataCursor fdata = datav.readField(f);
                printVariable(fdata,fieldslices);
            }
            break;

        case SEQUENCE:
            DapSequence dseq = (DapSequence)dstruct;
            long count = datav.getRecordCount();
            for(long r = 0; r < count; r++) {
                DataCursor dr = datav.readRecord(r);
                printer.marginPrint("[");
                printer.eol();
                printer.indent();
                printCompoundInstance(dr);
                printer.outdent();
                printer.marginPrint("]");
            }
            break;
        default:
            throw new DapException("Unexpected data cursor scheme:" + datav.getScheme());
        }
    }
protected void printCompoundInstance ( DataCursor datav ) throws DapException { //Index index = datav.getIndex(); DapStructure dstruct = ( DapStructure ) ( ( DapVariable ) datav . getTemplate ( ) ) . getBaseType ( ) ; switch ( datav . getScheme ( ) ) { case STRUCTURE : case RECORD : List < DapVariable > dfields = dstruct . getFields ( ) ; for ( int f = 0 ; f < dfields . size ( ) ; f ++ ) { DapVariable field = dfields . get ( f ) ; List < Slice > fieldslices = this . ce . getConstrainedSlices ( field ) ; DataCursor fdata = datav . readField ( f ) ; printVariable ( fdata , fieldslices ) ; } break ; case SEQUENCE : DapSequence dseq = ( DapSequence ) dstruct ; long count = datav . getRecordCount ( ) ; for ( long r = 0 ; r < count ; r ++ ) { DataCursor dr = datav . readRecord ( r ) ; printer . marginPrint ( "[" ) ; printer . eol ( ) ; printer . indent ( ) ; printCompoundInstance ( dr ) ; printer . outdent ( ) ; printer . marginPrint ( "]" ) ; } break ; default : throw new DapException ( "Unexpected data cursor scheme:" + datav . getScheme ( ) ) ; } }
Print a single structure or sequence or record instance

@param datav
@throws DapException
Print a single structure or sequence or record instance