dap4/d4core/src/main/java/dap4/core/dmr/DapDataset.java
protected void
    finishR(DapNode node)
    {
        if(ce != null && !ce.references(node)) return;
        switch (node.getSort()) {
        case DIMENSION:
            this.alldimensions.add((DapDimension) node);
            break;
        case ENUMERATION:
            this.allenums.add((DapEnumeration) node);
            break;
        case SEQUENCE:
        case STRUCTURE:
            this.allcompounds.add((DapStructure)node);
            break;
        case VARIABLE:
            if(node.isTopLevel())
                this.topvariables.add((DapVariable) node);
            this.allvariables.add((DapVariable) node);
            break;
        case GROUP:
        case DATASET:
            DapGroup g = (DapGroup) node;
            this.allgroups.add(g);
            for(DapNode subnode : g.getDecls()) {
                finishR(subnode);
            }
            break;
        default: /*ignore*/
            break;
        }
    }
protected void
    finishR(DapNode node)
    {
        if(ce != null && !ce.references(node)) return;
        switch (node.getSort()) {
        case DIMENSION:
            this.alldimensions.add((DapDimension) node);
            break;
        case ENUMERATION:
            this.allenums.add((DapEnumeration) node);
            break;
        case SEQUENCE:
        case STRUCTURE:
            this.allcompounds.add((DapStructure)node);
            break;
        case VARIABLE:
            if(node.isTopLevel())
                this.topvariables.add((DapVariable) node);
            this.allvariables.add((DapVariable) node);
            break;
        case GROUP:
        case DATASET:
            DapGroup g = (DapGroup) node;
            this.allgroups.add(g);
            for(DapNode subnode : g.getDecls()) {
                finishR(subnode);
            }
            break;
        default: /*ignore*/
            break;
        }
    }
Recursive helper

@param node to walk