dap4/d4core/src/main/java/dap4/core/ce/CEConstraint.java
protected void
    dumpvar(Segment seg, StringBuilder buf, boolean forconstraint)
    {
        if(seg.var.isTopLevel())
            buf.append(seg.var.getFQN());
        else
            buf.append(seg.var.getShortName());
        List<DapDimension> dimset = seg.var.getDimensions();
        // Add any slices
        List<Slice> slices = seg.slices;
        if(slices == null)
            dimset = new ArrayList<DapDimension>();
        else
            assert (dimset.size() == 0 && DapUtil.isScalarSlices(slices))
                    || (dimset.size() == slices.size());
        for(int i = 0; i < dimset.size(); i++) {
            Slice slice = slices.get(i);
            DapDimension dim = dimset.get(i);
            try {
                buf.append(forconstraint ? slice.toConstraintString() : slice.toString());
            } catch (DapException de) {
            }
        }
        DapType basetype = seg.var.getBaseType();

        // if the var is atomic, then we are done
        if(basetype.isAtomic())
            return;
        // If structure and all fields are in the view, then done
        if(basetype.getTypeSort().isCompound()) {
            DapStructure struct = (DapStructure)basetype;
            if(!isWholeCompound(struct)) {
                // Need to insert {...} and recurse
                buf.append(LBRACE);
                boolean first = true;
                for(DapVariable field : struct.getFields()) {
                    if(!first) buf.append(";");
                    first = false;
                    Segment fseg = findSegment(field);
                    dumpvar(fseg, buf, forconstraint);
                }
                buf.append(RBRACE);
            }
            if(basetype.getTypeSort().isSeqType() && seg.filter != null) {
                buf.append("|");
                buf.append(seg.filter.toString());
            }
        }

    }
protected void
    dumpvar(Segment seg, StringBuilder buf, boolean forconstraint)
    {
        if(seg.var.isTopLevel())
            buf.append(seg.var.getFQN());
        else
            buf.append(seg.var.getShortName());
        List<DapDimension> dimset = seg.var.getDimensions();
        // Add any slices
        List<Slice> slices = seg.slices;
        if(slices == null)
            dimset = new ArrayList<DapDimension>();
        else
            assert (dimset.size() == 0 && DapUtil.isScalarSlices(slices))
                    || (dimset.size() == slices.size());
        for(int i = 0; i < dimset.size(); i++) {
            Slice slice = slices.get(i);
            DapDimension dim = dimset.get(i);
            try {
                buf.append(forconstraint ? slice.toConstraintString() : slice.toString());
            } catch (DapException de) {
            }
        }
        DapType basetype = seg.var.getBaseType();

        // if the var is atomic, then we are done
        if(basetype.isAtomic())
            return;
        // If structure and all fields are in the view, then done
        if(basetype.getTypeSort().isCompound()) {
            DapStructure struct = (DapStructure)basetype;
            if(!isWholeCompound(struct)) {
                // Need to insert {...} and recurse
                buf.append(LBRACE);
                boolean first = true;
                for(DapVariable field : struct.getFields()) {
                    if(!first) buf.append(";");
                    first = false;
                    Segment fseg = findSegment(field);
                    dumpvar(fseg, buf, forconstraint);
                }
                buf.append(RBRACE);
            }
            if(basetype.getTypeSort().isSeqType() && seg.filter != null) {
                buf.append("|");
                buf.append(seg.filter.toString());
            }
        }

    }
Recursive helper for tostring/toConstraintString

@param seg
@param buf
@param forconstraint