signature:
public class CDMDSP { /** * Actions */
protected void fillgroup ( DapGroup dapgroup , Group cdmgroup ) throws DapException { } }

implementation:
// Create decls in dap group for Dimensions
for ( Dimension cdmdim : cdmgroup . getDimensions ( ) ) { DapDimension dapdim = builddim ( cdmdim ) ; } // Create decls in dap group for Enumerations
for ( EnumTypedef cdmenum : cdmgroup . getEnumTypedefs ( ) ) { String name = cdmenum . getShortName ( ) ; DapEnumeration dapenum = buildenum ( cdmenum ) ; dapenum . setShortName ( name ) ; dapgroup . addDecl ( dapenum ) ; } // Create decls in dap group for vlen induced Sequences
// Do this before building compound types
for ( Variable cdmvar0 : cdmgroup . getVariables ( ) ) { Variable cdmvar = CDMUtil . unwrap ( cdmvar0 ) ; buildseqtypes ( cdmvar ) ; } // Create decls in dap group for Compound Types
for ( Variable cdmvar0 : cdmgroup . getVariables ( ) ) { Variable cdmvar = CDMUtil . unwrap ( cdmvar0 ) ; if ( cdmvar . getDataType ( ) != DataType . STRUCTURE && cdmvar . getDataType ( ) != DataType . SEQUENCE ) continue ; DapStructure struct = buildcompoundtype ( cdmvar , dapgroup ) ; } // Create decls in dap group for Variables
for ( Variable cdmvar0 : cdmgroup . getVariables ( ) ) { Variable cdmvar = CDMUtil . unwrap ( cdmvar0 ) ; DapNode newvar = buildvariable ( cdmvar , dapgroup , cdmvar . getDimensions ( ) ) ; } // Create decls in dap group for subgroups
for ( Group subgroup : cdmgroup . getGroups ( ) ) { DapGroup newgroup = buildgroup ( subgroup ) ; dapgroup . addDecl ( newgroup ) ; } // Create decls in dap group for group - level attributes
buildattributes ( dapgroup , cdmgroup . getAttributes ( ) ) ;


signature:
public class CDMDSP { /** * Declaration Builders */
protected DapDimension builddim ( Dimension cdmdim ) throws DapException { } }

implementation:
if ( cdmdim . isVariableLength ( ) ) throw new DapException ( "* dimensions not supported" ) ; DapDimension dapdim = null ; long cdmsize = dapsize ( cdmdim ) ; String name = cdmdim . getShortName ( ) ; if ( name != null && name . length ( ) == 0 ) name = null ; boolean shared = cdmdim . isShared ( ) ; if ( ! shared ) { // Unlike the parser , since we are working
// from a NetcdfDataset instance , there might
// be multiple anonymous dimension objects
// the same size . So , just go ahead and create
// multiple instances .
dapdim = ( DapDimension ) dmrfactory . newDimension ( null , cdmsize ) ; getDMR ( ) . addDecl ( dapdim ) ; } else { // Non anonymous ; create in current group
dapdim = ( DapDimension ) dmrfactory . newDimension ( name , cdmsize ) ; dapdim . setShared ( true ) ; if ( cdmdim . isUnlimited ( ) ) { dapdim . setUnlimited ( true ) ; } Group cdmparent = cdmdim . getGroup ( ) ; DapGroup dapparent = ( DapGroup ) this . nodemap . get ( cdmparent ) ; assert dapparent != null ; assert ( dapparent != null ) ; dapparent . addDecl ( dapdim ) ; } recordNode ( cdmdim , dapdim ) ; return dapdim ;


signature:
public class CDMDSP { /** * / * Create a sequence from a variable with a
 * variable length last dimension .
 * Suppose we have cdm equivalent to this :
 * T var [ d1 ] . . . [ dn ] ] [ * ]
 * We convert to the following
 * < Sequence name = " var " >
 * < T name = " var " / >
 * < Dim name = d1 / >
 * < Dim name = dn / >
 * < / Sequence > */
protected DapSequence buildseqtype ( Variable cdmvar ) throws DapException { } }

implementation:
cdmvar = CDMUtil . unwrap ( cdmvar ) ; assert ( CDMUtil . hasVLEN ( cdmvar ) ) ; DataType dt = cdmvar . getDataType ( ) ; DapType daptype = CDMTypeFcns . cdmtype2daptype ( dt ) ; DapSequence seq = ( DapSequence ) dmrfactory . newSequence ( cdmvar . getShortName ( ) ) ; // fill DapSequence with a single field ; note that the dimensions
// are elided because they will attach to the sequence variable ,
// not the field
DapVariable field = dmrfactory . newVariable ( cdmvar . getShortName ( ) , daptype ) ; seq . addField ( field ) ; field . setParent ( seq ) ; recordSeq ( cdmvar , seq ) ; return seq ;


signature:
public class CDMDSP { /** * Walk this variable , including fields , to construct sequence types
 * for any contained vlen dimensions
 * @ param cdmvar variable to walk */
protected void buildseqtypes ( Variable cdmvar ) throws DapException { } }

implementation:
if ( CDMUtil . hasVLEN ( cdmvar ) ) { buildseqtype ( cdmvar ) ; } if ( cdmvar . getDataType ( ) == DataType . STRUCTURE || cdmvar . getDataType ( ) == DataType . SEQUENCE ) { Structure struct = ( Structure ) cdmvar ; List < Variable > fields = struct . getVariables ( ) ; for ( int i = 0 ; i < fields . size ( ) ; i ++ ) { Variable field = fields . get ( i ) ; buildseqtypes ( field ) ; // recurse for inner vlen dims
} }


signature:
public class CDMDSP { /** * Assign dimensions to a variable
 * @ param dapvar The variable to which we wish to assign dimensions
 * @ param cdmdims The cdm dimensions from which we will find the dimension info */
protected void builddimrefs ( DapVariable dapvar , List < Dimension > cdmdims ) throws DapException { } }

implementation:
if ( cdmdims == null || cdmdims . size ( ) == 0 ) return ; // It is unfortunately the case that the dimensions
// associated with the variable are not
// necessarily the same object as those dimensions
// as declared , so we need to use a non - trivial
// matching algorithm .
for ( Dimension cdmdim : cdmdims ) { DapDimension dapdim = null ; if ( cdmdim . isShared ( ) ) { Dimension declareddim = finddimdecl ( cdmdim ) ; if ( declareddim == null ) throw new DapException ( "Unprocessed cdm dimension: " + cdmdim ) ; dapdim = ( DapDimension ) this . nodemap . get ( declareddim ) ; assert dapdim != null ; } else if ( cdmdim . isVariableLength ( ) ) { // ignore
continue ; } else { // anonymous
dapdim = builddim ( cdmdim ) ; } assert ( dapdim != null ) : "Internal error" ; dapvar . addDimension ( dapdim ) ; }


signature:
public class CDMDSP { /** * Unfortunately , the CDM Iosp does not
 * actually use the declared enums . Rather ,
 * for every enum type ' d variable , a new
 * enum decl is defined . So , we need
 * to find the original enum decl that matches
 * the variable ' s enum . */
protected EnumTypedef findMatchingEnum ( EnumTypedef varenum ) throws DapException { } }

implementation:
List < EnumTypedef > candidates = new ArrayList < > ( ) ; for ( Map . Entry < DapNode , CDMNode > entry : this . nodemap . getCDMMap ( ) . entrySet ( ) ) { CDMNode cdmnode = entry . getValue ( ) ; if ( cdmnode . getSort ( ) != CDMSort . ENUMERATION ) continue ; // Compare the enumeration ( note names will differ )
EnumTypedef target = ( EnumTypedef ) cdmnode ; /* Ideally , we should test the types of the enums ,
 but , unfortunately , the var enum is always enum4.
 if ( target . getBaseType ( ) ! = varenum . getBaseType ( ) )
 continue ; */
Map < Integer , String > targetmap = target . getMap ( ) ; Map < Integer , String > varmap = varenum . getMap ( ) ; if ( targetmap . size ( ) != varmap . size ( ) ) continue ; boolean match = true ; // until otherwise shown
for ( Map . Entry < Integer , String > tpair : targetmap . entrySet ( ) ) { String tname = tpair . getValue ( ) ; int value = ( int ) tpair . getKey ( ) ; boolean found = false ; for ( Map . Entry < Integer , String > vpair : varmap . entrySet ( ) ) { if ( tname . equals ( vpair . getValue ( ) ) && value == ( int ) vpair . getKey ( ) ) { found = true ; break ; } } if ( ! found ) { match = false ; break ; } } if ( ! match ) continue ; // Save it unless it is shadowed by a closer enum
boolean shadowed = false ; for ( EnumTypedef etd : candidates ) { if ( shadows ( etd . getGroup ( ) , target . getGroup ( ) ) ) { shadowed = true ; break ; } } if ( ! shadowed ) candidates . add ( target ) ; } switch ( candidates . size ( ) ) { case 0 : throw new DapException ( "CDMDSP: No matching enum type decl: " + varenum . getShortName ( ) ) ; case 1 : break ; default : throw new DapException ( "CDMDSP: Multiple matching enum type decls: " + varenum . getShortName ( ) ) ; } return candidates . get ( 0 ) ;


signature: public class CDMDSP { protected NetcdfFile createNetcdfFile ( String location , CancelTask canceltask ) throws DapException { } }

implementation: try { NetcdfFile ncfile = NetcdfFile . open ( location , - 1 , canceltask , getContext ( ) ) ; return ncfile ; } catch ( DapException de ) { if ( DEBUG ) de . printStackTrace ( ) ; throw de ; } catch ( Exception e ) { if ( DEBUG ) e . printStackTrace ( ) ; throw new DapException ( e ) ; }


signature:
public class CDMDSP { /** * Strip vlen dimensions from a set of dimensions
 * @ param dimset
 * @ return subset of dimset with ( trailing ) vlen removed
 * @ throws DapException */
static List < Dimension > getCoreDimset ( List < Dimension > dimset ) throws DapException { } }

implementation: if ( dimset == null ) return null ; List < Dimension > core = new ArrayList < > ( ) ; int pos = - 1 ; int count = 0 ; for ( int i = 0 ; i < dimset . size ( ) ; i ++ ) { if ( dimset . get ( i ) . isVariableLength ( ) ) { pos = i ; count ++ ; } else core . add ( dimset . get ( i ) ) ; } if ( ( pos != dimset . size ( ) - 1 ) || count > 1 ) throw new DapException ( "Unsupported use of (*) Dimension" ) ; return core ;


signature:
public class CDMDSP { /** * Some attributes that are added by the NetcdfDataset
 * need to be kept out of the DMR . This function
 * defines that set .
 * @ param attrname A non - escaped attribute name to be tested for suppression
 * @ return true if the attribute should be suppressed , false otherwise . */
protected boolean suppress ( String attrname ) { } }

implementation: if ( attrname . startsWith ( "_Coord" ) ) return true ; if ( attrname . equals ( CDM . UNSIGNED ) ) return true ; return false ;


signature: public class GribRewritePanel { public java . util . List < FileBean > scan ( String top , Formatter errlog ) { } }

implementation: List < FileBean > result = new ArrayList < > ( ) ; File topFile = new File ( top ) ; if ( ! topFile . exists ( ) ) { errlog . format ( "File %s does not exist" , top ) ; return result ; } if ( topFile . isDirectory ( ) ) scanDirectory ( topFile , false , result , errlog ) ; else { FileBean fdb = null ; try { fdb = new FileBean ( topFile ) ; } catch ( IOException e ) { System . out . printf ( "FAIL, skip %s%n" , topFile . getPath ( ) ) ; } result . add ( fdb ) ; } return result ;


signature:
public class ValueClause { /** * Prints the original string representation of this clause .
 * For use in debugging . */
public void printConstraint ( PrintWriter os ) { } }

implementation: if ( constant ) { value . printVal ( os , "" , false ) ; } else { value . printConstraint ( os ) ; }


signature:
public class NcStringOrRefType { /** * gml : description */
public static StringOrRefType initDescription ( StringOrRefType description , StationTimeSeriesFeature stationFeat ) { } }

implementation:
// TEXT
description . setStringValue ( stationFeat . getDescription ( ) ) ; return description ;


signature:
public class BufrDataProcess { /** * open the file and extract BUFR messages */
public int scanBufrFile ( String filename , Counter total ) throws Exception { } }

implementation: int count = 0 ; try ( RandomAccessFile raf = new RandomAccessFile ( filename , "r" ) ) { MessageScanner scan = new MessageScanner ( raf ) ; while ( scan . hasNext ( ) ) { Message m = scan . next ( ) ; if ( m == null ) continue ; try { if ( showMess ) out . format ( "%sMessage %d header=%s%n" , indent , count , m . getHeader ( ) ) ; count ++ ; Counter counter = new Counter ( ) ; processBufrMessageAsDataset ( scan , m , counter ) ; if ( showMess ) out . format ( "%scount=%d miss=%d%n" , indent , counter . nvals , counter . nmiss ) ; total . add ( counter ) ; } catch ( Exception e ) { System . out . printf ( "  BARF:%s on %s%n" , e . getMessage ( ) , m . getHeader ( ) ) ; indent . setIndentLevel ( 0 ) ; } } } return count ;


signature:
public class BufrDataProcess { /** * convert one message ino a NetcdfDataset and print data */
private void processBufrMessageAsDataset ( MessageScanner scan , Message m , Counter counter ) throws Exception { } }

implementation: byte [ ] mbytes = scan . getMessageBytes ( m ) ; NetcdfFile ncfile = NetcdfFile . openInMemory ( "test" , mbytes , "ucar.nc2.iosp.bufr.BufrIosp" ) ; Sequence obs = ( Sequence ) ncfile . findVariable ( BufrIosp2 . obsRecord ) ; StructureDataIterator sdataIter = obs . getStructureIterator ( - 1 ) ; processSequence ( obs , sdataIter , counter ) ;


signature:
public class BufrDataProcess { /** * iterate through the observations */
private void processSequence ( Structure s , StructureDataIterator sdataIter , Counter counter ) throws IOException { } }

implementation: indent . incr ( ) ; int count = 0 ; try { while ( sdataIter . hasNext ( ) ) { if ( showData ) out . format ( "%sSequence %s count=%d%n" , indent , s . getShortName ( ) , count ++ ) ; StructureData sdata = sdataIter . next ( ) ; indent . incr ( ) ; for ( StructureMembers . Member m : sdata . getMembers ( ) ) { Variable v = s . findVariable ( m . getName ( ) ) ; if ( m . getDataType ( ) . isString ( ) || m . getDataType ( ) . isNumeric ( ) ) { processVariable ( v , sdata . getArray ( m ) , counter ) ; } else if ( m . getDataType ( ) == DataType . STRUCTURE ) { Structure sds = ( Structure ) v ; ArrayStructure data = ( ArrayStructure ) sdata . getArray ( m ) ; processSequence ( sds , data . getStructureDataIterator ( ) , counter ) ; } else if ( m . getDataType ( ) == DataType . SEQUENCE ) { Sequence sds = ( Sequence ) v ; ArraySequence data = ( ArraySequence ) sdata . getArray ( m ) ; processSequence ( sds , data . getStructureDataIterator ( ) , counter ) ; } } indent . decr ( ) ; } } finally { sdataIter . close ( ) ; } indent . decr ( ) ;


signature:
public class WriterCFPointDataset { /** * private ArrayInt . D1 parentArray = new ArrayInt . D1(1 ) ; */
private void createRecordVariables ( List < ? extends VariableSimpleIF > dataVars ) { } }

implementation:
ncfileOut . addDimension ( null , new Dimension ( recordDimName , 0 , true , true , false ) ) ; // time variable
Variable timeVar = ncfileOut . addVariable ( null , timeName , DataType . DOUBLE , recordDimName ) ; timeVar . addAttribute ( new Attribute ( CDM . UNITS , "secs since 1970-01-01 00:00:00" ) ) ; timeVar . addAttribute ( new Attribute ( CDM . LONG_NAME , "date/time of observation" ) ) ; recordVars . add ( timeVar ) ; // latitude variable
Variable latVar = ncfileOut . addVariable ( null , latName , DataType . DOUBLE , recordDimName ) ; latVar . addAttribute ( new Attribute ( CDM . UNITS , "degrees_north" ) ) ; latVar . addAttribute ( new Attribute ( CDM . LONG_NAME , "latitude of observation" ) ) ; latVar . addAttribute ( new Attribute ( "standard_name" , "latitude" ) ) ; recordVars . add ( latVar ) ; // longitude variable
Variable lonVar = ncfileOut . addVariable ( null , lonName , DataType . DOUBLE , recordDimName ) ; lonVar . addAttribute ( new Attribute ( CDM . UNITS , "degrees_east" ) ) ; lonVar . addAttribute ( new Attribute ( CDM . LONG_NAME , "longitude of observation" ) ) ; lonVar . addAttribute ( new Attribute ( "standard_name" , "longitude" ) ) ; recordVars . add ( lonVar ) ; if ( useAlt ) { // altitude variable
Variable altVar = ncfileOut . addVariable ( null , altName , DataType . DOUBLE , recordDimName ) ; altVar . addAttribute ( new Attribute ( CDM . UNITS , altUnits ) ) ; altVar . addAttribute ( new Attribute ( CDM . LONG_NAME , "altitude of observation" ) ) ; altVar . addAttribute ( new Attribute ( "standard_name" , "longitude" ) ) ; altVar . addAttribute ( new Attribute ( CF . POSITIVE , CF1Convention . getZisPositive ( altName , altUnits ) ) ) ; recordVars . add ( altVar ) ; } String coordinates = timeName + " " + latName + " " + lonName ; if ( useAlt ) coordinates = coordinates + " " + altName ; Attribute coordAtt = new Attribute ( CF . COORDINATES , coordinates ) ; // find all dimensions needed by the data variables
for ( VariableSimpleIF var : dataVars ) { List < Dimension > dims = var . getDimensions ( ) ; dimSet . addAll ( dims ) ; } // add them
for ( Dimension d : dimSet ) { if ( isExtraDimension ( d ) ) ncfileOut . addDimension ( null , new Dimension ( d . getShortName ( ) , d . getLength ( ) , true , false , d . isVariableLength ( ) ) ) ; } // add the data variables all using the record dimension
for ( VariableSimpleIF oldVar : dataVars ) { if ( ncfileOut . findVariable ( oldVar . getShortName ( ) ) != null ) continue ; List < Dimension > dims = oldVar . getDimensions ( ) ; StringBuilder dimNames = new StringBuilder ( recordDimName ) ; for ( Dimension d : dims ) { if ( isExtraDimension ( d ) ) dimNames . append ( " " ) . append ( d . getShortName ( ) ) ; } Variable newVar = ncfileOut . addVariable ( null , oldVar . getShortName ( ) , oldVar . getDataType ( ) , dimNames . toString ( ) ) ; recordVars . add ( newVar ) ; List < Attribute > atts = oldVar . getAttributes ( ) ; for ( Attribute att : atts ) newVar . addAttribute ( att ) ; newVar . addAttribute ( coordAtt ) ; }


signature:
public class WriterCFPointDataset { /** * Write a ucar . nc2 . ft . PointFeatureCollection in CF point format .
 * @ param pfDataset find the first PointFeatureCollection , and write all data from it
 * @ param fileOut write to this netcdf - 3 file
 * @ return number of records written
 * @ throws IOException on read / write error , or if no PointFeatureCollection in pfDataset */
public static int writePointFeatureCollection ( FeatureDatasetPoint pfDataset , String fileOut ) throws IOException { } }

implementation:
// extract the PointFeatureCollection
PointFeatureCollection pointFeatureCollection = null ; List < DsgFeatureCollection > featureCollectionList = pfDataset . getPointFeatureCollectionList ( ) ; for ( DsgFeatureCollection featureCollection : featureCollectionList ) { if ( featureCollection instanceof PointFeatureCollection ) pointFeatureCollection = ( PointFeatureCollection ) featureCollection ; } if ( null == pointFeatureCollection ) throw new IOException ( "There is no PointFeatureCollection in  " + pfDataset . getLocation ( ) ) ; long start = System . currentTimeMillis ( ) ; FileOutputStream fos = new FileOutputStream ( fileOut ) ; DataOutputStream out = new DataOutputStream ( new BufferedOutputStream ( fos , 10000 ) ) ; WriterCFPointDataset writer = null ; // LOOK BAD
List < VariableSimpleIF > dataVars = new ArrayList < VariableSimpleIF > ( ) ; ucar . nc2 . NetcdfFile ncfile = pfDataset . getNetcdfFile ( ) ; if ( ( ncfile == null ) || ! ( ncfile instanceof NetcdfDataset ) ) { dataVars . addAll ( pfDataset . getDataVariables ( ) ) ; } else { NetcdfDataset ncd = ( NetcdfDataset ) ncfile ; for ( VariableSimpleIF vs : pfDataset . getDataVariables ( ) ) { if ( ncd . findCoordinateAxis ( vs . getShortName ( ) ) == null ) dataVars . add ( vs ) ; } } int count = 0 ; for ( PointFeature pointFeature : pointFeatureCollection ) { StructureData data = pointFeature . getDataAll ( ) ; if ( count == 0 ) { EarthLocation loc = pointFeature . getLocation ( ) ; // LOOK we dont know this until we see the obs
String altUnits = Double . isNaN ( loc . getAltitude ( ) ) ? null : "meters" ; // LOOK units may be wrong
writer = new WriterCFPointDataset ( out , pfDataset . getGlobalAttributes ( ) , altUnits ) ; writer . writeHeader ( dataVars , - 1 ) ; } writer . writeRecord ( pointFeature , data ) ; count ++ ; } writer . finish ( ) ; out . flush ( ) ; out . close ( ) ; long took = System . currentTimeMillis ( ) - start ; System . out . printf ( "Write %d records from %s to %s took %d msecs %n" , count , pfDataset . getLocation ( ) , fileOut , took ) ; return count ;


signature:
public class WriterCFPointDataset { /** * Open a ucar . nc2 . dt . PointObsDataset , write out in CF point format .
 * @ param fileIn open through TypedDatasetFactory . open ( FeatureType . POINT , . . )
 * @ param fileOut write to tehis netcdf - 3 file
 * @ param inMemory if true , write in memory for efficiency
 * @ throws IOException on read / write error */
public static void rewritePointObsDataset ( String fileIn , String fileOut , boolean inMemory ) throws IOException { } }

implementation:
System . out . println ( "Rewrite .nc files from " + fileIn + " to " + fileOut + "inMem= " + inMemory ) ; long start = System . currentTimeMillis ( ) ; // do it in memory for speed
NetcdfFile ncfile = inMemory ? NetcdfFile . openInMemory ( fileIn ) : NetcdfFile . open ( fileIn ) ; NetcdfDataset ncd = new NetcdfDataset ( ncfile ) ; StringBuilder errlog = new StringBuilder ( ) ; PointObsDataset pobsDataset = ( PointObsDataset ) TypedDatasetFactory . open ( FeatureType . POINT , ncd , null , errlog ) ; FileOutputStream fos = new FileOutputStream ( fileOut ) ; DataOutputStream out = new DataOutputStream ( fos ) ; WriterCFPointDataset writer = null ; DataIterator iter = pobsDataset . getDataIterator ( 1000 * 1000 ) ; while ( iter . hasNext ( ) ) { PointObsDatatype pobsData = ( PointObsDatatype ) iter . nextData ( ) ; StructureData sdata = pobsData . getData ( ) ; if ( writer == null ) { ucar . unidata . geoloc . EarthLocation loc = pobsData . getLocation ( ) ; String altUnits = Double . isNaN ( loc . getAltitude ( ) ) ? null : "meters" ; writer = new WriterCFPointDataset ( out , ncfile . getGlobalAttributes ( ) , altUnits ) ; writer . writeHeader ( pobsDataset . getDataVariables ( ) , - 1 ) ; } writer . writeRecord ( pobsData , sdata ) ; } writer . finish ( ) ; long took = System . currentTimeMillis ( ) - start ; System . out . println ( "Rewrite " + fileIn + " to " + fileOut + " took = " + took ) ;


signature:
public class CdmValidatorController { /** * GET handles the case where its a remote URL ( dods or http )
 * @ param req request
 * @ param res response
 * @ throws javax . servlet . ServletException
 * @ throws java . io . IOException */
public void doGet ( HttpServletRequest req , HttpServletResponse res ) throws ServletException , IOException { } }

implementation:
log . info ( "doGet(): " + UsageLog . setupRequestContext ( req ) ) ; String urlString = req . getParameter ( "URL" ) ; if ( urlString == null ) { log . info ( "doGet(): " + UsageLog . closingMessageForRequestContext ( HttpServletResponse . SC_BAD_REQUEST , 0 ) ) ; res . sendError ( HttpServletResponse . SC_BAD_REQUEST , "Must have a URL parameter" ) ; return ; } // validate the url String
try { URI uri = new URI ( urlString ) ; urlString = uri . toASCIIString ( ) ; // LOOK do we want just toString ( ) ? Is this useful " input validation " ?
} catch ( URISyntaxException e ) { log . info ( "doGet(): " + UsageLog . closingMessageForRequestContext ( HttpServletResponse . SC_BAD_REQUEST , 0 ) ) ; res . sendError ( HttpServletResponse . SC_BAD_REQUEST , "URISyntaxException on URU parameter" ) ; return ; } String xml = req . getParameter ( "xml" ) ; boolean wantXml = ( xml != null ) && xml . equals ( "true" ) ; try { int len = showValidatorResults ( res , urlString , wantXml ) ; log . info ( "doGet(): URL = " + urlString ) ; log . info ( "doGet(): " + UsageLog . closingMessageForRequestContext ( HttpServletResponse . SC_OK , len ) ) ; } catch ( Exception e ) { log . info ( "doGet(): " + UsageLog . closingMessageForRequestContext ( HttpServletResponse . SC_BAD_REQUEST , 0 ) ) ; res . sendError ( HttpServletResponse . SC_BAD_REQUEST , "Invalid input" ) ; } catch ( Throwable e ) { log . error ( "doGet(): Validator internal error" , e ) ; log . info ( "doGet(): " + UsageLog . closingMessageForRequestContext ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR , 0 ) ) ; res . sendError ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR , "Validator internal error" ) ; }


signature:
public class CdmValidatorController { /** * POST handles uploaded files
 * @ param req request
 * @ param res response
 * @ throws ServletException
 * @ throws IOException */
public void doPost ( HttpServletRequest req , HttpServletResponse res ) throws ServletException , IOException { } }

implementation:
log . info ( "doPost(): " + UsageLog . setupRequestContext ( req ) ) ; // Check that we have a file upload request
boolean isMultipart = ServletFileUpload . isMultipartContent ( req ) ; if ( ! isMultipart ) { log . info ( "doPost(): " + UsageLog . closingMessageForRequestContext ( HttpServletResponse . SC_BAD_REQUEST , 0 ) ) ; res . sendError ( HttpServletResponse . SC_BAD_REQUEST ) ; return ; } // Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload ( this . cdmValidatorContext . getFileuploadFileItemFactory ( ) ) ; upload . setSizeMax ( this . cdmValidatorContext . getMaxFileUploadSize ( ) ) ; // maximum bytes before a FileUploadException will be thrown
List < FileItem > fileItems ; try { fileItems = ( List < FileItem > ) upload . parseRequest ( req ) ; } catch ( FileUploadException e ) { log . info ( "doPost(): Validator FileUploadException" , e ) ; log . info ( "doPost(): " + UsageLog . closingMessageForRequestContext ( HttpServletResponse . SC_BAD_REQUEST , 0 ) ) ; if ( ! res . isCommitted ( ) ) res . sendError ( HttpServletResponse . SC_BAD_REQUEST ) ; return ; } // Process the uploaded items
String username = null ; boolean wantXml = false ; for ( FileItem item : fileItems ) { if ( item . isFormField ( ) ) { if ( "username" . equals ( item . getFieldName ( ) ) ) username = item . getString ( ) ; if ( "xml" . equals ( item . getFieldName ( ) ) ) wantXml = item . getString ( ) . equals ( "true" ) ; } } for ( FileItem item : fileItems ) { if ( ! item . isFormField ( ) ) { try { processUploadedFile ( req , res , ( DiskFileItem ) item , username , wantXml ) ; return ; } catch ( Exception e ) { log . info ( "doPost(): Validator processUploadedFile" , e ) ; log . info ( "doPost(): " + UsageLog . closingMessageForRequestContext ( HttpServletResponse . SC_BAD_REQUEST , 0 ) ) ; res . sendError ( HttpServletResponse . SC_BAD_REQUEST , e . getMessage ( ) ) ; } } }


signature: public class StandardTrajectoryCollectionImpl { @ Override public Iterator < TrajectoryFeature > iterator ( ) { } }

implementation: try { PointFeatureCollectionIterator pfIterator = getPointFeatureCollectionIterator ( ) ; return new CollectionIteratorAdapter < > ( pfIterator ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; }


signature:
public class Navigation { /** * Get the affine transform based on screen size and world bounding box */
public AffineTransform getTransform ( ) { } }

implementation: at . setTransform ( pix_per_world , 0.0 , 0.0 , - pix_per_world , pix_x0 , pix_y0 ) ; if ( debug ) { System . out . println ( "Navigation getTransform = " + pix_per_world + " " + pix_x0 + " " + pix_y0 ) ; System . out . println ( "  transform = " + at ) ; } return at ;


signature:
public class Navigation { /** * calculate if we want to rotate based on aspect ratio */
public boolean wantRotate ( double displayWidth , double displayHeight ) { } }

implementation:
getMapArea ( bb ) ; // current world bounding box
boolean aspectDisplay = displayHeight < displayWidth ; boolean aspectWorldBB = bb . getHeight ( ) < bb . getWidth ( ) ; return ( aspectDisplay ^ aspectWorldBB ) ; // aspects are different


signature:
public class Navigation { /** * Calculate an affine transform based on the display size parameters - used for printing .
 * @ param rotate should the page be rotated ?
 * @ param displayX upper right corner of display area
 * @ param displayY upper right corner of display area
 * @ param displayWidth display area
 * @ param displayHeight display area
 * see Navigation . calcTransform */
public AffineTransform calcTransform ( boolean rotate , double displayX , double displayY , double displayWidth , double displayHeight ) { } }

implementation:
getMapArea ( bb ) ; // current world bounding box
// scale to limiting dimension
double pxpsx , pypsy ; if ( rotate ) { pxpsx = displayHeight / bb . getWidth ( ) ; pypsy = displayWidth / bb . getHeight ( ) ; } else { pxpsx = displayWidth / bb . getWidth ( ) ; pypsy = displayHeight / bb . getHeight ( ) ; } double pps = Math . min ( pxpsx , pypsy ) ; // calc offset : based on center point staying in center
double wx0 = bb . getX ( ) + bb . getWidth ( ) / 2 ; // world midpoint
double wy0 = bb . getY ( ) + bb . getHeight ( ) / 2 ; double x0 = displayX + displayWidth / 2 - pps * wx0 ; double y0 = displayY + displayHeight / 2 + pps * wy0 ; AffineTransform cat = new AffineTransform ( pps , 0.0 , 0.0 , - pps , x0 , y0 ) ; // rotate if we need to
if ( rotate ) cat . rotate ( Math . PI / 2 , wx0 , wy0 ) ; if ( debug ) { System . out . println ( "Navigation calcTransform = " + displayX + " " + displayY + " " + displayWidth + " " + displayHeight ) ; System . out . println ( "  world = " + bb ) ; System . out . println ( "  scale/origin = " + pps + " " + x0 + " " + y0 ) ; System . out . println ( "  transform = " + cat ) ; } return cat ;


signature:
public class Navigation { /** * Get current MapArea .
 * @ param rect : place results here , or null to create new Object */
public ProjectionRect getMapArea ( ProjectionRect rect ) { } }

implementation:
if ( rect == null ) rect = new ProjectionRect ( ) ; double width = pwidth / pix_per_world ; double height = pheight / pix_per_world ; // center point
double wx0 = ( pwidth / 2 - pix_x0 ) / pix_per_world ; double wy0 = ( pix_y0 - pheight / 2 ) / pix_per_world ; rect . setRect ( wx0 - width / 2 , wy0 - height / 2 , // minx , miny
width , height ) ; // width , height
return rect ;


signature:
public class Navigation { /** * convert a world coordinate to a display point */
public Point2D worldToScreen ( ProjectionPointImpl w , Point2D p ) { } }

implementation: p . setLocation ( pix_per_world * w . getX ( ) + pix_x0 , - pix_per_world * w . getY ( ) + pix_y0 ) ; return p ;


signature:
public class Navigation { /** * convert screen Rectangle to a projection ( world ) rectangle */
public ProjectionRect screenToWorld ( Point2D start , Point2D end ) { } }

implementation: ProjectionPointImpl p1 = new ProjectionPointImpl ( ) ; ProjectionPointImpl p2 = new ProjectionPointImpl ( ) ; screenToWorld ( start , p1 ) ; screenToWorld ( end , p2 ) ; return new ProjectionRect ( p1 . getX ( ) , p1 . getY ( ) , p2 . getX ( ) , p2 . getY ( ) ) ;


signature:
public class Navigation { /** * convert a projection ( world ) rectangle to a screen Rectangle */
public java . awt . Rectangle worldToScreen ( ProjectionRect projRect ) { } }

implementation: Point2D p1 = new Point2D . Double ( ) ; Point2D p2 = new Point2D . Double ( ) ; worldToScreen ( ( ProjectionPointImpl ) projRect . getMaxPoint ( ) , p1 ) ; worldToScreen ( ( ProjectionPointImpl ) projRect . getMinPoint ( ) , p2 ) ; return new java . awt . Rectangle ( ( int ) p1 . getX ( ) , ( int ) p1 . getY ( ) , ( int ) p2 . getX ( ) , ( int ) p2 . getY ( ) ) ;


signature:
public class Navigation { /** * call this to change the center of the screen ' s world coordinates .
 * deltax , deltay in display coordinates */
public void pan ( double deltax , double deltay ) { } }

implementation: zoom . push ( ) ; pix_x0 -= deltax ; pix_y0 -= deltay ; fireMapAreaEvent ( ) ;


signature:
public class Navigation { /** * call this to zoom into a subset of the screen .
 * startx , starty are the upper left corner of the box in display coords
 * width , height the size of the box in display coords */
public void zoom ( double startx , double starty , double width , double height ) { } }

implementation: if ( debugZoom ) System . out . println ( "zoom " + startx + " " + starty + " " + width + " " + height + " " ) ; if ( ( width < 5 ) || ( height < 5 ) ) return ; zoom . push ( ) ; pix_x0 -= startx + width / 2 - pwidth / 2 ; pix_y0 -= starty + height / 2 - pheight / 2 ; zoom ( pwidth / width ) ;


signature:
public class Navigation { /** * adjust bounding box to fit inside the screen size */
private void recalcFromBoundingBox ( ) { } }

implementation:
if ( debugRecalc ) { System . out . println ( "Navigation recalcFromBoundingBox= " + bb ) ; System . out . println ( "  " + pwidth + " " + pheight ) ; } // decide which dimension is limiting
double pixx_per_wx = ( bb . getWidth ( ) == 0.0 ) ? 1 : pwidth / bb . getWidth ( ) ; double pixy_per_wy = ( bb . getHeight ( ) == 0.0 ) ? 1 : pheight / bb . getHeight ( ) ; pix_per_world = Math . min ( pixx_per_wx , pixy_per_wy ) ; // calc the center point
double wx0 = bb . getX ( ) + bb . getWidth ( ) / 2 ; double wy0 = bb . getY ( ) + bb . getHeight ( ) / 2 ; // calc offset based on center point
pix_x0 = pwidth / 2 - pix_per_world * wx0 ; pix_y0 = pheight / 2 + pix_per_world * wy0 ; if ( debugRecalc ) { System . out . println ( "Navigation recalcFromBoundingBox done= " + pix_per_world + " " + pix_x0 + " " + pix_y0 ) ; System . out . println ( "  " + pwidth + " " + pheight + " " + bb ) ; }


signature:
public class ListenerManager { /** * Add a listener .
 * @ param l listener must be of type " listener _ class " */
public synchronized void addListener ( Object l ) { } }

implementation: if ( ! listeners . contains ( l ) ) { listeners . add ( l ) ; hasListeners = true ; } else logger . warn ( "ListenerManager.addListener already has Listener " + l ) ;


signature:
public class ListenerManager { /** * Remove a listener .
 * @ param l listener must be of type " listener _ class " */
public synchronized void removeListener ( Object l ) { } }

implementation: if ( listeners . contains ( l ) ) { listeners . remove ( l ) ; hasListeners = ( listeners . size ( ) > 0 ) ; } else logger . warn ( "ListenerManager.removeListener couldnt find Listener " + l ) ;


signature:
public class ListenerManager { /** * Send an event to all registered listeners . If an exception is thrown , remove
 * the Listener from the list
 * @ param event the event to be sent : public void method _ name ( event _ class event ) */
public synchronized void sendEvent ( java . util . EventObject event ) { } }

implementation:
if ( ! hasListeners || ! enabled ) return ; Object [ ] args = new Object [ 1 ] ; args [ 0 ] = event ; // send event to all listeners
ListIterator iter = listeners . listIterator ( ) ; while ( iter . hasNext ( ) ) { Object client = iter . next ( ) ; try { method . invoke ( client , args ) ; } catch ( IllegalAccessException e ) { logger . error ( "ListenerManager IllegalAccessException" , e ) ; iter . remove ( ) ; } catch ( IllegalArgumentException e ) { logger . error ( "ListenerManager IllegalArgumentException" , e ) ; iter . remove ( ) ; } catch ( InvocationTargetException e ) { // logger . error ( " ListenerManager InvocationTargetException on " + method + " threw exception " + e . getTargetException ( ) , e ) ;
throw new RuntimeException ( e . getCause ( ) ) ; // pass exception to the caller of sendEvent ( )
} }


signature:
public class ListenerManager { /** * Send an event to all registered listeners , except the named one .
 * @ param event the event to be sent : public void method _ name ( event _ class event ) */
public synchronized void sendEventExcludeSource ( java . util . EventObject event ) { } }

implementation:
if ( ! hasListeners || ! enabled ) return ; Object source = event . getSource ( ) ; Object [ ] args = new Object [ 1 ] ; args [ 0 ] = event ; // send event to all listeners except the source
ListIterator iter = listeners . listIterator ( ) ; while ( iter . hasNext ( ) ) { Object client = iter . next ( ) ; if ( client == source ) continue ; try { method . invoke ( client , args ) ; } catch ( IllegalAccessException | InvocationTargetException | IllegalArgumentException e ) { e . printStackTrace ( ) ; if ( e . getCause ( ) != null ) e . getCause ( ) . printStackTrace ( ) ; // iter . remove ( ) ;
logger . error ( "ListenerManager calling " + method + " threw exception " , e ) ; } }


signature:
public class NCdumpW { /** * ncdump that parses a command string .
 * @ param command command string
 * @ param out send output here
 * @ param ct allow task to be cancelled ; may be null .
 * @ return true if successful
 * @ throws IOException on write error */
public static boolean print ( String command , Writer out , ucar . nc2 . util . CancelTask ct ) throws IOException { } }

implementation:
// pull out the filename from the command
String filename ; StringTokenizer stoke = new StringTokenizer ( command ) ; if ( stoke . hasMoreTokens ( ) ) filename = stoke . nextToken ( ) ; else { out . write ( usage ) ; return false ; } try ( NetcdfFile nc = NetcdfDataset . openFile ( filename , ct ) ) { // the rest of the command
int pos = command . indexOf ( filename ) ; command = command . substring ( pos + filename . length ( ) ) ; return print ( nc , command , out , ct ) ; } catch ( java . io . FileNotFoundException e ) { out . write ( "file not found= " ) ; out . write ( filename ) ; return false ; } finally { out . close ( ) ; }


signature:
public class NCdumpW { /** * ncdump , parsing command string , file already open .
 * @ param nc apply command to this file
 * @ param command : command string
 * @ param out send output here
 * @ param ct allow task to be cancelled ; may be null .
 * @ return true if successful
 * @ throws IOException on write error */
public static boolean print ( NetcdfFile nc , String command , Writer out , ucar . nc2 . util . CancelTask ct ) throws IOException { } }

implementation: WantValues showValues = WantValues . none ; boolean ncml = false ; boolean strict = false ; String varNames = null ; String trueDataset = null ; String fakeDataset = null ; if ( command != null ) { StringTokenizer stoke = new StringTokenizer ( command ) ; while ( stoke . hasMoreTokens ( ) ) { String toke = stoke . nextToken ( ) ; if ( toke . equalsIgnoreCase ( "-help" ) ) { out . write ( usage ) ; out . write ( '\n' ) ; return true ; } if ( toke . equalsIgnoreCase ( "-vall" ) ) showValues = WantValues . all ; if ( toke . equalsIgnoreCase ( "-c" ) && ( showValues == WantValues . none ) ) showValues = WantValues . coordsOnly ; if ( toke . equalsIgnoreCase ( "-ncml" ) ) ncml = true ; if ( toke . equalsIgnoreCase ( "-cdl" ) || toke . equalsIgnoreCase ( "-strict" ) ) strict = true ; if ( toke . equalsIgnoreCase ( "-v" ) && stoke . hasMoreTokens ( ) ) varNames = stoke . nextToken ( ) ; if ( toke . equalsIgnoreCase ( "-datasetname" ) && stoke . hasMoreTokens ( ) ) { fakeDataset = stoke . nextToken ( ) ; if ( fakeDataset . length ( ) == 0 ) fakeDataset = null ; if ( fakeDataset != null ) { trueDataset = nc . getLocation ( ) ; nc . setLocation ( fakeDataset ) ; } } } } boolean ok = print ( nc , out , showValues , ncml , strict , varNames , ct ) ; if ( trueDataset != null && fakeDataset != null ) nc . setLocation ( trueDataset ) ; return ok ;


signature:
public class NCdumpW { /** * ncdump - like print of netcdf file .
 * @ param filename NetcdfFile to open
 * @ param out print to this stream
 * @ param showAll dump all variable data
 * @ param showCoords only print header and coordinate variables
 * @ param ncml print NcML representation ( other arguments are ignored )
 * @ param strict print strict CDL representation
 * @ param varNames semicolon delimited list of variables whose data should be printed
 * @ param ct allow task to be cancelled ; may be null .
 * @ return true if successful
 * @ throws IOException on write error */
public static boolean print ( String filename , Writer out , boolean showAll , boolean showCoords , boolean ncml , boolean strict , String varNames , ucar . nc2 . util . CancelTask ct ) throws IOException { } }

implementation: try ( NetcdfFile nc = NetcdfDataset . openFile ( filename , ct ) ) { return print ( nc , out , showAll , showCoords , ncml , strict , varNames , ct ) ; } catch ( java . io . FileNotFoundException e ) { out . write ( "file not found= " ) ; out . write ( filename ) ; out . flush ( ) ; return false ; }


signature:
public class NCdumpW { /** * ncdump - like print of netcdf file .
 * @ param nc already opened NetcdfFile
 * @ param out print to this stream
 * @ param showAll dump all variable data
 * @ param showCoords only print header and coordinate variables
 * @ param ncml print NcML representation ( other arguments are ignored )
 * @ param strict print strict CDL representation
 * @ param varNames semicolon delimited list of variables whose data should be printed . May have
 * Fortran90 like selector : eg varName ( 1:2 , * , 2)
 * @ param ct allow task to be cancelled ; may be null .
 * @ return true if successful
 * @ throws IOException on write error */
public static boolean print ( NetcdfFile nc , Writer out , boolean showAll , boolean showCoords , boolean ncml , boolean strict , String varNames , ucar . nc2 . util . CancelTask ct ) throws IOException { } }

implementation: WantValues showValues = WantValues . none ; if ( showAll ) showValues = WantValues . all ; else if ( showCoords ) showValues = WantValues . coordsOnly ; return print ( nc , out , showValues , ncml , strict , varNames , ct ) ;


signature:
public class NCdumpW { /** * ncdump - like print of netcdf file .
 * @ param nc already opened NetcdfFile
 * @ param out print to this stream
 * @ param showValues do you want the variable values printed ?
 * @ param ncml print NcML representation ( other arguments are ignored )
 * @ param strict print strict CDL representation
 * @ param varNames semicolon delimited list of variables whose data should be printed . May have
 * Fortran90 like selector : eg varName ( 1:2 , * , 2)
 * @ param ct allow task to be cancelled ; may be null .
 * @ return true if successful
 * @ throws IOException on write error */
public static boolean print ( NetcdfFile nc , Writer out , WantValues showValues , boolean ncml , boolean strict , String varNames , ucar . nc2 . util . CancelTask ct ) throws IOException { } }

implementation:
boolean headerOnly = ( showValues == WantValues . none ) && ( varNames == null ) ; try { if ( ncml ) writeNcML ( nc , out , showValues , null ) ; // output schema in NcML
else if ( headerOnly ) nc . writeCDL ( new PrintWriter ( out ) , strict ) ; // output schema in CDL form ( like ncdump )
else { PrintWriter ps = new PrintWriter ( out ) ; nc . toStringStart ( ps , strict ) ; Indent indent = new Indent ( 2 ) ; indent . incr ( ) ; ps . printf ( "%n%sdata:%n" , indent ) ; indent . incr ( ) ; if ( showValues == WantValues . all ) { // dump all data
for ( Variable v : nc . getVariables ( ) ) { printArray ( v . read ( ) , v . getFullName ( ) , ps , indent , ct ) ; if ( ct != null && ct . isCancel ( ) ) return false ; } } else if ( showValues == WantValues . coordsOnly ) { // dump coordVars
for ( Variable v : nc . getVariables ( ) ) { if ( v . isCoordinateVariable ( ) ) printArray ( v . read ( ) , v . getFullName ( ) , ps , indent , ct ) ; if ( ct != null && ct . isCancel ( ) ) return false ; } } if ( ( showValues != WantValues . all ) && ( varNames != null ) ) { // dump the list of variables
StringTokenizer stoke = new StringTokenizer ( varNames , ";" ) ; while ( stoke . hasMoreTokens ( ) ) { String varSubset = stoke . nextToken ( ) ; // variable name and optionally a subset
if ( varSubset . indexOf ( '(' ) >= 0 ) { // has a selector
Array data = nc . readSection ( varSubset ) ; printArray ( data , varSubset , ps , indent , ct ) ; } else { // do entire variable
Variable v = nc . findVariable ( varSubset ) ; if ( v == null ) { ps . print ( " cant find variable: " + varSubset + "\n   " + usage ) ; continue ; } // dont print coord vars if they are already printed
if ( ( showValues != WantValues . coordsOnly ) || v . isCoordinateVariable ( ) ) printArray ( v . read ( ) , v . getFullName ( ) , ps , indent , ct ) ; } if ( ct != null && ct . isCancel ( ) ) return false ; } } indent . decr ( ) ; indent . decr ( ) ; nc . toStringEnd ( ps ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; out . write ( e . getMessage ( ) ) ; out . flush ( ) ; return false ; } out . flush ( ) ; return true ;


signature:
public class NCdumpW { /** * Print all the data of the given Variable .
 * @ param v variable to print
 * @ param ct allow task to be cancelled ; may be null .
 * @ return String result
 * @ throws IOException on write error */
static public String printVariableData ( VariableIF v , ucar . nc2 . util . CancelTask ct ) throws IOException { } }

implementation:
Array data = v . read ( ) ; /* try {
 data = v . isMemberOfStructure ( ) ? v . readAllStructures ( null , true ) : v . read ( ) ;
 catch ( InvalidRangeException ex ) {
 return ex . getMessage ( ) ; */
StringWriter writer = new StringWriter ( 10000 ) ; printArray ( data , v . getFullName ( ) , new PrintWriter ( writer ) , new Indent ( 2 ) , ct ) ; return writer . toString ( ) ;


signature:
public class NCdumpW { /** * Print a section of the data of the given Variable .
 * @ param v variable to print
 * @ param sectionSpec string specification
 * @ param ct allow task to be cancelled ; may be null .
 * @ return String result formatted data ouptut
 * @ throws IOException on write error
 * @ throws InvalidRangeException is specified section doesnt match variable shape */
static public String printVariableDataSection ( Variable v , String sectionSpec , ucar . nc2 . util . CancelTask ct ) throws IOException , InvalidRangeException { } }

implementation: Array data = v . read ( sectionSpec ) ; StringWriter writer = new StringWriter ( 20000 ) ; printArray ( data , v . getFullName ( ) , new PrintWriter ( writer ) , new Indent ( 2 ) , ct ) ; return writer . toString ( ) ;


signature:
public class NCdumpW { /** * Print contents of a StructureData .
 * @ param out send output here .
 * @ param sdata StructureData to print .
 * @ throws IOException on read error */
static public void printStructureData ( PrintWriter out , StructureData sdata ) throws IOException { } }

implementation: printStructureData ( out , sdata , new Indent ( 2 ) , null ) ; out . flush ( ) ;


signature:
public class NCdumpW { /** * Print array as undifferentiated sequence of values .
 * @ param ma any Array except ArrayStructure
 * @ param out print to here */
static public void printArrayPlain ( Array ma , PrintWriter out ) { } }

implementation: ma . resetLocalIterator ( ) ; while ( ma . hasNext ( ) ) { out . print ( ma . next ( ) ) ; out . print ( ' ' ) ; }


signature:
public class NCdumpW { /** * Print array to PrintWriter */
static public void printArray ( Array array , PrintWriter pw ) { } }

implementation: printArray ( array , null , null , pw , new Indent ( 2 ) , null , true ) ;


signature:
public class NCdumpW { /** * Write the NcML representation for a file .
 * Note that ucar . nc2 . dataset . NcMLWriter has a JDOM implementation , for complete NcML .
 * This method implements only the " core " NcML for plain ole netcdf files .
 * @ param ncfile write NcML for this file
 * @ param writer write to this Writer . Must be using UTF - 8 encoding ( where applicable )
 * @ param showValues do you want the variable values printed ?
 * @ param url use this for the url attribute ; if null use getLocation ( ) . / / ? ?
 * @ throws IOException on write error */
static public void writeNcML ( NetcdfFile ncfile , Writer writer , WantValues showValues , String url ) throws IOException { } }

implementation: Preconditions . checkNotNull ( ncfile ) ; Preconditions . checkNotNull ( writer ) ; Preconditions . checkNotNull ( showValues ) ; Predicate < Variable > writeVarsPred ; switch ( showValues ) { case none : writeVarsPred = NcMLWriter . writeNoVariablesPredicate ; break ; case coordsOnly : writeVarsPred = NcMLWriter . writeCoordinateVariablesPredicate ; break ; case all : writeVarsPred = NcMLWriter . writeAllVariablesPredicate ; break ; default : String message = String . format ( "CAN'T HAPPEN: showValues (%s) != null and checked all possible enum values." , showValues ) ; throw new AssertionError ( message ) ; } NcMLWriter ncmlWriter = new NcMLWriter ( ) ; ncmlWriter . setWriteVariablesPredicate ( writeVarsPred ) ; Element netcdfElement = ncmlWriter . makeNetcdfElement ( ncfile , url ) ; ncmlWriter . writeToWriter ( netcdfElement , writer ) ;


signature:
public class NCdumpW { /** * Main program .
 * < p > < strong > ucar . nc2 . NCdumpW filename [ - cdl | - ncml ] [ - c | - vall ] [ - v varName1 ; varName2 ; . . ] [ - v varName ( 0:1 , : , 12 ) ]
 * < / strong >
 * < p > where : < ul >
 * < li > filename : path of any CDM readable file
 * < li > cdl or ncml : output format is CDL or NcML
 * < li > - vall : dump all variable data
 * < li > - c : dump coordinate variable data
 * < li > - v varName1 ; varName2 ; : dump specified variable ( s )
 * < li > - v varName ( 0:1 , : , 12 ) : dump specified variable section
 * < / ul >
 * Default is to dump the header info only .
 * @ param args arguments */
public static void main ( String [ ] args ) { } }

implementation: if ( args . length == 0 ) { System . out . println ( usage ) ; return ; } StringBuilder sbuff = new StringBuilder ( ) ; for ( String arg : args ) { sbuff . append ( arg ) ; sbuff . append ( " " ) ; } try { Writer writer = new BufferedWriter ( new OutputStreamWriter ( System . out , CDM . utf8Charset ) ) ; NCdumpW . print ( sbuff . toString ( ) , writer , null ) ; } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; }


signature:
public class AbstractTransformBuilder { /** * from CF : false _ easting ( false _ northing ) :
 * The value added to all abscissa ( ordinate ) values in the rectangular coordinates for a map projection .
 * This value frequently is assigned to eliminate negative numbers .
 * Expressed in the unit of the coordinate variable identified by the standard name projection _ x _ coordinate ( projection _ y _ coordinate ) . */
static public double getFalseEastingScaleFactor ( NetcdfDataset ds , AttributeContainer ctv ) { } }

implementation: String units = getGeoCoordinateUnits ( ds , ctv ) ; return getFalseEastingScaleFactor ( units ) ;


signature:
public class AbstractTransformBuilder { /** * Read a variable attribute as a double .
 * @ param v the variable
 * @ param attname name of variable
 * @ param defValue default value if attribute is not found
 * @ return attribute value as a double , else NaN if not found */
protected double readAttributeDouble ( AttributeContainer v , String attname , double defValue ) { } }

implementation: Attribute att = v . findAttributeIgnoreCase ( attname ) ; if ( att == null ) return defValue ; if ( att . isString ( ) ) return Double . parseDouble ( att . getStringValue ( ) ) ; else return att . getNumericValue ( ) . doubleValue ( ) ;


signature:
public class AbstractTransformBuilder { /** * Read an attribute as double [ 2 ] . If only one value , make second same as first .
 * @ param att the attribute . May be numeric or String .
 * @ return attribute value as a double [ 2] */
protected double [ ] readAttributeDouble2 ( Attribute att ) { } }

implementation: if ( att == null ) return null ; double [ ] val = new double [ 2 ] ; if ( att . isString ( ) ) { StringTokenizer stoke = new StringTokenizer ( att . getStringValue ( ) ) ; val [ 0 ] = Double . parseDouble ( stoke . nextToken ( ) ) ; val [ 1 ] = stoke . hasMoreTokens ( ) ? Double . parseDouble ( stoke . nextToken ( ) ) : val [ 0 ] ; } else { val [ 0 ] = att . getNumericValue ( ) . doubleValue ( ) ; val [ 1 ] = ( att . getLength ( ) > 1 ) ? att . getNumericValue ( 1 ) . doubleValue ( ) : val [ 0 ] ; } return val ;


signature:
public class AbstractTransformBuilder { /** * Add a Parameter to a CoordinateTransform .
 * Make sure that the variable exists . If readData is true , read the data and use it as the value of the
 * parameter , otherwise use the variable name as the value of the parameter .
 * @ param rs the CoordinateTransform
 * @ param paramName the parameter name
 * @ param ds dataset
 * @ param varNameEscaped escaped variable name
 * @ return true if success , false is failed */
protected boolean addParameter ( CoordinateTransform rs , String paramName , NetcdfFile ds , String varNameEscaped ) { } }

implementation: if ( null == ( ds . findVariable ( varNameEscaped ) ) ) { if ( null != errBuffer ) errBuffer . format ( "CoordTransBuilder %s: no Variable named %s%n" , getTransformName ( ) , varNameEscaped ) ; return false ; } rs . addParameter ( new Parameter ( paramName , varNameEscaped ) ) ; return true ;


signature:
public class AbstractTransformBuilder { /** * Get the earth radius in km from the attribute " earth _ radius " .
 * Normally this is in meters , convert to km if its > 10,000.
 * Use Earth . getRadius ( ) as default .
 * @ param ctv coord transform variable
 * @ return earth radius in km */
protected double getEarthRadiusInKm ( AttributeContainer ctv ) { } }

implementation: double earth_radius = readAttributeDouble ( ctv , CF . EARTH_RADIUS , Earth . getRadius ( ) ) ; if ( earth_radius > 10000.0 ) earth_radius *= .001 ; return earth_radius ;


signature:
public class AccessLogParser { /** * try problem logs */
public static void main ( String [ ] args ) throws IOException { } }

implementation: AccessLogParser p = new AccessLogParser ( ) ; String line = "24.18.236.132 - - [04/Feb/2011:17:49:03 -0700] \"GET /thredds/fileServer//nexrad/level3/N0R/YUX/20110205/Level3_YUX_N0R_20110205_0011.nids \" 200 10409 \"-\" \"-\" 17" ; Matcher m = regPattern . matcher ( line ) ; System . out . printf ( "%s %s%n" , m . matches ( ) , m ) ; for ( int i = 0 ; i < m . groupCount ( ) ; i ++ ) { System . out . println ( " " + i + " " + m . group ( i ) ) ; } LogReader . Log log = p . parseLog ( line ) ; System . out . printf ( "%s%n" , log ) ;


signature:
public class InvAccessImpl { /** * * Finish constructing after all elements have been added .
 * @ return true if successful . */
public boolean finish ( ) { } }

implementation:
if ( serviceName != null ) { this . service = dataset . findService ( serviceName ) ; if ( this . service == null ) log . append ( "**InvAccess in (" ) . append ( dataset . getFullName ( ) ) . append ( "): has unknown service named (" ) . append ( serviceName ) . append ( ")\n" ) ; } // check urlPath is ok
try { new java . net . URI ( urlPath ) ; } catch ( java . net . URISyntaxException e ) { log . append ( "**InvAccess in (" ) . append ( dataset . getFullName ( ) ) . append ( "):\n" + "   urlPath= " ) . append ( urlPath ) . append ( ")\n  URISyntaxException=" ) . append ( e . getMessage ( ) ) ; } return true ;


signature: public class InvAccessImpl { boolean check ( StringBuilder out , boolean show ) { } }

implementation: boolean isValid = true ; if ( log . length ( ) > 0 ) { isValid = false ; out . append ( log ) ; } if ( getService ( ) == null ) { out . append ( "**InvAccess in (" ) . append ( dataset . getFullName ( ) ) . append ( "): with urlPath= (" ) . append ( urlPath ) . append ( ") has no valid service\n" ) ; isValid = false ; } else if ( getStandardUrlName ( ) == null ) { out . append ( "**InvAccess in (" ) . append ( dataset . getFullName ( ) ) . append ( "): with urlPath= (" ) . append ( urlPath ) . append ( ") has invalid URL\n" ) ; isValid = false ; } if ( show ) System . out . println ( "   access " + urlPath + " valid = " + isValid ) ; return isValid ;


signature:
public class D4Cursor { /** * DataCursor API ( Except as Implemented in AbstractCursor ) */
@ Override public Object read ( Index index ) throws DapException { } }

implementation: return read ( DapUtil . indexToSlices ( index ) ) ;


signature:
public class D4Cursor { /** * Support methods */
protected Object readAtomic ( List < Slice > slices ) throws DapException { } }

implementation: if ( slices == null ) throw new DapException ( "DataCursor.read: null set of slices" ) ; assert this . scheme == Scheme . ATOMIC ; DapVariable atomvar = ( DapVariable ) getTemplate ( ) ; int rank = atomvar . getRank ( ) ; assert slices != null && ( ( rank == 0 && slices . size ( ) == 1 ) || ( slices . size ( ) == rank ) ) ; DapType basetype = atomvar . getBaseType ( ) ; return readAs ( atomvar , basetype , slices ) ;


signature:
public class D4Cursor { /** * Allow specification of basetype to use ; used for enumerations
 * @ param atomvar
 * @ param basetype
 * @ param slices
 * @ return
 * @ throws DapException */
protected Object readAs ( DapVariable atomvar , DapType basetype , List < Slice > slices ) throws DapException { } }

implementation:
if ( basetype . getTypeSort ( ) == TypeSort . Enum ) { // short circuit this case
basetype = ( ( DapEnumeration ) basetype ) . getBaseType ( ) ; return readAs ( atomvar , basetype , slices ) ; } long count = DapUtil . sliceProduct ( slices ) ; Object result = LibTypeFcns . newVector ( basetype , count ) ; Odometer odom = Odometer . factory ( slices ) ; if ( DapUtil . isContiguous ( slices ) && basetype . isFixedSize ( ) ) readContig ( slices , basetype , count , odom , result ) ; else readOdom ( slices , basetype , odom , result ) ; return result ;


signature:
public class D4Cursor { /** * D4Cursor Extensions */
public D4Cursor setElements ( D4Cursor [ ] instances ) { } }

implementation: if ( ! ( getScheme ( ) == Scheme . SEQARRAY || getScheme ( ) == Scheme . STRUCTARRAY ) ) throw new IllegalStateException ( "Adding element to !(structure|sequence array) object" ) ; DapVariable var = ( DapVariable ) getTemplate ( ) ; this . elements = instances ; return this ;


signature:
public class CoverageViewer { /** * actions that control the dataset */
private void makeActionsDataset ( ) { } }

implementation:
/* choose local dataset
 AbstractAction chooseLocalDatasetAction = new AbstractAction ( ) {
 public void actionPerformed ( ActionEvent e ) {
 String filename = fileChooser . chooseFilename ( ) ;
 if ( filename = = null ) return ;
 Dataset invDs ;
 try { / / DatasetNode parent , String name , Map < String , Object > flds , List < AccessBuilder > accessBuilders , List < DatasetBuilder > datasetBuilders
 Map < String , Object > flds = new HashMap < > ( ) ;
 flds . put ( Dataset . FeatureType , FeatureType . GRID . toString ( ) ) ;
 flds . put ( Dataset . ServiceName , ServiceType . File . toString ( ) ) ; / / bogus
 invDs = new Dataset ( null , filename , flds , null , null ) ;
 setDataset ( invDs ) ;
 } catch ( Exception ue ) {
 JOptionPane . showMessageDialog ( CoverageDisplay . this , " Invalid filename = < " + filename + " > \ n " + ue . getMessage ( ) ) ;
 ue . printStackTrace ( ) ;
 BAMutil . setActionProperties ( chooseLocalDatasetAction , " FileChooser " , " open Local dataset . . . " , false , ' L ' , - 1 ) ;
 / * saveDatasetAction = new AbstractAction ( ) {
 public void actionPerformed ( ActionEvent e ) {
 String fname = controller . getDatasetName ( ) ;
 if ( fname ! = null ) {
 savedDatasetList . add ( fname ) ;
 BAMutil . addActionToMenu ( savedDatasetMenu , new DatasetAction ( fname ) , 0 ) ;
 BAMutil . setActionProperties ( saveDatasetAction , null , " save dataset " , false , ' S ' , 0 ) ; */
// Configure
chooseProjectionAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { getProjectionManager ( ) . setVisible ( ) ; } } ; BAMutil . setActionProperties ( chooseProjectionAction , null , "Projection Manager..." , false , 'P' , 0 ) ; saveCurrentProjectionAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { getProjectionManager ( ) ; // set the bounding box
ProjectionImpl proj = navPanel . getProjectionImpl ( ) . constructCopy ( ) ; proj . setDefaultMapArea ( navPanel . getMapArea ( ) ) ; // if ( debug ) System . out . println ( " GV save projection " + proj ) ;
// projManage . setMap ( renderAll . get ( " Map " ) ) ; LOOK !
// projManager . saveProjection ( proj ) ;
} } ; BAMutil . setActionProperties ( saveCurrentProjectionAction , null , "save Current Projection" , false , 'S' , 0 ) ; /* chooseColorScaleAction = new AbstractAction ( ) {
 public void actionPerformed ( ActionEvent e ) {
 if ( null = = csManager ) / / lazy instantiation
 makeColorScaleManager ( ) ;
 csManager . show ( ) ;
 BAMutil . setActionProperties ( chooseColorScaleAction , null , " ColorScale Manager . . . " , false , ' C ' , 0 ) ; */
// redraw
redrawAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { repaint ( ) ; start ( true ) ; draw ( true ) ; } } ; BAMutil . setActionProperties ( redrawAction , "alien" , "RedRaw" , false , 'W' , 0 ) ; showDatasetInfoAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { if ( infoWindow == null ) { datasetInfoTA = new TextHistoryPane ( ) ; infoWindow = new IndependentWindow ( "Dataset Information" , BAMutil . getImage ( "GDVs" ) , datasetInfoTA ) ; infoWindow . setSize ( 700 , 700 ) ; infoWindow . setLocation ( 100 , 100 ) ; } datasetInfoTA . clear ( ) ; if ( coverageDataset != null ) { Formatter f = new Formatter ( ) ; coverageDataset . toString ( f ) ; datasetInfoTA . appendLine ( f . toString ( ) ) ; } else { datasetInfoTA . appendLine ( "No coverageDataset loaded" ) ; } datasetInfoTA . gotoTop ( ) ; infoWindow . show ( ) ; } } ; BAMutil . setActionProperties ( showDatasetInfoAction , "Information" , "Show info..." , false , 'S' , - 1 ) ; /* showNcMLAction = new AbstractAction ( ) {
 public void actionPerformed ( ActionEvent e ) {
 if ( ncmlWindow = = null ) {
 ncmlTA = new TextHistoryPane ( ) ;
 ncmlWindow = new IndependentWindow ( " Dataset NcML " , BAMutil . getImage ( " GDVs " ) , ncmlTA ) ;
 ncmlWindow . setSize ( 700,700 ) ;
 ncmlWindow . setLocation ( 200 , 70 ) ;
 ncmlTA . clear ( ) ;
 / / datasetInfoTA . appendLine ( " GeoGrid XML for " + controller . getDatasetName ( ) + " \ n " ) ;
 ncmlTA . appendLine ( controller . getNcML ( ) ) ;
 ncmlTA . gotoTop ( ) ;
 ncmlWindow . show ( ) ;
 BAMutil . setActionProperties ( showNcMLAction , null , " Show NcML . . . " , false , ' X ' , - 1 ) ; */
/* showGridDatasetInfoAction = new AbstractAction ( ) {
 public void actionPerformed ( ActionEvent e ) {
 if ( ncmlWindow = = null ) {
 ncmlTA = new TextHistoryPane ( ) ;
 ncmlWindow = new IndependentWindow ( " Dataset NcML " , BAMutil . getImage ( " GDVs " ) , ncmlTA ) ;
 ncmlWindow . setSize ( 700,700 ) ;
 ncmlWindow . setLocation ( 200 , 70 ) ;
 ncmlTA . clear ( ) ;
 / / datasetInfoTA . appendLine ( " GeoGrid XML for " + controller . getDatasetName ( ) + " \ n " ) ;
 ncmlTA . appendLine ( controller . getDatasetXML ( ) ) ;
 ncmlTA . gotoTop ( ) ;
 ncmlWindow . show ( ) ;
 BAMutil . setActionProperties ( showGridDatasetInfoAction , null , " Show GridDataset Info XML . . . " , false , ' X ' , - 1 ) ;
 / / show netcdf dataset Table
 / * showNetcdfDatasetAction = new AbstractAction ( ) {
 public void actionPerformed ( ActionEvent e ) {
 NetcdfDataset netcdfDataset = controller . getNetcdfDataset ( ) ;
 if ( null ! = netcdfDataset ) {
 try {
 dsTable . setDataset ( netcdfDataset , null ) ;
 } catch ( IOException e1 ) {
 e1 . printStackTrace ( ) ;
 return ;
 dsDialog . show ( ) ;
 BAMutil . setActionProperties ( showNetcdfDatasetAction , " netcdf " , " NetcdfDataset Table Info . . . " , false , ' D ' , - 1 ) ; */
minmaxHorizAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { csDataMinMax . setSelectedItem ( ColorScale . MinMaxType . horiz ) ; setDataMinMaxType ( ColorScale . MinMaxType . horiz ) ; } } ; BAMutil . setActionProperties ( minmaxHorizAction , null , "Horizontal plane" , false , 'H' , 0 ) ; minmaxLogAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { csDataMinMax . setSelectedItem ( ColorScale . MinMaxType . log ) ; setDataMinMaxType ( ColorScale . MinMaxType . log ) ; } } ; BAMutil . setActionProperties ( minmaxLogAction , null , "log horiz plane" , false , 'V' , 0 ) ; /* minmaxVolAction = new AbstractAction ( ) {
 public void actionPerformed ( ActionEvent e ) {
 csDataMinMax . setSelectedIndex ( GridRenderer . VOL _ MinMaxType ) ;
 controller . setDataMinMaxType ( GridRenderer . MinMaxType . vert ;
 BAMutil . setActionProperties ( minmaxVolAction , null , " Grid volume " , false , ' G ' , 0 ) ; */
minmaxHoldAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { csDataMinMax . setSelectedItem ( ColorScale . MinMaxType . hold ) ; setDataMinMaxType ( ColorScale . MinMaxType . hold ) ; } } ; BAMutil . setActionProperties ( minmaxHoldAction , null , "Hold scale constant" , false , 'C' , 0 ) ; fieldLoopAction = new LoopControlAction ( fieldChooser ) ; levelLoopAction = new LoopControlAction ( levelChooser ) ; timeLoopAction = new LoopControlAction ( timeChooser ) ; runtimeLoopAction = new LoopControlAction ( runtimeChooser ) ;


signature:
public class CoverageViewer { /** * the actions can then be attached to buttcons , menus , etc */
private void makeActions ( ) { } }

implementation:
boolean state ; dataProjectionAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { Boolean state = ( Boolean ) getValue ( BAMutil . STATE ) ; if ( state ) { ProjectionImpl dataProjection = coverageRenderer . getDataProjection ( ) ; if ( null != dataProjection ) setProjection ( dataProjection ) ; } else { setProjection ( new LatLonProjection ( ) ) ; } } } ; BAMutil . setActionProperties ( dataProjectionAction , "DataProjection" , "use Data Projection" , true , 'D' , 0 ) ; dataProjectionAction . putValue ( BAMutil . STATE , true ) ; // contouring
drawBBAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { Boolean state = ( Boolean ) getValue ( BAMutil . STATE ) ; coverageRenderer . setDrawBB ( state . booleanValue ( ) ) ; draw ( false ) ; } } ; BAMutil . setActionProperties ( drawBBAction , "Contours" , "draw bounding box" , true , 'B' , 0 ) ; drawBBAction . putValue ( BAMutil . STATE , false ) ; // draw horiz
drawHorizAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { Boolean state = ( Boolean ) getValue ( BAMutil . STATE ) ; drawHorizOn = state . booleanValue ( ) ; setDrawHorizAndVert ( drawHorizOn , drawVertOn ) ; draw ( false ) ; } } ; BAMutil . setActionProperties ( drawHorizAction , "DrawHoriz" , "draw horizontal" , true , 'H' , 0 ) ; state = store . getBoolean ( "drawHorizAction" , true ) ; drawHorizAction . putValue ( BAMutil . STATE , new Boolean ( state ) ) ; drawHorizOn = state ; // draw Vert
drawVertAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { Boolean state = ( Boolean ) getValue ( BAMutil . STATE ) ; drawVertOn = state . booleanValue ( ) ; setDrawHorizAndVert ( drawHorizOn , drawVertOn ) ; draw ( false ) ; } } ; BAMutil . setActionProperties ( drawVertAction , "DrawVert" , "draw vertical" , true , 'V' , 0 ) ; state = store . getBoolean ( "drawVertAction" , false ) ; drawVertAction . putValue ( BAMutil . STATE , new Boolean ( state ) ) ; drawVertOn = state ; // show grid
showGridAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { Boolean state = ( Boolean ) getValue ( BAMutil . STATE ) ; coverageRenderer . setDrawGridLines ( state . booleanValue ( ) ) ; draw ( false ) ; } } ; BAMutil . setActionProperties ( showGridAction , "Grid" , "show grid lines" , true , 'G' , 0 ) ; state = store . getBoolean ( "showGridAction" , false ) ; showGridAction . putValue ( BAMutil . STATE , new Boolean ( state ) ) ; coverageRenderer . setDrawGridLines ( state ) ; // contouring
showContoursAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { Boolean state = ( Boolean ) getValue ( BAMutil . STATE ) ; coverageRenderer . setDrawContours ( state . booleanValue ( ) ) ; draw ( false ) ; } } ; BAMutil . setActionProperties ( showContoursAction , "Contours" , "show contours" , true , 'C' , 0 ) ; state = store . getBoolean ( "showContoursAction" , false ) ; showContoursAction . putValue ( BAMutil . STATE , new Boolean ( state ) ) ; coverageRenderer . setDrawContours ( state ) ; // contouring labels
showContourLabelsAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { Boolean state = ( Boolean ) getValue ( BAMutil . STATE ) ; coverageRenderer . setDrawContourLabels ( state . booleanValue ( ) ) ; draw ( false ) ; } } ; BAMutil . setActionProperties ( showContourLabelsAction , "ContourLabels" , "show contour labels" , true , 'L' , 0 ) ; state = store . getBoolean ( "showContourLabelsAction" , false ) ; showContourLabelsAction . putValue ( BAMutil . STATE , new Boolean ( state ) ) ; coverageRenderer . setDrawContourLabels ( state ) ;


signature:
public class CoverageViewer { /** * save all data in the PersistentStore */
public void save ( ) { } }

implementation:
// store . putInt ( " vertSplit " , splitDraw . getDividerLocation ( ) ) ;
store . putBoolean ( "navToolbarAction" , ( ( Boolean ) navToolbarAction . getValue ( BAMutil . STATE ) ) . booleanValue ( ) ) ; store . putBoolean ( "moveToolbarAction" , ( ( Boolean ) moveToolbarAction . getValue ( BAMutil . STATE ) ) . booleanValue ( ) ) ; if ( projManager != null ) projManager . storePersistentData ( ) ; /* if ( csManager ! = null )
 csManager . storePersistentData ( ) ;
 if ( sysConfigDialog ! = null )
 sysConfigDialog . storePersistentData ( ) ; */
// dsTable . save ( ) ;
// dsTable . getPrefs ( ) . putBeanObject ( " DialogBounds " , dsDialog . getBounds ( ) ) ;
store . put ( GEOTIFF_FILECHOOSER_DEFAULTDIR , geotiffFileChooser . getCurrentDirectory ( ) ) ; store . putBeanObject ( LastMapAreaName , navPanel . getMapArea ( ) ) ; store . putBeanObject ( LastProjectionName , navPanel . getProjectionImpl ( ) ) ; // if ( gridDataset ! = null )
// store . put ( LastDatasetName , gridDataset . getTitle ( ) ) ;
store . putBeanObject ( ColorScaleName , colorScale ) ; store . putBoolean ( "showGridAction" , ( ( Boolean ) showGridAction . getValue ( BAMutil . STATE ) ) . booleanValue ( ) ) ; store . putBoolean ( "showContoursAction" , ( ( Boolean ) showContoursAction . getValue ( BAMutil . STATE ) ) . booleanValue ( ) ) ; store . putBoolean ( "showContourLabelsAction" , ( ( Boolean ) showContourLabelsAction . getValue ( BAMutil . STATE ) ) . booleanValue ( ) ) ;


signature:
public class CoverageViewer { /** * / * private boolean chooseDataset ( String url ) {
 * InvDataset invDs = new InvDatasetImpl ( fname , ServerType . NETCDF ) ;
 * return chooseDataset ( invDs ) ; */
private void setSelected ( boolean b ) { } }

implementation:
selected = b ; // showGridTableAction . setEnabled ( b ) ;
// showNcMLAction . setEnabled ( b ) ;
// showNcMLAction . setEnabled ( b ) ;
// showNetcdfDatasetAction . setEnabled ( b ) ;
// showGridDatasetInfoAction . setEnabled ( b ) ;
// showNetcdfXMLAction . setEnabled ( b ) ;
navToolbarAction . setEnabled ( b ) ; moveToolbarAction . setEnabled ( b ) ; // controller . showGridAction . setEnabled ( b ) ;
// controller . showContoursAction . setEnabled ( b ) ;
// controller . showContourLabelsAction . setEnabled ( b ) ;
redrawAction . setEnabled ( b ) ; minmaxHorizAction . setEnabled ( b ) ; minmaxLogAction . setEnabled ( b ) ; minmaxHoldAction . setEnabled ( b ) ; fieldLoopAction . setEnabled ( b ) ; levelLoopAction . setEnabled ( b ) ; timeLoopAction . setEnabled ( b ) ; runtimeLoopAction . setEnabled ( b ) ; navPanel . setEnabledActions ( b ) ;


signature:
public class CoverageViewer { /** * assume that its done in the event thread */
boolean showDataset ( ) { } }

implementation:
// temp kludge for initialization
Iterable < Coverage > grids = coverageDataset . getCoverages ( ) ; currentField = grids . iterator ( ) . next ( ) ; // first
currentSlice = 0 ; currentLevel = 0 ; currentTime = 0 ; currentEnsemble = 0 ; currentRunTime = 0 ; eventsOK = false ; // dont let this trigger redraw
this . dataState = coverageRenderer . setCoverage ( coverageDataset , currentField ) ; coverageRenderer . setDataProjection ( currentField . getCoordSys ( ) . getProjection ( ) ) ; // setFields ( grids ) ;
setField ( currentField ) ; // LOOK if possible , change the projection and the map area to one that fits this dataset
ProjectionImpl dataProjection = currentField . getCoordSys ( ) . getProjection ( ) ; if ( dataProjection != null ) setProjection ( dataProjection ) ; // ready to draw
// draw ( true ) ;
// events now ok
eventsOK = true ; return true ;


signature:
public class CoverageViewer { /** * / * private void drawV ( boolean immediate ) {
 * if ( ! startOK ) return ;
 * ScaledPanel drawArea = vertPanel . getDrawArea ( ) ;
 * Graphics2D gV = drawArea . getBufferedImageGraphics ( ) ;
 * if ( gV = = null )
 * return ;
 * long startTime = System . currentTimeMillis ( ) ;
 * gV . setBackground ( Color . white ) ;
 * gV . fill ( gV . getClipBounds ( ) ) ;
 * renderGrid . renderVertView ( gV , atI ) ;
 * if ( Debug . isSet ( " timing / GridDrawVert " ) ) {
 * long tookTime = System . currentTimeMillis ( ) - startTime ;
 * System . out . println ( " timing . GridDrawVert : " + tookTime * . 001 + " seconds " ) ;
 * gV . dispose ( ) ;
 * copy buffer to the screen
 * if ( immediate )
 * drawArea . drawNow ( ) ;
 * else
 * drawArea . repaint ( ) ; */
private synchronized void redrawLater ( ) { } }

implementation:
// redrawComplete | = complete ;
boolean already = redrawTimer . isRunning ( ) ; if ( debugThread ) System . out . println ( "redrawLater isRunning= " + already ) ; if ( already ) redrawTimer . restart ( ) ; else redrawTimer . start ( ) ;


signature:
public class GempakLookup { /** * gets parameter table , then grib1 parameter based on number .
 * @ param gr GridRecord
 * @ return Parameter */
public final GridParameter getParameter ( GridRecord gr ) { } }

implementation: String name = gr . getParameterName ( ) ; GridParameter gp = GempakGridParameterTable . getParameter ( name ) ; if ( gp != null ) { return gp ; } return new GridParameter ( 0 , name , name , "" ) ;


signature:
public class GempakLookup { /** * is this a PositiveUp VerticalCoordinate . */
public final boolean isPositiveUp ( GridRecord gr ) { } }

implementation: int type = gr . getLevelType1 ( ) ; if ( ( type == 1 ) || ( type == 5 ) ) { return false ; } return true ;


signature:
public class NcReferenceType { /** * wml2 : Collection / wml2 : observationMember / om : OM _ Observation / om : observedProperty */
public static ReferenceType initObservedProperty ( ReferenceType observedProperty , VariableSimpleIF dataVar ) { } }

implementation:
// @ xlink : title
observedProperty . setTitle ( dataVar . getShortName ( ) ) ; return observedProperty ;


signature:
public class MapBean { /** * Construct the Action that is called when this bean ' s menu item / buttcon is selected .
 * Typically this routine is only called once when the bean is added .
 * The Action itself is called whenever the menu / buttcon is selected .
 * The action should have NAME , SMALL _ ICON and SHORT _ DESC properties set .
 * The applications uses these to put up a buttcon and menu item .
 * The actionPerformed ( ) method may do various things , but it must
 * send a PropertyChangeEvent with newValue = Renderer .
 * @ return the Action to be called . */
public javax . swing . Action getAction ( ) { } }

implementation: AbstractAction useMap = new AbstractAction ( getActionName ( ) , getIcon ( ) ) { public void actionPerformed ( java . awt . event . ActionEvent e ) { firePropertyChangeEvent ( this , "Renderer" , null , getRenderer ( ) ) ; } } ; useMap . putValue ( Action . SHORT_DESCRIPTION , getActionDesc ( ) ) ; return useMap ;


signature:
public class MapBean { /** * Convenience routine to make a button with a popup menu attached . to use :
 * < pre >
 * thredds . ui . PopupMenu mapBeanMenu = MapBean . makeMapSelectButton ( ) ;
 * AbstractButton butt = ( AbstractButton ) mapBeanMenu . getParentComponent ( ) ;
 * addToMenu ( butt ) ;
 * add map beans here
 * mapBeanMenu . addAction ( mb . getActionDesc ( ) , mb . getIcon ( ) , mb . getAction ( ) ) ;
 * mb . addPropertyChangeListener ( new PropertyChangeListener ( ) {
 * public void propertyChange ( java . beans . PropertyChangeEvent e ) {
 * if ( e . getPropertyName ( ) . equals ( " Renderer " ) ) {
 * mapRender = ( thredds . viewer . ui . Renderer ) e . getNewValue ( ) ;
 * mapRender . setProjection ( np . getProjectionImpl ( ) ) ;
 * redraw ( ) ; */
static public PopupMenu makeMapSelectButton ( ) { } }

implementation:
AbstractAction mapSelectAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { // System . out . println ( " mapSelectAction " ) ;
// mapPopup . show ( ) ;
} } ; BAMutil . setActionProperties ( mapSelectAction , "WorldMap" , "select map" , false , 'M' , - 1 ) ; AbstractButton mapSelectButton = BAMutil . makeButtconFromAction ( mapSelectAction ) ; PopupMenu mapPopup = new PopupMenu ( mapSelectButton , "Select Map" , true ) ; return mapPopup ;


signature:
public class UnitImpl { /** * Converts numeric values from this unit to another unit .
 * @ param amounts
 * The numeric values .
 * @ param outputUnit
 * The unit to which to convert the numeric values .
 * @ return The numeric values in the output unit in allocated space .
 * @ throws ConversionException
 * The units aren ' t convertible . */
public double [ ] convertTo ( final double [ ] amounts , final Unit outputUnit ) throws ConversionException { } }

implementation: return convertTo ( amounts , outputUnit , new double [ amounts . length ] ) ;


signature:
public class UnitImpl { /** * Converts numeric values from this unit to another unit .
 * @ param input
 * The input numeric values .
 * @ param outputUnit
 * The unit to which to convert the numeric values .
 * @ param output
 * The output numeric values . May be the same array as the input
 * values .
 * @ return The numeric values in the output unit .
 * @ throws ConversionException
 * The units aren ' t convertible . */
public float [ ] convertTo ( final float [ ] input , final Unit outputUnit , final float [ ] output ) throws ConversionException { } }

implementation: return getConverterTo ( outputUnit ) . convert ( input , output ) ;


signature:
public class UnitImpl { /** * Indicates if numeric values in this unit are convertible with another
 * unit .
 * @ param that
 * The other unit .
 * @ return < code > true < / code > if and only if numeric values in this unit are
 * convertible the other unit . */
public boolean isCompatible ( final Unit that ) { } }

implementation:
// jeffm : for some reason just calling getDerivedUnit ( ) . equals ( . . . )
// with jikes 1.1.7 as the compiler causes the jvm to crash .
// The Unit u1 = . . . does not crash .
final Unit u1 = getDerivedUnit ( ) ; return u1 . equals ( that . getDerivedUnit ( ) ) ; // return getDerivedUnit ( ) . equals ( that . getDerivedUnit ( ) ) ;


signature:
public class UnitImpl { /** * Returns a label for a quantity in this unit .
 * @ param quantityID
 * The identifier for the quantity ( e . g . " altitude " ) .
 * @ return The appropriate label ( e . g . " altitude / m " ) . */
public String makeLabel ( final String quantityID ) { } }

implementation: final StringBuilder buf = new StringBuilder ( quantityID ) ; if ( quantityID . contains ( " " ) ) { buf . insert ( 0 , '(' ) . append ( ')' ) ; } buf . append ( '/' ) ; final int start = buf . length ( ) ; buf . append ( toString ( ) ) ; if ( buf . substring ( start ) . indexOf ( ' ' ) != - 1 ) { buf . insert ( start , '(' ) . append ( ')' ) ; } return buf . toString ( ) ;


signature:
public class NcMonitoringPointType { /** * wml2 : Collection / wml2 : observationMember / om : OM _ Observation / om : featureOfInterest / wml2 : MonitoringPoint */
public static MonitoringPointType initMonitoringPointType ( MonitoringPointType monitoringPoint , StationTimeSeriesFeature stationFeat ) { } }

implementation:
// @ gml : id
String id = MarshallingUtil . createIdForType ( MonitoringPointType . class ) ; monitoringPoint . setId ( id ) ; // gml : identifier
NcCodeWithAuthorityType . initIdentifier ( monitoringPoint . addNewIdentifier ( ) , stationFeat ) ; // gml : description
NcStringOrRefType . initDescription ( monitoringPoint . addNewDescription ( ) , stationFeat ) ; if ( monitoringPoint . getDescription ( ) . getStringValue ( ) == null || monitoringPoint . getDescription ( ) . getStringValue ( ) . isEmpty ( ) ) { monitoringPoint . unsetDescription ( ) ; } // sam : sampledFeature
monitoringPoint . addNewSampledFeature ( ) ; monitoringPoint . setNilSampledFeatureArray ( 0 ) ; // Set the " sam : sampledFeature " we just added to nil .
// sams : shape
NcShapeType . initShape ( monitoringPoint . addNewShape ( ) , stationFeat ) ; return monitoringPoint ;


signature:
public class SimpleGeometryCS { /** * Given a Variable name and a beginning index and end index , returns a list of
 * polygon ( inclusive on both sides )
 * @ param name
 * @ param indexBegin
 * @ param indexEnd
 * @ return */
public List < Polygon > getPolygons ( String name , int indexBegin , int indexEnd ) { } }

implementation: return builder . getPolygons ( name , indexBegin , indexEnd ) ;


signature:
public class SimpleGeometryCS { /** * Given a Variable name and a beginning index and end index , returns a list of
 * lines ( inclusive on both sides )
 * @ param name
 * @ param indexBegin
 * @ param indexEnd
 * @ return */
public List < Line > getLines ( String name , int indexBegin , int indexEnd ) { } }

implementation: return builder . getLines ( name , indexBegin , indexEnd ) ;


signature:
public class SimpleGeometryCS { /** * Given a Variable name and a beginning index and end index
 * returns a list of points ( inclusive on both sides )
 * @ param name of the data variable
 * @ param indexBegin within the variable
 * @ param indexEnd within the variable
 * @ return a list of points with associated data */
public List < Point > getPoints ( String name , int indexBegin , int indexEnd ) { } }

implementation: return builder . getPoints ( name , indexBegin , indexEnd ) ;


signature:
public class BitReader { /** * Position file at bitOffset from startPos
 * @ param bitOffset bit offset from starting position
 * @ throws IOException on io error */
public void setBitOffset ( int bitOffset ) throws IOException { } }

implementation:
if ( bitOffset % 8 == 0 ) { raf . seek ( startPos + bitOffset / 8 ) ; bitPos = 0 ; bitBuf = 0 ; } else { raf . seek ( startPos + bitOffset / 8 ) ; bitPos = 8 - ( bitOffset % 8 ) ; bitBuf = ( byte ) raf . read ( ) ; bitBuf &= 0xff >> ( 8 - bitPos ) ; // mask off consumed bits
}


signature:
public class BitReader { /** * Read the next nb bits and return an Unsigned Long .
 * @ param nb the number of bits to convert to int , must be 0 < = nb < = 64.
 * @ return result
 * @ throws java . io . IOException on read error */
public long bits2UInt ( int nb ) throws IOException { } }

implementation:
assert nb <= 64 ; assert nb >= 0 ; long result = 0 ; int bitsLeft = nb ; while ( bitsLeft > 0 ) { // we ran out of bits - fetch the next byte . . .
if ( bitPos == 0 ) { bitBuf = nextByte ( ) ; bitPos = BIT_LENGTH ; } // - - retrieve bit from current byte - - - - -
// how many bits to read from the current byte
int size = Math . min ( bitsLeft , bitPos ) ; // move my part to start
int myBits = bitBuf >> ( bitPos - size ) ; // mask - off sign - extending
myBits &= BYTE_BITMASK ; // mask - off bits of next value
myBits &= ~ ( BYTE_BITMASK << size ) ; // - - put bit to result - - - - -
// where to place myBits inside of result
int shift = bitsLeft - size ; assert shift >= 0 ; // put it there
result |= myBits << shift ; // - - put bit to result - - - - -
// update information on what we consumed
bitsLeft -= size ; bitPos -= size ; } return result ;


signature:
public class BitReader { /** * Read the next nb bits and return an Signed Long .
 * @ param nb the number of bits to convert to int , must be < = 64.
 * @ return result
 * @ throws java . io . IOException on read error */
public long bits2SInt ( int nb ) throws IOException { } }

implementation:
long result = bits2UInt ( nb ) ; // check if we ' re negative
if ( getBit ( result , nb ) ) { // it ' s negative ! reset leading bit
result = setBit ( result , nb , false ) ; // build 2 ' s - complement
result = ~ result & LONG_BITMASK ; result = result + 1 ; } return result ;


signature:
public class DConnect2 { /** * Open a connection to the DODS server .
 * @ param urlString the URL to open ; assume already properly encoded
 * @ param command execute this command on the input stream
 * @ throws IOException if an IO exception occurred .
 * @ throws DAP2Exception if the DODS server returned an error . */
private void openConnection ( String urlString , Command command ) throws IOException , DAP2Exception { } }

implementation:
InputStream is = null ; try { try ( HTTPMethod method = HTTPFactory . Get ( _session , urlString ) ) { if ( acceptCompress ) method . setCompression ( "deflate,gzip" ) ; // enable sessions
if ( allowSessions ) method . setUseSessions ( true ) ; int statusCode ; for ( ; ; ) { statusCode = method . execute ( ) ; if ( statusCode != HttpStatus . SC_SERVICE_UNAVAILABLE ) break ; Thread . sleep ( 5000 ) ; System . err . println ( "Service Unavailable" ) ; } // debug
// if ( debugHeaders ) ucar . httpservices . HttpClientManager . showHttpRequestInfo ( f , method ) ;
if ( statusCode == HttpStatus . SC_NOT_FOUND ) { throw new DAP2Exception ( DAP2Exception . NO_SUCH_FILE , method . getStatusText ( ) + ": " + urlString ) ; } if ( statusCode == HttpStatus . SC_UNAUTHORIZED || statusCode == HttpStatus . SC_FORBIDDEN ) { throw new InvalidCredentialsException ( method . getStatusText ( ) ) ; } if ( statusCode != HttpStatus . SC_OK ) { throw new DAP2Exception ( "Method failed:" + method . getStatusText ( ) + " on URL= " + urlString ) ; } // Get the response body .
is = method . getResponseAsStream ( ) ; // check if its an error
Header header = method . getResponseHeader ( "Content-Description" ) ; if ( header != null && ( header . getValue ( ) . equals ( "dods-error" ) || header . getValue ( ) . equals ( "dods_error" ) ) ) { // create server exception object
DAP2Exception ds = new DAP2Exception ( ) ; // parse the Error object from stream and throw it
ds . parse ( is ) ; throw ds ; } ver = new ServerVersion ( method ) ; checkHeaders ( method ) ; // check for deflator
Header h = method . getResponseHeader ( "content-encoding" ) ; String encoding = ( h == null ) ? null : h . getValue ( ) ; // if ( encoding ! = null ) LogStream . out . println ( " encoding = " + encoding ) ;
if ( encoding != null && encoding . equals ( "deflate" ) ) { is = new BufferedInputStream ( new InflaterInputStream ( is ) , 1000 ) ; if ( showCompress ) System . out . printf ( "deflate %s%n" , urlString ) ; } else if ( encoding != null && encoding . equals ( "gzip" ) ) { is = new BufferedInputStream ( new GZIPInputStream ( is ) , 1000 ) ; if ( showCompress ) System . out . printf ( "gzip %s%n" , urlString ) ; } else { if ( showCompress ) System . out . printf ( "none %s%n" , urlString ) ; } command . process ( is ) ; } } catch ( IOException | DAP2Exception e ) { throw e ; } catch ( Exception e ) { Util . check ( e ) ; // e . printStackTrace ( ) ;
throw new DAP2Exception ( e ) ; }


signature:
public class DConnect2 { /** * Returns the DAS object from the dataset referenced by this object ' s URL .
 * The DAS object is referred to by appending ` . das ' to the end of a DODS
 * URL .
 * @ return the DAS associated with the referenced dataset .
 * @ throws MalformedURLException if the URL given to the
 * constructor has an error
 * @ throws IOException if an error connecting to the remote server
 * @ throws DASException on an error constructing the DAS
 * @ throws DAP2Exception if an error returned by the remote server */
public DAS getDAS ( ) throws IOException , DAP2Exception { } }

implementation:
DASCommand command = new DASCommand ( ) ; if ( filePath != null ) { // url was file :
File daspath = new File ( filePath + ".das" ) ; // See if the das file exists
if ( daspath . canRead ( ) ) { try ( FileInputStream is = new FileInputStream ( daspath ) ) { command . process ( is ) ; } } } else if ( stream != null ) { command . process ( stream ) ; } else { // assume url is remote
try { openConnection ( urlString + ".das" + getCompleteCE ( projString , selString ) , command ) ; } catch ( DAP2Exception de ) { // if ( de . getErrorCode ( ) ! = DAP2Exception . NO _ SUCH _ FILE )
// throw de ; / / rethrow
} } return command . das ;


signature:
public class DConnect2 { /** * Returns the DDS object from the dataset referenced by this object ' s URL .
 * The DDS object is referred to by appending ` . dds ' to the end of a OPeNDAP
 * URL .
 * @ param CE The constraint expression to be applied to this request by the
 * server . This is combined with any CE given in the constructor .
 * @ return the DDS associated with the referenced dataset .
 * @ throws MalformedURLException if the URL given to the constructor
 * has an error
 * @ throws IOException if an error connecting to the remote server
 * @ throws ParseException if the DDS parser returned an error
 * @ throws DDSException on an error constructing the DDS
 * @ throws DAP2Exception if an error returned by the remote server */
public DDS getDDS ( String CE ) throws IOException , ParseException , DAP2Exception { } }

implementation:
DDSCommand command = new DDSCommand ( ) ; command . setURL ( CE == null || CE . length ( ) == 0 ? urlString : urlString + "?" + CE ) ; if ( filePath != null ) { try ( FileInputStream is = new FileInputStream ( filePath + ".dds" ) ) { command . process ( is ) ; } } else if ( stream != null ) { command . process ( stream ) ; } else { // must be a remote url
openConnection ( urlString + ".dds" + ( getCompleteCE ( CE ) ) , command ) ; } return command . dds ;


signature:
public class DConnect2 { /** * Use some sense when assembling the CE . Since this DConnect
 * object may have constructed using a CE , any new CE will
 * have to be integrated into it for subsequent requests .
 * Try to do this in a sensible manner !
 * @ param CE The new CE from the client .
 * @ return The complete CE ( the one this object was built
 * with integrated with the clients ) */
private String getCompleteCE ( String CE ) { } }

implementation:
String localProjString = null ; String localSelString = null ; if ( CE == null ) return "" ; // remove any leading ' ? '
if ( CE . startsWith ( "?" ) ) CE = CE . substring ( 1 ) ; int selIndex = CE . indexOf ( '&' ) ; if ( selIndex == 0 ) { localProjString = "" ; localSelString = CE ; } else if ( selIndex > 0 ) { localSelString = CE . substring ( selIndex ) ; localProjString = CE . substring ( 0 , selIndex ) ; } else { // selIndex < 0
localProjString = CE ; localSelString = "" ; } String ce = projString ; if ( ! localProjString . equals ( "" ) ) { if ( ! ce . equals ( "" ) && localProjString . indexOf ( ',' ) != 0 ) ce += "," ; ce += localProjString ; } if ( ! selString . equals ( "" ) ) { if ( selString . indexOf ( '&' ) != 0 ) ce += "&" ; ce += selString ; } if ( ! localSelString . equals ( "" ) ) { if ( localSelString . indexOf ( '&' ) != 0 ) ce += "&" ; ce += localSelString ; } if ( ce . length ( ) > 0 ) ce = "?" + ce ; if ( false ) { DAPNode . log . debug ( "projString: '" + projString + "'" ) ; DAPNode . log . debug ( "localProjString: '" + localProjString + "'" ) ; DAPNode . log . debug ( "selString: '" + selString + "'" ) ; DAPNode . log . debug ( "localSelString: '" + localSelString + "'" ) ; DAPNode . log . debug ( "Complete CE: " + ce ) ; } return ce ; // escaping will happen elsewhere


signature:
public class DConnect2 { /** * ALternate interface to getCompleteCE ( String ce )
 * @ param proj the projection
 * @ param sel the selection
 * @ return the combined constraint */
private String getCompleteCE ( String proj , String sel ) { } }

implementation:
if ( proj != null && proj . length ( ) == 0 ) proj = "" ; // canonical
if ( sel != null && sel . length ( ) == 0 ) sel = null ; // canonical
StringBuilder buf = new StringBuilder ( ) ; if ( proj . startsWith ( "?" ) ) buf . append ( proj . substring ( 1 ) ) ; else buf . append ( proj ) ; if ( sel != null ) { if ( sel . startsWith ( "&" ) ) buf . append ( sel ) ; else { buf . append ( "&" ) ; buf . append ( sel ) ; } } return getCompleteCE ( buf . toString ( ) ) ;


signature:
public class DConnect2 { /** * Returns the DDS object from the dataset referenced by this object ' s URL .
 * The DDS object is referred to by appending ` . ddx ' to the end of a OPeNDAP
 * URL . The server should send back a DDX ( A DDS in XML format ) which
 * will get parsed here ( locally ) and a new DDS instantiated using
 * the DDSXMLParser .
 * @ param CE The constraint expression to be applied to this request by the
 * server . This is combined with any CE given in the constructor .
 * @ return the DDS associated with the referenced dataset .
 * @ throws MalformedURLException if the URL given to the constructor
 * has an error
 * @ throws IOException if an error connecting to the remote server
 * @ throws ParseException if the DDS parser returned an error
 * @ throws DDSException on an error constructing the DDS
 * @ throws DAP2Exception if an error returned by the remote server
 * @ opendap . ddx . experimental */
public DDS getDDX ( String CE ) throws IOException , ParseException , DDSException , DAP2Exception { } }

implementation: DDXCommand command = new DDXCommand ( ) ; openConnection ( urlString + ".ddx" + ( getCompleteCE ( CE ) ) , command ) ; return command . dds ;


signature:
public class DConnect2 { /** * Returns the DataDDS object from the dataset referenced by this object ' s URL .
 * The DDS object is referred to by appending ` . ddx ' to the end of a OPeNDAP
 * URL . The server should send back a DDX ( A DDS in XML format ) which
 * will get parsed here ( locally ) and a new DDS instantiated using
 * the DDSXMLParser .
 * @ param CE The constraint expression to use for this request .
 * @ return the DataDDS associated with the referenced dataset .
 * @ throws MalformedURLException if the URL given to the constructor
 * has an error
 * @ throws IOException if an error connecting to the remote server
 * @ throws ParseException if the DDS parser returned an error
 * @ throws DDSException on an error constructing the DDS
 * @ throws DAP2Exception if an error returned by the remote server
 * @ opendap . ddx . experimental */
public DataDDS getDataDDX ( String CE ) throws MalformedURLException , IOException , ParseException , DDSException , DAP2Exception { } }

implementation: return getDataDDX ( CE , new DefaultFactory ( ) ) ;


signature:
public class DConnect2 { /** * Returns the DataDDS object from the dataset referenced by this object ' s URL .
 * The DDS object is referred to by appending ` . ddx ' to the end of a OPeNDAP
 * URL . The server should send back a DDX ( A DDS in XML format ) which
 * will get parsed here ( locally ) and a new DDS instantiated using
 * the DDSXMLParser .
 * @ param CE The constraint expression to use for this request .
 * @ param btf The < code > BaseTypeFactory < / code > to build the member
 * variables in the DDS with .
 * @ return the DataDDS associated with the referenced dataset .
 * @ throws MalformedURLException if the URL given to the constructor
 * has an error
 * @ throws IOException if an error connecting to the remote server
 * @ throws ParseException if the DDS parser returned an error
 * @ throws DDSException on an error constructing the DDS
 * @ throws DAP2Exception if an error returned by the remote server
 * @ opendap . ddx . experimental
 * @ see BaseTypeFactory */
public DataDDS getDataDDX ( String CE , BaseTypeFactory btf ) throws MalformedURLException , IOException , ParseException , DDSException , DAP2Exception { } }

implementation: DataDDXCommand command = new DataDDXCommand ( btf , this . ver ) ; openConnection ( urlString + ".ddx" + ( getCompleteCE ( CE ) ) , command ) ; return command . dds ;


signature:
public class DConnect2 { /** * Returns the ` Data object ' from the dataset referenced by this object ' s
 * URL given the constraint expression CE . Note that the Data object is
 * really just a DDS object with data bound to the variables . The DDS will
 * probably contain fewer variables ( and those might have different
 * types ) than in the DDS returned by getDDS ( ) because that method returns
 * the entire DDS ( but without any data ) while this method returns
 * only those variables listed in the projection part of the constraint
 * expression .
 * Note that if CE is an empty String then the entire dataset will be
 * returned , unless a " sticky " CE has been specified in the constructor .
 * @ param CE The constraint expression to be applied to this request by the
 * server . This is combined with any CE given in the constructor .
 * @ param statusUI the < code > StatusUI < / code > object to use for GUI updates
 * and user cancellation notification ( may be null ) .
 * @ param btf The < code > BaseTypeFactory < / code > to build the member
 * variables in the DDS with .
 * @ return The < code > DataDDS < / code > object that results from applying the
 * given CE , combined with this object ' s sticky CE , on the referenced
 * dataset .
 * @ throws MalformedURLException if the URL given to the constructor
 * has an error
 * @ throws IOException if any error connecting to the remote server
 * @ throws ParseException if the DDS parser returned an error
 * @ throws DDSException on an error constructing the DDS
 * @ throws DAP2Exception if any error returned by the remote server */
public DataDDS getData ( String CE , StatusUI statusUI , BaseTypeFactory btf ) throws MalformedURLException , IOException , ParseException , DDSException , DAP2Exception { } }

implementation:
if ( CE != null && CE . trim ( ) . length ( ) == 0 ) CE = null ; DataDDS dds = new DataDDS ( ver , btf ) ; DataDDSCommand command = new DataDDSCommand ( dds , statusUI ) ; command . setURL ( urlString + ( CE == null ? "" : "?" + CE ) ) ; if ( filePath != null ) { // url is file :
File dodspath = new File ( filePath + ".dods" ) ; // See if the dods file exists
if ( dodspath . canRead ( ) ) { /* WARNING : any constraints are ignored in reading the file */
try ( FileInputStream is = new FileInputStream ( dodspath ) ) { command . process ( is ) ; } } } else if ( stream != null ) { command . process ( stream ) ; } else { String urls = urlString + ".dods" + ( CE == null ? "" : getCompleteCE ( CE ) ) ; openConnection ( urls , command ) ; } return command . dds ;