Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Return CDL notation from Group.toString (master) #935

Merged
merged 1 commit into from
Oct 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions cdm/src/main/java/ucar/nc2/Group.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 1998-2014 University Corporation for Atmospheric Research/Unidata
* Copyright 1998-2017 University Corporation for Atmospheric Research/Unidata
*
* Portions of this software were developed by the Unidata Program at the
* University Corporation for Atmospheric Research.
Expand Down Expand Up @@ -379,6 +379,18 @@ public String getNameAndAttributes() {
return sbuff.toString();
}

/**
* CDL representation.
*
* @param strict if true, write in strict adherence to CDL definition.
* @return CDL representation.
*/
public String writeCDL(boolean strict) {
Formatter buf = new Formatter();
writeCDL(buf, new Indent(2), strict);
return buf.toString();
}

protected void writeCDL(Formatter out, Indent indent, boolean strict) {
boolean hasE = (enumTypedefs.size() > 0);
boolean hasD = (dimensions.size() > 0);
Expand Down Expand Up @@ -672,7 +684,7 @@ public Group setImmutable() {

@Override
public String toString() {
return getShortName();
return writeCDL(false);
}

/**
Expand Down