signature:
public class DSequence { /** * Deserialize a single row of the < code > DSequence < / code > .
 * @ param source a < code > DataInputStream < / code > to read from .
 * @ param sv the < code > ServerVersion < / code > returned by the server .
 * @ param statusUI the < code > StatusUI < / code > object to use for GUI updates
 * and user cancellation notification ( may be null ) .
 * @ throws EOFException if EOF is found before the variable is completely
 * deserialized .
 * @ throws IOException thrown on any other InputStream exception .
 * @ throws DataReadException if an unexpected value was read . */
private void deserializeSingle ( DataInputStream source , ServerVersion sv , StatusUI statusUI ) throws IOException , EOFException , DataReadException { } }

implementation:
// create a new instance from the variable template Vector
Vector newInstance = new Vector ( ) ; for ( int i = 0 ; i < varTemplate . size ( ) ; i ++ ) { BaseType bt = ( BaseType ) varTemplate . elementAt ( i ) ; newInstance . addElement ( bt . clone ( ) ) ; } // deserialize the new instance
for ( Enumeration e = newInstance . elements ( ) ; e . hasMoreElements ( ) ; ) { if ( statusUI != null && statusUI . userCancelled ( ) ) throw new DataReadException ( "User cancelled" ) ; ClientIO bt = ( ClientIO ) e . nextElement ( ) ; bt . deserialize ( source , sv , statusUI ) ; } // add the new instance to the allValues vector
allValues . addElement ( newInstance ) ;


signature:
public class DSequence { /** * Reads a marker byte from the input stream . */
private byte readMarker ( DataInputStream source ) throws IOException { } }

implementation:
byte marker = source . readByte ( ) ; // pad out to a multiple of four bytes
byte unused ; for ( int i = 0 ; i < 3 ; i ++ ) unused = source . readByte ( ) ; return marker ;


signature:
public class DSequence { /** * Writes a marker byte to the output stream . */
protected void writeMarker ( DataOutputStream sink , byte marker ) throws IOException { } }

implementation:
// for ( int i = 0 ; i < 4 ; i + + )
sink . writeByte ( marker ) ; sink . writeByte ( ( byte ) 0 ) ; sink . writeByte ( ( byte ) 0 ) ; sink . writeByte ( ( byte ) 0 ) ;


signature:
public class DSequence { /** * Writes data to a < code > DataOutputStream < / code > . This method is used
 * primarily by GUI clients which need to download OPeNDAP data , manipulate
 * it , and then re - save it as a binary file .
 * @ param sink a < code > DataOutputStream < / code > to write to .
 * @ throws IOException thrown on any < code > OutputStream < / code >
 * exception . */
public void externalize ( DataOutputStream sink ) throws IOException { } }

implementation:
// loop until end of sequence
for ( int i = 0 ; i < allValues . size ( ) ; i ++ ) { // * * * * * Pulled out the getLevel ( ) check in order to support the " new "
// and " improved " serialization of OPeNDAP sequences . 8/31/01 ndp
// if ( getLevel ( ) = = 0)
writeMarker ( sink , START_OF_INSTANCE ) ; Vector rowVec = ( Vector ) allValues . elementAt ( i ) ; for ( int j = 0 ; j < rowVec . size ( ) ; j ++ ) { ClientIO bt = ( ClientIO ) rowVec . elementAt ( j ) ; bt . externalize ( sink ) ; } } // * * * * * Pulled out the getLevel ( ) check in order to support the " new "
// and " improved " serialization of OPeNDAP sequences . 8/31/01 ndp
// if ( getLevel ( ) = = 0)
writeMarker ( sink , END_OF_SEQUENCE ) ;


signature:
public class DSequence { /** * Returns a clone of this < code > Sequence < / code > .
 * See DAPNode . cloneDag ( )
 * @ param map track previously cloned nodes
 * @ return a clone of this object . */
public DAPNode cloneDAG ( CloneMap map ) throws CloneNotSupportedException { } }

implementation: DSequence s = ( DSequence ) super . cloneDAG ( map ) ; s . varTemplate = new Vector ( ) ; for ( int i = 0 ; i < varTemplate . size ( ) ; i ++ ) { BaseType bt = ( BaseType ) varTemplate . elementAt ( i ) ; BaseType btclone = ( BaseType ) cloneDAG ( map , bt ) ; s . varTemplate . addElement ( btclone ) ; } s . allValues = new Vector ( ) ; for ( int i = 0 ; i < allValues . size ( ) ; i ++ ) { Vector rowVec = ( Vector ) allValues . elementAt ( i ) ; Vector newVec = new Vector ( ) ; for ( int j = 0 ; j < rowVec . size ( ) ; j ++ ) { BaseType bt = ( BaseType ) rowVec . elementAt ( j ) ; newVec . addElement ( ( BaseType ) cloneDAG ( map , bt ) ) ; } s . allValues . addElement ( newVec ) ; } return s ;


signature:
public class SaxEventHandler { /** * Public API */
public boolean parse ( String document ) throws SAXException { } }

implementation:
// Trim and strip any leading < ? xml . . . ? >
StringBuilder doc = new StringBuilder ( document . trim ( ) ) ; int index = doc . indexOf ( "<?xml" ) ; if ( index == 0 ) { index = doc . indexOf ( "?>" ) ; if ( index < 0 ) throw new SAXException ( "Document has malformed <?xml...?> prefix" ) ; doc . delete ( 0 , index + 2 ) ; // remove any leading crlf
while ( doc . length ( ) > 0 && "\r\n" . indexOf ( doc . charAt ( 0 ) ) >= 0 ) doc . deleteCharAt ( 0 ) ; document = doc . toString ( ) ; } this . document = document ; // Create the sax parser that will drive us with events
try { spf = SAXParserFactory . newInstance ( ) ; spf . setValidating ( false ) ; spf . setNamespaceAware ( true ) ; spf . setFeature ( LOAD_EXTERNAL_DTD , false ) ; saxparser = spf . newSAXParser ( ) ; // Set up for the parse
input = new ByteArrayInputStream ( document . getBytes ( UTF8 ) ) ; saxparser . parse ( input , this ) ; // ' this ' is link to subclass parser
return true ; } catch ( Exception e ) { throw new SAXException ( e ) ; }


signature:
public class SaxEventHandler { /** * Entity resolution ( Ignored ) */
@ Override public InputSource resolveEntity ( String publicId , String systemId ) { } }

implementation: if ( TRACE ) trace ( "eventtype.RESOLVEENTITY: %s.%s%n" , publicId , systemId ) ; return null ;


signature:
public class SaxEventHandler { /** * Error handling Events */
@ Override public void fatalError ( SAXParseException e ) throws SAXException { } }

implementation: throw new SAXParseException ( String . format ( "Sax fatal error: %s; %s%n" , e , report ( this . locator ) ) , this . locator ) ;


signature:
public class SaxEventHandler { /** * Location printing */
protected void locatedEvent ( SaxEvent token ) throws SAXException { } }

implementation: try { yyevent ( token ) ; } catch ( SAXException se ) { throw new SAXException ( locatedError ( se . getMessage ( ) ) ) ; }


signature:
public class MultipleAxisChart { /** * Creates the demo chart .
 * @ return The chart .
 * private JFreeChart createChart ( ) {
 * XYDataset dataset1 = createDataset ( " Series 1 " , 100.0 , new Minute ( ) , 200 ) ;
 * JFreeChart chart = ChartFactory . createTimeSeriesChart (
 * " Multiple Axis Demo 1 " ,
 * " Time of Day " ,
 * " Primary Range Axis " ,
 * dataset1,
 * true ,
 * true ,
 * false
 * chart . addSubtitle ( new TextTitle ( " Four datasets and four range axes . " ) ) ;
 * XYPlot plot = ( XYPlot ) chart . getPlot ( ) ;
 * plot . setOrientation ( PlotOrientation . VERTICAL ) ;
 * plot . getRangeAxis ( ) . setFixedDimension ( 15.0 ) ;
 * AXIS 2
 * NumberAxis axis2 = new NumberAxis ( " Range Axis 2 " ) ;
 * axis2 . setFixedDimension ( 10.0 ) ;
 * axis2 . setAutoRangeIncludesZero ( false ) ;
 * plot . setRangeAxis ( 1 , axis2 ) ;
 * plot . setRangeAxisLocation ( 1 , AxisLocation . BOTTOM _ OR _ LEFT ) ;
 * XYDataset dataset2 = createDataset ( " Series 2 " , 1000.0 , new Minute ( ) ,
 * 170 ) ;
 * plot . setDataset ( 1 , dataset2 ) ;
 * plot . mapDatasetToRangeAxis ( 1 , 1 ) ;
 * XYItemRenderer renderer2 = new StandardXYItemRenderer ( ) ;
 * plot . setRenderer ( 1 , renderer2 ) ;
 * AXIS 3
 * NumberAxis axis3 = new NumberAxis ( " Range Axis 3 " ) ;
 * plot . setRangeAxis ( 2 , axis3 ) ;
 * XYDataset dataset3 = createDataset ( " Series 3 " , 10000.0 , new Minute ( ) ,
 * 170 ) ;
 * plot . setDataset ( 2 , dataset3 ) ;
 * plot . mapDatasetToRangeAxis ( 2 , 2 ) ;
 * XYItemRenderer renderer3 = new StandardXYItemRenderer ( ) ;
 * plot . setRenderer ( 2 , renderer3 ) ;
 * AXIS 4
 * NumberAxis axis4 = new NumberAxis ( " Range Axis 4 " ) ;
 * plot . setRangeAxis ( 3 , axis4 ) ;
 * XYDataset dataset4 = createDataset ( " Series 4 " , 25.0 , new Minute ( ) , 200 ) ;
 * plot . setDataset ( 3 , dataset4 ) ;
 * plot . mapDatasetToRangeAxis ( 3 , 3 ) ;
 * XYItemRenderer renderer4 = new StandardXYItemRenderer ( ) ;
 * plot . setRenderer ( 3 , renderer4 ) ;
 * ChartUtilities . applyCurrentTheme ( chart ) ;
 * change the series and axis colours after the theme has
 * been applied . . .
 * plot . getRenderer ( ) . setSeriesPaint ( 0 , Color . black ) ;
 * renderer2 . setSeriesPaint ( 0 , Color . red ) ;
 * axis2 . setLabelPaint ( Color . red ) ;
 * axis2 . setTickLabelPaint ( Color . red ) ;
 * renderer3 . setSeriesPaint ( 0 , Color . blue ) ;
 * axis3 . setLabelPaint ( Color . blue ) ;
 * axis3 . setTickLabelPaint ( Color . blue ) ;
 * renderer4 . setSeriesPaint ( 0 , Color . green ) ;
 * axis4 . setLabelPaint ( Color . green ) ;
 * axis4 . setTickLabelPaint ( Color . green ) ;
 * return chart ;
 * Creates a sample dataset .
 * @ param name the dataset name .
 * @ param base the starting value .
 * @ param start the starting period .
 * @ param count the number of values to generate .
 * @ return The dataset . */
private static TimeSeries createDataset ( String name , double base , RegularTimePeriod start , int count ) { } }

implementation: TimeSeries series = new TimeSeries ( name , start . getClass ( ) ) ; RegularTimePeriod period = start ; double value = base ; for ( int i = 0 ; i < count ; i ++ ) { series . add ( period , value ) ; period = period . next ( ) ; value = value * ( 1 + ( Math . random ( ) - 0.495 ) / 10.0 ) ; } return series ;


signature:
public class MultipleAxisChart { /** * Starting point for the demonstration application .
 * @ param args ignored . */
public static void main ( String [ ] args ) { } }

implementation:
TimeSeries dataset1 = createDataset ( "Series 1" , 100.0 , new Minute ( ) , 200 ) ; MultipleAxisChart demo = new MultipleAxisChart ( "Multiple Axis Demo 1" , "Time of Day" , "Primary Range Axis" , dataset1 ) ; /* AXIS 2
 NumberAxis axis2 = new NumberAxis ( " Range Axis 2 " ) ;
 axis2 . setFixedDimension ( 10.0 ) ;
 axis2 . setAutoRangeIncludesZero ( false ) ;
 plot . setRangeAxis ( 1 , axis2 ) ;
 plot . setRangeAxisLocation ( 1 , AxisLocation . BOTTOM _ OR _ LEFT ) ; /
 plot . setDataset ( 1 , dataset2 ) ;
 plot . mapDatasetToRangeAxis ( 1 , 1 ) ;
 XYItemRenderer renderer2 = new StandardXYItemRenderer ( ) ;
 plot . setRenderer ( 1 , renderer2 ) ; */
TimeSeries dataset2 = createDataset ( "Series 2" , 1000.0 , new Minute ( ) , 170 ) ; demo . addSeries ( "Range Axis 2" , dataset2 ) ; /* / / AXIS 3
 NumberAxis axis3 = new NumberAxis ( " Range Axis 3 " ) ;
 plot . setRangeAxis ( 2 , axis3 ) ;
 XYDataset dataset3 = createDataset ( " Series 3 " , 10000.0 , new Minute ( ) , 170 ) ;
 plot . setDataset ( 2 , dataset3 ) ;
 plot . mapDatasetToRangeAxis ( 2 , 2 ) ;
 XYItemRenderer renderer3 = new StandardXYItemRenderer ( ) ;
 plot . setRenderer ( 2 , renderer3 ) ; */
TimeSeries dataset3 = createDataset ( "Series 3" , 10000.0 , new Minute ( ) , 170 ) ; demo . addSeries ( "Range Axis 3" , dataset3 ) ; /* AXIS 4
 NumberAxis axis4 = new NumberAxis ( " Range Axis 4 " ) ;
 plot . setRangeAxis ( 3 , axis4 ) ;
 XYDataset dataset4 = createDataset ( " Series 4 " , 25.0 , new Minute ( ) , 200 ) ;
 plot . setDataset ( 3 , dataset4 ) ;
 plot . mapDatasetToRangeAxis ( 3 , 3 ) ;
 XYItemRenderer renderer4 = new StandardXYItemRenderer ( ) ;
 plot . setRenderer ( 3 , renderer4 ) ; */
TimeSeries dataset4 = createDataset ( "Series 4" , 25.0 , new Minute ( ) , 200 ) ; demo . addSeries ( "Range Axis 4" , dataset4 ) ; demo . finish ( new java . awt . Dimension ( 600 , 270 ) ) ; JFrame frame = new JFrame ( "Demovabulous " ) ; frame . getContentPane ( ) . add ( demo , BorderLayout . CENTER ) ; frame . setSize ( 640 , 480 ) ; frame . setVisible ( true ) ; frame . setDefaultCloseOperation ( JFrame . EXIT_ON_CLOSE ) ;


signature:
public class StructureDataA { /** * LOOK can we optimize ? ? */
public String [ ] getJavaArrayString ( StructureMembers . Member m ) { } }

implementation: if ( m . getDataType ( ) == DataType . STRING ) { Array data = getArray ( m ) ; int n = m . getSize ( ) ; String [ ] result = new String [ n ] ; for ( int i = 0 ; i < result . length ; i ++ ) result [ i ] = ( String ) data . getObject ( i ) ; return result ; } else if ( m . getDataType ( ) == DataType . CHAR ) { ArrayChar data = ( ArrayChar ) getArray ( m ) ; ArrayChar . StringIterator iter = data . getStringIterator ( ) ; String [ ] result = new String [ iter . getNumElems ( ) ] ; int count = 0 ; while ( iter . hasNext ( ) ) result [ count ++ ] = iter . next ( ) ; return result ; } throw new IllegalArgumentException ( "getJavaArrayString: not String DataType :" + m . getDataType ( ) ) ;


signature:
public class DoradeVOLD { /** * Get the array of available parameter names for this volume .
 * @ return an array of parameter names */
public DoradePARM [ ] getParamList ( ) { } }

implementation: int paramCount = 0 ; for ( int i = 0 ; i < nSensors ; i ++ ) paramCount += myRADDs [ i ] . getNParams ( ) ; DoradePARM [ ] list = new DoradePARM [ paramCount ] ; int next = 0 ; for ( int i = 0 ; i < nSensors ; i ++ ) { int nParams = myRADDs [ i ] . getNParams ( ) ; System . arraycopy ( myRADDs [ i ] . getParamList ( ) , 0 , list , next , nParams ) ; next += nParams ; } return list ;


signature:
public class StationRegionDateChooser { /** * override superclass */
private void makeMyUI ( ) { } }

implementation:
AbstractAction incrFontAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { stnRender . incrFontSize ( ) ; redraw ( ) ; } } ; BAMutil . setActionProperties ( incrFontAction , "FontIncr" , "increase font size" , false , 'I' , - 1 ) ; AbstractAction decrFontAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { stnRender . decrFontSize ( ) ; redraw ( ) ; } } ; BAMutil . setActionProperties ( decrFontAction , "FontDecr" , "decrease font size" , false , 'D' , - 1 ) ; JCheckBox declutCB = new JCheckBox ( "Declutter" , true ) ; declutCB . addActionListener ( e -> { setDeclutter ( ( ( JCheckBox ) e . getSource ( ) ) . isSelected ( ) ) ; } ) ; AbstractAction bbAction = new AbstractAction ( ) { public void actionPerformed ( ActionEvent e ) { geoSelectionMode = ! geoSelectionMode ; np . setGeoSelectionMode ( geoSelectionMode ) ; redraw ( ) ; } } ; BAMutil . setActionProperties ( bbAction , "geoselect" , "select geo region" , true , 'B' , - 1 ) ; bbAction . putValue ( BAMutil . STATE , geoSelectionMode ? Boolean . TRUE : Boolean . FALSE ) ; // the fields use a PrefPanel
if ( regionSelect ) { minmaxPP = new PrefPanel ( null , null ) ; minLonField = minmaxPP . addDoubleField ( "minLon" , "minLon" , geoSelection . getMinX ( ) , nfracDig , 0 , 0 , null ) ; maxLonField = minmaxPP . addDoubleField ( "maxLon" , "maxLon" , geoSelection . getMaxX ( ) , nfracDig , 2 , 0 , null ) ; minLatField = minmaxPP . addDoubleField ( "minLat" , "minLat" , geoSelection . getMinY ( ) , nfracDig , 4 , 0 , null ) ; maxLatField = minmaxPP . addDoubleField ( "maxLat" , "maxLat" , geoSelection . getMaxY ( ) , nfracDig , 6 , 0 , null ) ; minmaxPP . finish ( true , BorderLayout . EAST ) ; minmaxPP . addActionListener ( e -> { // " Apply " was called
double minLon = minLonField . getDouble ( ) ; double minLat = minLatField . getDouble ( ) ; double maxLon = maxLonField . getDouble ( ) ; double maxLat = maxLatField . getDouble ( ) ; LatLonRect llbb = new LatLonRect ( new LatLonPointImpl ( minLat , minLon ) , new LatLonPointImpl ( maxLat , maxLon ) ) ; setGeoSelection ( llbb ) ; redraw ( ) ; } ) ; } // assemble
setLayout ( new BorderLayout ( ) ) ; if ( stationSelect ) { BAMutil . addActionToContainer ( toolPanel , incrFontAction ) ; BAMutil . addActionToContainer ( toolPanel , decrFontAction ) ; toolPanel . add ( declutCB ) ; } if ( regionSelect ) BAMutil . addActionToContainer ( toolPanel , bbAction ) ; if ( dateSelect ) BAMutil . addActionToContainer ( toolPanel , dateAction ) ; JPanel upperPanel = new JPanel ( new BorderLayout ( ) ) ; if ( regionSelect ) upperPanel . add ( minmaxPP , BorderLayout . NORTH ) ; upperPanel . add ( toolPanel , BorderLayout . SOUTH ) ; JPanel statusPanel = new JPanel ( new BorderLayout ( ) ) ; statusPanel . setBorder ( new EtchedBorder ( ) ) ; JLabel positionLabel = new JLabel ( "position" ) ; statusPanel . add ( positionLabel , BorderLayout . CENTER ) ; np . setPositionLabel ( positionLabel ) ; add ( upperPanel , BorderLayout . NORTH ) ; add ( np , BorderLayout . CENTER ) ; add ( statusPanel , BorderLayout . SOUTH ) ;


signature:
public class StationRegionDateChooser { /** * Set the list of Stations .
 * @ param stns list of Station */
public void setStations ( java . util . List stns ) { } }

implementation: stnRender . setStations ( stns ) ; redraw ( true ) ;


signature:
public class StationRegionDateChooser { /** * Looks for the station with given id . If found , makes it current . Redraws .
 * @ param id must match stationIF . getID ( ) . */
public void setSelectedStation ( String id ) { } }

implementation: stnRender . setSelectedStation ( id ) ; selectedStation = stnRender . getSelectedStation ( ) ; assert selectedStation != null ; np . setLatLonCenterMapArea ( selectedStation . getLatitude ( ) , selectedStation . getLongitude ( ) ) ; redraw ( ) ;


signature:
public class StationRegionDateChooser { /** * Redraw the graphics on the screen . */
protected void redraw ( ) { } }

implementation:
long tstart = System . currentTimeMillis ( ) ; java . awt . Graphics2D gNP = np . getBufferedImageGraphics ( ) ; if ( gNP == null ) // panel not drawn on screen yet
return ; // clear it
gNP . setBackground ( np . getBackgroundColor ( ) ) ; java . awt . Rectangle r = gNP . getClipBounds ( ) ; gNP . clearRect ( r . x , r . y , r . width , r . height ) ; if ( regionSelect && geoSelectionMode ) { if ( geoSelection != null ) drawBB ( gNP , geoSelection , Color . cyan ) ; if ( geoBounds != null ) drawBB ( gNP , geoBounds , null ) ; // System . out . println ( " GeoRegionChooser . redraw geoBounds = " + geoBounds ) ;
if ( geoSelection != null ) { // gNP . setColor ( Color . orange ) ;
Navigation navigate = np . getNavigation ( ) ; double handleSize = RubberbandRectangleHandles . handleSizePixels / navigate . getPixPerWorld ( ) ; Rectangle2D rect = new Rectangle2D . Double ( geoSelection . getX ( ) , geoSelection . getY ( ) , geoSelection . getWidth ( ) , geoSelection . getHeight ( ) ) ; RubberbandRectangleHandles . drawHandledRect ( gNP , rect , handleSize ) ; if ( debug ) System . out . println ( "GeoRegionChooser.drawHandledRect=" + handleSize + " = " + geoSelection ) ; } } for ( int i = 0 ; i < renderers . size ( ) ; i ++ ) { ucar . nc2 . ui . util . Renderer rend = ( Renderer ) renderers . get ( i ) ; rend . draw ( gNP , atI ) ; } gNP . dispose ( ) ; if ( debug ) { long tend = System . currentTimeMillis ( ) ; System . out . println ( "StationRegionDateChooser draw time = " + ( tend - tstart ) / 1000.0 + " secs" ) ; } // copy buffer to the screen
np . repaint ( ) ;


signature:
public class SingleTrajectoryObsDataset { /** * Setup needed for all SingleTrajectoryObsDatatypes . Can only be called once .
 * Units of time varible must be udunits time units .
 * Units of latitude variable must be convertible to " degrees _ north " by udunits .
 * Units of longitude variable must be convertible to " degrees _ east " by udunits .
 * Units of altitude variable must be convertible to " meters " by udunits .
 * @ throws IllegalArgumentException if units of time , latitude , longitude , or altitude variables are not as required .
 * @ throws IllegalStateException if this method has already been called . */
public void setTrajectoryInfo ( Config trajConfig ) throws IOException { } }

implementation:
if ( timeDim != null ) throw new IllegalStateException ( "The setTrajectoryInfo() method can only be called once." ) ; this . trajectoryId = trajConfig . getTrajectoryId ( ) ; this . timeDim = trajConfig . getTimeDim ( ) ; this . timeVar = trajConfig . getTimeVar ( ) ; this . latVar = trajConfig . getLatVar ( ) ; this . lonVar = trajConfig . getLonVar ( ) ; this . elevVar = trajConfig . getElevVar ( ) ; trajectoryNumPoint = this . timeDim . getLength ( ) ; timeVarUnitsString = this . timeVar . findAttribute ( "units" ) . getStringValue ( ) ; // Check that time , lat , lon , elev units are acceptable .
if ( DateUnit . getStandardDate ( timeVarUnitsString ) == null ) { throw new IllegalArgumentException ( "Units of time variable <" + timeVarUnitsString + "> not a date unit." ) ; } String latVarUnitsString = this . latVar . findAttribute ( "units" ) . getStringValue ( ) ; if ( ! SimpleUnit . isCompatible ( latVarUnitsString , "degrees_north" ) ) { throw new IllegalArgumentException ( "Units of lat var <" + latVarUnitsString + "> not compatible with \"degrees_north\"." ) ; } String lonVarUnitsString = this . lonVar . findAttribute ( "units" ) . getStringValue ( ) ; if ( ! SimpleUnit . isCompatible ( lonVarUnitsString , "degrees_east" ) ) { throw new IllegalArgumentException ( "Units of lon var <" + lonVarUnitsString + "> not compatible with \"degrees_east\"." ) ; } String elevVarUnitsString = this . elevVar . findAttribute ( "units" ) . getStringValue ( ) ; if ( ! SimpleUnit . isCompatible ( elevVarUnitsString , "meters" ) ) { throw new IllegalArgumentException ( "Units of elev var <" + elevVarUnitsString + "> not compatible with \"meters\"." ) ; } try { elevVarUnitsConversionFactor = getMetersConversionFactor ( elevVarUnitsString ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Exception on getMetersConversionFactor() for the units of elev var <" + elevVarUnitsString + ">." ) ; } if ( this . netcdfDataset . hasUnlimitedDimension ( ) && this . netcdfDataset . getUnlimitedDimension ( ) . equals ( timeDim ) ) { Object result = this . netcdfDataset . sendIospMessage ( NetcdfFile . IOSP_MESSAGE_ADD_RECORD_STRUCTURE ) ; if ( ( result != null ) && ( Boolean ) result ) this . recordVar = ( Structure ) this . netcdfDataset . getRootGroup ( ) . findVariable ( "record" ) ; else this . recordVar = new StructurePseudo ( this . netcdfDataset , null , "record" , timeDim ) ; } else { this . recordVar = new StructurePseudo ( this . netcdfDataset , null , "record" , timeDim ) ; } // @ todo HACK , HACK , HACK - remove once addRecordStructure ( ) deals with ncd attribute changes .
Variable elevVarInRecVar = this . recordVar . findVariable ( this . elevVar . getFullNameEscaped ( ) ) ; if ( ! elevVarUnitsString . equals ( elevVarInRecVar . findAttribute ( "units" ) . getStringValue ( ) ) ) { elevVarInRecVar . addAttribute ( new Attribute ( "units" , elevVarUnitsString ) ) ; } trajectoryVarsMap = new HashMap ( ) ; // for ( Iterator it = this . recordVar . getVariables ( ) . iterator ( ) ; it . hasNext ( ) ; )
for ( Iterator it = this . netcdfDataset . getRootGroup ( ) . getVariables ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Variable curVar = ( Variable ) it . next ( ) ; if ( curVar . getRank ( ) > 0 && ! curVar . equals ( this . timeVar ) && ! curVar . equals ( this . latVar ) && ! curVar . equals ( this . lonVar ) && ! curVar . equals ( this . elevVar ) && ( this . recordVar == null ? true : ! curVar . equals ( this . recordVar ) ) ) { MyTypedDataVariable typedVar = new MyTypedDataVariable ( new VariableDS ( null , curVar , true ) ) ; dataVariables . add ( typedVar ) ; trajectoryVarsMap . put ( typedVar . getShortName ( ) , typedVar ) ; } } trajectory = new SingleTrajectory ( this . trajectoryId , trajectoryNumPoint , this . timeVar , timeVarUnitsString , this . latVar , this . lonVar , this . elevVar , dataVariables , trajectoryVarsMap ) ; startDate = trajectory . getTime ( 0 ) ; endDate = trajectory . getTime ( trajectoryNumPoint - 1 ) ; ( ( SingleTrajectory ) trajectory ) . setStartDate ( startDate ) ; ( ( SingleTrajectory ) trajectory ) . setEndDate ( endDate ) ;


signature:
public class DapType { /** * Static methods */
static public DapType lookup ( TypeSort atomic ) { } }

implementation:
if ( atomic == TypeSort . Enum ) return null ; // we need more info
return typemap . get ( atomic ) ;


signature:
public class Mercator { /** * Convert a LatLonPoint to projection coordinates
 * @ param latLon convert from these lat , lon coordinates
 * @ param result the object to write to
 * @ return the given result */
@ Override public ProjectionPoint latLonToProj ( LatLonPoint latLon , ProjectionPointImpl result ) { } }

implementation:
double toX , toY ; double fromLat = latLon . getLatitude ( ) ; double fromLon = latLon . getLongitude ( ) ; double fromLat_r = Math . toRadians ( fromLat ) ; // infinite projection
if ( ( Math . abs ( 90.0 - Math . abs ( fromLat ) ) ) < TOLERANCE ) { toX = Double . POSITIVE_INFINITY ; toY = Double . POSITIVE_INFINITY ; } else { toX = A * Math . toRadians ( LatLonPointImpl . range180 ( fromLon - this . lon0 ) ) ; toY = A * SpecialMathFunction . atanh ( Math . sin ( fromLat_r ) ) ; // p 41 Snyder
} result . setLocation ( toX + falseEasting , toY + falseNorthing ) ; return result ;


signature:
public class Mercator { /** * Convert projection coordinates to a LatLonPoint
 * Note : a new object is not created on each call for the return value .
 * @ param world convert from these projection coordinates
 * @ param result the object to write to
 * @ return LatLonPoint convert to these lat / lon coordinates */
@ Override public LatLonPoint projToLatLon ( ProjectionPoint world , LatLonPointImpl result ) { } }

implementation:
double fromX = world . getX ( ) - falseEasting ; double fromY = world . getY ( ) - falseNorthing ; double toLon = Math . toDegrees ( fromX / A ) + lon0 ; double e = Math . exp ( - fromY / A ) ; double toLat = Math . toDegrees ( Math . PI / 2 - 2 * Math . atan ( e ) ) ; // Snyder p 44
result . setLatitude ( toLat ) ; result . setLongitude ( toLon ) ; return result ;


signature:
public class CatalogXmlWriter { /** * Write the catalog as an XML document to the specified stream .
 * @ param catalog write this catalog
 * @ param os write to this OutputStream
 * @ param raw write raw file if true ( for server configuration )
 * @ throws java . io . IOException */
public void writeXML ( Catalog catalog , OutputStream os , boolean raw ) throws IOException { } }

implementation: this . raw = raw ; writeXML ( catalog , os ) ; this . raw = false ;


signature:
public class CatalogXmlWriter { /** * Write the catalog as an XML document to the specified stream .
 * @ param catalog write this catalog
 * @ param os write to this OutputStream
 * @ throws IOException */
public void writeXML ( Catalog catalog , OutputStream os ) throws IOException { } }

implementation:
// Output the document , use standard formatter
// XMLOutputter fmt = new XMLOutputter ( ) ;
// fmt . setNewlines ( true ) ;
// fmt . setIndent ( " " ) ;
// fmt . setTrimAllWhite ( true ) ;
XMLOutputter fmt = new XMLOutputter ( org . jdom2 . output . Format . getPrettyFormat ( ) ) ; // LOOK maybe compact ? ?
fmt . output ( writeCatalog ( catalog ) , os ) ;


signature:
public class CatalogXmlWriter { /** * / * protected void writeCat6InheritedMetadata ( Element elem , ThreddsMetadata tmi ) {
 * if ( ( tmi . getDataType ( ) = = null ) & & ( tmi . getServiceName ( ) = = null ) & &
 * ( tmi . getAuthority ( ) = = null ) & & ( tmi . getProperties ( ) . size ( ) = = 0 ) )
 * return ;
 * Element mdataElem = new Element ( " metadata " , Catalog . defNS ) ;
 * mdataElem . setAttribute ( " inherited " , " true " ) ;
 * writeThreddsMetadata ( mdataElem , tmi ) ;
 * elem . addContent ( mdataElem ) ; */
protected void writeInheritedMetadata ( Element elem , Dataset ds ) { } }

implementation: Element mdataElem = new Element ( "metadata" , Catalog . defNS ) ; mdataElem . setAttribute ( "inherited" , "true" ) ; ThreddsMetadata tmi = ( ThreddsMetadata ) ds . getLocalField ( Dataset . ThreddsMetadataInheritable ) ; if ( tmi == null ) return ; writeThreddsMetadata ( mdataElem , tmi ) ; if ( mdataElem . getChildren ( ) . size ( ) > 0 ) elem . addContent ( mdataElem ) ;


signature:
public class ProjectionRect { /** * Adds a < code > Rectangle2D < / code > object to this
 * < code > Rectangle2D < / code > . The resulting < code > Rectangle2D < / code >
 * is the union of the two < code > Rectangle2D < / code > objects .
 * @ param r the < code > Rectangle2D < / code > to add to this
 * < code > Rectangle2D < / code > .
 * @ since 1.2 */
public void add ( ProjectionRect r ) { } }

implementation: double x1 = Math . min ( getMinX ( ) , r . getMinX ( ) ) ; double x2 = Math . max ( getMaxX ( ) , r . getMaxX ( ) ) ; double y1 = Math . min ( getMinY ( ) , r . getMinY ( ) ) ; double y2 = Math . max ( getMaxY ( ) , r . getMaxY ( ) ) ; setRect ( x1 , y1 , x2 - x1 , y2 - y1 ) ;


signature:
public class ProjectionRect { /** * Adds a point , specified by the double precision arguments
 * < code > newx < / code > and < code > newy < / code > , to this
 * < code > Rectangle2D < / code > . The resulting < code > Rectangle2D < / code >
 * is the smallest < code > Rectangle2D < / code > that
 * contains both the original < code > Rectangle2D < / code > and the
 * specified point .
 * After adding a point , a call to < code > contains < / code > with the
 * added point as an argument does not necessarily return
 * < code > true < / code > . The < code > contains < / code > method does not
 * return < code > true < / code > for points on the right or bottom
 * edges of a rectangle . Therefore , if the added point falls on
 * the left or bottom edge of the enlarged rectangle ,
 * < code > contains < / code > returns < code > false < / code > for that point .
 * @ param newx the X coordinate of the new point
 * @ param newy the Y coordinate of the new point
 * @ since 1.2 */
public void add ( double newx , double newy ) { } }

implementation: double x1 = Math . min ( getMinX ( ) , newx ) ; double x2 = Math . max ( getMaxX ( ) , newx ) ; double y1 = Math . min ( getMinY ( ) , newy ) ; double y2 = Math . max ( getMaxY ( ) , newy ) ; setRect ( x1 , y1 , x2 - x1 , y2 - y1 ) ;


signature:
public class ProjectionRect { /** * Intersects the pair of specified source < code > Rectangle2D < / code >
 * objects and puts the result into the specified destination
 * < code > Rectangle2D < / code > object . One of the source rectangles
 * can also be the destination to avoid creating a third Rectangle2D
 * object , but in this case the original points of this source
 * rectangle will be overwritten by this method .
 * @ param src1 the first of a pair of < code > Rectangle2D < / code >
 * objects to be intersected with each other
 * @ param src2 the second of a pair of < code > Rectangle2D < / code >
 * objects to be intersected with each other
 * @ param dest the < code > Rectangle2D < / code > that holds the
 * results of the intersection of < code > src1 < / code > and
 * < code > src2 < / code >
 * @ since 1.2 */
public static void intersect ( ProjectionRect src1 , ProjectionRect src2 , ProjectionRect dest ) { } }

implementation: double x1 = Math . max ( src1 . getMinX ( ) , src2 . getMinX ( ) ) ; double y1 = Math . max ( src1 . getMinY ( ) , src2 . getMinY ( ) ) ; double x2 = Math . min ( src1 . getMaxX ( ) , src2 . getMaxX ( ) ) ; double y2 = Math . min ( src1 . getMaxY ( ) , src2 . getMaxY ( ) ) ; dest . setRect ( x1 , y1 , x2 - x1 , y2 - y1 ) ;


signature:
public class ProjectionRect { /** * Returns { @ code true } if this bounding box contains { @ code point } .
 * @ param point a point in projection coordinates .
 * @ return { @ code true } if this bounding box contains { @ code point } . */
public boolean contains ( ProjectionPoint point ) { } }

implementation: return DoubleMath . fuzzyCompare ( point . getX ( ) , getMinX ( ) , 1e-6 ) >= 0 && DoubleMath . fuzzyCompare ( point . getX ( ) , getMaxX ( ) , 1e-6 ) <= 0 && DoubleMath . fuzzyCompare ( point . getY ( ) , getMinY ( ) , 1e-6 ) >= 0 && DoubleMath . fuzzyCompare ( point . getY ( ) , getMaxY ( ) , 1e-6 ) <= 0 ;


signature:
public class ProjectionRect { /** * Read the object from the input stream of the serialized object
 * @ param s stream to read
 * @ throws ClassNotFoundException couldn ' t file the class
 * @ throws IOException Problem reading from stream */
private void readObject ( ObjectInputStream s ) throws IOException , ClassNotFoundException { } }

implementation: double x = s . readDouble ( ) ; double y = s . readDouble ( ) ; double w = s . readDouble ( ) ; double h = s . readDouble ( ) ; setRect ( x , y , w , h ) ;


signature:
public class ProjectionRect { /** * Wrtie the object to the output stream
 * @ param s stream to write
 * @ throws IOException Problem writing to stream */
private void writeObject ( ObjectOutputStream s ) throws IOException { } }

implementation: s . writeDouble ( getX ( ) ) ; s . writeDouble ( getY ( ) ) ; s . writeDouble ( getWidth ( ) ) ; s . writeDouble ( getHeight ( ) ) ;


signature:
public class ProjectionRect { /** * Returns { @ code true } if this rectangle is nearly equal to { @ code other } . The " near equality " of corners is
 * determined using { @ link ProjectionPoint # nearlyEquals ( ProjectionPoint , double ) } , with the specified maxRelDiff .
 * @ param other the other rectangle to check .
 * @ param maxRelDiff the maximum { @ link Misc # relativeDifference relative difference } that two corners may have .
 * @ return { @ code true } if this rectangle is nearly equal to { @ code other } . */
public boolean nearlyEquals ( ProjectionRect other , double maxRelDiff ) { } }

implementation: return this . getLowerLeftPoint ( ) . nearlyEquals ( other . getLowerLeftPoint ( ) , maxRelDiff ) && this . getUpperRightPoint ( ) . nearlyEquals ( other . getUpperRightPoint ( ) , maxRelDiff ) ;


signature:
public class UnitDBImpl { /** * Adds all the entries in another UnitDBImpl to this database .
 * @ param that
 * The other UnitDBImpl .
 * @ throws UnitExistsException
 * Attempt to redefine an existing entry . */
public void add ( final UnitDBImpl that ) throws UnitExistsException { } }

implementation: unitSet . addAll ( that . unitSet ) ; nameMap . putAll ( that . nameMap ) ; symbolMap . putAll ( that . symbolMap ) ;


signature:
public class UnitDBImpl { /** * Adds a unit to the database .
 * @ param unit
 * The unit to be added .
 * @ throws UnitExistsException
 * Another unit with the same name or symbol already exists in
 * the database .
 * @ throws NameException
 * Bad unit name . */
public void addUnit ( final Unit unit ) throws UnitExistsException , NameException { } }

implementation: if ( unit . getName ( ) == null ) { throw new NameException ( "Unit name can't be null" ) ; } addByName ( unit . getName ( ) , unit ) ; addByName ( unit . getPlural ( ) , unit ) ; addBySymbol ( unit . getSymbol ( ) , unit ) ; unitSet . add ( unit ) ;


signature:
public class UnitDBImpl { /** * Adds an alias for a unit already in the database .
 * @ param alias
 * An alias for the unit .
 * @ param name
 * The name of the unit already in the database .
 * @ throws UnitExistsException
 * Another unit with the same name or symbol already exists in
 * the database .
 * @ throws NoSuchUnitException
 * The unit isn ' t in the database . */
public final void addAlias ( final String alias , final String name ) throws NoSuchUnitException , UnitExistsException { } }

implementation: addAlias ( alias , name , null ) ;


signature:
public class UnitDBImpl { /** * Adds a symbol for a unit already in the database .
 * @ param symbol
 * The symbol for the unit .
 * @ param name
 * The name of the unit already in the database .
 * @ throws UnitExistsException
 * Another unit with the same name or symbol already exists in
 * the database .
 * @ throws NoSuchUnitException
 * The unit isn ' t in the database . */
public final void addSymbol ( final String symbol , final String name ) throws NoSuchUnitException , UnitExistsException { } }

implementation: addAlias ( null , name , symbol , null ) ;


signature:
public class UnitDBImpl { /** * Adds an alias for a unit already in the database .
 * @ param alias
 * The alias to be added to the database . May be null .
 * @ param name
 * The name of the unit to have an alias added to the database .
 * @ param symbol
 * The symbol to be added . May be null .
 * @ param plural
 * The plural form of the alias . If < code > null
 * < / code > , then regular
 * plural - forming rules are followed .
 * @ throws NoSuchUnitException
 * The unit is not in the database .
 * @ throws UnitExistsException
 * Another unit with the same alias is already in the database . */
public final void addAlias ( final String alias , final String name , final String symbol , final String plural ) throws NoSuchUnitException , UnitExistsException { } }

implementation: addAlias ( UnitID . newUnitID ( alias , plural , symbol ) , name ) ;


signature:
public class UnitDBImpl { /** * Adds an alias for a unit already in the database .
 * @ param alias
 * The alias to be added to the database .
 * @ param name
 * The name of the unit to have an alias added to the database .
 * @ throws NoSuchUnitException
 * The unit is not in the database .
 * @ throws UnitExistsException
 * Another unit with the same alias is already in the database . */
public final void addAlias ( final UnitID alias , final String name ) throws NoSuchUnitException , UnitExistsException { } }

implementation: final Unit unit = getByName ( name ) ; if ( unit == null ) { throw new NoSuchUnitException ( name ) ; } addByName ( alias . getName ( ) , unit ) ; addByName ( alias . getPlural ( ) , unit ) ; addBySymbol ( alias . getSymbol ( ) , unit ) ;


signature:
public class UnitDBImpl { /** * Gets a unit by either name , plural , or symbol . Retrieving the unit by
 * symbol is attempted before retrieving the unit by name because symbol
 * comparisons are case sensitive and , hence , should be more robust .
 * @ param id
 * The id to be matched .
 * @ return The unit whose name , plural , or symbol matches or
 * < code > null < / code > if no such unit was found . */
public Unit get ( final String id ) { } }

implementation: Unit unit = getBySymbol ( id ) ; if ( unit == null ) { unit = getByName ( id ) ; } return unit ;


signature:
public class UnitDBImpl { /** * Adds a unit to the database by name .
 * @ param name
 * The name of the unit . If < code > null < / code > then the unit is
 * not added .
 * @ param newUnit
 * The unit to be added .
 * @ throws UnitExistsException
 * Attempt to redefine an existing unit . */
private final void addByName ( final String name , final Unit newUnit ) throws UnitExistsException { } }

implementation: if ( name != null ) { addUnique ( nameMap , canonicalize ( name ) , newUnit ) ; }


signature:
public class UnitDBImpl { /** * Adds a unit to the database by symbol .
 * @ param symbol
 * The symbol for the unit . If < code > null < / code > then the unit is
 * not added .
 * @ param newUnit
 * The unit to be added .
 * @ throws UnitExistsException
 * Attempt to redefine an existing unit . */
private final void addBySymbol ( final String symbol , final Unit newUnit ) throws UnitExistsException { } }

implementation: if ( symbol != null ) { addUnique ( symbolMap , symbol , newUnit ) ; }


signature:
public class UnitDBImpl { /** * Adds a unique unit to a map . .
 * @ param map
 * The map to be added to .
 * @ param key
 * The key for the unit entry .
 * @ param newUnit
 * The unit to be added .
 * @ throws UnitExistsException
 * Attempt to redefine an existing unit . */
private static final void addUnique ( final Map < String , Unit > map , final String key , final Unit newUnit ) throws UnitExistsException { } }

implementation: final Unit oldUnit = map . put ( key , newUnit ) ; if ( oldUnit != null && ! oldUnit . equals ( newUnit ) ) { throw new UnitExistsException ( oldUnit , newUnit ) ; }


signature: public class FrontPage { protected void buildFileList ( Root rootinfo ) throws DapException { } }

implementation:
File root = new File ( rootinfo . getFullPath ( ) ) ; if ( ! root . isDirectory ( ) ) throw new DapException ( "FrontPage: specified root directory is not a directory: " + rootinfo . getFullPath ( ) ) ; if ( ! root . canRead ( ) ) throw new DapException ( "FrontPage: specified root directory is not readable: " + rootinfo . getFullPath ( ) ) ; // take files from set of files immediately under root
File [ ] candidates = root . listFiles ( ) ; List < FileSource > activesources = new ArrayList < FileSource > ( ) ; // Capture lists of files for each FileSource
for ( FileSource src : SOURCES ) { List < File > matches = new ArrayList < File > ( ) ; for ( File candidate : candidates ) { String name = candidate . getName ( ) ; boolean excluded = false ; for ( String exclude : expatterns ) { if ( name . indexOf ( exclude ) >= 0 ) { excluded = true ; break ; } } if ( excluded ) continue ; if ( ! name . endsWith ( src . ext ) ) continue ; if ( ! candidate . canRead ( ) ) { DapLog . info ( "FrontPage: file not readable: " + candidate ) ; continue ; } matches . add ( candidate ) ; } if ( matches . size ( ) > 0 ) { // Sort the set of files
matches . sort ( new Comparator < File > ( ) { public int compare ( File f1 , File f2 ) { return f1 . getName ( ) . compareTo ( f2 . getName ( ) ) ; } } ) ; if ( DUMPFILELIST ) { for ( File x : matches ) { System . err . printf ( "file: %s/%s%n" , rootinfo . prefix , x . getName ( ) ) ; } } FileSource clone = new FileSource ( src . ext , src . tag ) ; clone . files = matches ; activesources . add ( clone ) ; } } rootinfo . setFiles ( activesources ) ;


signature:
public class PLAF { /** * Add a set of MenuItems to the given JMenu , one for each possible L & F .
 * if this platform doesnt support the L & F , disable the MenuItem . */
public void addToMenu ( final JMenu menu ) { } }

implementation: final UIManager . LookAndFeelInfo [ ] plafInfo = UIManager . getInstalledLookAndFeels ( ) ; for ( UIManager . LookAndFeelInfo aPlafInfo : plafInfo ) { addToMenu ( aPlafInfo . getName ( ) , aPlafInfo . getClassName ( ) , menu ) ; } final LookAndFeel current = UIManager . getLookAndFeel ( ) ; System . out . printf ( "current L&F=%s%n" , current . getName ( ) ) ;


signature:
public class dasTools { /** * / * C + + implementation
 * static bool
 * name _ is _ global ( string & name )
 * static Regex global ( " \ \ ( . * global . * \ \ ) \ \ | \ \ ( . * opendap . * \ \ ) " , 1 ) ;
 * downcase ( name ) ;
 * return global . match ( name . c _ str ( ) , name . length ( ) ) ! = - 1; */
public static boolean nameIsGlobal ( String name ) { } }

implementation:
String lcName = name . toLowerCase ( ) ; boolean global = false ; if ( lcName . indexOf ( "global" ) >= 0 ) global = true ; if ( lcName . indexOf ( "dods" ) >= 0 ) global = true ; // System . out . println ( " nameIsGlobal ( ) : " + global ) ;
return ( global ) ;


signature: public class dasTools { public static String fancyTypeName ( BaseType bt ) { } }

implementation: if ( bt instanceof DByte ) return ( "8 bit Byte" ) ; if ( bt instanceof DUInt16 ) return ( "16 bit Unsigned Integer" ) ; if ( bt instanceof DInt16 ) return ( "16 bit Integer" ) ; if ( bt instanceof DUInt32 ) return ( "32 bit Unsigned Integer" ) ; if ( bt instanceof DInt32 ) return ( "32 bit Integer" ) ; if ( bt instanceof DFloat32 ) return ( "32 bit Real" ) ; if ( bt instanceof DFloat64 ) return ( "64 bit Real" ) ; if ( bt instanceof DURL ) return ( "URL" ) ; if ( bt instanceof DString ) return ( "String" ) ; if ( bt instanceof DArray ) { DArray a = ( DArray ) bt ; StringBuilder type = new StringBuilder ( ) ; type . append ( "Array of " ) ; type . append ( fancyTypeName ( a . getPrimitiveVector ( ) . getTemplate ( ) ) ) ; type . append ( "s " ) ; Enumeration e = a . getDimensions ( ) ; while ( e . hasMoreElements ( ) ) { DArrayDimension dad = ( DArrayDimension ) e . nextElement ( ) ; type . append ( "[" ) ; type . append ( dad . getEncodedName ( ) ) ; type . append ( " = 0.." ) ; type . append ( dad . getSize ( ) - 1 ) ; type . append ( "]" ) ; } type . append ( "\n" ) ; return ( type . toString ( ) ) ; } if ( bt instanceof DStructure ) return ( "Structure" ) ; if ( bt instanceof DSequence ) return ( "Sequence" ) ; if ( bt instanceof DGrid ) return ( "Grid" ) ; return ( "UNKNOWN" ) ;


signature:
public class Grib2RecordScanner { /** * tricky bit of business . recapture the entire record based on drs position .
 * for validation .
 * @ param raf from this RandomAccessFile
 * @ param drsPos Grib2SectionDataRepresentation starts here */
@ Nullable public static Grib2Record findRecordByDrspos ( RandomAccessFile raf , long drsPos ) throws IOException { } }

implementation:
long pos = Math . max ( 0 , drsPos - ( 20 * 1000 ) ) ; // go back 20K
Grib2RecordScanner scan = new Grib2RecordScanner ( raf , pos ) ; while ( scan . hasNext ( ) ) { ucar . nc2 . grib . grib2 . Grib2Record gr = scan . next ( ) ; Grib2SectionDataRepresentation drs = gr . getDataRepresentationSection ( ) ; if ( drsPos == drs . getStartingPosition ( ) ) return gr ; if ( raf . getFilePointer ( ) > drsPos ) break ; // missed it .
} return null ;


signature:
public class Grib2RecordScanner { /** * side effect is that the new record is in repeatRecord */
private boolean nextRepeating ( ) throws IOException { } }

implementation:
raf . seek ( repeatPos ) ; GribNumbers . int4 ( raf ) ; // skip octets 1-4
int section = raf . read ( ) ; // find out what section this is
raf . seek ( repeatPos ) ; // back to beginning of section
if ( section == 2 ) { repeatRecord . setLus ( new Grib2SectionLocalUse ( raf ) ) ; repeatRecord . setGdss ( new Grib2SectionGridDefinition ( raf ) ) ; repeatRecord . setPdss ( new Grib2SectionProductDefinition ( raf ) ) ; repeatRecord . setDrs ( new Grib2SectionDataRepresentation ( raf ) ) ; repeatRecord . setBms ( new Grib2SectionBitMap ( raf ) , false ) ; repeatRecord . setDataSection ( new Grib2SectionData ( raf ) ) ; repeatRecord . repeat = section ; } else if ( section == 3 ) { repeatRecord . setGdss ( new Grib2SectionGridDefinition ( raf ) ) ; repeatRecord . setPdss ( new Grib2SectionProductDefinition ( raf ) ) ; repeatRecord . setDrs ( new Grib2SectionDataRepresentation ( raf ) ) ; repeatRecord . setBms ( new Grib2SectionBitMap ( raf ) , false ) ; repeatRecord . setDataSection ( new Grib2SectionData ( raf ) ) ; repeatRecord . repeat = section ; } else if ( section == 4 ) { repeatRecord . setPdss ( new Grib2SectionProductDefinition ( raf ) ) ; repeatRecord . setDrs ( new Grib2SectionDataRepresentation ( raf ) ) ; repeatRecord . setBms ( new Grib2SectionBitMap ( raf ) , false ) ; repeatRecord . setDataSection ( new Grib2SectionData ( raf ) ) ; repeatRecord . repeat = section ; } else { if ( debugRepeat ) logger . debug ( " REPEAT Terminate %d%n" , section ) ; lastPos = repeatPos ; // start next scan from here
repeatPos = - 1 ; repeatRecord = null ; repeatBms = null ; return false ; } // look for repeating bms
Grib2SectionBitMap bms = repeatRecord . getBitmapSection ( ) ; if ( bms . getBitMapIndicator ( ) == 254 ) { // replace BMS with last good one
if ( repeatBms == null ) throw new IllegalStateException ( "No bms in repeating section" ) ; repeatRecord . setBms ( repeatBms , true ) ; // debug
if ( debugRepeat ) logger . debug ( "replaced bms %d%n" , section ) ; repeatRecord . repeat += 1000 ; } else if ( bms . getBitMapIndicator ( ) == 0 ) { // track last good bms
repeatBms = repeatRecord . getBitmapSection ( ) ; } // keep only unique gds
if ( ( section == 2 ) || ( section == 3 ) ) { // look for duplicate gds
Grib2SectionGridDefinition gds = repeatRecord . getGDSsection ( ) ; long crc = gds . calcCRC ( ) ; Grib2SectionGridDefinition gdsCached = gdsMap . get ( crc ) ; if ( gdsCached != null ) repeatRecord . setGdss ( gdsCached ) ; else gdsMap . put ( crc , gds ) ; } // check to see if we are at the end
long pos = raf . getFilePointer ( ) ; long ending = repeatRecord . getIs ( ) . getEndPos ( ) ; if ( pos + 34 < ending ) { // give it 30 bytes of slop
if ( debugRepeat ) logger . debug ( " REPEAT AGAIN %d != %d%n" , pos + 4 , ending ) ; repeatPos = pos ; return true ; } if ( debug ) logger . debug ( " REPEAT read until %d grib ending at %d header ='%s'%n" , raf . getFilePointer ( ) , ending , StringUtil2 . cleanup ( header ) ) ; // check that end section is correct
raf . seek ( ending - 4 ) ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( raf . read ( ) != 55 ) { String clean = StringUtil2 . cleanup ( header ) ; if ( clean . length ( ) > 40 ) clean = clean . substring ( 0 , 40 ) + "..." ; logger . warn ( "  REPEAT Missing End of GRIB message at pos=" + ending + " header= " + clean + " for=" + raf . getLocation ( ) ) ; break ; } } lastPos = raf . getFilePointer ( ) ; if ( debugRepeat ) logger . debug ( " REPEAT DONE%n" ) ; repeatPos = - 1 ; // no more repeats in this record
return true ;


signature:
public class NcSDStructure { /** * called if its scalar */
public boolean read ( String datasetName , Object specialO ) throws NoSuchVariableException , IOException { } }

implementation:
// read the scalar structure into memory
StructureData sdata = ncVar . readStructure ( ) ; setData ( sdata ) ; return ( false ) ;


signature:
public class NcSDStructure { /** * LOOK - should modify to use hasNetcdf . setData ( StructureData ) for efficiency */
public void setData ( StructureData sdata ) { } }

implementation:
int count = 0 ; StructureMembers sm = sdata . getStructureMembers ( ) ; java . util . Enumeration vars = getVariables ( ) ; while ( vars . hasMoreElements ( ) ) { // loop through both structures
HasNetcdfVariable hasNetcdf = ( HasNetcdfVariable ) vars . nextElement ( ) ; StructureMembers . Member m = sm . getMember ( count ++ ) ; // extract the data and set it into the dods object
Array data = sdata . getArray ( m ) ; hasNetcdf . setData ( data ) ; } setRead ( true ) ;


signature:
public class NcSDStructure { /** * overrride for array of Structures */
public void serialize ( String dataset , DataOutputStream sink , CEEvaluator ce , Object specialO ) throws NoSuchVariableException , DAP2ServerSideException , IOException { } }

implementation:
if ( org == null ) { super . serialize ( dataset , sink , ce , specialO ) ; return ; } // use the projection info in the original
java . util . Enumeration vars = org . getVariables ( ) ; // run through each structure member
StructureMembers sm = sdata . getStructureMembers ( ) ; int count = 0 ; while ( vars . hasMoreElements ( ) ) { HasNetcdfVariable sm_org = ( HasNetcdfVariable ) vars . nextElement ( ) ; boolean isProjected = ( ( ServerMethods ) sm_org ) . isProject ( ) ; if ( isProjected ) { StructureMembers . Member m = sm . getMember ( count ) ; sm_org . serialize ( sink , sdata , m ) ; } count ++ ; }


signature:
public class DoradePARM { /** * Get the unpacked data values for a selected parameter .
 * @ param rdat the name of the desired parameter
 * @ param workingArray If non - null and the same length as needed then use this .
 * @ return the unpacked data values for all cells , using BAD _ VALUE
 * for bad data cells
 * @ throws DescriptorException */
public float [ ] getParamValues ( DoradeRDAT rdat , float [ ] workingArray ) throws DescriptorException { } }

implementation: if ( ! paramName . equals ( rdat . getParamName ( ) ) ) throw new DescriptorException ( "parameter name mismatch" ) ; byte [ ] paramData = rdat . getRawData ( ) ; int nCells = myRADD . getNCells ( ) ; float [ ] values ; if ( workingArray != null && workingArray . length == nCells ) { values = workingArray ; } else { values = new float [ nCells ] ; } short [ ] svalues = null ; if ( myRADD . getCompressionScheme ( ) == DoradeRADD . COMPRESSION_HRD ) { if ( binaryFormat != DoradePARM . FORMAT_16BIT_INT ) { throw new DescriptorException ( "Cannot unpack " + "compressed data with binary format " + binaryFormat ) ; } svalues = uncompressHRD ( paramData , nCells ) ; } for ( int cell = 0 ; cell < nCells ; cell ++ ) { switch ( binaryFormat ) { case DoradePARM . FORMAT_8BIT_INT : byte bval = paramData [ cell ] ; values [ cell ] = ( bval == badDataFlag ) ? BAD_VALUE : ( bval - bias ) / scale ; break ; case DoradePARM . FORMAT_16BIT_INT : short sval = ( svalues != null ) ? svalues [ cell ] : grabShort ( paramData , 2 * cell ) ; values [ cell ] = ( sval == badDataFlag ) ? BAD_VALUE : ( sval - bias ) / scale ; break ; case DoradePARM . FORMAT_32BIT_INT : int ival = grabInt ( paramData , 4 * cell ) ; values [ cell ] = ( ival == badDataFlag ) ? BAD_VALUE : ( ival - bias ) / scale ; break ; case DoradePARM . FORMAT_32BIT_FLOAT : float fval = grabFloat ( paramData , 4 * cell ) ; values [ cell ] = ( fval == badDataFlag ) ? BAD_VALUE : ( fval - bias ) / scale ; break ; case DoradePARM . FORMAT_16BIT_FLOAT : throw new DescriptorException ( "can't unpack 16-bit " + "float data yet" ) ; default : throw new DescriptorException ( "bad binary format (" + binaryFormat + ")" ) ; } } return values ;


signature:
public class DoradePARM { /** * Unpack MIT / HRD - compressed data into an array of exactly nCells shorts .
 * @ param compressedData the raw HRD - compressed data array
 * @ return an array of nCells unpacked short values
 * @ throws DescriptorException */
private short [ ] uncompressHRD ( byte [ ] compressedData , int nCells ) throws DescriptorException { } }

implementation:
short [ ] svalues = new short [ nCells ] ; int cPos = 0 ; // position in the compressed data , in bytes
int nextCell = 0 ; int runLength ; for ( ; ; nextCell += runLength ) { // Each run begins with a 16 - bin run descriptor . The
// high order bit is set if the run consists of bad flags .
// The remaining 15 bits tell the length of the run .
// A run length of 1 indicates the end of compressed data .
short runDescriptor = grabShort ( compressedData , cPos ) ; cPos += 2 ; boolean runHasGoodValues = ( ( runDescriptor & 0x8000 ) != 0 ) ; runLength = runDescriptor & 0x7fff ; if ( runLength == 1 ) break ; // Sanity check on run length
if ( ( nextCell + runLength ) > nCells ) throw new DescriptorException ( "attempt to unpack " + "too many cells" ) ; // If the run contains good values , then the next runLength
// values in the compressed data stream are real values . Otherwise
// we need to fill with runLength bad value flags .
for ( int cell = nextCell ; cell < nextCell + runLength ; cell ++ ) { if ( runHasGoodValues ) { svalues [ cell ] = grabShort ( compressedData , cPos ) ; cPos += 2 ; } else { svalues [ cell ] = ( short ) badDataFlag ; } } } // Fill the remainder of the array ( if any ) with bad value flags
for ( int cell = nextCell ; cell < nCells ; cell ++ ) svalues [ cell ] = ( short ) badDataFlag ; return svalues ;


signature:
public class VerticalPerspectiveView { /** * " map limit " circle of this radius from the origin , p 173 */
@ Override public ProjectionImpl constructCopy ( ) { } }

implementation: ProjectionImpl result = new VerticalPerspectiveView ( getOriginLat ( ) , getOriginLon ( ) , R , getHeight ( ) , false_east , false_north ) ; result . setDefaultMapArea ( defaultMapArea ) ; result . setName ( name ) ; return result ;


signature:
public class VerticalPerspectiveView { /** * Precalculate some stuff */
private void precalculate ( ) { } }

implementation:
sinLat0 = Math . sin ( lat0 ) ; cosLat0 = Math . cos ( lat0 ) ; lon0Degrees = Math . toDegrees ( lon0 ) ; P = 1.0 + H / R ; // " map limit " circle of this radius from the origin , p 173
maxR = .99 * R * Math . sqrt ( ( P - 1 ) / ( P + 1 ) ) ;


signature:
public class VerticalPerspectiveView { /** * Convert a LatLonPoint to projection coordinates
 * @ param latLon convert from these lat , lon coordinates
 * @ param result the object to write to
 * @ return the given result */
public ProjectionPoint latLonToProj ( LatLonPoint latLon , ProjectionPointImpl result ) { } }

implementation: double toX , toY ; double fromLat = latLon . getLatitude ( ) ; double fromLon = latLon . getLongitude ( ) ; fromLat = Math . toRadians ( fromLat ) ; double lonDiff = Math . toRadians ( LatLonPointImpl . lonNormal ( fromLon - lon0Degrees ) ) ; double cosc = sinLat0 * Math . sin ( fromLat ) + cosLat0 * Math . cos ( fromLat ) * Math . cos ( lonDiff ) ; double ksp = ( P - 1.0 ) / ( P - cosc ) ; if ( cosc < 1.0 / P ) { toX = Double . POSITIVE_INFINITY ; toY = Double . POSITIVE_INFINITY ; } else { toX = false_east + R * ksp * Math . cos ( fromLat ) * Math . sin ( lonDiff ) ; toY = false_north + R * ksp * ( cosLat0 * Math . sin ( fromLat ) - sinLat0 * Math . cos ( fromLat ) * Math . cos ( lonDiff ) ) ; } result . setLocation ( toX , toY ) ; return result ;


signature:
public class VerticalPerspectiveView { /** * Convert projection coordinates to a LatLonPoint
 * Note : a new object is not created on each call for the return value .
 * @ param world convert from these projection coordinates
 * @ param result the object to write to
 * @ return LatLonPoint convert to these lat / lon coordinates */
public LatLonPoint projToLatLon ( ProjectionPoint world , LatLonPointImpl result ) { } }

implementation:
double toLat , toLon ; double fromX = world . getX ( ) ; double fromY = world . getY ( ) ; fromX = fromX - false_east ; fromY = fromY - false_north ; double rho = Math . sqrt ( fromX * fromX + fromY * fromY ) ; double r = rho / R ; double con = P - 1.0 ; double com = P + 1.0 ; double c = Math . asin ( ( P - Math . sqrt ( 1.0 - ( r * r * com ) / con ) ) / ( con / r + r / con ) ) ; toLon = lon0 ; double temp = 0 ; if ( Math . abs ( rho ) > TOLERANCE ) { toLat = Math . asin ( Math . cos ( c ) * sinLat0 + ( fromY * Math . sin ( c ) * cosLat0 / rho ) ) ; if ( Math . abs ( lat0 - PI_OVER_4 ) > TOLERANCE ) { // not 90 or - 90
temp = rho * cosLat0 * Math . cos ( c ) - fromY * sinLat0 * Math . sin ( c ) ; toLon = lon0 + Math . atan ( fromX * Math . sin ( c ) / temp ) ; } else if ( Double . compare ( lat0 , PI_OVER_4 ) == 0 ) { toLon = lon0 + Math . atan ( fromX / - fromY ) ; temp = - fromY ; } else { toLon = lon0 + Math . atan ( fromX / fromY ) ; temp = fromY ; } } else { toLat = lat0 ; } toLat = Math . toDegrees ( toLat ) ; toLon = Math . toDegrees ( toLon ) ; if ( temp < 0 ) { toLon += 180 ; } toLon = LatLonPointImpl . lonNormal ( toLon ) ; result . setLatitude ( toLat ) ; result . setLongitude ( toLon ) ; return result ;


signature:
public class VerticalPerspectiveView { /** * Convert lat / lon coordinates to projection coordinates .
 * @ param from array of lat / lon coordinates : from [ 2 ] [ n ] ,
 * where from [ 0 ] [ i ] , from [ 1 ] [ i ] is the ( lat , lon )
 * coordinate of the ith point
 * @ param to resulting array of projection coordinates ,
 * where to [ 0 ] [ i ] , to [ 1 ] [ i ] is the ( x , y ) coordinate
 * of the ith point
 * @ param latIndex index of latitude in " from "
 * @ param lonIndex index of longitude in " from "
 * @ return the " to " array . */
public float [ ] [ ] latLonToProj ( float [ ] [ ] from , float [ ] [ ] to , int latIndex , int lonIndex ) { } }

implementation: int cnt = from [ 0 ] . length ; float [ ] fromLatA = from [ latIndex ] ; float [ ] fromLonA = from [ lonIndex ] ; float [ ] resultXA = to [ INDEX_X ] ; float [ ] resultYA = to [ INDEX_Y ] ; double toX , toY ; for ( int i = 0 ; i < cnt ; i ++ ) { double fromLat = fromLatA [ i ] ; double fromLon = fromLonA [ i ] ; fromLat = Math . toRadians ( fromLat ) ; double lonDiff = Math . toRadians ( LatLonPointImpl . lonNormal ( fromLon - lon0Degrees ) ) ; double cosc = sinLat0 * Math . sin ( fromLat ) + cosLat0 * Math . cos ( fromLat ) * Math . cos ( lonDiff ) ; double ksp = ( P - 1.0 ) / ( P - cosc ) ; if ( cosc < 1.0 / P ) { toX = Double . POSITIVE_INFINITY ; toY = Double . POSITIVE_INFINITY ; } else { toX = false_east + R * ksp * Math . cos ( fromLat ) * Math . sin ( lonDiff ) ; toY = false_north + R * ksp * ( cosLat0 * Math . sin ( fromLat ) - sinLat0 * Math . cos ( fromLat ) * Math . cos ( lonDiff ) ) ; } resultXA [ i ] = ( float ) toX ; resultYA [ i ] = ( float ) toY ; } return to ;


signature:
public class WmoTemplateTables { /** * < GRIB2_22_0_0 _ Template _ en >
 * < No > 1451 < / No >
 * < Title _ en > Product definition template 4.55 - spatio - temporal changing tiles at a horizontal level or horizontal layer at a point in time < / Title _ en >
 * < OctetNo > 35 < / OctetNo >
 * < Contents _ en > Type of second fixed surface < / Contents _ en >
 * < Note _ en > ( see Code table 4.5 ) < / Note _ en >
 * < Status > Operational < / Status >
 * < / GRIB2_22_0_0 _ Template _ en > */
private void readXml ( Version version ) throws IOException { } }

implementation:
try ( InputStream ios = WmoTemplateTables . class . getResourceAsStream ( version . getResourceName ( ) ) ) { if ( ios == null ) { throw new IOException ( "cant open TemplateTable %s " + version . getResourceName ( ) ) ; } org . jdom2 . Document doc ; try { SAXBuilder builder = new SAXBuilder ( ) ; doc = builder . build ( ios ) ; } catch ( JDOMException e ) { throw new IOException ( e . getMessage ( ) ) ; } Map < String , TemplateTable > map = new HashMap < > ( ) ; String [ ] elems = version . getElemNames ( ) ; assert elems != null ; assert elems . length > 3 ; Element root = doc . getRootElement ( ) ; List < Element > featList = root . getChildren ( elems [ 0 ] ) ; // 0 = main element
for ( Element elem : featList ) { String desc = elem . getChildTextNormalize ( elems [ 1 ] ) ; // 1 = title
String octet = elem . getChildTextNormalize ( "OctetNo" ) ; String content = elem . getChildTextNormalize ( elems [ 3 ] ) ; // 3 = content
String status = elem . getChildTextNormalize ( "Status" ) ; String note = elem . getChildTextNormalize ( elems [ 2 ] ) ; // 2 = = note
TemplateTable template = map . computeIfAbsent ( desc , name -> new TemplateTable ( name ) ) ; template . add ( octet , content , status , note ) ; } ios . close ( ) ; List < TemplateTable > tlist = new ArrayList < > ( map . values ( ) ) ; for ( TemplateTable t : tlist ) { if ( t . m1 == 3 ) { t . add ( 1 , 4 , "GDS length" ) ; t . add ( 5 , 1 , "Section" ) ; t . add ( 6 , 1 , "Source of Grid Definition (see code table 3.0)" ) ; t . add ( 7 , 4 , "Number of data points" ) ; t . add ( 11 , 1 , "Number of octects for optional list of numbers" ) ; t . add ( 12 , 1 , "Interpretation of list of numbers" ) ; t . add ( 13 , 2 , "Grid Definition Template Number" ) ; } else if ( t . m1 == 4 ) { t . add ( 1 , 4 , "PDS length" ) ; t . add ( 5 , 1 , "Section" ) ; t . add ( 6 , 2 , "Number of coordinates values after Template" ) ; t . add ( 8 , 2 , "Product Definition Template Number" ) ; } Collections . sort ( t . flds ) ; } this . templateTables = map . values ( ) . stream ( ) . sorted ( ) . collect ( ImmutableList . toImmutableList ( ) ) ; ImmutableMap . Builder < String , TemplateTable > builder = ImmutableMap . builder ( ) ; map . values ( ) . forEach ( t -> builder . put ( t . getId ( ) , t ) ) ; this . templateMap = builder . build ( ) ; }


signature:
public class PointRenderer { /** * Find station that contains this point . If it exists , make it the
 * " selected " station .
 * @ param pickPt : world coordinates
 * @ return station that contains this point , or null if none .
 * public PointObsDatatype pick ( Point2D pickPt ) {
 * if ( world2Normal = = null | | pickPt = = null | | obsUIlist . isEmpty ( ) ) return null ;
 * world2Normal . transform ( pickPt , ptN ) ; / / work in normalized coordinate space
 * ObservationUI closest = ( ObservationUI ) stationGrid . findIntersection ( ptN ) ;
 * setSelectedStation ( closest ) ;
 * return getSelectedStation ( ) ;
 * Find station closest to this point . Make it the " selected " station .
 * @ param pickPt : world coordinates
 * @ return station that contains this point , or null if none .
 * public PointObsDatatype pickClosest ( Point2D pickPt ) {
 * if ( world2Normal = = null | | pickPt = = null | | obsUIlist . isEmpty ( ) ) return null ;
 * world2Normal . transform ( pickPt , ptN ) ; / / work in normalized coordinate space
 * ObservationUI closest = ( ObservationUI ) stationGrid . findClosest ( ptN ) ;
 * if ( debug ) System . out . println ( " closest = " + closest ) ;
 * setSelectedStation ( closest ) ;
 * return getSelectedStation ( ) ;
 * Get the selected station , or null .
 * public PointObsDatatype getSelectedStation ( ) {
 * return ( selected ! = null ) ? selected . getObservation ( ) : null ;
 * Is this point contained in a Station bounding box ?
 * @ param p : normalized coords .
 * @ return Station containing pt , or null .
 * public ObservationUI isOnStation ( Point p ) {
 * return ( ObservationUI ) stationGrid . findIntersection ( p ) ; */
public void draw ( java . awt . Graphics2D g , java . awt . geom . AffineTransform normal2Device ) { } }

implementation:
if ( ( project == null ) || ! posWasCalc ) return ; // use world coordinates for position , but draw in screen coordinates
// so that the symbols stay the same size
AffineTransform world2Device = g . getTransform ( ) ; g . setTransform ( normal2Device ) ; // identity transform for screen coords
// transform World to Normal coords :
// world2Normal = pixelAT - 1 * world2Device
// cache for pick closest
AffineTransform world2Normal ; try { world2Normal = normal2Device . createInverse ( ) ; world2Normal . concatenate ( world2Device ) ; } catch ( java . awt . geom . NoninvertibleTransformException e ) { System . out . println ( " RendSurfObs: NoninvertibleTransformException on " + normal2Device ) ; return ; } // we want aliasing ; but save previous state to restore at end
Object saveHint = g . getRenderingHint ( RenderingHints . KEY_ANTIALIASING ) ; // g . setRenderingHint ( RenderingHints . KEY _ ANTIALIASING ,
// RenderingHints . VALUE _ ANTIALIAS _ ON ) ;
g . setStroke ( new java . awt . BasicStroke ( 1.0f ) ) ; /* set up the grid
 Rectangle2D bbox = ( Rectangle2D ) g . getClip ( ) ; / / clipping area in normal coords
 / / clear the grid = " no stations are drawn "
 stationGrid . clear ( ) ;
 / / set the grid size based on typical bounding box
 stationGrid . setGrid ( bbox , typicalBB . getWidth ( ) , typicalBB . getHeight ( ) ) ;
 / / always draw selected
 if ( selected ! = null ) {
 selected . calcPos ( world2Normal ) ;
 stationGrid . markIfClear ( selected . getBB ( ) , selected ) ;
 selected . draw ( g ) ; */
g . setFont ( textFont . getFont ( ) ) ; g . setColor ( color ) ; int count = 0 ; int npts = obsUIlist . size ( ) ; GeneralPath path = new GeneralPath ( GeneralPath . WIND_EVEN_ODD , npts ) ; for ( int i = 0 ; i < npts ; i ++ ) { ObservationUI s = ( ObservationUI ) obsUIlist . get ( i ) ; s . calcPos ( world2Normal ) ; s . draw ( g ) ; if ( Double . isNaN ( s . screenPos . getX ( ) ) ) { System . out . println ( "screenPos=" + s . screenPos + " world = " + s . worldPos ) ; continue ; } if ( count == 0 ) path . moveTo ( ( float ) s . screenPos . getX ( ) , ( float ) s . screenPos . getY ( ) ) ; else path . lineTo ( ( float ) s . screenPos . getX ( ) , ( float ) s . screenPos . getY ( ) ) ; count ++ ; } g . setColor ( color ) ; if ( drawConnectingLine ) g . draw ( path ) ; // draw selected
if ( selected != null ) selected . draw ( g ) ; // restore
g . setTransform ( world2Device ) ; g . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , saveHint ) ;


signature:
public class ThreddsDataFactory { /** * Open a FeatureDataset from a URL location string . Example URLS : < ul >
 * < li > http : / / localhost : 8080 / test / addeStationDataset . xml # surfaceHourly
 * < li > thredds : http : / / localhost : 8080 / test / addeStationDataset . xml # surfaceHourly
 * < li > thredds : / / localhost : 8080 / test / addeStationDataset . xml # surfaceHourly
 * < li > thredds : file : c : / test / data / catalog / addeStationDataset . xml # AddeSurfaceData ( absolute file )
 * < li > thredds : resolve : resolveURL
 * < / ul >
 * @ param urlString [ thredds : ] catalog . xml # datasetId
 * @ param task may be null
 * @ return ThreddsDataFactory . Result check fatalError for validity
 * @ throws java . io . IOException on read error */
public ThreddsDataFactory . Result openFeatureDataset ( String urlString , ucar . nc2 . util . CancelTask task ) throws IOException { } }

implementation: ThreddsDataFactory . Result result = new ThreddsDataFactory . Result ( ) ; InvDataset invDataset = processLocation ( urlString , task , result ) ; if ( result . fatalError ) return result ; return openFeatureDataset ( null , invDataset , task , result ) ;


signature:
public class ThreddsDataFactory { /** * Open a FeatureDataset from an InvDataset object , deciding on which InvAccess to use .
 * @ param invDataset use this to figure out what type , how to open , etc
 * @ param task allow user to cancel ; may be null
 * @ return ThreddsDataFactory . Result check fatalError for validity
 * @ throws IOException on read error */
public ThreddsDataFactory . Result openFeatureDataset ( InvDataset invDataset , ucar . nc2 . util . CancelTask task ) throws IOException { } }

implementation: return openFeatureDataset ( null , invDataset , task , new Result ( ) ) ;


signature:
public class ThreddsDataFactory { /** * Open a FeatureDataset from an InvAccess object .
 * @ param access use this InvAccess .
 * @ param task may be null
 * @ return ThreddsDataFactory . Result check fatalError for validity
 * @ throws IOException on read error */
public ThreddsDataFactory . Result openFeatureDataset ( InvAccess access , ucar . nc2 . util . CancelTask task ) throws IOException { } }

implementation: InvDataset invDataset = access . getDataset ( ) ; ThreddsDataFactory . Result result = new Result ( ) ; if ( invDataset . getDataType ( ) == null ) { result . errLog . format ( "InvDatasert must specify a FeatureType%n" ) ; result . fatalError = true ; return result ; } return openFeatureDataset ( invDataset . getDataType ( ) , access , task , result ) ;


signature:
public class ThreddsDataFactory { /** * Try to open as a NetcdfDataset .
 * @ param invDataset open this
 * @ param acquire if true , aquire the dataset , else open it
 * @ param task may be null
 * @ param log error message , may be null
 * @ return NetcdfDataset or null if failure
 * @ throws IOException on read error */
public NetcdfDataset openDataset ( InvDataset invDataset , boolean acquire , ucar . nc2 . util . CancelTask task , Formatter log ) throws IOException { } }

implementation: Result result = new Result ( ) ; NetcdfDataset ncd = openDataset ( invDataset , acquire , task , result ) ; if ( log != null ) log . format ( "%s" , result . errLog ) ; return ( result . fatalError ) ? null : ncd ;


signature:
public class ThreddsDataFactory { /** * Find the " best " access in case theres more than one , based on what the CDM knows
 * how to open and use .
 * @ param accessList choose from this list .
 * @ return best access method . */
public InvAccess chooseDatasetAccess ( List < InvAccess > accessList ) { } }

implementation:
if ( accessList . size ( ) == 0 ) return null ; InvAccess access = null ; if ( preferAccess != null ) { for ( ServiceType type : preferAccess ) { access = findAccessByServiceType ( accessList , type ) ; if ( access != null ) break ; } } // the order indicates preference
if ( access == null ) access = findAccessByServiceType ( accessList , ServiceType . CdmRemote ) ; if ( access == null ) access = findAccessByServiceType ( accessList , ServiceType . DODS ) ; if ( access == null ) access = findAccessByServiceType ( accessList , ServiceType . OPENDAP ) ; if ( access == null ) access = findAccessByServiceType ( accessList , ServiceType . DAP4 ) ; if ( access == null ) access = findAccessByServiceType ( accessList , ServiceType . FILE ) ; // should mean that it can be opened through netcdf API
if ( access == null ) access = findAccessByServiceType ( accessList , ServiceType . NETCDF ) ; // ServiceType . NETCDF is deprecated , use FILE
// look for HTTP with format we can read
if ( access == null ) { InvAccess tryAccess = findAccessByServiceType ( accessList , ServiceType . HTTPServer ) ; if ( tryAccess == null ) tryAccess = findAccessByServiceType ( accessList , ServiceType . HTTP ) ; // ServiceType . HTTP should be HTTPServer
if ( tryAccess != null ) { DataFormatType format = tryAccess . getDataFormatType ( ) ; // these are the file types we can read
if ( ( DataFormatType . BUFR == format ) || ( DataFormatType . GINI == format ) || ( DataFormatType . GRIB1 == format ) || ( DataFormatType . GRIB2 == format ) || ( DataFormatType . HDF5 == format ) || ( DataFormatType . NCML == format ) || ( DataFormatType . NETCDF == format ) || ( DataFormatType . NEXRAD2 == format ) || ( DataFormatType . NIDS == format ) ) { access = tryAccess ; } } } // ADDE
if ( access == null ) access = findAccessByServiceType ( accessList , ServiceType . ADDE ) ; // RESOLVER
if ( access == null ) { access = findAccessByServiceType ( accessList , ServiceType . RESOLVER ) ; } return access ;


signature:
public class ThreddsDataFactory { /** * Add information from the InvDataset to the NetcdfDataset .
 * @ param ds get info from here
 * @ param ncDataset add to here */
public static void annotate ( InvDataset ds , NetcdfDataset ncDataset ) { } }

implementation:
ncDataset . setTitle ( ds . getName ( ) ) ; ncDataset . setId ( ds . getID ( ) ) ; // add properties as global attributes
for ( InvProperty p : ds . getProperties ( ) ) { String name = p . getName ( ) ; if ( null == ncDataset . findGlobalAttribute ( name ) ) { ncDataset . addAttribute ( null , new Attribute ( name , p . getValue ( ) ) ) ; } } /* ThreddsMetadata . GeospatialCoverage geoCoverage = ds . getGeospatialCoverage ( ) ;
 if ( geoCoverage ! = null ) {
 if ( null ! = geoCoverage . getNorthSouthRange ( ) ) {
 ncDataset . addAttribute ( null , new Attribute ( " geospatial _ lat _ min " , new Double ( geoCoverage . getLatSouth ( ) ) ) ) ;
 ncDataset . addAttribute ( null , new Attribute ( " geospatial _ lat _ max " , new Double ( geoCoverage . getLatNorth ( ) ) ) ) ;
 if ( null ! = geoCoverage . getEastWestRange ( ) ) {
 ncDataset . addAttribute ( null , new Attribute ( " geospatial _ lon _ min " , new Double ( geoCoverage . getLonWest ( ) ) ) ) ;
 ncDataset . addAttribute ( null , new Attribute ( " geospatial _ lon _ max " , new Double ( geoCoverage . getLonEast ( ) ) ) ) ;
 if ( null ! = geoCoverage . getUpDownRange ( ) ) {
 ncDataset . addAttribute ( null , new Attribute ( " geospatial _ vertical _ min " , new Double ( geoCoverage . getHeightStart ( ) ) ) ) ;
 ncDataset . addAttribute ( null , new Attribute ( " geospatial _ vertical _ max " , new Double ( geoCoverage . getHeightStart ( ) + geoCoverage . getHeightExtent ( ) ) ) ) ;
 DateRange timeCoverage = ds . getTimeCoverage ( ) ;
 if ( timeCoverage ! = null ) {
 ncDataset . addAttribute ( null , new Attribute ( " time _ coverage _ start " , timeCoverage . getStart ( ) . toDateTimeStringISO ( ) ) ) ;
 ncDataset . addAttribute ( null , new Attribute ( " time _ coverage _ end " , timeCoverage . getEnd ( ) . toDateTimeStringISO ( ) ) ) ; */
ncDataset . finish ( ) ;


signature:
public class ThreddsDataFactory { /** * look for an access method for an image datatype */
private InvAccess getImageAccess ( InvDataset invDataset , ucar . nc2 . util . CancelTask task , Result result ) { } }

implementation:
List < InvAccess > accessList = new ArrayList < > ( invDataset . getAccess ( ) ) ; // a list of all the accesses
while ( accessList . size ( ) > 0 ) { InvAccess access = chooseImageAccess ( accessList ) ; if ( access != null ) return access ; // next choice is resolver type .
access = invDataset . getAccess ( ServiceType . RESOLVER ) ; // no valid access
if ( access == null ) { result . errLog . format ( "No access that could be used for Image Type %s %n" , invDataset ) ; return null ; } // deal with RESOLVER type
String datasetLocation = access . getStandardUrlName ( ) ; InvDatasetImpl rds = openResolver ( datasetLocation , task , result ) ; if ( rds == null ) return null ; // use the access list from the resolved dataset
accessList = new ArrayList < > ( invDataset . getAccess ( ) ) ; } // loop over accesses
return null ;


signature:
public class ThreddsDataFactory { /** * works against the accessList instead of the dataset list , so we can remove and try again */
private InvAccess findAccessByServiceType ( List < InvAccess > accessList , ServiceType type ) { } }

implementation: for ( InvAccess a : accessList ) { if ( type . toString ( ) . equalsIgnoreCase ( a . getService ( ) . getServiceType ( ) . toString ( ) ) ) return a ; } return null ;


signature:
public class ThreddsDataFactory { /** * works against the accessList instead of the dataset list , so we can remove and try again */
private InvAccess findAccessByDataFormatType ( List < InvAccess > accessList , DataFormatType type ) { } }

implementation: for ( InvAccess a : accessList ) { if ( type . toString ( ) . equalsIgnoreCase ( a . getDataFormatType ( ) . toString ( ) ) ) return a ; } return null ;


signature:
public class Property { /** * first one override */
public static List < Property > removeDups ( List < Property > org ) { } }

implementation:
List < Property > result = new ArrayList < > ( org . size ( ) ) ; for ( Property p : org ) if ( ! result . contains ( p ) ) // O ( n * * 2)
result . add ( p ) ; return result ;


signature:
public class VariableIndexPartitioned { /** * only used by PartitionBuilder , not PartitionBuilderFromIndex */
void addPartition ( int partno , int groupno , int varno , int ndups , int nrecords , int nmissing , GribCollectionMutable . VariableIndex vi ) { } }

implementation: if ( partList == null ) partList = new ArrayList < > ( nparts ) ; partList . add ( new PartitionForVariable2D ( partno , groupno , varno ) ) ; this . ndups += ndups ; this . nrecords += nrecords ; this . nmissing += nmissing ;


signature:
public class Partition { /** * acquire or construct GribCollection - caller must call gc . close ( ) when done */
public GribCollectionImmutable getGribCollection ( ) throws IOException { } }

implementation:
String path = getIndexFilenameInCache ( ) ; if ( path == null ) { if ( Grib . debugIndexOnly ) { // we are running in debug mode where we only have the indices , not the data files
// tricky : substitute the current root
File orgParentDir = new File ( directory ) ; File currentFile = new File ( PartitionCollectionMutable . this . indexFilename ) ; File currentParent = currentFile . getParentFile ( ) ; File currentParentWithDir = new File ( currentParent , orgParentDir . getName ( ) ) ; File nestedIndex = isPartitionOfPartitions ? new File ( currentParentWithDir , filename ) : new File ( currentParent , filename ) ; // JMJ
path = nestedIndex . getPath ( ) ; } else { throw new FileNotFoundException ( "No index filename for partition= " + this . toString ( ) ) ; } } // LOOK not cached
return ( GribCollectionImmutable ) PartitionCollectionImmutable . partitionCollectionFactory . open ( new DatasetUrl ( null , path ) , - 1 , null , this ) ;


signature:
public class Partition { /** * the children must already exist */
@ Nullable public GribCollectionMutable makeGribCollection ( ) { } }

implementation: GribCollectionMutable result = GribCdmIndex . openMutableGCFromIndex ( dcm . getIndexFilename ( GribCdmIndex . NCX_SUFFIX ) , config , false , true , logger ) ; if ( result == null ) { logger . error ( "Failed on openMutableGCFromIndex {}" , dcm . getIndexFilename ( GribCdmIndex . NCX_SUFFIX ) ) ; return null ; } lastModified = result . lastModified ; fileSize = result . fileSize ; if ( result . masterRuntime != null ) partitionDate = result . masterRuntime . getFirstDate ( ) ; return result ;


signature:
public class RegExpAndDurationTimeCoverageEnhancer { /** * Factory method that returns a RegExpAndDurationTimeCoverageEnhancer instance
 * that will apply the match pattern to the dataset name .
 * @ param matchPattern a regular expression used to match against the CrawlableDataset name .
 * @ param substitutionPattern the time coverage start time ( which may contain regular expression capturing group substitution strings ) .
 * @ param duration the time coverage duration string .
 * @ return a RegExpAndDurationTimeCoverageEnhancer that will apply the match pattern to the dataset name . */
public static RegExpAndDurationTimeCoverageEnhancer getInstanceToMatchOnDatasetName ( String matchPattern , String substitutionPattern , String duration ) { } }

implementation: return new RegExpAndDurationTimeCoverageEnhancer ( matchPattern , substitutionPattern , duration , MatchTarget . DATASET_NAME ) ;


signature:
public class RegExpAndDurationTimeCoverageEnhancer { /** * Factory method that returns a RegExpAndDurationTimeCoverageEnhancer instance
 * that will apply the match pattern to the dataset path .
 * @ param matchPattern a regular expression used to match against the CrawlableDataset path .
 * @ param substitutionPattern the time coverage start time ( which may contain regular expression capturing group substitution strings ) .
 * @ param duration the time coverage duration string .
 * @ return a RegExpAndDurationTimeCoverageEnhancer that will apply the match pattern to the dataset path . */
public static RegExpAndDurationTimeCoverageEnhancer getInstanceToMatchOnDatasetPath ( String matchPattern , String substitutionPattern , String duration ) { } }

implementation: return new RegExpAndDurationTimeCoverageEnhancer ( matchPattern , substitutionPattern , duration , MatchTarget . DATASET_PATH ) ;


signature:
public class DqcFactory { /** * Create an QueryCapability from an XML document at a named URL .
 * check dqc . isValid , dqc . getErrorMessages ( ) to see if ok .
 * If Disk caching is set , cache the dqc and check IfModifiedSince .
 * @ param uriString : the URI name that the XML doc is at .
 * @ return an QueryCapability object
 * @ throws IOException on failure */
public QueryCapability readXML ( String uriString ) throws IOException { } }

implementation:
// get URI
URI uri ; try { uri = new URI ( uriString ) ; } catch ( URISyntaxException e ) { throw new MalformedURLException ( e . getMessage ( ) ) ; } // check if its cached
if ( diskCache != null ) { File file = diskCache . getCacheFile ( uriString ) ; if ( file != null ) { HttpURLConnection conn = null ; try { URL url = uri . toURL ( ) ; conn = ( HttpURLConnection ) url . openConnection ( ) ; conn . setRequestMethod ( "GET" ) ; conn . setIfModifiedSince ( file . lastModified ( ) ) ; int code = conn . getResponseCode ( ) ; if ( code == HttpURLConnection . HTTP_OK ) { java . io . InputStream is = conn . getInputStream ( ) ; if ( is != null ) { try ( FileOutputStream fout = new FileOutputStream ( file ) ) { IO . copyB ( is , fout , buffer_size ) ; // cache it
} try ( InputStream fin = new BufferedInputStream ( new FileInputStream ( file ) , 50000 ) ) { return readXML ( fin , uri ) ; } } } else { // use file
try ( FileInputStream fin = new FileInputStream ( file ) ) { return readXML ( fin , uri ) ; } } } finally { if ( conn != null ) conn . disconnect ( ) ; } } // has file
// no file - read and cache
IO . readURLtoFileWithExceptions ( uriString , file , buffer_size ) ; try ( InputStream fin = new BufferedInputStream ( new FileInputStream ( file ) , 50000 ) ) { return readXML ( fin , uri ) ; } } // has diskCache
// otherwise just open the URL
warnMessages . setLength ( 0 ) ; errMessages . setLength ( 0 ) ; fatalMessages . setLength ( 0 ) ; Document doc = null ; try { doc = builder . build ( uriString ) ; } catch ( JDOMException e ) { fatalMessages . append ( e . getMessage ( ) ) ; // makes it invalid
} return readXML ( doc , uri ) ;


signature:
public class DqcFactory { /** * Create an QueryCapability from an InputStream .
 * check dqc . isValid , dqc . getErrorMessages ( ) to see if ok .
 * @ param docIs : the InputStream to read from
 * @ param uri : the URI of the document , used for resolving reletive references .
 * @ return an QueryCapability object
 * @ throws IOException on failure */
public QueryCapability readXML ( InputStream docIs , URI uri ) throws IOException { } }

implementation:
// get ready for XML parsing
warnMessages . setLength ( 0 ) ; errMessages . setLength ( 0 ) ; fatalMessages . setLength ( 0 ) ; Document doc = null ; try { doc = builder . build ( docIs ) ; } catch ( JDOMException e ) { fatalMessages . append ( e . getMessage ( ) ) ; // makes it invalid
} return readXML ( doc , uri ) ;


signature:
public class DqcFactory { /** * Create an InvCatalog from an a JDOM document .
 * check dqc . isValid , dqc . getErrorMessages ( ) to see if ok .
 * @ param doc parse this document
 * @ param uri : the URI of the document , used for resolving reletive references .
 * @ return an InvCatalogImpl object
 * @ throws IOException on failure */
private QueryCapability readXML ( org . jdom2 . Document doc , URI uri ) throws IOException { } }

implementation:
if ( doc == null ) { // parse failed
QueryCapability dqc = new QueryCapability ( ) ; if ( fatalMessages . length ( ) > 0 ) dqc . appendErrorMessage ( fatalMessages . toString ( ) , true ) ; // makes it invalid
if ( errMessages . length ( ) > 0 ) dqc . appendErrorMessage ( errMessages . toString ( ) , false ) ; // doesnt make it invalid
if ( errMessages . length ( ) > 0 ) dqc . appendErrorMessage ( warnMessages . toString ( ) , false ) ; // doesnt make it invalid
return dqc ; } // decide on converter based on namespace
Element root = doc . getRootElement ( ) ; String namespace = root . getNamespaceURI ( ) ; DqcConvertIF fac = namespaceToDqcConverterHash . get ( namespace ) ; if ( fac == null ) { fac = defaultConverter ; // LOOK
if ( debugVersion ) System . out . println ( "use default converter " + fac . getClass ( ) . getName ( ) + "; no namespace " + namespace ) ; } else if ( debugVersion ) System . out . println ( "use converter " + fac . getClass ( ) . getName ( ) + " based on namespace " + namespace ) ; // convert to object model
QueryCapability dqc = fac . parseXML ( this , doc , uri ) ; if ( fatalMessages . length ( ) > 0 ) dqc . appendErrorMessage ( fatalMessages . toString ( ) , true ) ; // makes it invalid
if ( errMessages . length ( ) > 0 ) dqc . appendErrorMessage ( errMessages . toString ( ) , false ) ; // doesnt make it invalid
if ( errMessages . length ( ) > 0 ) dqc . appendErrorMessage ( warnMessages . toString ( ) , false ) ; // doesnt make it invalid
return dqc ;


signature:
public class DqcFactory { /** * Write the catalog as an XML document to a String .
 * @ param dqc : write this QueryCapability to an XML representation .
 * @ return string containing XML representation
 * @ throws IOException on failure */
public String writeXML ( QueryCapability dqc ) throws IOException { } }

implementation: ByteArrayOutputStream os = new ByteArrayOutputStream ( 10000 ) ; writeXML ( dqc , os ) ; return os . toString ( CDM . utf8Charset . name ( ) ) ;


signature:
public class DqcFactory { /** * Write the catalog as an XML document to the specified stream .
 * @ param dqc : write this QueryCapability to an XML representation .
 * @ param os write to this OutputStream
 * @ throws IOException on an error . */
public void writeXML ( QueryCapability dqc , OutputStream os ) throws IOException { } }

implementation: String ns = versionToNamespaceHash . get ( dqc . getVersion ( ) ) ; DqcConvertIF fac = namespaceToDqcConverterHash . get ( ns ) ; if ( fac == null ) fac = defaultConverter ; fac . writeXML ( dqc , os ) ;


signature:
public class DqcFactory { /** * Write the catalog as an XML document to the specified filename .
 * @ param dqc : write this QueryCapability to an XML representation .
 * @ param filename write to this filename
 * @ return true if success */
public boolean writeXML ( QueryCapability dqc , String filename ) { } }

implementation: try { BufferedOutputStream os = new BufferedOutputStream ( new FileOutputStream ( filename ) ) ; writeXML ( dqc , os ) ; os . close ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; return false ; } return true ;


signature:
public class DqcFactory { /** * testing */
private static void doOne ( DqcFactory fac , String url ) { } }

implementation: System . out . println ( "***read " + url ) ; try { QueryCapability dqc = fac . readXML ( url ) ; System . out . println ( " dqc hasFatalError= " + dqc . hasFatalError ( ) ) ; System . out . println ( " dqc messages= \n" + dqc . getErrorMessages ( ) ) ; fac . writeXML ( dqc , System . out ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; }


signature:
public class DArrayDimension { /** * Set the projection information for this dimension .
 * The parameters < code > start < / code > < code > stride < / code > and < code > stop < / code >
 * are checked to verify that they make sense relative to each other and to
 * the size of this dimension . If not an Invalid ParameterException is thrown .
 * The general rule is : 0 & lt ; = start & lt ; size , 0 & lt ; stride , 0 & lt ; = stop & lt ; size , start & lt ; = stop .
 * @ param start The starting point for the projection of this < code > DArrayDimension < / code > .
 * @ param stride The size of the stride for the projection of this < code > DArrayDimension < / code > .
 * @ param stop The stopping point for the projection of this < code > DArrayDimension < / code > . */
public void setProjection ( int start , int stride , int stop ) throws InvalidDimensionException { } }

implementation:
if ( projection != null ) { // See if we are changing start / stride / stop
if ( getSize ( ) != start || getStride ( ) != stride || getStop ( ) != stop ) { Formatter f = new Formatter ( ) ; f . format ( " [%d:%d:%d (%d)] != [%d:%d:%d (%d)]" , start , stride , stop , projection . size , projection . start , projection . stride , projection . stop , projection . size ) ; throw new ConstraintException ( "Implementation limitation: muliple references to same variable in single constraint: " + container . getLongName ( ) + f . toString ( ) ) ; } } String msg = "DArrayDimension.setProjection: Bad Projection Request: " ; // validate the arguments
if ( start < 0 ) throw new InvalidDimensionException ( msg + "start < 0" ) ; if ( stride <= 0 ) throw new InvalidDimensionException ( msg + "stride <= 0" ) ; if ( stop < 0 ) throw new InvalidDimensionException ( msg + "stop < 0" ) ; if ( start < decl . start ) throw new InvalidDimensionException ( msg + "start (" + start + ") < size (" + decl . size + ") for " + _nameClear ) ; if ( stop >= decl . size ) throw new InvalidDimensionException ( msg + "stop >= size: " + stop + ":" + decl . size ) ; if ( stop < start ) throw new InvalidDimensionException ( msg + "stop < start" ) ; projection = new Slice ( start , stride , stop ) ;


signature:
public class DArrayDimension { /** * Returns a clone of this < code > Array < / code > .
 * See DAPNode . cloneDag ( )
 * @ param map track previously cloned nodes
 * @ return a clone of this object . */
public DAPNode cloneDAG ( CloneMap map ) throws CloneNotSupportedException { } }

implementation: DArrayDimension d = ( DArrayDimension ) super . cloneDAG ( map ) ; if ( container != null ) d . container = ( DArray ) cloneDAG ( map , container ) ; return d ;


signature:
public class H4iosp { /** * Structures must be fixed sized
 * @ param s the record structure
 * @ param section the record range to read
 * @ return an ArrayStructure , with all the data read in .
 * @ throws IOException on error
 * @ throws ucar . ma2 . InvalidRangeException if invalid section */
private ucar . ma2 . ArrayStructure readStructureData ( ucar . nc2 . Structure s , Section section ) throws java . io . IOException , InvalidRangeException { } }

implementation:
H4header . Vinfo vinfo = ( H4header . Vinfo ) s . getSPobject ( ) ; vinfo . setLayoutInfo ( ) ; // make sure needed info is present
int recsize = vinfo . elemSize ; // create the ArrayStructure
StructureMembers members = s . makeStructureMembers ( ) ; for ( StructureMembers . Member m : members . getMembers ( ) ) { Variable v2 = s . findVariable ( m . getName ( ) ) ; H4header . Minfo minfo = ( H4header . Minfo ) v2 . getSPobject ( ) ; m . setDataParam ( minfo . offset ) ; } members . setStructureSize ( recsize ) ; ArrayStructureBB structureArray = new ArrayStructureBB ( members , section . getShape ( ) ) ; // LOOK subset
// loop over records
byte [ ] result = structureArray . getByteBuffer ( ) . array ( ) ; /* if ( vinfo . isChunked ) {
 InputStream is = getChunkedInputStream ( vinfo ) ;
 PositioningDataInputStream dataSource = new PositioningDataInputStream ( is ) ;
 Layout layout = new LayoutRegular ( vinfo . start , recsize , s . getShape ( ) , section ) ;
 IospHelper . readData ( dataSource , layout , DataType . STRUCTURE , result ) ; */
if ( ! vinfo . isLinked && ! vinfo . isCompressed ) { Layout layout = new LayoutRegular ( vinfo . start , recsize , s . getShape ( ) , section ) ; IospHelper . readData ( raf , layout , DataType . STRUCTURE , result , - 1 , true ) ; /* option 1
 } else if ( vinfo . isLinked & & ! vinfo . isCompressed ) {
 Layout layout = new LayoutSegmented ( vinfo . segPos , vinfo . segSize , recsize , s . getShape ( ) , section ) ;
 IospHelper . readData ( raf , layout , DataType . STRUCTURE , result , - 1 ) ; */
// option 2
} else if ( vinfo . isLinked && ! vinfo . isCompressed ) { InputStream is = new LinkedInputStream ( vinfo ) ; PositioningDataInputStream dataSource = new PositioningDataInputStream ( is ) ; Layout layout = new LayoutRegular ( 0 , recsize , s . getShape ( ) , section ) ; IospHelper . readData ( dataSource , layout , DataType . STRUCTURE , result ) ; } else if ( ! vinfo . isLinked && vinfo . isCompressed ) { InputStream is = getCompressedInputStream ( vinfo ) ; PositioningDataInputStream dataSource = new PositioningDataInputStream ( is ) ; Layout layout = new LayoutRegular ( 0 , recsize , s . getShape ( ) , section ) ; IospHelper . readData ( dataSource , layout , DataType . STRUCTURE , result ) ; } else if ( vinfo . isLinked && vinfo . isCompressed ) { InputStream is = getLinkedCompressedInputStream ( vinfo ) ; PositioningDataInputStream dataSource = new PositioningDataInputStream ( is ) ; Layout layout = new LayoutRegular ( 0 , recsize , s . getShape ( ) , section ) ; IospHelper . readData ( dataSource , layout , DataType . STRUCTURE , result ) ; } else { throw new IllegalStateException ( ) ; } return structureArray ;


signature:
public class PicturePane { /** * brings up the indicated picture on the display .
 * @ param filenameURL The URL of the picture to display
 * @ param legendParamThe description of the picture
 * @ param rotation The rotation that should be applied */
public void setPicture ( URL filenameURL , String legendParam , double rotation ) { } }

implementation: legend = legendParam ; centerWhenScaled = true ; sclPic . setScaleSize ( getSize ( ) ) ; sclPic . stopLoadingExcept ( filenameURL ) ; sclPic . loadAndScalePictureInThread ( filenameURL , Thread . MAX_PRIORITY , rotation ) ;


signature:
public class PicturePane { /** * sets the buffered image directly . */
public void setBufferedImage ( BufferedImage img , String statusMessage ) { } }

implementation: legend = statusMessage ; centerWhenScaled = true ; Dimension dim = getSize ( ) ; sclPic . setScaleSize ( dim ) ; SourcePicture source = new SourcePicture ( ) ; source . setSourceBufferedImage ( img , statusMessage ) ; sclPic . setSourcePicture ( source ) ; if ( ! scaleToFit ) sclPic . setScaleFactor ( 1.0 ) ; sclPic . scalePicture ( ) ; repaint ( ) ;


signature:
public class PicturePane { /** * Multifilies the scale factor so that paint ( ) method scales the
 * image larger . This method calls
 * { @ link ScalablePicture # createScaledPictureInThread ( int ) } which in
 * turn will tell this oject by means of the status update that
 * the image is ready and should be repainted . */
public void zoomIn ( ) { } }

implementation:
double OldScaleFactor = sclPic . getScaleFactor ( ) ; double NewScaleFactor = OldScaleFactor * 1.5 ; // If scaling goes from scale down to scale up , set ScaleFactor to exactly 1
if ( ( OldScaleFactor < 1 ) && ( NewScaleFactor > 1 ) ) NewScaleFactor = 1 ; // Check if the picture would get to large and cause the system to " hang "
if ( ( sclPic . getOriginalWidth ( ) * sclPic . getScaleFactor ( ) < maximumPictureSize ) && ( sclPic . getOriginalHeight ( ) * sclPic . getScaleFactor ( ) < maximumPictureSize ) ) { sclPic . setScaleFactor ( NewScaleFactor ) ; sclPic . createScaledPictureInThread ( Thread . MAX_PRIORITY ) ; }


signature:
public class PicturePane { /** * this method sets the desired scaled size of the ScalablePicture
 * to the size of the JPanel and fires off a createScaledPictureInThread
 * request if the ScalablePicture has been loaded or is ready .
 * @ see ScalablePicture # createScaledPictureInThread ( int ) */
public void zoomToFit ( ) { } }

implementation:
// Tools . log ( " zoomToFit invoked " ) ;
sclPic . setScaleSize ( getSize ( ) ) ; // prevent useless rescale events when the picture is not ready
if ( sclPic . getStatusCode ( ) == sclPic . LOADED || sclPic . getStatusCode ( ) == sclPic . READY ) { sclPic . createScaledPictureInThread ( Thread . MAX_PRIORITY ) ; }


signature:
public class PicturePane { /** * Set image to center of panel by putting the coordinates of the middle of the original image into the
 * Center to X and Center to Y varaibles by invoking the setCenterLoaction method .
 * This method
 * calls < code > repaint ( ) < / code > directly since no time consuming image operations need to take place . */
public void centerImage ( ) { } }

implementation: if ( sclPic . getOriginalImage ( ) != null ) { setCenterLocation ( ( int ) sclPic . getOriginalWidth ( ) / 2 , ( int ) sclPic . getOriginalHeight ( ) / 2 ) ; repaint ( ) ; }


signature:
public class PicturePane { /** * method that moves the image up by 10 % of the pixels shown on the screen .
 * This method
 * calls < code > repaint ( ) < / code > directly since no time consuming image operations need to take place .
 * < p > < img src = . . / scrollUp . png border = 0 > < p >
 * @ see # scrollUp ( )
 * @ see # scrollDown ( )
 * @ see # scrollLeft ( )
 * @ see # scrollRight ( ) */
public void scrollUp ( ) { } }

implementation:
// if the bottom edge of the picture is visible , do not scroll
if ( ( ( sclPic . getOriginalHeight ( ) - focusPoint . y ) * sclPic . getScaleFactor ( ) ) + getSize ( ) . height / 2 > getSize ( ) . height ) { focusPoint . y = focusPoint . y + ( int ) ( getSize ( ) . height * 0.1 / sclPic . getScaleFactor ( ) ) ; repaint ( ) ; } else { Tools . log ( "Scrollup rejected because bottom of picture is already showing." ) ; }


signature:
public class PicturePane { /** * method that moves the image down by 10 % of the pixels shown on the screen .
 * This method
 * calls < code > repaint ( ) < / code > directly since no time consuming image operations need to take place .
 * < p > < img src = . . / scrollDown . png border = 0 > < p >
 * @ see # scrollUp ( )
 * @ see # scrollDown ( )
 * @ see # scrollLeft ( )
 * @ see # scrollRight ( ) */
public void scrollDown ( ) { } }

implementation: if ( getSize ( ) . height / 2 - focusPoint . y * sclPic . getScaleFactor ( ) < 0 ) { focusPoint . y = focusPoint . y - ( int ) ( getSize ( ) . height * 0.1 / sclPic . getScaleFactor ( ) ) ; repaint ( ) ; } else { Tools . log ( "Scroll down rejected because top edge is aready visible" ) ; }