signature:
public class DodsDirDatasetSource { /** * Return a list of the InvDatasets contained in the given collection dataset
 * on this DatasetSource .
 * @ param dataset - the collection dataset to be expanded .
 * @ return A list of the InvDatasets contained in the given collection dataset .
 * @ throws IllegalArgumentException when given dataset is not a collection dataset .
 * @ throws NullPointerException if given dataset is null .
 * @ throws ClassCastException if the given InvDataset is not a DodsDirInvDataset . */
protected List expandThisLevel ( InvDataset dataset , String prefixUrlPath ) { } }

implementation:
// @ todo Switch to return type of InvDataset ( ? ? ? ) so can return error messages about datasets removed from list .
if ( dataset == null ) throw new NullPointerException ( "Given dataset cannot be null." ) ; if ( ! isCollection ( dataset ) ) throw new IllegalArgumentException ( "Dataset \"" + dataset . getName ( ) + "\" is not a collection dataset." ) ; List dsList = new ArrayList ( ) ; // Get list of possible datasets from current URL .
List possibleDsList = null ; try { possibleDsList = urlExtractor . extract ( dataset . getName ( ) ) ; } catch ( java . io . IOException e ) { log . warn ( "expandThisLevel(): IOException while extracting dataset info from given OPeNDAP directory <" + dataset . getName ( ) + ">, return empty list: " + e . getMessage ( ) ) ; return ( dsList ) ; } // Handle each link in the current access path .
String curDsUrlString = null ; URI curDsUri = null ; InvDataset curDs = null ; for ( Iterator it = possibleDsList . iterator ( ) ; it . hasNext ( ) ; ) // @ todo curDsUrlString = ( String ) it . next ( ) )
{ curDsUrlString = ( String ) it . next ( ) ; // Skip datasets that aren ' t OPeNDAP datasets ( " . html " ) or collection datasets ( " / " ) .
if ( ( ! curDsUrlString . endsWith ( ".html" ) ) && ( ! curDsUrlString . endsWith ( "/" ) ) ) { log . warn ( "expandThisLevel(): Dataset isn't an OPeNDAP dataset or collection dataset, skip <" + dataset . getName ( ) + ">." ) ; continue ; } // Remove " . html " extension .
if ( curDsUrlString . endsWith ( ".html" ) ) { curDsUrlString = curDsUrlString . substring ( 0 , curDsUrlString . length ( ) - 5 ) ; } // Avoid links back down the path hierarchy ( i . e . , parent directory links ) .
if ( ! curDsUrlString . startsWith ( this . accessPointHeaderUri . toString ( ) ) ) { log . debug ( "expandThisLevel(): current path <" + curDsUrlString + "> not child of given" + " location <" + this . accessPointHeaderUri . toString ( ) + ">, skip." ) ; continue ; } // Get URI from URL string .
try { curDsUri = new URI ( curDsUrlString ) ; } catch ( URISyntaxException e ) { log . error ( "expandThisLevel(): Skipping dataset  <" + curDsUrlString + "> due to URISyntaxException: " + e . getMessage ( ) ) ; continue ; } log . debug ( "expandThisLevel(): handle dataset (" + curDsUrlString + ")" ) ; try { curDs = new DodsDirInvDataset ( null , curDsUri ) ; } catch ( IOException e ) { log . warn ( "expandThisLevel(): skipping dataset <" + curDsUri . toString ( ) + ">, not under accessPointHeader: " + e . getMessage ( ) ) ; continue ; } dsList . add ( curDs ) ; } // END - loop through files in current directory
return ( dsList ) ;


signature:
public class CoordinateSystem { /** * Create standard name from list of axes . Sort the axes first
 * @ param axes list of CoordinateAxis
 * @ return CoordinateSystem name , created from axes names */
static public String makeName ( List < CoordinateAxis > axes ) { } }

implementation: List < CoordinateAxis > axesSorted = new ArrayList < > ( axes ) ; Collections . sort ( axesSorted , new CoordinateAxis . AxisComparator ( ) ) ; StringBuilder buff = new StringBuilder ( ) ; for ( int i = 0 ; i < axesSorted . size ( ) ; i ++ ) { CoordinateAxis axis = axesSorted . get ( i ) ; if ( i > 0 ) buff . append ( " " ) ; buff . append ( axis . getFullNameEscaped ( ) ) ; } return buff . toString ( ) ;


signature:
public class CoordinateSystem { /** * prefer smaller ranks , in case more than one */
private CoordinateAxis lesserRank ( CoordinateAxis a1 , CoordinateAxis a2 ) { } }

implementation: if ( a1 == null ) return a2 ; return ( a1 . getRank ( ) <= a2 . getRank ( ) ) ? a1 : a2 ;


signature:
public class CoordinateSystem { /** * Find the CoordinateAxis that has the given AxisType .
 * If more than one , return the one with lesser rank .
 * @ param type look for this axisType
 * @ return CoordinateAxis of the given AxisType , else null . */
public CoordinateAxis findAxis ( AxisType type ) { } }

implementation: CoordinateAxis result = null ; for ( CoordinateAxis axis : coordAxes ) { AxisType axisType = axis . getAxisType ( ) ; if ( ( axisType != null ) && ( axisType == type ) ) result = lesserRank ( result , axis ) ; } return result ;


signature:
public class CoordinateSystem { /** * Find the first ProjectionCT from the list of CoordinateTransforms .
 * @ return ProjectionCT or null if none . */
public ProjectionCT getProjectionCT ( ) { } }

implementation: for ( CoordinateTransform ct : coordTrans ) { if ( ct instanceof ProjectionCT ) return ( ProjectionCT ) ct ; } return null ;


signature:
public class CoordinateSystem { /** * Get the Projection for this coordinate system .
 * If isLatLon ( ) , then returns a LatLonProjection . Otherwise , extracts the
 * projection from any ProjectionCT CoordinateTransform .
 * @ return ProjectionImpl or null if none . */
public ProjectionImpl getProjection ( ) { } }

implementation: if ( projection == null ) { if ( isLatLon ( ) ) projection = new LatLonProjection ( ) ; ProjectionCT projCT = getProjectionCT ( ) ; if ( null != projCT ) projection = projCT . getProjection ( ) ; } return projection ;


signature:
public class CoordinateSystem { /** * true if it has X and Y CoordinateAxis , and a CoordTransform Projection
 * @ return true if it has X and Y CoordinateAxis , and a CoordTransform Projection */
public boolean isGeoXY ( ) { } }

implementation: if ( ( xAxis == null ) || ( yAxis == null ) ) return false ; return null != getProjection ( ) && ! ( projection instanceof LatLonProjection ) ;


signature:
public class CoordinateSystem { /** * true if all axes are CoordinateAxis1D and are regular
 * @ return true if all axes are CoordinateAxis1D and are regular */
public boolean isRegular ( ) { } }

implementation: for ( CoordinateAxis axis : coordAxes ) { if ( ! ( axis instanceof CoordinateAxis1D ) ) return false ; if ( ! ( ( CoordinateAxis1D ) axis ) . isRegular ( ) ) return false ; } return true ;


signature:
public class CoordinateSystem { /** * Test if all the Dimensions in subset are in set
 * @ param subset is this a subset
 * @ param set of this ?
 * @ return true if all the Dimensions in subset are in set */
public static boolean isSubset ( Collection < Dimension > subset , Collection < Dimension > set ) { } }

implementation: for ( Dimension d : subset ) { if ( ! ( set . contains ( d ) ) ) return false ; } return true ;


signature:
public class CoordinateSystem { /** * Do we have all the axes in the list ?
 * @ param wantAxes List of CoordinateAxis
 * @ return true if all in our list . */
public boolean containsAxes ( List < CoordinateAxis > wantAxes ) { } }

implementation: for ( CoordinateAxis ca : wantAxes ) { if ( ! containsAxis ( ca . getFullName ( ) ) ) return false ; } return true ;


signature:
public class CoordinateSystem { /** * Do we have the named axis ?
 * @ param axisName ( full unescaped ) name of axis
 * @ return true if we have an axis of that name */
public boolean containsAxis ( String axisName ) { } }

implementation: for ( CoordinateAxis ca : coordAxes ) { if ( ca . getFullName ( ) . equals ( axisName ) ) return true ; } return false ;


signature:
public class CoordinateSystem { /** * Do we have all the dimensions in the list ?
 * @ param wantDimensions List of Dimensions
 * @ return true if all in our list . */
public boolean containsDomain ( List < Dimension > wantDimensions ) { } }

implementation: for ( Dimension d : wantDimensions ) { if ( ! domain . contains ( d ) ) return false ; } return true ;


signature:
public class CoordinateSystem { /** * Do we have all the axes types in the list ?
 * @ param wantAxes List of AxisType
 * @ return true if all in our list . */
public boolean containsAxisTypes ( List < AxisType > wantAxes ) { } }

implementation: for ( AxisType wantAxisType : wantAxes ) { if ( ! containsAxisType ( wantAxisType ) ) return false ; } return true ;


signature:
public class CoordinateSystem { /** * Do we have an axes of the given type ?
 * @ param wantAxisType want this AxisType
 * @ return true if we have at least one axis of that type . */
public boolean containsAxisType ( AxisType wantAxisType ) { } }

implementation: for ( CoordinateAxis ca : coordAxes ) { if ( ca . getAxisType ( ) == wantAxisType ) return true ; } return false ;


signature:
public class DAPNode { /** * This version of cloneDAG ( ) is the primary
 * point of cloning . If the src is already cloned ,
 * then that existing clone is immediately returned .
 * Otherwise cloneDAG ( map ) is called to have the object
 * clone itself . Note this is static because it uses no
 * existing state .
 * @ param map list of previously cloned nodes
 * @ return the clone of the src node
 * @ throws CloneNotSupportedException */
static public DAPNode cloneDAG ( CloneMap map , DAPNode src ) throws CloneNotSupportedException { } }

implementation: DAPNode bt = map . nodes . get ( src ) ; if ( bt == null ) bt = src . cloneDAG ( map ) ; return bt ;


signature:
public class DAPNode { /** * This procedure does the actual recursive clone .
 * @ param map list of previously cloned nodes
 * @ return clone of this node
 * @ throws CloneNotSupportedException */
public DAPNode cloneDAG ( CloneMap map ) throws CloneNotSupportedException { } }

implementation:
DAPNode node = ( DAPNode ) super . clone ( ) ; // Object . clone
map . nodes . put ( this , node ) ; DAPNode tmp = map . nodes . get ( _myParent ) ; if ( tmp != node ) _myParent = tmp ; return node ;


signature:
public class GetHTMLInterfaceHandler { /** * Default handler for OPeNDAP . html requests . Returns an html form
 * and javascript code that allows the user to use their browser
 * to select variables and build constraints for a data request .
 * The DDS and DAS for the data set are used to build the form . The
 * types in opendap . servlet . www are integral to the form generation .
 * @ param rs The < code > ReqState < / code > from the client .
 * @ param dataSet
 * @ param sdds
 * @ param myDAS
 * @ throws opendap . dap . DAP2Exception
 * @ throws ParseException
 * @ see opendap . servlet . www . wwwFactory */
public void sendDataRequestForm ( ReqState rs , String dataSet , ServerDDS sdds , DAS myDAS ) // changed jc
throws DAP2Exception , ParseException { } }

implementation:
if ( _Debug ) System . out . println ( "Sending DODS Data Request Form For: " + dataSet + "    CE: '" + rs . getRequest ( ) . getQueryString ( ) + "'" ) ; String requestURL ; /* / / Turn this on later if we discover we ' re supposed to accept
 / / constraint expressions as input to the Data Request Web Form
 String ce ;
 if ( request . getQueryString ( ) = = null ) {
 ce = " " ;
 else {
 ce = " ? " + request . getQueryString ( ) ; */
int suffixIndex = rs . getRequest ( ) . getRequestURL ( ) . toString ( ) . lastIndexOf ( "." ) ; requestURL = rs . getRequest ( ) . getRequestURL ( ) . substring ( 0 , suffixIndex ) ; String dapCssUrl = "/" + requestURL . split ( "/" , 5 ) [ 3 ] + "/" + "tdsDap.css" ; try { // PrintWriter pw = new PrintWriter ( response . getOutputStream ( ) ) ;
PrintWriter pw ; if ( false ) { pw = new PrintWriter ( new FileOutputStream ( new File ( "debug.html" ) ) ) ; } else pw = new PrintWriter ( new OutputStreamWriter ( rs . getResponse ( ) . getOutputStream ( ) , Util . UTF8 ) ) ; wwwOutPut wOut = new wwwOutPut ( pw ) ; // Get the DDS and the DAS ( if one exists ) for the dataSet .
DDS myDDS = getWebFormDDS ( dataSet , sdds ) ; // DAS myDAS = dServ . getDAS ( dataSet ) ; / / change jc
jscriptCore jsc = new jscriptCore ( ) ; pw . println ( "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"\n" + "\"http://www.w3.org/TR/REC-html40/loose.dtd\">\n" + "<title>OPeNDAP Dataset Query Form</title>\n" + "<link type=\"text/css\" rel=\"stylesheet\" media=\"screen\" href=\"" + dapCssUrl + "\"/>\n" + "<base href=\"" + helpLocation + "\">\n" + "\n" + "\n" + "\n" + "

OPeNDAP Dataset Access Form
\n" + "
\n" + "<form action=\"\">\n" + "
\n" ) ; pw . flush ( ) ; wOut . writeDisposition ( requestURL ) ; pw . println ( "

\n" ) ; wOut . writeGlobalAttributes ( myDAS , myDDS ) ; pw . println ( "

\n" ) ; wOut . writeVariableEntries ( myDAS , myDDS ) ; pw . println ( "
</form>\n" ) ; pw . println ( "
\n" ) ; pw . println ( "<address>Send questions or comments to: " + "" + "support@unidata.ucar.edu" + "</address>" + "\n" ) ; pw . println ( "
" ) ; pw . println ( "
DDS:
" ) ; pw . println ( "
" ) ; myDDS . print ( pw ) ; pw . println ( "
" ) ; pw . println ( "
" ) ; pw . flush ( ) ; } catch ( IOException ioe ) { System . out . println ( "OUCH! IOException: " + ioe . getMessage ( ) ) ; ioe . printStackTrace ( System . out ) ; }


signature: public class StandardFields { private static TypeAndOrder findTao ( int center , String key ) { } }

implementation: Map < String , BufrCdmIndexProto . FldType > local = locals . get ( center ) ; if ( local != null ) { BufrCdmIndexProto . FldType result = local . get ( key ) ; if ( result != null ) return new TypeAndOrder ( result , - 1 ) ; } return fld2type . get ( key ) ;


signature: public class StandardFields { public static StandardFieldsFromMessage extract ( Message m ) throws IOException { } }

implementation: StandardFieldsFromMessage result = new StandardFieldsFromMessage ( ) ; extract ( m . ids . getCenterId ( ) , m . getRootDataDescriptor ( ) , result ) ; return result ;


signature:
public class BeanTable { /** * debug */
public String getToolTipText ( MouseEvent event ) { } }

implementation: String text = super . getToolTipText ( event ) ; System . out . println ( "BeanTable tooltip " + text ) ; return text ;


signature:
public class BeanTable { /** * Add listener : ListSelectionEvent sent when a new row is selected */
public void addListSelectionListener ( ListSelectionListener l ) { } }

implementation: listenerList . add ( javax . swing . event . ListSelectionListener . class , l ) ;


signature:
public class BeanTable { /** * Remove listener */
public void removeListSelectionListener ( ListSelectionListener l ) { } }

implementation: listenerList . remove ( javax . swing . event . ListSelectionListener . class , l ) ;


signature:
public class BeanTable { /** * Get the currently selected bean , or null if none selected .
 * @ return the currently selected bean , or null if none selected */
public Object getSelectedBean ( ) { } }

implementation: int viewRowIndex = jtable . getSelectedRow ( ) ; if ( viewRowIndex < 0 ) return null ; int modelRowIndex = jtable . convertRowIndexToModel ( viewRowIndex ) ; return ( modelRowIndex < 0 ) || ( modelRowIndex >= beans . size ( ) ) ? null : beans . get ( modelRowIndex ) ;


signature:
public class BeanTable { /** * Get the currently selected beans . Use this for multiple selection
 * @ return ArrayList of currently selected beans ( wont be null ) .
 * @ see # setSelectionMode */
public List getSelectedBeans ( ) { } }

implementation: ArrayList < Object > list = new ArrayList < > ( ) ; int [ ] viewRowIndices = jtable . getSelectedRows ( ) ; for ( int viewRowIndex : viewRowIndices ) { int modelRowIndex = jtable . convertRowIndexToModel ( viewRowIndex ) ; list . add ( beans . get ( modelRowIndex ) ) ; if ( debugSelected ) System . out . println ( " bean selected= " + modelRowIndex + " " + beans . get ( modelRowIndex ) ) ; } return list ;


signature:
public class BeanTable { /** * Get the currently selected cells .
 * Use this for multiple row selection , when columnSelection is on
 * @ return ArrayList of currently selected cells ( wont be null ) .
 * @ see BeanTable # setSelectionMode ( int ) . */
public ArrayList < Object > getSelectedCells ( ) { } }

implementation: ArrayList < Object > list = new ArrayList < > ( ) ; int [ ] viewRowIndices = jtable . getSelectedRows ( ) ; int [ ] viewColumnIndices = jtable . getSelectedColumns ( ) ; for ( int i = 0 ; i < viewRowIndices . length ; i ++ ) for ( int j = 0 ; i < viewColumnIndices . length ; j ++ ) { int modelRowIndex = jtable . convertRowIndexToModel ( viewRowIndices [ i ] ) ; int modelColumnIndex = jtable . convertColumnIndexToModel ( viewColumnIndices [ j ] ) ; list . add ( model . getValueAt ( modelRowIndex , modelColumnIndex ) ) ; } return list ;


signature:
public class BeanTable { /** * Set the currently selected cells ( 0 , false or null ) .
 * Use this for multiple row selection , when columnSelection is on */
public void clearSelectedCells ( ) { } }

implementation: int [ ] viewRowIndices = jtable . getSelectedRows ( ) ; int [ ] viewColumnIndices = jtable . getSelectedColumns ( ) ; TableColumnModel tcm = jtable . getColumnModel ( ) ; for ( int viewColumnIndex : viewColumnIndices ) { TableColumn tc = tcm . getColumn ( viewColumnIndex ) ; int modelColumnIndex = tc . getModelIndex ( ) ; Class colClass = jtable . getColumnClass ( viewColumnIndex ) ; Object zeroValue = model . zeroValue ( colClass ) ; for ( int viewRowIndex : viewRowIndices ) { int modelRowIndex = jtable . convertRowIndexToModel ( viewRowIndex ) ; model . setValueAt ( zeroValue , modelRowIndex , modelColumnIndex ) ; } }


signature:
public class BeanTable { /** * Set which row is selected .
 * @ param bean select this one ; must be in the list . */
public void setSelectedBean ( Object bean ) { } }

implementation: if ( bean == null ) return ; int modelRowIndex = beans . indexOf ( bean ) ; int viewRowIndex = jtable . convertRowIndexToView ( modelRowIndex ) ; if ( viewRowIndex >= 0 ) jtable . getSelectionModel ( ) . setSelectionInterval ( viewRowIndex , viewRowIndex ) ; makeRowVisible ( viewRowIndex ) ;


signature:
public class BeanTable { /** * Set which rows are selected .
 * must also call setSelectionMode ( ListSelectionModel . MULTIPLE _ INTERVAL _ SELECTION ) ;
 * @ param want select these */
public void setSelectedBeans ( List want ) { } }

implementation: jtable . getSelectionModel ( ) . clearSelection ( ) ; for ( Object bean : want ) { int modelRowIndex = beans . indexOf ( bean ) ; int viewRowIndex = jtable . convertRowIndexToView ( modelRowIndex ) ; if ( viewRowIndex >= 0 ) { jtable . getSelectionModel ( ) . addSelectionInterval ( viewRowIndex , viewRowIndex ) ; } }


signature:
public class BeanTable { /** * Save state to the PreferencesExt . */
public void saveState ( boolean saveData ) { } }

implementation:
if ( store == null ) return ; try { // save data
if ( saveData ) { store . putBeanCollection ( "beanList" , beans ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } List < PropertyCol > propCols = new ArrayList < > ( ) ; HidableTableColumnModel tableColumnModel = ( HidableTableColumnModel ) jtable . getColumnModel ( ) ; Enumeration < TableColumn > columns = tableColumnModel . getColumns ( false ) ; while ( columns . hasMoreElements ( ) ) { PropertyCol propCol = new PropertyCol ( ) ; TableColumn column = columns . nextElement ( ) ; propCol . setName ( column . getIdentifier ( ) . toString ( ) ) ; propCol . setWidth ( column . getWidth ( ) ) ; propCol . setVisible ( tableColumnModel . isColumnVisible ( column ) ) ; propCols . add ( propCol ) ; } store . putBeanCollection ( "propertyCol" , propCols ) ;


signature:
public class BeanTable { /** * Notifies the TableModel that the data in the specified bean has changed .
 * The TableModel will then fire an event of its own , which its listeners will hear ( usually a JTable ) .
 * @ param bean a bean that has changed . */
public void fireBeanDataChanged ( Object bean ) { } }

implementation: int row = beans . indexOf ( bean ) ; if ( row >= 0 ) { model . fireTableRowsUpdated ( row , row ) ; }


signature:
public class BeanTable { /** * Restore state from PreferencesExt */
protected void restoreState ( ) { } }

implementation:
if ( store == null ) { return ; } ArrayList propColObjs = ( ArrayList ) store . getBean ( "propertyCol" , new ArrayList ( ) ) ; HidableTableColumnModel tableColumnModel = ( HidableTableColumnModel ) jtable . getColumnModel ( ) ; int newViewIndex = 0 ; for ( Object propColObj : propColObjs ) { PropertyCol propCol = ( PropertyCol ) propColObj ; try { int currentViewIndex = tableColumnModel . getColumnIndex ( propCol . getName ( ) ) ; // May throw IAE .
TableColumn column = tableColumnModel . getColumn ( currentViewIndex ) ; column . setPreferredWidth ( propCol . getWidth ( ) ) ; tableColumnModel . moveColumn ( currentViewIndex , newViewIndex ) ; assert tableColumnModel . getColumn ( newViewIndex ) == column : "tableColumn wasn't successfully moved." ; // We must do this last , since moveColumn ( ) only works on visible columns .
tableColumnModel . setColumnVisible ( column , propCol . isVisible ( ) ) ; if ( propCol . isVisible ( ) ) { ++ newViewIndex ; // Don ' t increment for hidden columns .
} } catch ( IllegalArgumentException e ) { logger . debug ( String . format ( "Column named \"%s\" was present in the preferences file but not the dataset." , propCol . getName ( ) ) , e ) ; } }


signature:
public class CDMTypeFcns { /** * / * Needed to implement Array . getElement ( ) */
static public Class cdmElementClass ( DataType dt ) { } }

implementation: switch ( dt ) { case BOOLEAN : return boolean . class ; case ENUM1 : case BYTE : return byte . class ; case CHAR : return char . class ; case ENUM2 : case SHORT : return short . class ; case ENUM4 : case INT : return int . class ; case LONG : return long . class ; case FLOAT : return float . class ; case DOUBLE : return double . class ; case STRING : return String . class ; case OPAQUE : return ByteBuffer . class ; case UBYTE : return byte . class ; case USHORT : return short . class ; case UINT : return int . class ; case ULONG : return long . class ; default : break ; } return null ;


signature:
public class CDMTypeFcns { /** * convert a string to a specified cdmtype
 * Note that if en is defined , then we attempt
 * to convert the string as enum const
 * @ param cdmtype
 * @ param en
 * @ param o
 * @ return */
static public Object attributeParse ( DataType cdmtype , EnumTypedef en , Object o ) { } }

implementation:
String so = o . toString ( ) ; if ( en != null ) { switch ( cdmtype ) { case ENUM1 : case ENUM2 : case ENUM4 : if ( ! ( o instanceof Integer ) ) throw new ConversionException ( o . toString ( ) ) ; int eval = ( Integer ) o ; String econst = en . lookupEnumString ( eval ) ; if ( econst == null ) throw new ConversionException ( o . toString ( ) ) ; return econst ; default : throw new ConversionException ( o . toString ( ) ) ; } } long lval = 0 ; double dval = 0.0 ; boolean islong = true ; boolean isdouble = true ; // Do a quick conversion checks
try { lval = Long . parseLong ( so ) ; } catch ( NumberFormatException nfe ) { islong = false ; } try { dval = Double . parseDouble ( so ) ; } catch ( NumberFormatException nfe ) { isdouble = false ; } o = null ; // default is not convertible
switch ( cdmtype ) { case BOOLEAN : if ( so . equalsIgnoreCase ( "false" ) || ( islong && lval == 0 ) ) o = Boolean . FALSE ; else o = Boolean . TRUE ; break ; case BYTE : if ( islong ) o = Byte . valueOf ( ( byte ) lval ) ; break ; case SHORT : if ( islong ) o = Short . valueOf ( ( short ) lval ) ; break ; case INT : if ( islong ) o = Integer . valueOf ( ( int ) lval ) ; break ; case LONG : if ( islong ) o = Long . valueOf ( lval ) ; break ; case UBYTE : // Keep the proper bit pattern
if ( islong ) o = Byte . valueOf ( ( byte ) ( lval & 0xFFL ) ) ; break ; case USHORT : if ( islong ) o = Short . valueOf ( ( short ) ( lval & 0xFFFFL ) ) ; break ; case UINT : if ( islong ) o = Integer . valueOf ( ( int ) ( lval & 0xFFFFFFFFL ) ) ; break ; case ULONG : // Need to resort to BigInteger
BigInteger bi = new BigInteger ( so ) ; bi = bi . and ( LONGMASK ) ; o = ( Long ) bi . longValue ( ) ; break ; case FLOAT : if ( islong && ! isdouble ) { dval = ( double ) lval ; isdouble = true ; } if ( isdouble ) o = ( Float ) ( ( float ) dval ) ; break ; case DOUBLE : if ( islong && ! isdouble ) { dval = ( double ) lval ; isdouble = true ; } if ( isdouble ) o = ( Double ) ( dval ) ; break ; case STRING : return so ; case OPAQUE : // Big Integer then ByteBuffer
if ( so . startsWith ( "0x" ) || so . startsWith ( "0X" ) ) so = so . substring ( 2 ) ; bi = new BigInteger ( so , 16 ) ; // Now extract bytes
byte [ ] bb = bi . toByteArray ( ) ; o = ByteBuffer . wrap ( bb ) ; break ; default : throw new ConversionException ( o . toString ( ) ) ; } if ( o == null ) throw new ConversionException ( o . toString ( ) ) ; return o ;


signature:
public class UnknownUnit { /** * Factory method for constructing an unknown unit from a name .
 * @ param name The name of the unit .
 * @ return The unknown unit .
 * @ throws NameException < code > name = = null < / code > . */
public static UnknownUnit create ( String name ) throws NameException { } }

implementation: UnknownUnit unit ; name = name . toLowerCase ( ) ; synchronized ( map ) { unit = map . get ( name ) ; if ( unit == null ) { unit = new UnknownUnit ( name ) ; map . put ( unit . getName ( ) , unit ) ; map . put ( unit . getPlural ( ) , unit ) ; } } return unit ;


signature:
public class HTTPMethodStream { /** * Closes this input stream and releases any system resources associated
 * with the stream ; closes the method also .
 * @ exception IOException if an I / O error occurs ; but not if close
 * is called twice . */
@ Override public void close ( ) throws IOException { } }

implementation:
if ( closed ) return ; /* Allow multiple close calls */
closed = true ; try { consume ( ) ; } finally { super . close ( ) ; } if ( method != null ) method . close ( ) ;


signature:
public class NestedTable { /** * Has v already been added to the set of extra variables ? */
private boolean isExtra ( Variable v ) { } }

implementation: return v != null && extras != null && extras . contains ( v ) ;


signature:
public class NestedTable { /** * Is v a coordinate axis for this feature type ? */
private boolean isCoordinate ( Variable v ) { } }

implementation: if ( v == null ) return false ; String name = v . getShortName ( ) ; return ( latVE != null && latVE . axisName . equals ( name ) ) || ( lonVE != null && lonVE . axisName . equals ( name ) ) || ( altVE != null && altVE . axisName . equals ( name ) ) || ( stnAltVE != null && stnAltVE . axisName . equals ( name ) ) || ( timeVE != null && timeVE . axisName . equals ( name ) ) || ( nomTimeVE != null && nomTimeVE . axisName . equals ( name ) ) ;


signature:
public class NestedTable { /** * find a coord axis of the given type in the table and its parents */
private CoordVarExtractor findCoordinateAxis ( Table . CoordName coordName , Table t , int nestingLevel ) { } }

implementation:
if ( t == null ) return null ; String axisName = t . findCoordinateVariableName ( coordName ) ; if ( axisName != null ) { VariableDS v = t . findVariable ( axisName ) ; if ( v != null ) return new CoordVarExtractorVariable ( v , axisName , nestingLevel ) ; if ( t . extraJoins != null ) { for ( Join j : t . extraJoins ) { v = j . findVariable ( axisName ) ; if ( v != null ) return new CoordVarExtractorVariable ( v , axisName , nestingLevel ) ; } } // see if its in the StructureData
if ( t instanceof Table . TableSingleton ) { Table . TableSingleton ts = ( Table . TableSingleton ) t ; return new CoordVarStructureData ( axisName , ts . sdata ) ; } // see if its at the top level
if ( t instanceof Table . TableTop ) { v = ( VariableDS ) ds . findVariable ( axisName ) ; if ( v != null ) return new CoordVarTop ( v ) ; else return new CoordVarConstant ( coordName . toString ( ) , "" , axisName ) ; // assume its the actual value
} errlog . format ( "NestedTable: cant find variable '%s' for coordinate type %s %n" , axisName , coordName ) ; } // check the parent
return findCoordinateAxis ( coordName , t . parent , nestingLevel + 1 ) ;


signature:
public class NestedTable { /** * use recursion so that parent variables come first */
private void addDataVariables ( List < VariableSimpleIF > list , Table t ) { } }

implementation:
if ( t . parent != null ) addDataVariables ( list , t . parent ) ; for ( VariableSimpleIF col : t . cols . values ( ) ) { if ( t . nondataVars . contains ( col . getFullName ( ) ) ) continue ; if ( t . nondataVars . contains ( col . getShortName ( ) ) ) continue ; // fishy
list . add ( col ) ; }


signature:
public class NestedTable { /** * add table join to this cursor level */
void addParentJoin ( Cursor cursor ) throws IOException { } }

implementation:
int level = cursor . currentIndex ; Table t = getTable ( level ) ; if ( t . extraJoins != null ) { List < StructureData > sdata = new ArrayList < > ( 3 ) ; sdata . add ( cursor . tableData [ level ] ) ; for ( Join j : t . extraJoins ) { sdata . add ( j . getJoinData ( cursor ) ) ; } cursor . tableData [ level ] = StructureDataFactory . make ( sdata . toArray ( new StructureData [ sdata . size ( ) ] ) ) ; // LOOK should try to consolidate
}


signature:
public class NestedTable { /** * / / Station or Station _ Profile */
public StructureDataIterator getStationDataIterator ( ) throws IOException { } }

implementation: Table stationTable = root ; StructureDataIterator siter = stationTable . getStructureDataIterator ( null ) ; if ( stationTable . limit != null ) { Variable limitV = ds . findVariable ( stationTable . limit ) ; int limit = limitV . readScalarInt ( ) ; return new StructureDataIteratorLimited ( siter , limit ) ; } return siter ;


signature:
public class NestedTable { /** * also called from StandardPointFeatureIterator */
StationFeature makeStation ( StructureData stationData ) { } }

implementation:
if ( stnVE . isMissing ( stationData ) ) return null ; String stationName = stnVE . getCoordValueAsString ( stationData ) ; String stationDesc = ( stnDescVE == null ) ? "" : stnDescVE . getCoordValueAsString ( stationData ) ; String stnWmoId = ( wmoVE == null ) ? "" : wmoVE . getCoordValueAsString ( stationData ) ; double lat = latVE . getCoordValue ( stationData ) ; double lon = lonVE . getCoordValue ( stationData ) ; double elev = ( stnAltVE == null ) ? Double . NaN : stnAltVE . getCoordValue ( stationData ) ; // missing lat , lon means skip this station
if ( Double . isNaN ( lat ) || Double . isNaN ( lon ) ) return null ; return new StationFeatureImpl ( stationName , stationDesc , stnWmoId , lat , lon , elev , - 1 , stationData ) ;


signature:
public class DMRToCDM { /** * Do the conversion and return a NodeMap
 * representing the conversion .
 * @ throws DapException */
public NodeMap < CDMNode , DapNode > create ( ) throws DapException { } }

implementation:
// Netcdf Dataset will already have a root group
Group cdmroot = ncfile . getRootGroup ( ) ; this . nodemap . put ( cdmroot , this . dmr ) ; fillGroup ( cdmroot , this . dmr , ncfile ) ; return this . nodemap ;


signature:
public class DMRToCDM { /** * Create a variable or field
 * @ param dapvar the template variable
 * @ param ncfile the containing NetcdfFile ( really NetcdfDataset )
 * @ param cdmgroup the containing CDM group
 * @ param cdmparentstruct the containing CDM structure ( or null ) */
protected void createVar ( DapVariable dapvar , NetcdfFile ncfile , Group cdmgroup , Structure cdmparentstruct ) throws DapException { } }

implementation:
Variable cdmvar = null ; DapType basetype = dapvar . getBaseType ( ) ; if ( basetype . isAtomic ( ) ) { DapVariable atomvar = ( DapVariable ) dapvar ; cdmvar = new Variable ( ncfile , cdmgroup , cdmparentstruct , atomvar . getShortName ( ) ) ; DataType cdmbasetype ; if ( basetype . isEnumType ( ) ) cdmbasetype = CDMTypeFcns . enumTypeFor ( basetype ) ; else cdmbasetype = CDMTypeFcns . daptype2cdmtype ( basetype ) ; if ( cdmbasetype == null ) throw new DapException ( "Unknown basetype:" + basetype ) ; cdmvar . setDataType ( cdmbasetype ) ; if ( basetype . isEnumType ( ) ) { EnumTypedef cdmenum = ( EnumTypedef ) this . nodemap . get ( basetype ) ; if ( cdmenum == null ) throw new DapException ( "Unknown enumeration type:" + basetype . toString ( ) ) ; cdmvar . setEnumTypedef ( cdmenum ) ; } this . nodemap . put ( cdmvar , dapvar ) ; } else if ( basetype . isStructType ( ) ) { DapStructure dapstruct = ( DapStructure ) basetype ; Structure cdmstruct = new Structure ( ncfile , cdmgroup , cdmparentstruct , dapstruct . getShortName ( ) ) ; cdmvar = cdmstruct ; this . nodemap . put ( cdmvar , dapvar ) ; // Add the fields
for ( DapVariable field : dapstruct . getFields ( ) ) { createVar ( field , ncfile , cdmgroup , cdmstruct ) ; } } else if ( basetype . isSeqType ( ) ) { DapSequence dapseq = ( DapSequence ) basetype ; // In general one would convert the sequence
// to a CDM sequence with vlen
// so Sequence { . . . } s [ d1 ] . . . [ dn ]
// = > Sequence { . . . } s [ d1 ] . . . [ dn ]
Sequence cdmseq = new Sequence ( ncfile , cdmgroup , cdmparentstruct , dapseq . getShortName ( ) ) ; cdmvar = cdmseq ; this . nodemap . put ( cdmvar , dapvar ) ; // Add the fields
for ( DapVariable field : dapseq . getFields ( ) ) { createVar ( field , ncfile , cdmgroup , cdmseq ) ; } // If the rank > 0 , then add warning attribute
if ( dapvar . getRank ( ) > 0 ) { List value = new ArrayList ( ) ; value . add ( "CDM does not support Sequences with rank > 0" ) ; Attribute warning = new Attribute ( "_WARNING:" , value ) ; cdmvar . addAttribute ( warning ) ; } } else assert ( false ) : "Unknown variable sort: " + dapvar . getSort ( ) ; int rank = dapvar . getRank ( ) ; List < Dimension > cdmdims = new ArrayList < Dimension > ( rank + 1 ) ; // + 1 for vlen
for ( int i = 0 ; i < rank ; i ++ ) { DapDimension dim = dapvar . getDimension ( i ) ; Dimension cdmdim = createDimensionRef ( dim , cdmgroup ) ; cdmdims . add ( cdmdim ) ; } if ( basetype . isSeqType ( ) ) { // Add the final vlen
cdmdims . add ( Dimension . VLEN ) ; } cdmvar . setDimensions ( cdmdims ) ; // Create variable ' s attributes
for ( String key : dapvar . getAttributes ( ) . keySet ( ) ) { DapAttribute attr = dapvar . getAttributes ( ) . get ( key ) ; Attribute cdmattr = createAttribute ( attr ) ; cdmvar . addAttribute ( cdmattr ) ; } if ( cdmparentstruct != null ) cdmparentstruct . addMemberVariable ( cdmvar ) ; else if ( cdmgroup != null ) cdmgroup . addVariable ( cdmvar ) ;


signature:
public class Nc4DSP { /** * / * package */
void note ( Notes note ) { } }

implementation: assert ( this . allnotes != null ) ; int gid = note . gid ; int id = note . id ; NoteSort sort = note . getSort ( ) ; Map < Long , Notes > sortnotes = this . allnotes . get ( sort ) ; assert sortnotes != null ; switch ( sort ) { case TYPE : case GROUP : case DIM : assert sortnotes . get ( id ) == null ; sortnotes . put ( ( long ) id , note ) ; break ; case VAR : long gv = Nc4Notes . getVarId ( ( VarNotes ) note ) ; assert sortnotes . get ( gv ) == null ; sortnotes . put ( gv , note ) ; break ; }


signature:
public class Nc4DSP { /** * / * package */
VarNotes findVar ( int gid , int varid ) { } }

implementation: long gv = Nc4Notes . getVarId ( gid , varid , - 1 ) ; return ( VarNotes ) find ( gv , NoteSort . VAR ) ;


signature:
public class Nc4DSP { /** * / * package */
VarNotes findField ( int gid , int varid , int fid ) { } }

implementation: long gv = Nc4Notes . getVarId ( gid , varid , fid ) ; return ( VarNotes ) find ( gv , NoteSort . VAR ) ;


signature:
public class Nc4DSP { /** * / * package */
Notes find ( DapNode node ) { } }

implementation: NoteSort sort = noteSortFor ( node ) ; assert ( this . allnotes != null ) ; Map < Long , Notes > sortnotes = this . allnotes . get ( sort ) ; assert sortnotes != null ; for ( Map . Entry < Long , Notes > entries : sortnotes . entrySet ( ) ) { Notes note = entries . getValue ( ) ; if ( note . get ( ) == node ) return note ; } return null ;


signature:
public class Nc4DSP { /** * DSP API */
@ Override public Nc4DSP open ( String filepath ) throws DapException { } }

implementation:
if ( filepath . startsWith ( "file:" ) ) try { XURI xuri = new XURI ( filepath ) ; filepath = xuri . getPath ( ) ; } catch ( URISyntaxException use ) { throw new DapException ( "Malformed filepath: " + filepath ) . setCode ( DapCodes . SC_NOT_FOUND ) ; } int ret , mode ; IntByReference ncidp = new IntByReference ( ) ; this . filepath = filepath ; try { mode = NC_NOWRITE ; Nc4Cursor . errcheck ( nc4 , ret = nc4 . nc_open ( this . filepath , mode , ncidp ) ) ; this . ncid = ncidp . getValue ( ) ; // Figure out what kind of file
IntByReference formatp = new IntByReference ( ) ; Nc4Cursor . errcheck ( nc4 , ret = nc4 . nc_inq_format ( ncid , formatp ) ) ; this . format = formatp . getValue ( ) ; if ( DEBUG ) System . out . printf ( "TestNetcdf: open: %s; ncid=%d; format=%d%n" , this . filepath , ncid , this . format ) ; // Compile the DMR
Nc4DMRCompiler dmrcompiler = new Nc4DMRCompiler ( this , ncid , dmrfactory ) ; setDMR ( dmrcompiler . compile ( ) ) ; if ( DEBUG || DUMPDMR ) { System . err . println ( "+++++++++++++++++++++" ) ; System . err . println ( printDMR ( getDMR ( ) ) ) ; System . err . println ( "+++++++++++++++++++++" ) ; } return this ; } catch ( Exception t ) { t . printStackTrace ( ) ; } return null ;


signature:
public class Nc4DSP { /** * Utilities */
static public String makeString ( byte [ ] b ) { } }

implementation:
// null terminates
int count ; for ( count = 0 ; ( count < b . length && b [ count ] != 0 ) ; count ++ ) { ; } return new String ( b , 0 , count , DapUtil . UTF8 ) ;


signature:
public class SimpleUnit { /** * Create a SimpleUnit from the given name , catch Exceptions .
 * @ param name parse this name to create a unit .
 * @ return SimpleUnit , DateUnit , TimeUnit , or null if failed
 * @ see ucar . units . UnitFormat # parse */
static public SimpleUnit factory ( String name ) { } }

implementation: try { return factoryWithExceptions ( name ) ; } catch ( Exception e ) { if ( debugParse ) System . out . println ( "Parse " + name + " got Exception " + e ) ; return null ; }


signature:
public class SimpleUnit { /** * Create a SimpleUnit from the given name , allow Exceptions .
 * @ param name parse this name to create a unit .
 * @ return SimpleUnit , DateUnit , or TimeUnit
 * @ throws Exception when date parser fails
 * @ see ucar . units . UnitFormat # parse */
static public SimpleUnit factoryWithExceptions ( String name ) throws UnitException { } }

implementation:
UnitFormat format = UnitFormatManager . instance ( ) ; Unit uu = format . parse ( name ) ; // if ( isDateUnit ( uu ) ) return new DateUnit ( name ) ;
if ( isTimeUnit ( uu ) ) return new TimeUnit ( name ) ; return new SimpleUnit ( uu ) ;


signature:
public class SimpleUnit { /** * need subclass access */
static protected Unit makeUnit ( String name ) throws UnitException { } }

implementation: UnitFormat format = UnitFormatManager . instance ( ) ; return format . parse ( name ) ;


signature:
public class SimpleUnit { /** * Return true if unitString1 is compatible to unitString2 , meaning one can be converted to the other .
 * If either unit string is illegal , return false .
 * @ param unitString1 compare this unit
 * @ param unitString2 compare this unit
 * @ return true if the 2 units are compatible */
static public boolean isCompatible ( String unitString1 , String unitString2 ) { } }

implementation:
Unit uu1 , uu2 ; try { UnitFormat format = UnitFormatManager . instance ( ) ; uu1 = format . parse ( unitString1 ) ; } catch ( Exception e ) { if ( debugParse ) System . out . println ( "Parse " + unitString1 + " got Exception1 " + e ) ; return false ; } try { UnitFormat format = UnitFormatManager . instance ( ) ; uu2 = format . parse ( unitString2 ) ; } catch ( Exception e ) { if ( debugParse ) System . out . println ( "Parse " + unitString2 + " got Exception2 " + e ) ; return false ; } // System . out . println ( " udunits isCompatible " + uu1 + " " + uu2 ) ;
return uu1 . isCompatible ( uu2 ) ;


signature:
public class SimpleUnit { /** * Return true if unitString1 is convertible to unitString2
 * @ param unitString1 compare this unit
 * @ param unitString2 compare this unit
 * @ return true if the 2 units are compatible
 * @ throws UnitException if units parsing fails */
static public boolean isCompatibleWithExceptions ( String unitString1 , String unitString2 ) throws UnitException { } }

implementation: UnitFormat format = UnitFormatManager . instance ( ) ; Unit uu1 = format . parse ( unitString1 ) ; Unit uu2 = format . parse ( unitString2 ) ; return uu1 . isCompatible ( uu2 ) ;


signature:
public class SimpleUnit { /** * Return true if this ucar . units . Unit is a Date .
 * @ param uu check this Unit
 * @ return true if its a Date */
static public boolean isDateUnit ( ucar . units . Unit uu ) { } }

implementation: boolean ok = uu . isCompatible ( dateReferenceUnit ) ; if ( ! ok ) return false ; try { uu . getConverterTo ( dateReferenceUnit ) ; return true ; } catch ( ConversionException e ) { return false ; }


signature:
public class SimpleUnit { /** * Return true if the given unit is convertible to a date Unit .
 * allowed format is something like :
 * < pre > [ - ] Y [ Y [ Y [ Y ] ] ] - MM - DD [ ( T | ) hh [ : mm [ : ss [ . sss * ] ] ] [ [ + | - ] hh [ [ : ] mm ] ] ] < / pre >
 * @ param unitString check this unit string
 * @ return true if its a Date */
static public boolean isDateUnit ( String unitString ) { } }

implementation: SimpleUnit su = factory ( unitString ) ; return su != null && isDateUnit ( su . getUnit ( ) ) ;


signature:
public class SimpleUnit { /** * Return true if the given unit is a time Unit , eg " seconds " .
 * @ param unitString check this unit string
 * @ return true if its a Time */
static public boolean isTimeUnit ( String unitString ) { } }

implementation: SimpleUnit su = factory ( unitString ) ; return su != null && isTimeUnit ( su . getUnit ( ) ) ;


signature:
public class SimpleUnit { /** * Get the conversion factor to convert inputUnit to outputUnit .
 * @ param inputUnitString inputUnit in string form
 * @ param outputUnitString outputUnit in string form
 * @ return conversion factor
 * @ throws IllegalArgumentException if not convertible */
static public double getConversionFactor ( String inputUnitString , String outputUnitString ) throws IllegalArgumentException { } }

implementation: SimpleUnit inputUnit = SimpleUnit . factory ( inputUnitString ) ; SimpleUnit outputUnit = SimpleUnit . factory ( outputUnitString ) ; return inputUnit . convertTo ( 1.0 , outputUnit ) ;


signature:
public class SimpleUnit { /** * Convert given value of this unit to the new unit .
 * @ param value value in this unit
 * @ param outputUnit convert to this unit
 * @ return value in outputUnit
 * @ throws IllegalArgumentException if outputUnit not convertible from this unit */
public double convertTo ( double value , SimpleUnit outputUnit ) throws IllegalArgumentException { } }

implementation: try { return uu . convertTo ( value , outputUnit . getUnit ( ) ) ; } catch ( ConversionException e ) { throw new IllegalArgumentException ( e . getMessage ( ) ) ; }


signature:
public class SimpleUnit { /** * Return true if unitString1 is compatible to unitString2,
 * meaning one can be converted to the other .
 * If either unit string is illegal , return false .
 * @ param unitString check if this is compatible with unitString
 * @ return true if compatible */
public boolean isCompatible ( String unitString ) { } }

implementation: Unit uuWant ; try { UnitFormat format = UnitFormatManager . instance ( ) ; uuWant = format . parse ( unitString ) ; } catch ( Exception e ) { if ( debugParse ) System . out . println ( "Parse " + unitString + " got Exception1 " + e ) ; return false ; } return uu . isCompatible ( uuWant ) ;


signature:
public class SimpleUnit { /** * Is this an instance of an UnknownUnit ?
 * @ return true if an instance of an UnknownUnit */
public boolean isUnknownUnit ( ) { } }

implementation: ucar . units . Unit uu = getUnit ( ) ; if ( uu instanceof ucar . units . UnknownUnit ) return true ; if ( uu instanceof ucar . units . DerivedUnit ) return isUnknownUnit ( ( ucar . units . DerivedUnit ) uu ) ; if ( uu instanceof ucar . units . ScaledUnit ) { ucar . units . ScaledUnit scu = ( ucar . units . ScaledUnit ) uu ; Unit u = scu . getUnit ( ) ; if ( u instanceof ucar . units . UnknownUnit ) return true ; if ( u instanceof ucar . units . DerivedUnit ) return isUnknownUnit ( ( ucar . units . DerivedUnit ) u ) ; } return false ;


signature:
public class SimpleUnit { /** * Extract the value , can only be called for ScaledUnit .
 * @ return value of this unit if ScaledUnit , else NaN */
public double getValue ( ) { } }

implementation: if ( ! ( uu instanceof ScaledUnit ) ) return Double . NaN ; ScaledUnit offset = ( ScaledUnit ) uu ; return offset . getScale ( ) ;


signature:
public class ClauseFactory { /** * Generates a clause which which compares subclauses , using one of the
 * relative operators supported by the Operator class . */
public TopLevelClause newRelOpClause ( int operator , SubClause lhs , List rhs ) throws DAP2ServerSideException { } }

implementation: return new RelOpClause ( operator , lhs , rhs ) ;


signature:
public class ClauseFactory { /** * Generates a clause which invokes a function that returns a
 * boolean value .
 * @ see BoolFunctionClause */
public TopLevelClause newBoolFunctionClause ( String functionName , List children ) throws DAP2ServerSideException , NoSuchFunctionException { } }

implementation: BoolFunction function = functionLibrary . getBoolFunction ( functionName ) ; if ( function == null ) { if ( functionLibrary . getBTFunction ( functionName ) != null ) { throw new NoSuchFunctionException ( "The function " + functionName + "() does not return a " + "boolean value, and must be used in a comparison or " + "as an argument to another function." ) ; } else { throw new NoSuchFunctionException ( "This server does not support a " + functionName + "() function" ) ; } } return new BoolFunctionClause ( function , children ) ;


signature:
public class ClauseFactory { /** * Generates a clause which invokes a function that returns a
 * BaseType .
 * @ see BTFunctionClause */
public SubClause newBTFunctionClause ( String functionName , List children ) throws DAP2ServerSideException , NoSuchFunctionException { } }

implementation: BTFunction function = functionLibrary . getBTFunction ( functionName ) ; if ( function == null ) { if ( functionLibrary . getBoolFunction ( functionName ) != null ) { throw new NoSuchFunctionException ( "The function " + functionName + "() cannot be used as a " + "sub-expression in a constraint clause" ) ; } else { throw new NoSuchFunctionException ( "This server does not support a " + functionName + "() function" ) ; } } return new BTFunctionClause ( function , children ) ;


signature:
public class WriterCFStationObsDataset { /** * / * private void writeDataFinish ( ) throws IOException {
 * ArrayInt . D1 nextChildArray = new ArrayInt . D1 ( recno ) ;
 * int nstns = stnList . size ( ) ;
 * ArrayInt . D1 firstArray = new ArrayInt . D1 ( nstns ) ;
 * ArrayInt . D1 lastArray = new ArrayInt . D1 ( nstns ) ;
 * ArrayInt . D1 numArray = new ArrayInt . D1 ( nstns ) ;
 * for ( int i = 0 ; i < stnList . size ( ) ; i + + ) {
 * Station stn = stnList . get ( i ) ;
 * StationTracker tracker = stationMap . get ( stn . getName ( ) ) ;
 * lastArray . set ( i , tracker . lastChild ) ;
 * numArray . set ( i , tracker . numChildren ) ;
 * int first = ( tracker . link . size ( ) > 0 ) ? tracker . link . get ( 0 ) : - 1;
 * firstArray . set ( i , first ) ;
 * if ( tracker . link . size ( ) > 0 ) {
 * construct forward link
 * List < Integer > nextList = tracker . link ;
 * for ( int j = 0 ; j < nextList . size ( ) - 1 ; j + + ) {
 * Integer curr = nextList . get ( j ) ;
 * Integer next = nextList . get ( j + 1 ) ;
 * nextChildArray . set ( curr , next ) ;
 * Integer curr = nextList . get ( nextList . size ( ) - 1 ) ;
 * nextChildArray . set ( curr , - 1 ) ;
 * try {
 * ncfile . write ( firstChildName , firstArray ) ;
 * ncfile . write ( lastChildName , lastArray ) ;
 * ncfile . write ( numChildName , numArray ) ;
 * ncfile . write ( nextChildName , nextChildArray ) ;
 * } catch ( InvalidRangeException e ) {
 * e . printStackTrace ( ) ;
 * throw new IllegalStateException ( e ) ;
 * if there is no data
 * if ( minDate = = null ) minDate = new Date ( ) ;
 * if ( maxDate = = null ) maxDate = new Date ( ) ;
 * ncfile . updateAttribute ( null , new Attribute ( " time _ coverage _ start " , dateFormatter . toDateTimeStringISO ( minDate ) ) ) ;
 * ncfile . updateAttribute ( null , new Attribute ( " time _ coverage _ end " , dateFormatter . toDateTimeStringISO ( maxDate ) ) ) ; */
public void writeRecord ( StationObsDatatype sobs , StructureData sdata ) throws IOException { } }

implementation: if ( debug ) System . out . println ( "sobs= " + sobs + "; station = " + sobs . getStation ( ) ) ; for ( Variable v : recordVars ) { if ( timeName . equals ( v . getShortName ( ) ) ) { Date d = sobs . getObservationTimeAsDate ( ) ; int secs = ( int ) ( d . getTime ( ) / 1000 ) ; timeArray . set ( 0 , secs ) ; } else if ( parentName . equals ( v . getShortName ( ) ) ) { int stationIndex = stnList . indexOf ( sobs . getStation ( ) ) ; parentArray . set ( 0 , stationIndex ) ; } else { v . setCachedData ( sdata . getArray ( v . getShortName ( ) ) , false ) ; } } ncfile . writeRecordData ( recordVars ) ;


signature: public class WriterCFStationObsDataset { public static void rewrite ( String fileIn , String fileOut , boolean inMemory , boolean sort ) throws IOException { } }

implementation:
System . out . println ( "Rewrite .nc files from " + fileIn + " to " + fileOut + "inMem= " + inMemory + " sort= " + sort ) ; 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 ( ) ; StationObsDataset sobs = ( StationObsDataset ) TypedDatasetFactory . open ( FeatureType . STATION , ncd , null , errlog ) ; List < ucar . unidata . geoloc . Station > stns = sobs . getStations ( ) ; List < VariableSimpleIF > vars = sobs . getDataVariables ( ) ; FileOutputStream fos = new FileOutputStream ( fileOut ) ; DataOutputStream out = new DataOutputStream ( fos ) ; WriterCFStationObsDataset writer = new WriterCFStationObsDataset ( out , "rewrite " + fileIn ) ; writer . writeHeader ( stns , vars , - 1 ) ; if ( sort ) { for ( ucar . unidata . geoloc . Station s : stns ) { DataIterator iter = sobs . getDataIterator ( s ) ; while ( iter . hasNext ( ) ) { StationObsDatatype sobsData = ( StationObsDatatype ) iter . nextData ( ) ; StructureData data = sobsData . getData ( ) ; writer . writeRecord ( sobsData , data ) ; } } } else { DataIterator iter = sobs . getDataIterator ( 1000 * 1000 ) ; while ( iter . hasNext ( ) ) { StationObsDatatype sobsData = ( StationObsDatatype ) iter . nextData ( ) ; StructureData data = sobsData . getData ( ) ; writer . writeRecord ( sobsData , data ) ; } } writer . finish ( ) ; long took = System . currentTimeMillis ( ) - start ; System . out . println ( "Rewrite " + fileIn + " to " + fileOut + " took = " + took ) ;


signature:
public class ImageArrayAdapter { /** * Adapt a rank 2 array into a java . awt . image . BufferedImage .
 * If passed a rank 3 array , take first 2D slice .
 * @ param ma rank 2 or 3 array .
 * @ return BufferedImage */
public static java . awt . image . BufferedImage makeGrayscaleImage ( Array ma , IsMissingEvaluator missEval ) { } }

implementation:
if ( ma . getRank ( ) < 2 ) return null ; if ( ma . getRank ( ) == 3 ) ma = ma . reduce ( ) ; if ( ma . getRank ( ) == 3 ) ma = ma . slice ( 0 , 0 ) ; // we need 2D
int h = ma . getShape ( ) [ 0 ] ; int w = ma . getShape ( ) [ 1 ] ; DataBuffer dataBuffer = makeDataBuffer ( ma , missEval ) ; WritableRaster raster = WritableRaster . createInterleavedRaster ( dataBuffer , w , h , // int w , int h ,
w , // int scanlineStride ,
1 , // int pixelStride ,
new int [ ] { 0 } , // int bandOffsets [ ] ,
null ) ; // Point location )
ColorSpace cs = ColorSpace . getInstance ( ColorSpace . CS_GRAY ) ; ComponentColorModel colorModel = new ComponentColorModel ( cs , new int [ ] { 8 } , false , false , Transparency . OPAQUE , DataBuffer . TYPE_BYTE ) ; return new BufferedImage ( colorModel , raster , false , null ) ;


signature: public class CatalogRef { protected String translatePathToReletiveLocation ( String dsPath , String configPath ) { } }

implementation:
if ( dsPath == null ) return null ; if ( dsPath . length ( ) == 0 ) return null ; if ( dsPath . startsWith ( "/" ) ) dsPath = dsPath . substring ( 1 ) ; if ( ! dsPath . startsWith ( configPath ) ) return null ; // remove the matching part , the rest is the " reletive location "
String dataDir = dsPath . substring ( configPath . length ( ) ) ; if ( dataDir . startsWith ( "/" ) ) dataDir = dataDir . substring ( 1 ) ; return dataDir ;


signature:
public class CatalogCrawler { /** * Open a catalog and crawl ( depth first ) all the datasets in it .
 * Close catalogs and release their resources as you .
 * @ param catUrl url of catalog to open
 * @ param task user can cancel the task ( may be null )
 * @ param out send status messages to here ( may be null )
 * @ param context caller can pass this object in ( used for thread safety )
 * @ return number of catalog references opened and crawled */
public int crawl ( String catUrl , CancelTask task , PrintWriter out , Object context ) { } }

implementation: InvCatalogFactory catFactory = InvCatalogFactory . getDefaultFactory ( true ) ; InvCatalogImpl cat = catFactory . readXML ( catUrl ) ; StringBuilder buff = new StringBuilder ( ) ; boolean isValid = cat . check ( buff , false ) ; if ( out != null ) { out . println ( "catalog <" + cat . getName ( ) + "> " + ( isValid ? "is" : "is not" ) + " valid" ) ; out . println ( " validation output=\n" + buff ) ; } if ( isValid ) return crawl ( cat , task , out , context ) ; return 0 ;


signature:
public class CatalogCrawler { /** * Crawl a catalog thats already been opened .
 * When you get to a dataset containing leaf datasets , do all , only the first , or a randomly chosen one .
 * @ param cat the catalog
 * @ param task user can cancel the task ( may be null )
 * @ param out send status messages to here ( may be null )
 * @ param context caller can pass this object in ( used for thread safety )
 * @ return number of catalog references opened and crawled */
public int crawl ( InvCatalogImpl cat , CancelTask task , PrintWriter out , Object context ) { } }

implementation: if ( out != null ) out . println ( "***CATALOG " + cat . getCreateFrom ( ) ) ; countCatrefs = 0 ; for ( InvDataset ds : cat . getDatasets ( ) ) { if ( type == Type . all ) crawlDataset ( ds , task , out , context , true ) ; else crawlDirectDatasets ( ds , task , out , context , true ) ; if ( ( task != null ) && task . isCancel ( ) ) break ; } return 1 + countCatrefs ;


signature:
public class CatalogCrawler { /** * Crawl this dataset recursively , return all datasets
 * @ param ds the dataset
 * @ param task user can cancel the task ( may be null )
 * @ param out send status messages to here ( may be null )
 * @ param context caller can pass this object in ( used for thread safety ) */
public void crawlDataset ( InvDataset ds , CancelTask task , PrintWriter out , Object context , boolean release ) { } }

implementation:
boolean isCatRef = ( ds instanceof InvCatalogRef ) ; if ( filter != null && filter . skipAll ( ds ) ) { if ( isCatRef && release ) ( ( InvCatalogRef ) ds ) . release ( ) ; return ; } boolean isDataScan = ds . findProperty ( "DatasetScan" ) != null ; if ( isCatRef ) { InvCatalogRef catref = ( InvCatalogRef ) ds ; if ( out != null ) out . println ( " **CATREF " + catref . getURI ( ) + " (" + ds . getName ( ) + ") " ) ; countCatrefs ++ ; if ( ! listen . getCatalogRef ( catref , context ) ) { if ( release ) catref . release ( ) ; return ; } } if ( ! isCatRef || isDataScan ) listen . getDataset ( ds , context ) ; // recurse - depth first
List < InvDataset > dlist = ds . getDatasets ( ) ; if ( isCatRef ) { InvCatalogRef catref = ( InvCatalogRef ) ds ; if ( ! isDataScan ) { listen . getDataset ( catref . getProxyDataset ( ) , context ) ; // wait till a catref is read , so all metadata is there !
} } for ( InvDataset dds : dlist ) { crawlDataset ( dds , task , out , context , release ) ; if ( ( task != null ) && task . isCancel ( ) ) break ; } if ( isCatRef && release ) { InvCatalogRef catref = ( InvCatalogRef ) ds ; catref . release ( ) ; }


signature:
public class CatalogCrawler { /** * Crawl this dataset recursively . Only send back direct datasets
 * @ param ds the dataset
 * @ param task user can cancel the task ( may be null )
 * @ param out send status messages to here ( may be null )
 * @ param context caller can pass this object in ( used for thread safety ) */
public void crawlDirectDatasets ( InvDataset ds , CancelTask task , PrintWriter out , Object context , boolean release ) { } }

implementation:
boolean isCatRef = ( ds instanceof InvCatalogRef ) ; if ( filter != null && filter . skipAll ( ds ) ) { if ( isCatRef && release ) ( ( InvCatalogRef ) ds ) . release ( ) ; return ; } if ( isCatRef ) { InvCatalogRef catref = ( InvCatalogRef ) ds ; if ( out != null ) out . println ( " **CATREF " + catref . getURI ( ) + " (" + ds . getName ( ) + ") " ) ; countCatrefs ++ ; if ( ! listen . getCatalogRef ( catref , context ) ) { if ( release ) catref . release ( ) ; return ; } } // get datasets with data access ( " leaves " )
List < InvDataset > dlist = ds . getDatasets ( ) ; List < InvDataset > leaves = new ArrayList < InvDataset > ( ) ; for ( InvDataset dds : dlist ) { if ( dds . hasAccess ( ) ) leaves . add ( dds ) ; } if ( leaves . size ( ) > 0 ) { if ( type == Type . first_direct ) { InvDataset dds = leaves . get ( 0 ) ; listen . getDataset ( dds , context ) ; } else if ( type == Type . random_direct ) { listen . getDataset ( chooseRandom ( leaves ) , context ) ; } else if ( type == Type . random_direct_middle ) { listen . getDataset ( chooseRandomNotFirstOrLast ( leaves ) , context ) ; } else { // do all of them
for ( InvDataset dds : leaves ) { listen . getDataset ( dds , context ) ; if ( ( task != null ) && task . isCancel ( ) ) break ; } } } // recurse
for ( InvDataset dds : dlist ) { if ( dds . hasNestedDatasets ( ) ) crawlDirectDatasets ( dds , task , out , context , release ) ; if ( ( task != null ) && task . isCancel ( ) ) break ; } /* if ( out ! = null ) {
 int took = ( int ) ( System . currentTimeMillis ( ) - start ) ;
 out . println ( " * * " + ds . getName ( ) + " took " + took + " msecs \ n " ) ; */
if ( ds instanceof InvCatalogRef && release ) { InvCatalogRef catref = ( InvCatalogRef ) ds ; catref . release ( ) ; }


signature:
public class GribIndexCache { /** * Get index file , may be in cache directory , may not exist
 * @ param fileLocation full path of original index filename
 * @ return File , possibly in cache , may or may not exist */
public static File getFileOrCache ( String fileLocation ) { } }

implementation: File result = getExistingFileOrCache ( fileLocation ) ; if ( result != null ) return result ; return getDiskCache2 ( ) . getFile ( fileLocation ) ;


signature:
public class GribIndexCache { /** * Looking for an existing file , in cache or not
 * @ param fileLocation full path of original index filename
 * @ return existing file if you can find it , else null */
public static File getExistingFileOrCache ( String fileLocation ) { } }

implementation:
File result = getDiskCache2 ( ) . getExistingFileOrCache ( fileLocation ) ; if ( result == null && Grib . debugGbxIndexOnly && fileLocation . endsWith ( ".gbx9.ncx4" ) ) { // might create only from gbx9 for debugging
int length = fileLocation . length ( ) ; String maybeIndexAlreadyExists = fileLocation . substring ( 0 , length - 10 ) + ".ncx4" ; result = getDiskCache2 ( ) . getExistingFileOrCache ( maybeIndexAlreadyExists ) ; } return result ;


signature:
public class NcDirectPositionType { /** * gml : Point / gml : pos */
public static DirectPositionType initPos ( DirectPositionType pos , StationTimeSeriesFeature stationFeat ) { } }

implementation:
// TEXT
pos . setListValue ( Arrays . asList ( stationFeat . getLatitude ( ) , stationFeat . getLongitude ( ) , stationFeat . getAltitude ( ) ) ) ; return pos ;


signature:
public class UrlAuthenticatorDialog { /** * java . net calls this : */
protected PasswordAuthentication getPasswordAuthentication ( ) { } }

implementation: if ( pwa == null ) throw new IllegalStateException ( ) ; if ( debug ) { System . out . println ( "site= " + getRequestingSite ( ) ) ; System . out . println ( "port= " + getRequestingPort ( ) ) ; System . out . println ( "protocol= " + getRequestingProtocol ( ) ) ; System . out . println ( "prompt= " + getRequestingPrompt ( ) ) ; System . out . println ( "scheme= " + getRequestingScheme ( ) ) ; } serverF . setText ( getRequestingHost ( ) + ":" + getRequestingPort ( ) ) ; realmF . setText ( getRequestingPrompt ( ) ) ; dialog . setVisible ( true ) ; if ( debug ) { System . out . println ( "user= (" + pwa . getUserName ( ) + ")" ) ; System . out . println ( "password= (" + pwa . getPassword ( ) + ")" ) ; } return new PasswordAuthentication ( pwa . getUserName ( ) , pwa . getPassword ( ) . toCharArray ( ) ) ;


signature:
public class UrlAuthenticatorDialog { /** * http client calls this : */
public Credentials getCredentials ( AuthScope scope ) { } }

implementation:
serverF . setText ( scope . getHost ( ) + ":" + scope . getPort ( ) ) ; String realmName = scope . getRealm ( ) ; if ( realmName == null ) { realmName = "THREDDS Data Server" ; } realmF . setText ( realmName ) ; dialog . setVisible ( true ) ; if ( pwa == null ) throw new IllegalStateException ( ) ; if ( debug ) { System . out . println ( "user= (" + pwa . getUserName ( ) + ")" ) ; System . out . println ( "password= (" + new String ( pwa . getPassword ( ) ) + ")" ) ; } // Is this really necessary ?
UsernamePasswordCredentials upc = new UsernamePasswordCredentials ( pwa . getUserName ( ) , new String ( pwa . getPassword ( ) ) ) ; return upc ;


signature:
public class RandomAccessFile { /** * Debugging , do not use in production .
 * Set counters to zero , set debugging on
 * @ param b set true to track java . io . RandomAccessFile */
static public void setDebugLeaks ( boolean b ) { } }

implementation: if ( b ) { count_openFiles . set ( 0 ) ; maxOpenFiles . set ( 0 ) ; allFiles = new HashSet < > ( 1000 ) ; } debugLeaks = b ;


signature:
public class RandomAccessFile { /** * Debugging , do not use .
 * @ return list of all files used . */
static public List < String > getAllFiles ( ) { } }

implementation: if ( null == allFiles ) return null ; List < String > result = new ArrayList < > ( ) ; result . addAll ( allFiles ) ; Collections . sort ( result ) ; return result ;


signature:
public class RandomAccessFile { /** * Close the file , and release any associated system resources .
 * @ throws IOException if an I / O error occurrs . */
public synchronized void close ( ) throws IOException { } }

implementation:
if ( cache != null ) { if ( cacheState > 0 ) { if ( cacheState == 1 ) { cacheState = 2 ; if ( cache . release ( this ) ) // return true if in the cache , otherwise was opened regular , so must be closed regular
return ; cacheState = 0 ; // release failed , bail out
} else { return ; // close has been called more than once - ok
} } } if ( debugLeaks ) { openFiles . remove ( location ) ; if ( showOpen ) System . out . println ( "  close " + location ) ; } if ( file == null ) return ; // If we are writing and the buffer has been modified , flush the contents of the buffer .
flush ( ) ; // may need to extend file , in case no fill is being used
// may need to truncate file in case overwriting a longer file
// use only if minLength is set ( by N3iosp )
long fileSize = file . length ( ) ; if ( ! readonly && ( minLength != 0 ) && ( minLength != fileSize ) ) { file . setLength ( minLength ) ; // System . out . println ( " TRUNCATE ! ! ! minlength = " + minLength ) ;
} // Close the underlying file object .
file . close ( ) ; file = null ; // help the gc


signature:
public class RandomAccessFile { /** * Set the position in the file for the next read or write .
 * @ param pos the offset ( in bytes ) from the start of the file .
 * @ throws IOException if an I / O error occurrs . */
public void seek ( long pos ) throws IOException { } }

implementation:
if ( pos < 0 ) throw new java . io . IOException ( "Negative seek offset" ) ; // If the seek is into the buffer , just update the file pointer .
if ( ( pos >= bufferStart ) && ( pos < dataEnd ) ) { filePosition = pos ; return ; } // need new buffer , starting at pos
readBuffer ( pos ) ;


signature:
public class RandomAccessFile { /** * Get the length of the file . The data in the buffer ( which may not
 * have been written the disk yet ) is taken into account .
 * @ return the length of the file in bytes .
 * @ throws IOException if an I / O error occurrs . */
public long length ( ) throws IOException { } }

implementation:
long fileLength = ( file == null ) ? - 1L : file . length ( ) ; // GRIB has closed the data raf
if ( fileLength < dataEnd ) { return dataEnd ; } else { return fileLength ; }


signature:
public class RandomAccessFile { /** * Copy the contents of the buffer to the disk .
 * @ throws IOException if an I / O error occurs . */
public void flush ( ) throws IOException { } }

implementation:
if ( bufferModified ) { file . seek ( bufferStart ) ; file . write ( buffer , 0 , dataSize ) ; // System . out . println ( " - - flush at " + bufferStart + " dataSize = " + dataSize + " filePosition = " + filePosition ) ;
bufferModified = false ; } /* check min length
 if ( ! readonly & & ( minLength ! = 0 ) & & ( minLength ! = file . length ( ) ) ) {
 file . setLength ( minLength ) ; */


signature:
public class RandomAccessFile { /** * Read a byte of data from the file , blocking until data is
 * available .
 * @ return the next byte of data , or - 1 if the end of the file is
 * reached .
 * @ throws IOException if an I / O error occurrs . */
public int read ( ) throws IOException { } }

implementation:
// If the file position is within the data , return the byte . . .
if ( filePosition < dataEnd ) { int pos = ( int ) ( filePosition - bufferStart ) ; filePosition ++ ; return ( buffer [ pos ] & 0xff ) ; // . . . or should we indicate EOF . . .
} else if ( endOfFile ) { return - 1 ; // . . . or seek to fill the buffer , and try again .
} else { seek ( filePosition ) ; return read ( ) ; }


signature:
public class RandomAccessFile { /** * Read up to < code > len < / code > bytes into an array , at a specified
 * offset . This will block until at least one byte has been read .
 * @ param b the byte array to receive the bytes .
 * @ param off the offset in the array where copying will start .
 * @ param len the number of bytes to copy .
 * @ return the actual number of bytes read , or - 1 if there is not
 * more data due to the end of the file being reached .
 * @ throws IOException if an I / O error occurrs . */
public int readBytes ( byte b [ ] , int off , int len ) throws IOException { } }

implementation:
// Check for end of file .
if ( endOfFile ) { return - 1 ; } // See how many bytes are available in the buffer - if none ,
// seek to the file position to update the buffer and try again .
int bytesAvailable = ( int ) ( dataEnd - filePosition ) ; if ( bytesAvailable < 1 ) { seek ( filePosition ) ; return readBytes ( b , off , len ) ; } // Copy as much as we can .
int copyLength = ( bytesAvailable >= len ) ? len : bytesAvailable ; System . arraycopy ( buffer , ( int ) ( filePosition - bufferStart ) , b , off , copyLength ) ; filePosition += copyLength ; // If there is more to copy . . .
if ( copyLength < len ) { int extraCopy = len - copyLength ; // If the amount remaining is more than a buffer ' s length , read it
// directly from the file .
if ( extraCopy > buffer . length ) { extraCopy = read_ ( filePosition , b , off + copyLength , len - copyLength ) ; // . . . or read a new buffer full , and copy as much as possible . . .
} else { seek ( filePosition ) ; if ( ! endOfFile ) { extraCopy = ( extraCopy > dataSize ) ? dataSize : extraCopy ; System . arraycopy ( buffer , 0 , b , off + copyLength , extraCopy ) ; } else { extraCopy = - 1 ; } } // If we did manage to copy any more , update the file position and
// return the amount copied .
if ( extraCopy > 0 ) { filePosition += extraCopy ; return copyLength + extraCopy ; } } // Return the amount copied .
return copyLength ;


signature:
public class RandomAccessFile { /** * Read < code > nbytes < / code > bytes , at the specified file offset , send to a WritableByteChannel .
 * This will block until all bytes are read .
 * This uses the underlying file channel directly , bypassing all user buffers .
 * @ param dest write to this WritableByteChannel .
 * @ param offset the offset in the file where copying will start .
 * @ param nbytes the number of bytes to read .
 * @ return the actual number of bytes read and transfered
 * @ throws IOException if an I / O error occurs . */
public long readToByteChannel ( WritableByteChannel dest , long offset , long nbytes ) throws IOException { } }

implementation:
if ( fileChannel == null ) fileChannel = file . getChannel ( ) ; long need = nbytes ; while ( need > 0 ) { long count = fileChannel . transferTo ( offset , need , dest ) ; // if ( count = = 0 ) break ; / / LOOK not sure what the EOF condition is
need -= count ; offset += count ; } return nbytes - need ;


signature:
public class RandomAccessFile { /** * Read directly from file , without going through the buffer .
 * All reading goes through here or readToByteChannel ;
 * @ param pos start here in the file
 * @ param b put data into this buffer
 * @ param offset buffer offset
 * @ param len this number of bytes
 * @ return actual number of bytes read
 * @ throws IOException on io error */
protected int read_ ( long pos , byte [ ] b , int offset , int len ) throws IOException { } }

implementation:
file . seek ( pos ) ; int n = file . read ( b , offset , len ) ; if ( debugAccess ) { if ( showRead ) System . out . println ( " **read_ " + location + " = " + len + " bytes at " + pos + "; block = " + ( pos / buffer . length ) ) ; debug_nseeks . incrementAndGet ( ) ; debug_nbytes . addAndGet ( len ) ; } if ( extendMode && ( n < len ) ) { // System . out . println ( " read _ = " + len + " at " + pos + " ; got = " + n ) ;
n = len ; } return n ;


signature:
public class RandomAccessFile { /** * Reads exactly < code > len < / code > bytes from this file into the byte
 * array . This method reads repeatedly from the file until all the
 * bytes are read . This method blocks until all the bytes are read ,
 * the end of the stream is detected , or an exception is thrown .
 * @ param b the buffer into which the data is read .
 * @ param off the start offset of the data .
 * @ param len the number of bytes to read .
 * @ throws EOFException if this file reaches the end before reading
 * all the bytes .
 * @ throws IOException if an I / O error occurs . */
public final void readFully ( byte b [ ] , int off , int len ) throws IOException { } }

implementation: int n = 0 ; while ( n < len ) { int count = this . read ( b , off + n , len - n ) ; if ( count < 0 ) { throw new EOFException ( "Reading " + location + " at " + filePosition + " file length = " + length ( ) ) ; } n += count ; }


signature:
public class RandomAccessFile { /** * Write a byte to the file . If the file has not been opened for
 * writing , an IOException will be raised only when an attempt is
 * made to write the buffer to the file .
 * Caveat : the effects of seek ( ) ing beyond the end of the file are
 * undefined .
 * @ param b write this byte
 * @ throws IOException if an I / O error occurrs . */
public void write ( int b ) throws IOException { } }

implementation:
// If the file position is within the block of data . . .
if ( filePosition < dataEnd ) { int pos = ( int ) ( filePosition - bufferStart ) ; buffer [ pos ] = ( byte ) b ; bufferModified = true ; filePosition ++ ; // . . . or ( assuming that seek will not allow the file pointer
// to move beyond the end of the file ) get the correct block of
// data . . .
} else { // If there is room in the buffer , expand it . . .
if ( dataSize != buffer . length ) { int pos = ( int ) ( filePosition - bufferStart ) ; buffer [ pos ] = ( byte ) b ; bufferModified = true ; filePosition ++ ; dataSize ++ ; dataEnd ++ ; // . . . or do another seek to get a new buffer , and start again . . .
} else { seek ( filePosition ) ; write ( b ) ; } }


signature:
public class RandomAccessFile { /** * Write < code > len < / code > bytes from an array to the file .
 * @ param b the array containing the data .
 * @ param off the offset in the array to the data .
 * @ param len the length of the data .
 * @ throws IOException if an I / O error occurrs . */
public void writeBytes ( byte b [ ] , int off , int len ) throws IOException { } }

implementation:
// If the amount of data is small ( less than a full buffer ) . . .
if ( len < buffer . length ) { // If any of the data fits within the buffer . . .
int spaceInBuffer = 0 ; int copyLength = 0 ; if ( filePosition >= bufferStart ) { spaceInBuffer = ( int ) ( ( bufferStart + buffer . length ) - filePosition ) ; } if ( spaceInBuffer > 0 ) { // Copy as much as possible to the buffer .
copyLength = ( spaceInBuffer > len ) ? len : spaceInBuffer ; System . arraycopy ( b , off , buffer , ( int ) ( filePosition - bufferStart ) , copyLength ) ; bufferModified = true ; long myDataEnd = filePosition + copyLength ; dataEnd = ( myDataEnd > dataEnd ) ? myDataEnd : dataEnd ; dataSize = ( int ) ( dataEnd - bufferStart ) ; filePosition += copyLength ; // / System . out . println ( " - - copy to buffer " + copyLength + " " + len ) ;
} // If there is any data remaining , move to the new position and copy to
// the new buffer .
if ( copyLength < len ) { // System . out . println ( " - - need more " + copyLength + " " + len + " space = " + spaceInBuffer ) ;
seek ( filePosition ) ; // triggers a flush
System . arraycopy ( b , off + copyLength , buffer , ( int ) ( filePosition - bufferStart ) , len - copyLength ) ; bufferModified = true ; long myDataEnd = filePosition + ( len - copyLength ) ; dataEnd = ( myDataEnd > dataEnd ) ? myDataEnd : dataEnd ; dataSize = ( int ) ( dataEnd - bufferStart ) ; filePosition += ( len - copyLength ) ; } // . . . or write a lot of data . . .
} else { // Flush the current buffer , and write this data to the file .
if ( bufferModified ) { flush ( ) ; } file . seek ( filePosition ) ; // moved per Steve Cerruti ; Jan 14 , 2005
file . write ( b , off , len ) ; // System . out . println ( " - - write at " + filePosition + " " + len ) ;
filePosition += len ; bufferStart = filePosition ; // an empty buffer
dataSize = 0 ; dataEnd = bufferStart + dataSize ; }


signature:
public class RandomAccessFile { /** * Read an array of shorts
 * @ param pa read into this array
 * @ param start starting at pa [ start ]
 * @ param n read this many elements
 * @ throws IOException on read error */
public final void readShort ( short [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { pa [ start + i ] = readShort ( ) ; }


signature:
public class RandomAccessFile { /** * Read an integer at the given position , bypassing all buffering .
 * @ param pos read a byte at this position
 * @ return The int that was read
 * @ throws IOException if an I / O error occurs . */
public final int readIntUnbuffered ( long pos ) throws IOException { } }

implementation: byte [ ] bb = new byte [ 4 ] ; read_ ( pos , bb , 0 , 4 ) ; int ch1 = bb [ 0 ] & 0xff ; int ch2 = bb [ 1 ] & 0xff ; int ch3 = bb [ 2 ] & 0xff ; int ch4 = bb [ 3 ] & 0xff ; if ( ( ch1 | ch2 | ch3 | ch4 ) < 0 ) { throw new EOFException ( ) ; } if ( bigEndian ) { return ( ( ch1 << 24 ) + ( ch2 << 16 ) + ( ch3 << 8 ) + ( ch4 ) ) ; } else { return ( ( ch4 << 24 ) + ( ch3 << 16 ) + ( ch2 << 8 ) + ( ch1 ) ) ; }


signature:
public class RandomAccessFile { /** * Read an array of ints
 * @ param pa read into this array
 * @ param start starting at pa [ start ]
 * @ param n read this many elements
 * @ throws IOException on read error */
public final void readInt ( int [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { pa [ start + i ] = readInt ( ) ; }


signature:
public class RandomAccessFile { /** * Read an array of longs
 * @ param pa read into this array
 * @ param start starting at pa [ start ]
 * @ param n read this many elements
 * @ throws IOException on read error */
public final void readLong ( long [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { pa [ start + i ] = readLong ( ) ; }


signature:
public class RandomAccessFile { /** * Read an array of floats
 * @ param pa read into this array
 * @ param start starting at pa [ start ]
 * @ param n read this many elements
 * @ throws IOException on read error */
public final void readFloat ( float [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { pa [ start + i ] = Float . intBitsToFloat ( readInt ( ) ) ; }


signature:
public class RandomAccessFile { /** * Read an array of doubles
 * @ param pa read into this array
 * @ param start starting at pa [ start ]
 * @ param n read this many elements
 * @ throws IOException on read error */
public final void readDouble ( double [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { pa [ start + i ] = Double . longBitsToDouble ( readLong ( ) ) ; }


signature:
public class RandomAccessFile { /** * Read a String of known length .
 * @ param nbytes number of bytes to read
 * @ return String wrapping the bytes .
 * @ throws IOException if an I / O error occurs . */
public String readString ( int nbytes ) throws IOException { } }

implementation: byte [ ] data = new byte [ nbytes ] ; readFully ( data ) ; return new String ( data , CDM . utf8Charset ) ;


signature:
public class RandomAccessFile { /** * Read a String of max length , zero terminate .
 * @ param nbytes number of bytes to read
 * @ return String wrapping the bytes .
 * @ throws IOException if an I / O error occurs . */
public String readStringMax ( int nbytes ) throws IOException { } }

implementation: byte [ ] b = new byte [ nbytes ] ; readFully ( b ) ; int count ; for ( count = 0 ; count < nbytes ; count ++ ) if ( b [ count ] == 0 ) break ; return new String ( b , 0 , count , CDM . utf8Charset ) ;


signature:
public class RandomAccessFile { /** * Write an array of booleans
 * @ param pa write from this array
 * @ param start starting with this element in the array
 * @ param n write this number of elements
 * @ throws IOException on read error */
public final void writeBoolean ( boolean [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { writeBoolean ( pa [ start + i ] ) ; }


signature:
public class RandomAccessFile { /** * Write an array of shorts
 * @ param pa write from this array
 * @ param start starting with this element in the array
 * @ param n this number of elements
 * @ throws IOException on read error */
public final void writeShort ( short [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { writeShort ( pa [ start + i ] ) ; }


signature:
public class RandomAccessFile { /** * Write an array of chars
 * @ param pa write from this array
 * @ param start starting with this element in the array
 * @ param n this number of elements
 * @ throws IOException on read error */
public final void writeChar ( char [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { writeChar ( pa [ start + i ] ) ; }


signature:
public class RandomAccessFile { /** * Write an array of ints
 * @ param pa write from this array
 * @ param start starting with this element in the array
 * @ param n write this number of elements
 * @ throws IOException on read error */
public final void writeInt ( int [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { writeInt ( pa [ start + i ] ) ; }


signature:
public class RandomAccessFile { /** * Write an array of longs
 * @ param pa write from this array
 * @ param start starting with this element in the array
 * @ param n write this number of elements
 * @ throws IOException on read error */
public final void writeLong ( long [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { writeLong ( pa [ start + i ] ) ; }


signature:
public class RandomAccessFile { /** * Write an array of floats
 * @ param pa write from this array
 * @ param start starting with this element in the array
 * @ param n write this number of elements
 * @ throws IOException on read error */
public final void writeFloat ( float [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { writeFloat ( pa [ start + i ] ) ; }


signature:
public class RandomAccessFile { /** * Write an array of doubles
 * @ param pa write from this array
 * @ param start starting with this element in the array
 * @ param n write this number of elements
 * @ throws IOException on read error */
public final void writeDouble ( double [ ] pa , int start , int n ) throws IOException { } }

implementation: for ( int i = 0 ; i < n ; i ++ ) { writeDouble ( pa [ start + i ] ) ; }


signature:
public class RandomAccessFile { /** * Writes the string to the file as a sequence of bytes . Each
 * character in the string is written out , in sequence , by discarding
 * its high eight bits .
 * @ param s a string of bytes to be written .
 * @ throws IOException if an I / O error occurs . */
public final void writeBytes ( String s ) throws IOException { } }

implementation: int len = s . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { write ( ( byte ) s . charAt ( i ) ) ; }


signature:
public class RandomAccessFile { /** * Writes the character array to the file as a sequence of bytes . Each
 * character in the string is written out , in sequence , by discarding
 * its high eight bits .
 * @ param b a character array of bytes to be written .
 * @ param off the index of the first character to write .
 * @ param len the number of characters to write .
 * @ throws IOException if an I / O error occurs . */
public final void writeBytes ( char b [ ] , int off , int len ) throws IOException { } }

implementation: for ( int i = off ; i < len ; i ++ ) { write ( ( byte ) b [ i ] ) ; }


signature:
public class RandomAccessFile { /** * Writes a string to the file as a sequence of characters . Each
 * character is written to the data output stream as if by the
 * < code > writeChar < / code > method .
 * @ param s a < code > String < / code > value to be written .
 * @ throws IOException if an I / O error occurs .
 * @ see java . io . RandomAccessFile # writeChar ( int ) */
public final void writeChars ( String s ) throws IOException { } }

implementation: int len = s . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { int v = s . charAt ( i ) ; write ( ( v >>> 8 ) & 0xFF ) ; write ( ( v ) & 0xFF ) ; }


signature:
public class RandomAccessFile { /** * Writes a string to the file using UTF - 8 encoding in a
 * machine - independent manner .
 * First , two bytes are written to the file as if by the
 * < code > writeShort < / code > method giving the number of bytes to
 * follow . This value is the number of bytes actually written out ,
 * not the length of the string . Following the length , each character
 * of the string is output , in sequence , using the UTF - 8 encoding
 * for each character .
 * @ param str a string to be written .
 * @ throws IOException if an I / O error occurs . */
public final void writeUTF ( String str ) throws IOException { } }

implementation: int strlen = str . length ( ) ; int utflen = 0 ; for ( int i = 0 ; i < strlen ; i ++ ) { int c = str . charAt ( i ) ; if ( ( c >= 0x0001 ) && ( c <= 0x007F ) ) { utflen ++ ; } else if ( c > 0x07FF ) { utflen += 3 ; } else { utflen += 2 ; } } if ( utflen > 65535 ) { throw new UTFDataFormatException ( ) ; } write ( ( utflen >>> 8 ) & 0xFF ) ; write ( ( utflen ) & 0xFF ) ; for ( int i = 0 ; i < strlen ; i ++ ) { int c = str . charAt ( i ) ; if ( ( c >= 0x0001 ) && ( c <= 0x007F ) ) { write ( c ) ; } else if ( c > 0x07FF ) { write ( 0xE0 | ( ( c >> 12 ) & 0x0F ) ) ; write ( 0x80 | ( ( c >> 6 ) & 0x3F ) ) ; write ( 0x80 | ( ( c ) & 0x3F ) ) ; } else { write ( 0xC0 | ( ( c >> 6 ) & 0x1F ) ) ; write ( 0x80 | ( ( c ) & 0x3F ) ) ; } }


signature:
public class RandomAccessFile { /** * Search forward from the current pos , looking for a match .
 * @ param match the match to look for .
 * @ param maxBytes maximum number of bytes to search . use - 1 for all
 * @ return true if found , file position will be at the start of the match .
 * @ throws IOException on read error */
public boolean searchForward ( KMPMatch match , int maxBytes ) throws IOException { } }

implementation:
long start = getFilePointer ( ) ; long last = ( maxBytes < 0 ) ? length ( ) : Math . min ( length ( ) , start + maxBytes ) ; long needToScan = last - start ; // check what ever is now in the buffer
int bytesAvailable = ( int ) ( dataEnd - filePosition ) ; if ( bytesAvailable < 1 ) { seek ( filePosition ) ; // read a new buffer
bytesAvailable = ( int ) ( dataEnd - filePosition ) ; } int bufStart = ( int ) ( filePosition - bufferStart ) ; int scanBytes = ( int ) Math . min ( bytesAvailable , needToScan ) ; int pos = match . indexOf ( buffer , bufStart , scanBytes ) ; if ( pos >= 0 ) { seek ( bufferStart + pos ) ; return true ; } int matchLen = match . getMatchLength ( ) ; needToScan -= scanBytes - matchLen ; while ( needToScan > matchLen ) { readBuffer ( dataEnd - matchLen ) ; // force new buffer
scanBytes = ( int ) Math . min ( buffer . length , needToScan ) ; pos = match . indexOf ( buffer , 0 , scanBytes ) ; if ( pos > 0 ) { seek ( bufferStart + pos ) ; return true ; } needToScan -= scanBytes - matchLen ; } // failure
seek ( last ) ; return false ;


signature:
public class Selector { /** * Create the selector result string , and append .
 * @ param sbuff append here
 * @ param values list of selected values , each value is a pair ( String , Object ) , where the
 * String is name of the value , and the Object is the value itself . We use the toString ( )
 * method on the object to get its String representation . */
public void appendQuery ( StringBuffer sbuff , ArrayList values ) { } }

implementation: if ( template != null ) appendQueryFromTemplate ( sbuff , values ) ; else appendQueryFromParamValue ( sbuff , values ) ;


signature:
public class NcssGridRequestValidator { /** * since none of these are required , can only do consistency checks
 * @ see " http : / / www . unidata . ucar . edu / software / thredds / current / tds / reference / NetcdfSubsetServiceReference . html " */
@ Override public boolean isValid ( NcssGridParamsBean params , ConstraintValidatorContext constraintValidatorContext ) { } }

implementation:
constraintValidatorContext . disableDefaultConstraintViolation ( ) ; boolean isValid = true ; // lat / lon point
if ( params . getLatitude ( ) != null || params . getLongitude ( ) != null ) { if ( ! params . hasLatLonPoint ( ) ) { isValid = false ; constraintValidatorContext . buildConstraintViolationWithTemplate ( "{thredds.server.ncSubset.validation.lat_or_lon_missing}" ) . addConstraintViolation ( ) ; } } // lat / lon bb
if ( params . getNorth ( ) != null || params . getSouth ( ) != null || params . getEast ( ) != null || params . getWest ( ) != null ) { if ( ! params . hasLatLonBB ( ) ) { isValid = false ; constraintValidatorContext . buildConstraintViolationWithTemplate ( "{thredds.server.ncSubset.validation.wrong_bbox}" ) . addConstraintViolation ( ) ; } if ( params . getNorth ( ) < params . getSouth ( ) ) { isValid = false ; constraintValidatorContext . buildConstraintViolationWithTemplate ( "{thredds.server.ncSubset.validation.north_south}" ) . addConstraintViolation ( ) ; } if ( params . getEast ( ) < params . getWest ( ) ) { isValid = false ; constraintValidatorContext . buildConstraintViolationWithTemplate ( "{thredds.server.ncSubset.validation.east_west}" ) . addConstraintViolation ( ) ; } } // proj bb
if ( params . getMaxx ( ) != null || params . getMinx ( ) != null || params . getMaxy ( ) != null || params . getMiny ( ) != null ) { if ( ! params . hasProjectionBB ( ) ) { isValid = false ; constraintValidatorContext . buildConstraintViolationWithTemplate ( "{thredds.server.ncSubset.validation.wrong_pbox}" ) . addConstraintViolation ( ) ; } if ( params . getMaxx ( ) < params . getMinx ( ) ) { isValid = false ; constraintValidatorContext . buildConstraintViolationWithTemplate ( "{thredds.server.ncSubset.validation.rangex}" ) . addConstraintViolation ( ) ; } if ( params . getMaxy ( ) < params . getMiny ( ) ) { isValid = false ; constraintValidatorContext . buildConstraintViolationWithTemplate ( "{thredds.server.ncSubset.validation.rangey}" ) . addConstraintViolation ( ) ; } } // runtime : latest , all , or time
if ( params . getRuntime ( ) != null ) { if ( "latest" . equalsIgnoreCase ( params . getRuntime ( ) ) ) { params . setLatestRuntime ( true ) ; } else if ( "all" . equalsIgnoreCase ( params . getRuntime ( ) ) ) { params . setAllRuntime ( true ) ; } else { CalendarDate cd = TimeParamsValidator . validateISOString ( params . getRuntime ( ) , "{thredds.server.ncSubset.validation.param.runtime}" , constraintValidatorContext ) ; if ( cd != null ) params . setRuntimeDate ( cd ) ; } } // timeOffset : first or double
if ( params . getTimeOffset ( ) != null ) { if ( "first" . equalsIgnoreCase ( params . getTimeOffset ( ) ) ) { params . setFirstTimeOffset ( true ) ; } else { try { double val = Double . parseDouble ( params . getTimeOffset ( ) ) ; params . setTimeOffsetVal ( val ) ; } catch ( NumberFormatException e ) { constraintValidatorContext . buildConstraintViolationWithTemplate ( "{thredds.server.ncSubset.validation.param.time_offset}" ) . addConstraintViolation ( ) ; } } } return isValid ;


signature:
public class DirectoryBuilder { /** * returns a DirectoryPartition or DirectoryCollection */
static public MCollection factory ( FeatureCollectionConfig config , Path topDir , boolean isTop , IndexReader indexReader , String suffix , org . slf4j . Logger logger ) throws IOException { } }

implementation:
DirectoryBuilder builder = new DirectoryBuilder ( config . collectionName , topDir . toString ( ) , suffix ) ; DirectoryPartition dpart = new DirectoryPartition ( config , topDir , isTop , indexReader , suffix , logger ) ; if ( ! builder . isLeaf ( indexReader ) ) { // its a partition
return dpart ; } // its a collection
boolean hasIndex = builder . findIndex ( ) ; if ( hasIndex ) { return dpart . makeChildCollection ( builder ) ; } else { DirectoryCollection result = new DirectoryCollection ( config . collectionName , topDir , isTop , config . olderThan , logger ) ; // no index file
return result ; }


signature:
public class DirectoryBuilder { /** * Find the index file , using its canonical name
 * @ return true if found
 * @ throws IOException */
public boolean findIndex ( ) throws IOException { } }

implementation: Path indexPath = Paths . get ( dir . toString ( ) , partitionName + suffix ) ; if ( Files . exists ( indexPath ) ) { this . index = indexPath ; BasicFileAttributes attr = Files . readAttributes ( indexPath , BasicFileAttributes . class ) ; this . indexLastModified = attr . lastModifiedTime ( ) ; this . indexSize = attr . size ( ) ; return true ; } return false ;


signature:
public class DirectoryBuilder { /** * Scans first 100 files to decide if its a leaf . If so , it becomes a DirectoryCollection , else a PartitionCollection .
 * @ param indexReader reads the index
 * @ return true if partition , false if file collection
 * @ throws IOException on IO error */
private boolean isLeaf ( IndexReader indexReader ) throws IOException { } }

implementation: if ( partitionStatus == PartitionStatus . unknown ) { int countDir = 0 , countFile = 0 , count = 0 ; try ( DirectoryStream < Path > dirStream = Files . newDirectoryStream ( dir ) ) { Iterator < Path > iterator = dirStream . iterator ( ) ; while ( iterator . hasNext ( ) && count ++ < 100 ) { Path p = iterator . next ( ) ; BasicFileAttributes attr = Files . readAttributes ( p , BasicFileAttributes . class ) ; if ( attr . isDirectory ( ) ) countDir ++ ; else countFile ++ ; } } partitionStatus = ( countFile > countDir ) ? PartitionStatus . isLeaf : PartitionStatus . isDirectoryPartition ; } return partitionStatus == PartitionStatus . isLeaf ;


signature:
public class DirectoryBuilder { /** * Find all children directories . Does not recurse .
 * We separate this from the constructor so it can be done on demand
 * Public for debugging .
 * Look for children by :
 * < ol >
 * < li > If index exists , use the children inside there . / li >
 * < li > ( or ) scan the directory for children partitions < / li >
 * < / ol >
 * @ param indexReader this reads the index , and calls AddChild . addchild ( ) for each child
 * @ return children , may be empty but not null
 * @ throws IOException */
public List < DirectoryBuilder > constructChildren ( IndexReader indexReader , CollectionUpdateType forceCollection ) throws IOException { } }

implementation:
if ( childrenConstructed ) return children ; if ( index != null && forceCollection == CollectionUpdateType . nocheck ) { // use index if it exists
constructChildrenFromIndex ( indexReader , false ) ; } else { scanForChildren ( ) ; } // once we have found children , we know that this is a time partition
partitionStatus = ( children . size ( ) > 0 ) ? PartitionStatus . isDirectoryPartition : PartitionStatus . isLeaf ; childrenConstructed = true ; // otherwise we are good
return children ;


signature:
public class DirectoryBuilder { /** * Scan for subdirectories , make each into a DirectoryBuilder and add as a child */
private void scanForChildren ( ) { } }

implementation: if ( debug ) System . out . printf ( "DirectoryBuilder.scanForChildren on %s " , dir ) ; int count = 0 ; try ( DirectoryStream < Path > ds = Files . newDirectoryStream ( dir ) ) { for ( Path p : ds ) { BasicFileAttributes attr = Files . readAttributes ( p , BasicFileAttributes . class ) ; if ( attr . isDirectory ( ) ) { children . add ( new DirectoryBuilder ( topCollectionName , p , attr , suffix ) ) ; if ( debug && ( ++ count % 10 == 0 ) ) System . out . printf ( "%d " , count ) ; } } } catch ( IOException e ) { e . printStackTrace ( ) ; } if ( debug ) System . out . printf ( "done=%d%n" , count ) ; childrenConstructed = true ;


signature:
public class DirectoryBuilder { /** * read the list of files from the index */
public List < MFile > readFilesFromIndex ( IndexReader indexReader ) throws IOException { } }

implementation: List < MFile > result = new ArrayList < > ( 100 ) ; if ( index == null ) return result ; indexReader . readMFiles ( index , result ) ; return result ;


signature:
public class GridDataset { /** * Open a netcdf dataset , using NetcdfDataset . defaultEnhanceMode plus CoordSystems
 * and turn into a GridDataset .
 * @ param location netcdf dataset to open , using NetcdfDataset . acquireDataset ( ) .
 * @ return GridDataset
 * @ throws java . io . IOException on read error
 * @ see ucar . nc2 . dataset . NetcdfDataset # acquireDataset */
static public GridDataset open ( String location ) throws java . io . IOException { } }

implementation: return open ( location , NetcdfDataset . getDefaultEnhanceMode ( ) ) ;


signature:
public class GridDataset { /** * Open a netcdf dataset , using NetcdfDataset . defaultEnhanceMode plus CoordSystems
 * and turn into a GridDataset .
 * @ param location netcdf dataset to open , using NetcdfDataset . acquireDataset ( ) .
 * @ param enhanceMode open netcdf dataset with this enhanceMode
 * @ return GridDataset
 * @ throws java . io . IOException on read error
 * @ see ucar . nc2 . dataset . NetcdfDataset # acquireDataset */
static public GridDataset open ( String location , Set < NetcdfDataset . Enhance > enhanceMode ) throws java . io . IOException { } }

implementation: NetcdfDataset ds = ucar . nc2 . dataset . NetcdfDataset . acquireDataset ( null , DatasetUrl . findDatasetUrl ( location ) , enhanceMode , - 1 , null , null ) ; return new GridDataset ( ds , null ) ;


signature:
public class GridDataset { /** * Return GridDatatype objects grouped by GridCoordSys . All GridDatatype in a Gridset
 * have the same GridCoordSystem .
 * @ return List of type ucar . nc2 . dt . GridDataset . Gridset */
public List < ucar . nc2 . dt . GridDataset . Gridset > getGridsets ( ) { } }

implementation: return new ArrayList < ucar . nc2 . dt . GridDataset . Gridset > ( gridsetHash . values ( ) ) ;


signature:
public class GridDataset { /** * Show Grids and coordinate systems .
 * @ param buf put info here */
private void getInfo ( Formatter buf ) { } }

implementation: int countGridset = 0 ; for ( Gridset gs : gridsetHash . values ( ) ) { GridCoordSystem gcs = gs . getGeoCoordSystem ( ) ; buf . format ( "%nGridset %d  coordSys=%s" , countGridset , gcs ) ; buf . format ( " LLbb=%s " , gcs . getLatLonBoundingBox ( ) ) ; if ( ( gcs . getProjection ( ) != null ) && ! gcs . getProjection ( ) . isLatLon ( ) ) buf . format ( " bb= %s" , gcs . getBoundingBox ( ) ) ; buf . format ( "%n" ) ; buf . format ( "Name__________________________Unit__________________________hasMissing_Description%n" ) ; for ( GridDatatype grid : gs . getGrids ( ) ) { buf . format ( "%s%n" , grid . getInfo ( ) ) ; } countGridset ++ ; buf . format ( "%n" ) ; } buf . format ( "%nGeoReferencing Coordinate Axes%n" ) ; buf . format ( "Name__________________________Units_______________Type______Description%n" ) ; for ( CoordinateAxis axis : ncd . getCoordinateAxes ( ) ) { if ( axis . getAxisType ( ) == null ) continue ; axis . getInfo ( buf ) ; buf . format ( "%n" ) ; }


signature:
public class GridDataset { /** * FileCacheable */
@ Override public synchronized void close ( ) throws java . io . IOException { } }

implementation: if ( fileCache != null ) { if ( fileCache . release ( this ) ) return ; } try { if ( ncd != null ) ncd . close ( ) ; } finally { ncd = null ; }


signature:
public class FileCache { /** * You must call shutdown ( ) to shut down the background threads in order to get a clean process shutdown . */
public static synchronized void shutdown ( ) { } }

implementation: if ( timer != null ) { timer . cancel ( ) ; System . out . printf ( "FileCache.shutdown called%n" ) ; } timer = null ;