signature:
public class StringValidateEncodeUtils { /** * Return true if the given String is a valid ID string .
 * A String is considered a valid ID string if :
 * < ul >
 * < li > it contains no space separator characters ( Unicode general
 * category Zs - Separator , Space ) ; and < / li >
 * < li > true is returned when the string is passed to
 * validSingleLineString ( String ) . < / li >
 * < / ul >
 * @ param id the String to validate
 * @ return true if the given String is a valid ID string .
 * @ see # validSingleLineString ( String ) */
public static boolean validIdString ( String id ) { } }

implementation: if ( id == null ) return false ; Matcher m = INVALID_CHARACTERS_FOR_ID_STRING_PATTERN . matcher ( id ) ; return ! ( m . find ( ) || ! validSingleLineString ( id ) ) ;


signature:
public class StringValidateEncodeUtils { /** * Return true if the given String contains any less than ( " < " ) or
 * greater than ( " > " ) characters ; otherwise return false .
 * @ param string the String to check .
 * @ return true if the given String contains any less than ( " < " ) or greater than ( " > " ) characters */
public static boolean containsAngleBracketCharacters ( String string ) { } }

implementation: if ( string == null ) return false ; if ( string . indexOf ( "<" ) == - 1 && string . indexOf ( ">" ) == - 1 ) return false ; return true ;


signature:
public class StringValidateEncodeUtils { /** * Return true if the given String contains any ampersand ( " & " )
 * characters ; otherwise return false .
 * @ param string the String to check .
 * @ return true if the given String contains any ampersand ( " & " ) characters */
public static boolean containsAmpersandCharacters ( String string ) { } }

implementation: if ( string == null ) return false ; if ( string . indexOf ( "&" ) == - 1 ) return false ; return true ;


signature:
public class StringValidateEncodeUtils { /** * Return true if the given String contains any backslash ( " \ " )
 * characters ; otherwise return false .
 * @ param string the String to check .
 * @ return true if the given String contains any backslash ( " \ " ) characters */
public static boolean containsBackslashCharacters ( String string ) { } }

implementation: if ( string == null ) return false ; if ( string . indexOf ( "\\" ) == - 1 ) return false ; return true ;


signature:
public class StringValidateEncodeUtils { /** * Return true if the given String is " true " or " false " , ignoring case .
 * @ param boolString the String to validate .
 * @ return true if the given String is " true " or " false " , ignoring case . */
@ SuppressWarnings ( { } }

implementation: "SimplifiableIfStatement" } ) public static boolean validBooleanString ( String boolString ) { if ( boolString == null ) return false ; Matcher m = VALID_CHARACTERS_FOR_BOOLEAN_STRING_PATTERN . matcher ( boolString ) ; if ( ! m . matches ( ) ) return false ; return boolString . equalsIgnoreCase ( "true" ) || boolString . equalsIgnoreCase ( "false" ) ;


signature:
public class StringValidateEncodeUtils { /** * Return true if the given String is an alphanumeric string .
 * @ param alphNumString the String to validate .
 * @ return true if the given String is an alphanumeric string . */
public static boolean validAlphanumericString ( String alphNumString ) { } }

implementation: if ( alphNumString == null ) return false ; Matcher m = VALID_CHARACTERS_FOR_ALPHANUMERIC_STRING_PATTERN . matcher ( alphNumString ) ; return m . matches ( ) ;


signature:
public class StringValidateEncodeUtils { /** * Return true if the given String is an alphanumeric string and one of
 * the valid strings in the constrained set .
 * @ param alphNumString the String to validate .
 * @ param constrainedSet the set of valid strings
 * @ param ignoreCase if true ignore the case of the letters
 * @ return true if the given String is an alphanumeric string . */
public static boolean validAlphanumericStringConstrainedSet ( String alphNumString , String [ ] constrainedSet , boolean ignoreCase ) { } }

implementation: if ( alphNumString == null || constrainedSet == null || constrainedSet . length == 0 ) return false ; Matcher m = VALID_CHARACTERS_FOR_ALPHANUMERIC_STRING_PATTERN . matcher ( alphNumString ) ; if ( ! m . matches ( ) ) return false ; for ( String s : constrainedSet ) { if ( ignoreCase ? alphNumString . equalsIgnoreCase ( s ) : alphNumString . equals ( s ) ) return true ; } return false ;


signature:
public class StringValidateEncodeUtils { /** * Return true if the given path does not ascend into parent directory .
 * @ param path the path to check
 * @ return true if the given path does not ascend into parent directory . */
@ SuppressWarnings ( { } }

implementation:
"UnnecessaryContinue" } ) public static boolean descendOnlyFilePath ( String path ) { String [ ] pathSegments = path . split ( "/" ) ; // String [ ] newPathSegments = new String [ pathSegments . length ] ;
int i = 0 ; for ( int indxOrigSegs = 0 ; indxOrigSegs < pathSegments . length ; indxOrigSegs ++ ) { String s = pathSegments [ indxOrigSegs ] ; if ( s . equals ( "." ) ) continue ; else if ( s . equals ( ".." ) ) { if ( i == 0 ) return false ; i -- ; } else { // newPathSegments [ i ] = s ;
i ++ ; } } return true ;


signature:
public class StringValidateEncodeUtils { /** * Check that the given string is a valid percentHexOctets string . The
 * string is considered valid if it only contains a sequence of " % " prefixed ,
 * two character strings where each two character string is composed only of
 * US - ASCII digits and upper - or lower - case A - F .
 * For example : " % 31%32 " or " % 7b % 7d % 7E "
 * @ param percentHexOctetsString the string to check for validity
 * @ return true if the string is valid , false otherwise . */
public static boolean validPercentHexOctetsString ( String percentHexOctetsString ) { } }

implementation: if ( percentHexOctetsString == null ) return false ; Matcher m = VALID_PERCENT_HEX_OCTETS_PATTERN . matcher ( percentHexOctetsString ) ; return m . matches ( ) ;


signature:
public class StringValidateEncodeUtils { /** * Return the percentHexOctets string that represents the given Unicode
 * code point in the given character set or null if the given character
 * set cannot encode the given code point .
 * @ param codePoint the given Unicode code point
 * @ param charsetName the name of the character set .
 * @ return the percentHexOctets string that represents the given Unicode code point in the given character set .
 * @ throws IllegalArgumentException if the code point is not defined or the the character set is not supported . */
public static String unicodeCodePoint2PercentHexString ( int codePoint , String charsetName ) { } }

implementation: if ( ! Character . isDefined ( codePoint ) ) throw new IllegalArgumentException ( String . format ( "Given code point [U+%1$04X - %1$d] not assigned to an abstract character." , codePoint ) ) ; if ( Character . getType ( codePoint ) == Character . SURROGATE ) throw new IllegalArgumentException ( String . format ( "Given code point [U+%1$04X - %1$d] is an unencodable (by itself) surrogate character." , codePoint ) ) ; Charset charset = Charset . availableCharsets ( ) . get ( charsetName ) ; if ( charset == null ) throw new IllegalArgumentException ( String . format ( "Unsupported charset [%s]." , charsetName ) ) ; char [ ] chars = Character . toChars ( codePoint ) ; ByteBuffer byteBuffer = null ; try { byteBuffer = charset . newEncoder ( ) . encode ( CharBuffer . wrap ( chars ) ) ; } catch ( CharacterCodingException e ) { String message = String . format ( "Given code point [U+%1$04X - %1$d] cannot be encode in given charset [%2$s]." , codePoint , charsetName ) ; throw new IllegalArgumentException ( message , e ) ; } byteBuffer . rewind ( ) ; StringBuilder encodedString = new StringBuilder ( ) ; for ( int i = 0 ; i < byteBuffer . limit ( ) ; i ++ ) { String asHex = Integer . toHexString ( byteBuffer . get ( ) & 0xFF ) ; encodedString . append ( "%" ) . append ( asHex . length ( ) == 1 ? "0" : "" ) . append ( asHex ) ; } return encodedString . toString ( ) ;


signature:
public class GridDefRecord { /** * adds a param and value .
 * @ param key name of the param
 * @ param value of the param */
public final void addParam ( String key , String value ) { } }

implementation:
// System . out . println ( " adding " + key + " = " + value ) ;
paramStr . put ( key . trim ( ) , value ) ; paramsValues = paramsValues + "\t" + key + "\t" + value ;


signature:
public class GridDefRecord { /** * adds a param and value .
 * @ param key name of the param
 * @ param value of the param */
public final void addParam ( String key , int value ) { } }

implementation:
// System . out . println ( " adding " + key + " = " + value ) ;
paramInt . put ( key , new Integer ( value ) ) ; paramStr . put ( key , Integer . toString ( value ) ) ;


signature:
public class GridDefRecord { /** * adds a param and value .
 * @ param key name of the param
 * @ param value of the param */
public final void addParam ( String key , float value ) { } }

implementation:
// System . out . println ( " adding " + key + " = " + value ) ;
paramDbl . put ( key , new Double ( value ) ) ; paramStr . put ( key , Float . toString ( value ) ) ;


signature:
public class GridDefRecord { /** * gets a param and value .
 * @ param key name of the param
 * @ return the value or null */
public final String getParam ( String key ) { } }

implementation:
String value = paramStr . get ( key ) ; if ( value == null ) { // check the dbl and int tables
Double result = paramDbl . get ( key ) ; if ( result != null ) { value = result . toString ( ) ; } else { Integer intResult = paramInt . get ( key ) ; if ( intResult != null ) { value = intResult . toString ( ) ; } } // save it back off to the string table for next time
if ( value != null ) { paramStr . put ( key , value ) ; } } if ( debug && value == null ) { System . out . println ( key + " value not found" ) ; } return value ;


signature:
public class GridDefRecord { /** * Compare GridDefRecords , the numerics will use nearlyEquals so values that
 * differ in 3 or 4th decimal places will return equal . This is being coded
 * because the NDFD model dx differ in the 3 decimal place otherwise equal . */
public static boolean compare ( GridDefRecord local , GridDefRecord other ) { } }

implementation:
java . util . Set < String > keys = local . getKeys ( ) ; java . util . Set < String > okeys = other . getKeys ( ) ; if ( keys . size ( ) != okeys . size ( ) ) return false ; for ( String key : keys ) { if ( key . equals ( WIND_FLAG ) || key . equals ( RESOLUTION ) || key . equals ( VECTOR_COMPONENT_FLAG ) || key . equals ( GDS_KEY ) ) continue ; String val = local . getParam ( key ) ; String oval = other . getParam ( key ) ; if ( val . matches ( "^[0-9]+\\.[0-9]*" ) ) { // double
double d = local . getDouble ( key ) ; double od = other . getDouble ( key ) ; if ( ! Misc . nearlyEquals ( d , od ) ) return false ; } else if ( val . matches ( "^[0-9]+" ) ) { // int
if ( ! val . equals ( oval ) ) return false ; } else { // String
if ( ! val . equals ( oval ) ) return false ; } } return true ;


signature:
public class MessageBroker { /** * Step 1 - read and extract a Bufr Message */
public void process ( InputStream is ) throws IOException { } }

implementation: int pos = - 1 ; Buffer b = null ; while ( true ) { b = ( pos < 0 ) ? readBuffer ( is ) : readBuffer ( is , b , pos ) ; pos = process ( b , is ) ; if ( b . done ) break ; }


signature:
public class MessageBroker { /** * return where in the buffer we got to . */
private int process ( Buffer b , InputStream is ) throws IOException { } }

implementation:
int start = 0 ; while ( start < b . have ) { int matchPos = matcher . indexOf ( b . buff , start , b . have - start ) ; // didnt find " BUFR " match
if ( matchPos < 0 ) { if ( start == 0 ) // discard all but last 3 bytes
return b . have - 3 ; else return start ; // indicates part of the buffer thats not processed
} // do we have the length already read ? ?
if ( matchPos + 6 >= b . have ) { return start ; // this will save the end of the buffer and read more in .
} // read BUFR message length
int b1 = ( b . buff [ matchPos + 4 ] & 0xff ) ; int b2 = ( b . buff [ matchPos + 5 ] & 0xff ) ; int b3 = ( b . buff [ matchPos + 6 ] & 0xff ) ; int messLen = b1 << 16 | b2 << 8 | b3 ; // System . out . println ( " match at = " + matchPos + " len = " + messLen ) ;
// create a task for this message
// int headerLen = matchPos - start ;
MessageTask task = new MessageTask ( messLen ) ; task . header = extractHeader ( start , matchPos , b ) ; // copy message bytes into it
int last = matchPos + messLen ; if ( last > b . have ) { task . have = b . have - matchPos ; System . arraycopy ( b . buff , matchPos , task . mess , 0 , task . have ) ; // read the rest of the message
if ( ! readBuffer ( is , task . mess , task . have , task . len - task . have ) ) { System . out . println ( "Failed to read remaining BUFR message" ) ; break ; } } else { task . have = task . len ; System . arraycopy ( b . buff , matchPos , task . mess , 0 , task . have ) ; } boolean ok = true ; // check on ending
for ( int i = task . len - 4 ; i < task . len ; i ++ ) { int bb = task . mess [ i ] ; if ( bb != 55 ) { // System . out . println ( " Missing End of BUFR message at pos = " + i + " " + bb ) ;
ok = false ; bad_msgs ++ ; } } try { if ( ok ) messQ . put ( task ) ; total_msgs ++ ; // System . out . println ( " added message " + task . id + " start = " + matchPos + " end = " + ( matchPos + messLen ) ) ;
} catch ( InterruptedException e ) { System . out . println ( " interrupted queue put - assume process exit" ) ; break ; } start = matchPos + messLen + 1 ; } return - 1 ;


signature:
public class NcStreamDataRow { /** * message DataRow {
 * string fullName = 1;
 * DataType dataType = 2;
 * Section section = 3;
 * bool bigend = 4;
 * uint32 version = 5;
 * bool isVlen = 7;
 * uint32 nelems = 9;
 * oneof
 * bytes primarray = 10 ; / / rectangular , primitive array # < 1 >
 * repeated string stringdata = 11 ; / / string dataType # < 2 >
 * ArrayStructureRow structdata = 12 ; / / structure / seq dataType # < 3 >
 * repeated uint32 vlens = 13 ; / / isVlen true # < 4 >
 * repeated bytes opaquedata = 14 ; / / opaque dataType # < 5 >
 * primarray has nelems * sizeof ( dataType ) bytes , turn into multidim array of primitives with section info and bigend
 * stringdata has nelems strings , turn into multidim array of String with section info
 * structdata has nelems StructureData objects , turn into multidim array of StructureData with section info and bigend
 * vlens has section . size array lengths
 * opaquedata has nelems opaque objects , turn into multidim array of Opaque with section info */
public NcStreamProto . DataRow encodeData3 ( String name , boolean isVlen , Section section , Array data ) { } }

implementation: NcStreamProto . DataRow . Builder builder = NcStreamProto . DataRow . newBuilder ( ) ; encodeData3 ( builder , name , isVlen , section , data ) ; return builder . build ( ) ;


signature:
public class NcStreamDataRow { /** * message Member {
 * string shortName = 1;
 * DataType dataType = 2;
 * repeated uint32 shape = 3 ; / / or section ?
 * bool isVlen = 4;
 * message ArrayStructureRow {
 * repeated Member members = 1;
 * uint64 nrows = 5 ; / / number of rows in this message
 * uint32 rowLength = 6 ; / / length in bytes of each row
 * bytes fixdata = 10 ; / / fixed data
 * repeated string stringdata = 11 ; / / string dataType
 * repeated bytes bytedata = 13 ; / / opaque dataType and vlens
 * repeated ArrayStructureRow structdata = 14 ; / / structure / seq dataType */
NcStreamProto . ArrayStructureRow . Builder encodeStructureData ( String structName , Array data ) { } }

implementation:
assert data instanceof ArrayStructure ; ArrayStructure as = ( ArrayStructure ) data ; int nelems = ( int ) as . getSize ( ) ; List < MemberData > memberData = new ArrayList < > ( ) ; StructureMembers sm = as . getStructureMembers ( ) ; for ( StructureMembers . Member m : sm . getMembers ( ) ) { memberData . add ( new MemberData ( m , nelems ) ) ; } // use most efficient form of data extraction
for ( int recno = 0 ; recno < nelems ; recno ++ ) { for ( MemberData md : memberData ) { if ( md . member . isVariableLength ( ) ) { md . vlenList . add ( as . getArray ( recno , md . member ) ) ; } else { extractData ( as , recno , md ) ; } } } NcStreamProto . ArrayStructureRow . Builder builder = NcStreamProto . ArrayStructureRow . newBuilder ( ) ; for ( MemberData md : memberData ) { NcStreamProto . Member . Builder member = NcStreamProto . Member . newBuilder ( ) ; member . setShortName ( md . member . getName ( ) ) ; member . setDataType ( NcStream . convertDataType ( md . member . getDataType ( ) ) ) ; /* LOOK
 member . setNelems ( md . nelems ) ;
 if ( md . member . isVariableLength ( ) ) {
 md . completeVlens ( ) ;
 nested . addAllVlens ( md . vlens ) ;
 nested . setPrimdata ( ByteString . copyFrom ( md . bb ) ) ;
 } else if ( md . member . getDataType ( ) = = DataType . STRING )
 nested . addAllStringdata ( md . stringList ) ;
 else if ( md . member . getDataType ( ) = = DataType . OPAQUE )
 nested . addAllOpaquedata ( md . opaqueList ) ;
 else
 nested . setPrimdata ( ByteString . copyFrom ( md . bb ) ) ; */
builder . addMembers ( member ) ; } return builder ;


signature:
public class UploadController { /** * Invoked once on first request so that everything is available ,
 * especially Spring stuff . */
public void doonce ( HttpServletRequest req ) throws SendError { } }

implementation:
if ( once ) return ; super . initOnce ( req ) ; if ( this . uploaddir == null ) throw new SendError ( HttpStatus . SC_PRECONDITION_FAILED , "Upload disabled" ) ; this . uploaddirname = new File ( this . uploaddir ) . getName ( ) ; // Get the upload form
File upform = null ; upform = tdsContext . getUploadForm ( ) ; if ( upform == null ) { // Look in WEB - INF directory
File root = tdsContext . getServletRootDirectory ( ) ; upform = new File ( root , DEFAULTUPLOADFORM ) ; } try { this . uploadform = loadForm ( upform ) ; } catch ( IOException ioe ) { throw new SendError ( HttpStatus . SC_PRECONDITION_FAILED , ioe ) ; }


signature:
public class UploadController { /** * Controller entry point ( s ) */
@ RequestMapping ( value = "**" , method = RequestMethod . GET ) public void doGet ( HttpServletRequest req , HttpServletResponse res ) throws ServletException { } }

implementation:
try { setup ( req , res ) ; switch ( this . params . command ) { case NONE : case UPLOAD : // Send back the upload form
sendForm ( "No files uploaded" ) ; break ; case INQUIRE : String result = inquire ( ) ; // Send back the inquiry answers
sendOK ( result ) ; break ; default : throw new SendError ( res . SC_BAD_REQUEST , "Unknown command: " + this . params . command ) ; } } catch ( SendError se ) { sendError ( se ) ; } catch ( Exception e ) { String msg = getStackTrace ( e ) ; sendError ( HttpServletResponse . SC_INTERNAL_SERVER_ERROR , msg , e ) ; }


signature:
public class Ceparse { /** * / * Parser core */
void projections ( Ceparse state , Object list0 ) throws ParseException { } }

implementation: ast . projections = ( List < ASTprojection > ) list0 ;


signature:
public class Ceparse { /** * / * Selection Procedures */
Object clauselist ( Ceparse state , Object list0 , Object decl ) throws ParseException { } }

implementation: List < ASTclause > list = ( List < ASTclause > ) list0 ; if ( list == null ) list = new ArrayList < ASTclause > ( ) ; list . add ( ( ASTclause ) decl ) ; return list ;


signature:
public class Ceparse { /** * Remove double quotes from around a string . If there ' s not both start
 * and ending quotes , does nothing .
 * @ param s The source string .
 * @ return The string without double quotes . */
String removeQuotes ( String s ) { } }

implementation: if ( s . startsWith ( "\"" ) && s . endsWith ( "\"" ) ) return s . substring ( 1 , s . length ( ) - 1 ) ; else return s ;


signature:
public class Ceparse { /** * Given a stack of BaseType variables , mark these as part of the
 * current projection . This function assumes that if the TOS contains a
 * Ctor type variable , all of its members are to be projected . Also
 * assume all variables under the TOS are Ctor variables and
 * only the ctor itself is to be projected ; the member within the Ctor
 * that is part of the projection will be on the stack , too . */
void markStackedVariables ( Stack s ) { } }

implementation:
// Reverse the stack .
Stack bts = new Stack ( ) ; // LogStream . err . println ( " Variables to be marked : " ) ;
while ( ! s . empty ( ) ) { // LogStream . err . println ( ( ( BaseType ) s . peek ( ) ) . getName ( ) ) ;
bts . push ( s . pop ( ) ) ; } // For each but the last stack element , set the projection .
// setProject ( true , false ) for a ctor type sets the projection for
// the ctor itself but * does not * set the projection for all its
// children . Thus , if a user wants the variable S . X , and S contains Y
// and Z too , S ' s projection will be set ( so serialize will descend
// into S ) but X , Y and Z ' s projection remain clear . In this example ,
// X ' s projection is set by the code that follows the while loop .
// 1/28/2000 jhrg
while ( bts . size ( ) > 1 ) { ServerMethods ct = ( ServerMethods ) bts . pop ( ) ; ct . setProject ( true , false ) ; } // For the last element , project the entire variable .
ServerMethods bt = ( ServerMethods ) bts . pop ( ) ; bt . setProject ( true , true ) ;


signature:
public class Ceparse { /** * This parses , then fills in the evaluator from the AST */
public boolean constraint_expression ( CEEvaluator ceEval , BaseTypeFactory factory , ClauseFactory clauseFactory ) throws DAP2Exception , ParseException { } }

implementation: ServerDDS sdds = ceEval . getDDS ( ) ; if ( ! parse ( ) ) return false ; ast . init ( ceEval , factory , clauseFactory , sdds , getASTnodeset ( ) ) ; ast . walkConstraint ( ) ; return true ;


signature:
public class NcmlEditor { /** * write ncml from given dataset */
boolean writeNcml ( String location ) { } }

implementation: boolean err = false ; closeOpenFiles ( ) ; try { final String result ; ds = openDataset ( location , addCoords , null ) ; if ( ds == null ) { editor . setText ( "Failed to open <" + location + ">" ) ; } else { final NcMLWriter ncmlWriter = new NcMLWriter ( ) ; final Element netcdfElem = ncmlWriter . makeNetcdfElement ( ds , null ) ; result = ncmlWriter . writeToString ( netcdfElem ) ; editor . setText ( result ) ; editor . setCaretPosition ( 0 ) ; } } catch ( Exception e ) { final StringWriter sw = new StringWriter ( 10000 ) ; e . printStackTrace ( ) ; e . printStackTrace ( new PrintWriter ( sw ) ) ; editor . setText ( sw . toString ( ) ) ; err = true ; } return ! err ;


signature:
public class NcmlEditor { /** * Read text from textArea through NcMLReader
 * then write it back out via resulting dataset */
void doTransform ( String text ) { } }

implementation: try { final StringReader reader = new StringReader ( text ) ; final NetcdfDataset ncd = NcMLReader . readNcML ( reader , null ) ; final StringWriter sw = new StringWriter ( 10000 ) ; ncd . writeNcML ( sw , null ) ; editor . setText ( sw . toString ( ) ) ; editor . setCaretPosition ( 0 ) ; JOptionPane . showMessageDialog ( this , "File successfully transformed" ) ; } catch ( IOException ioe ) { JOptionPane . showMessageDialog ( this , "ERROR: " + ioe . getMessage ( ) ) ; ioe . printStackTrace ( ) ; }


signature:
public class NcmlEditor { /** * Read text from textArea through NcMLReader
 * then write it back out via resulting dataset */
private void checkNcml ( Formatter f ) { } }

implementation: if ( ncmlLocation == null ) { return ; } try { NetcdfDataset ncd = NetcdfDataset . openDataset ( ncmlLocation ) ; ncd . check ( f ) ; } catch ( IOException ioe ) { JOptionPane . showMessageDialog ( this , "ERROR: " + ioe . getMessage ( ) ) ; ioe . printStackTrace ( ) ; }


signature:
public class TdsConfigMapper { /** * static so can be called from static enum classes */
private static String getValueFromThreddsConfig ( String key , String alternateKey , String defaultValue ) { } }

implementation: String value = ThreddsConfig . get ( key , null ) ; if ( value == null && alternateKey != null ) value = ThreddsConfig . get ( alternateKey , null ) ; if ( value == null ) value = defaultValue ; return value ;


signature:
public class Grib2PartitionBuilderFromIndex { /** * read in the index , index raf already open ; return null on failure */
@ Nullable static PartitionCollectionMutable openMutablePCFromIndex ( String name , RandomAccessFile raf , FeatureCollectionConfig config , org . slf4j . Logger logger ) { } }

implementation: Grib2PartitionBuilderFromIndex builder = new Grib2PartitionBuilderFromIndex ( name , config , logger ) ; if ( builder . readIndex ( raf ) ) return builder . pc ; return null ;


signature:
public class Grib2PartitionBuilderFromIndex { /** * extend GribCollection {
 * repeated Partition partitions = 100;
 * required bool isPartitionOfPartitions = 101;
 * repeated uint32 run2part = 102 ; / / masterRuntime index to partition index */
@ Override protected boolean readExtensions ( GribCollectionProto . GribCollection proto ) { } }

implementation: pc . isPartitionOfPartitions = proto . getIsPartitionOfPartitions ( ) ; List < Integer > list = proto . getRun2PartList ( ) ; pc . run2part = new int [ list . size ( ) ] ; int count = 0 ; for ( int partno : list ) pc . run2part [ count ++ ] = partno ; List < ucar . nc2 . grib . collection . GribCollectionProto . Partition > partList = proto . getPartitionsList ( ) ; for ( ucar . nc2 . grib . collection . GribCollectionProto . Partition partProto : partList ) makePartition ( partProto ) ; return partList . size ( ) > 0 ;


signature:
public class EnumTypedef { /** * / * private boolean
 * IgnoreinRange ( int i ) {
 * WARNING , we do not have signed / unsigned info available
 * if ( this . basetype = = DataType . ENUM1
 * & & ( i > = Byte . MIN _ VALUE | | i < = UBYTE _ MAX ) )
 * return true ;
 * else if ( this . basetype = = DataType . ENUM2
 * & & ( i > = Short . MIN _ VALUE | | i < = USHORT _ MAX ) )
 * return true ;
 * else if ( this . basetype = = DataType . ENUM4 ) / / always ok
 * return true ;
 * else
 * return false ; */
public String lookupEnumString ( int e ) { } }

implementation: String result = map . get ( e ) ; return ( result == null ) ? "Unknown enum value=" + e : result ;


signature:
public class EnumTypedef { /** * String representation .
 * @ param strict if true , write in strict adherence to CDL definition .
 * @ return CDL representation . */
public String writeCDL ( boolean strict ) { } }

implementation: Formatter out = new Formatter ( ) ; writeCDL ( out , new Indent ( 2 ) , strict ) ; return out . toString ( ) ;


signature:
public class StationCollectionStream { /** * initialize the stationHelper . */
@ Override protected StationHelper createStationHelper ( ) throws IOException { } }

implementation:
// read in all the stations with the " stations " query
StationHelper stationHelper = new StationHelper ( ) ; try ( InputStream in = CdmRemote . sendQuery ( null , uri , "req=stations" ) ) { PointStream . MessageType mtype = PointStream . readMagic ( in ) ; if ( mtype != PointStream . MessageType . StationList ) { throw new RuntimeException ( "Station Request: bad response" ) ; } int len = NcStream . readVInt ( in ) ; byte [ ] b = new byte [ len ] ; NcStream . readFully ( in , b ) ; PointStreamProto . StationList stationsp = PointStreamProto . StationList . parseFrom ( b ) ; for ( ucar . nc2 . ft . point . remote . PointStreamProto . Station sp : stationsp . getStationsList ( ) ) { // Station s = new StationImpl ( sp . getId ( ) , sp . getDesc ( ) , sp . getWmoId ( ) , sp . getLat ( ) , sp . getLon ( ) , sp . getAlt ( ) ) ;
stationHelper . addStation ( new StationFeatureStream ( null , null ) ) ; // LOOK WRONG
} return stationHelper ; }


signature:
public class StationCollectionStream { /** * StationTimeSeriesFeatureCollection */
@ Override public StationTimeSeriesFeatureCollection subset ( List < StationFeature > stations ) throws IOException { } }

implementation:
if ( stations == null ) return this ; // List < StationFeature > subset = getStationHelper ( ) . getStationFeatures ( stations ) ;
return new Subset ( this , null , null ) ; // LOOK WRONG


signature:
public class StationCollectionStream { /** * NestedPointFeatureCollection */
@ Override public PointFeatureCollection flatten ( LatLonRect boundingBox , CalendarDateRange dateRange ) throws IOException { } }

implementation:
// boolean restrictedList = false ;
// QueryMaker queryMaker = restrictedList ? new QueryByStationList ( ) : null ;
PointFeatureCollection pfc = new PointCollectionStreamRemote ( uri , getTimeUnit ( ) , getAltUnits ( ) , null ) ; return pfc . subset ( boundingBox , dateRange ) ;


signature:
public class ResultService { /** * Validate this ResultService object . Return true if valid , false if invalid .
 * @ param out StringBuffer with validation messages .
 * @ return boolean true if valid , false if invalid */
protected boolean validate ( StringBuilder out ) { } }

implementation:
this . isValid = true ; // If log from construction has content , append to validation output msg .
if ( this . log . length ( ) > 0 ) { out . append ( this . log ) ; } // Check that ' accessPointHeader ' attribute is not null .
if ( this . getAccessPointHeader ( ) == null ) { this . isValid = false ; out . append ( " ** ResultService (1): a null 'accessPointHeader' is invalid." ) ; } return ( this . isValid ) ;


signature:
public class LambertAzimuthalEqualArea { /** * 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 g = sinLat0 * Math . sin ( fromLat ) + cosLat0 * Math . cos ( fromLat ) * Math . cos ( lonDiff ) ; double kPrime = Math . sqrt ( 2 / ( 1 + g ) ) ; toX = R * kPrime * Math . cos ( fromLat ) * Math . sin ( lonDiff ) + falseEasting ; toY = R * kPrime * ( cosLat0 * Math . sin ( fromLat ) - sinLat0 * Math . cos ( fromLat ) * Math . cos ( lonDiff ) ) + falseNorthing ; result . setLocation ( toX , toY ) ; return result ;


signature:
public class LambertAzimuthalEqualArea { /** * 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 g = sinLat0 * Math . sin ( fromLat ) + cosLat0 * Math . cos ( fromLat ) * Math . cos ( lonDiff ) ; double kPrime = Math . sqrt ( 2 / ( 1 + g ) ) ; toX = R * kPrime * Math . cos ( fromLat ) * Math . sin ( lonDiff ) + falseEasting ; toY = R * kPrime * ( cosLat0 * Math . sin ( fromLat ) - sinLat0 * Math . cos ( fromLat ) * Math . cos ( lonDiff ) ) + falseNorthing ; resultXA [ i ] = ( float ) toX ; resultYA [ i ] = ( float ) toY ; } return to ;


signature:
public class LambertAzimuthalEqualArea { /** * 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 : to [ 2 ] [ n ]
 * where ( to [ 0 ] [ i ] , to [ 1 ] [ i ] ) is the ( x , y ) coordinate
 * of the ith point
 * @ return the " to " array */
public float [ ] [ ] projToLatLon ( float [ ] [ ] from , float [ ] [ ] to ) { } }

implementation:
int cnt = from [ 0 ] . length ; float [ ] fromXA = from [ INDEX_X ] ; float [ ] fromYA = from [ INDEX_Y ] ; float [ ] toLatA = to [ INDEX_LAT ] ; float [ ] toLonA = to [ INDEX_LON ] ; double toLat , toLon ; for ( int i = 0 ; i < cnt ; i ++ ) { double fromX = fromXA [ i ] ; double fromY = fromYA [ i ] ; fromX = fromX - falseEasting ; fromY = fromY - falseNorthing ; double rho = Math . sqrt ( fromX * fromX + fromY * fromY ) ; double c = 2 * Math . asin ( rho / ( 2 * R ) ) ; 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 ) ; toLatA [ i ] = ( float ) toLat ; toLonA [ i ] = ( float ) toLon ; } return to ;


signature:
public class Cinrad2Record { /** * Get the azimuth in degrees
 * @ return azimuth angle in degrees 0 = true north , 90 = east */
public float getAzimuth ( ) { } }

implementation: if ( message_type != 1 ) return - 1.0f ; if ( Cinrad2IOServiceProvider . isSC ) return 360.0f * azimuth_ang / 65536.0f ; else if ( Cinrad2IOServiceProvider . isCC ) return 360.0f * azimuth_ang / 512.0f ; else if ( Cinrad2IOServiceProvider . isCC20 ) return azimuth_ang * 0.01f ; return 180.0f * azimuth_ang / 32768.0f ;


signature:
public class Cinrad2Record { /** * Get the elevation angle in degrees
 * @ return elevation angle in degrees 0 = parellel to pedestal base , 90 = perpendicular */
public float getElevation ( ) { } }

implementation: if ( message_type != 1 ) return - 1.0f ; if ( Cinrad2IOServiceProvider . isSC ) return 120.0f * elevation_ang / 65536.0f ; else if ( Cinrad2IOServiceProvider . isCC ) return elevation_ang * 0.01f ; else if ( Cinrad2IOServiceProvider . isCC20 ) return elevation_ang * 0.01f ; return 180.0f * elevation_ang / 32768.0f ;


signature:
public class DoradeSWIB { /** * unidata added */
public Date [ ] getTimes ( ) { } }

implementation: if ( myRYIBs == null ) return null ; Date [ ] times = new Date [ nRays ] ; for ( int i = 0 ; i < nRays ; i ++ ) times [ i ] = myRYIBs [ i ] . getRayTime ( ) ; return times ;


signature:
public class DoradeSWIB { /** * Get the array of per - ray latitudes . If we do not have per - ray position
 * information , null is returned .
 * @ return an array of per - ray latitudes , or null if no per - ray position
 * information is available . */
public float [ ] getLatitudes ( ) { } }

implementation: if ( myASIBs == null ) return null ; float [ ] lats = new float [ nRays ] ; for ( int i = 0 ; i < nRays ; i ++ ) lats [ i ] = myASIBs [ i ] . getLatitude ( ) ; return lats ;


signature:
public class DoradeSWIB { /** * Get the array of per - ray longitudes . If we do not have per - ray position
 * information , null is returned .
 * @ return an array of per - ray longitudes , or null if no per - ray position
 * information is available . */
public float [ ] getLongitudes ( ) { } }

implementation: if ( myASIBs == null ) return null ; float [ ] lons = new float [ nRays ] ; for ( int i = 0 ; i < nRays ; i ++ ) lons [ i ] = myASIBs [ i ] . getLongitude ( ) ; return lons ;


signature:
public class DoradeSWIB { /** * Get the array of per - ray altitudes . If we do not have per - ray position
 * information , null is returned .
 * @ return an array of per - ray altitudes in km MSL , or null if no per - ray
 * position information is available . */
public float [ ] getAltitudes ( ) { } }

implementation: if ( myASIBs == null ) return null ; float [ ] alts = new float [ nRays ] ; for ( int i = 0 ; i < nRays ; i ++ ) alts [ i ] = myASIBs [ i ] . getAltitude ( ) ; return alts ;


signature:
public class DoradeSWIB { /** * Get the array of azimuths for this sweep .
 * @ return the array of azimuths for this sweep
 * @ see # getNRays ( ) */
public float [ ] getAzimuths ( ) { } }

implementation: if ( azimuths == null ) { azimuths = new float [ nRays ] ; for ( int r = 0 ; r < nRays ; r ++ ) { azimuths [ r ] = myRYIBs [ r ] . getAzimuth ( ) ; } } return azimuths ;


signature:
public class DoradeSWIB { /** * Get the array of elevations for this sweep .
 * @ return the array of elevations for this sweep
 * @ see # getNRays ( ) */
public float [ ] getElevations ( ) { } }

implementation: if ( elevations == null ) { elevations = new float [ nRays ] ; for ( int r = 0 ; r < nRays ; r ++ ) { elevations [ r ] = myRYIBs [ r ] . getElevation ( ) ; } } return elevations ;


signature:
public class Structure { /** * Create a subset of the Structure consisting only of the given member variables
 * @ param memberNames list of Variable names , already a member
 * @ return Structure containing just those members */
public Structure select ( List < String > memberNames ) { } }

implementation: Structure result = ( Structure ) copy ( ) ; List < Variable > members = new ArrayList < > ( ) ; for ( String name : memberNames ) { Variable m = findVariable ( name ) ; if ( null != m ) members . add ( m ) ; } result . setMemberVariables ( members ) ; result . isSubset = true ; return result ;


signature:
public class Structure { /** * Create a subset of the Structure consisting only of the one member variable
 * @ param varName name of member Variable
 * @ return containing just that member */
public Structure select ( String varName ) { } }

implementation: List < String > memberNames = new ArrayList < > ( 1 ) ; memberNames . add ( varName ) ; return select ( memberNames ) ;


signature:
public class Structure { /** * Add a member variable
 * @ param v add this variable as a member of this structure
 * @ return the added variable */
public Variable addMemberVariable ( Variable v ) { } }

implementation: if ( isImmutable ( ) ) throw new IllegalStateException ( "Cant modify" ) ; members . add ( v ) ; memberHash . put ( v . getShortName ( ) , v ) ; v . setParentStructure ( this ) ; return v ;


signature:
public class Structure { /** * Set the list of member variables .
 * @ param vars this is the list of member variables */
public void setMemberVariables ( List < Variable > vars ) { } }

implementation: if ( isImmutable ( ) ) throw new IllegalStateException ( "Cant modify" ) ; members = new ArrayList < > ( ) ; memberHash = new HashMap < > ( 2 * vars . size ( ) ) ; for ( Variable v : vars ) { addMemberVariable ( v ) ; }


signature:
public class Structure { /** * Remove a Variable : uses the Variable name to find it .
 * @ param v remove this variable as a member of this structure
 * @ return true if was found and removed */
public boolean removeMemberVariable ( Variable v ) { } }

implementation:
if ( isImmutable ( ) ) throw new IllegalStateException ( "Cant modify" ) ; if ( v == null ) return false ; // smembers = null ;
java . util . Iterator < Variable > iter = members . iterator ( ) ; while ( iter . hasNext ( ) ) { Variable mv = iter . next ( ) ; if ( mv . getShortName ( ) . equals ( v . getShortName ( ) ) ) { iter . remove ( ) ; memberHash . remove ( v . getShortName ( ) ) ; return true ; } } return false ;


signature:
public class Structure { /** * Replace a Variable with another that has the same name : uses the variable name to find it .
 * If old Var is not found , just add the new one
 * @ param newVar add this variable as a member of this structure
 * @ return true if was found and replaced */
public boolean replaceMemberVariable ( Variable newVar ) { } }

implementation:
if ( isImmutable ( ) ) throw new IllegalStateException ( "Cant modify" ) ; // smembers = null ;
boolean found = false ; for ( int i = 0 ; i < members . size ( ) ; i ++ ) { Variable v = members . get ( i ) ; if ( v . getShortName ( ) == null ) System . out . println ( "BAD null short name" ) ; // E : / work / ghansham / iasi _ 20110513_045057 _ metopa _ 23676 _ eps _ o . l1 _ bufr
if ( v . getShortName ( ) . equals ( newVar . getShortName ( ) ) ) { members . set ( i , newVar ) ; found = true ; } } if ( ! found ) members . add ( newVar ) ; return found ;


signature:
public class Structure { /** * Set the parent group of this Structure , and all member variables . */
@ Override public void setParentGroup ( Group group ) { } }

implementation: if ( isImmutable ( ) ) throw new IllegalStateException ( "Cant modify" ) ; super . setParentGroup ( group ) ; if ( members != null ) { for ( Variable v : members ) { v . setParentGroup ( group ) ; } }


signature:
public class Structure { /** * Find the Variable member with the specified ( short ) name .
 * @ param shortName name of the member variable .
 * @ return the Variable member with the specified ( short ) name , or null if not found . */
public Variable findVariable ( String shortName ) { } }

implementation: if ( shortName == null ) return null ; return memberHash . get ( shortName ) ;


signature:
public class Structure { /** * Create a StructureMembers object that describes this Structure .
 * CAUTION : Do not use for iterating over a StructureData or ArrayStructure - get the StructureMembers object
 * directly from the StructureData or ArrayStructure .
 * @ return a StructureMembers object that describes this Structure . */
public StructureMembers makeStructureMembers ( ) { } }

implementation: StructureMembers smembers = new StructureMembers ( getShortName ( ) ) ; for ( Variable v2 : getVariables ( ) ) { StructureMembers . Member m = smembers . addMember ( v2 . getShortName ( ) , v2 . getDescription ( ) , v2 . getUnitsString ( ) , v2 . getDataType ( ) , v2 . getShape ( ) ) ; if ( v2 instanceof Structure ) m . setStructureMembers ( ( ( Structure ) v2 ) . makeStructureMembers ( ) ) ; } return smembers ;


signature:
public class Structure { /** * Force recalculation of size of one element of this structure - equals the sum of sizes of its members .
 * This is used only by low level classes like IOSPs . */
public void calcElementSize ( ) { } }

implementation: int total = 0 ; for ( Variable v : members ) { total += v . getElementSize ( ) * v . getSize ( ) ; } elementSize = total ;


signature:
public class Structure { /** * Use this when this is a scalar Structure . Its the same as read ( ) , but it extracts the single
 * StructureData out of the Array .
 * @ return StructureData for a scalar
 * @ throws java . io . IOException on read error */
public StructureData readStructure ( ) throws IOException { } }

implementation: if ( getRank ( ) != 0 ) throw new java . lang . UnsupportedOperationException ( "not a scalar structure" ) ; Array dataArray = read ( ) ; ArrayStructure data = ( ArrayStructure ) dataArray ; return data . getStructureData ( 0 ) ;


signature:
public class Structure { /** * Use this when this is a one dimensional array of Structures , or you are doing the index calculation yourself for
 * a multidimension array . This will read only the ith structure , and return the data as a StructureData object .
 * @ param index index into 1D array
 * @ return ith StructureData
 * @ throws java . io . IOException on read error
 * @ throws ucar . ma2 . InvalidRangeException if index out of range */
public StructureData readStructure ( int index ) throws IOException , ucar . ma2 . InvalidRangeException { } }

implementation:
Section section = null ; // works for scalars i think
if ( getRank ( ) == 1 ) { section = new Section ( ) . appendRange ( index , index ) ; } else if ( getRank ( ) > 1 ) { Index ii = Index . factory ( shape ) ; // convert to nD index
ii . setCurrentCounter ( index ) ; int [ ] origin = ii . getCurrentCounter ( ) ; section = new Section ( ) ; for ( int anOrigin : origin ) section . appendRange ( anOrigin , anOrigin ) ; } Array dataArray = read ( section ) ; ArrayStructure data = ( ArrayStructure ) dataArray ; return data . getStructureData ( 0 ) ;


signature:
public class Structure { /** * For rank 1 array of Structures , read count Structures and return the data as an ArrayStructure .
 * Use only when this is a one dimensional array of Structures .
 * @ param start start at this index
 * @ param count return this many StructureData
 * @ return the StructureData recordsfrom start to start + count - 1
 * @ throws java . io . IOException on read error
 * @ throws ucar . ma2 . InvalidRangeException if start , count out of range */
public ArrayStructure readStructure ( int start , int count ) throws IOException , ucar . ma2 . InvalidRangeException { } }

implementation: if ( getRank ( ) != 1 ) throw new java . lang . UnsupportedOperationException ( "not a vector structure" ) ; int [ ] origin = new int [ ] { start } ; int [ ] shape = new int [ ] { count } ; if ( NetcdfFile . debugStructureIterator ) System . out . println ( "readStructure " + start + " " + count ) ; return ( ArrayStructure ) read ( origin , shape ) ;


signature:
public class Structure { /** * Get an efficient iterator over all the data in the Structure .
 * This is the efficient way to get all the data , it can be much faster than reading one record at a time ,
 * and is optimized for large datasets .
 * This is accomplished by buffering bufferSize amount of data at once .
 * < pre > Example :
 * StructureDataIterator ii = structVariable . getStructureIterator ( 100 * 1000 ) ;
 * while ( ii . hasNext ( ) ) {
 * StructureData sdata = ii . next ( ) ;
 * < / pre >
 * @ param bufferSize size in bytes to buffer , set < 0 to use default size
 * @ return StructureDataIterator over type StructureData
 * @ throws java . io . IOException on read error */
public StructureDataIterator getStructureIterator ( int bufferSize ) throws java . io . IOException { } }

implementation: return ( getRank ( ) < 2 ) ? new Structure . IteratorRank1 ( bufferSize ) : new Structure . Iterator ( bufferSize ) ;


signature:
public class Structure { /** * Get String with name and attributes . Used in short descriptions like tooltips .
 * @ return name and attributes String */
public String getNameAndAttributes ( ) { } }

implementation: Formatter sbuff = new Formatter ( ) ; sbuff . format ( "Structure " ) ; getNameAndDimensions ( sbuff , false , true ) ; sbuff . format ( "%n" ) ; for ( Attribute att : attributes . getAttributes ( ) ) { sbuff . format ( "  %s:%s;%n" , getShortName ( ) , att . toString ( ) ) ; } return sbuff . toString ( ) ;


signature:
public class TableA { /** * < BUFR _ 19_1_1 _ TableA _ en >
 * < No > 27 < / No >
 * < CodeFigure > 28 < / CodeFigure >
 * < Meaning _ en > Precision orbit ( satellite ) < / Meaning _ en >
 * < Status > Operational < / Status >
 * < / BUFR _ 19_1_1 _ TableA _ en >
 * < Exp _ BUFRTableA _ E >
 * < No > 4 < / No >
 * < CodeFigure > 3 < / CodeFigure >
 * < Meaning _ E > Vertical soundings ( satellite ) < / Meaning _ E >
 * < Status > Operational < / Status >
 * < / Exp _ BUFRTableA _ E > */
static private void init ( ) { } }

implementation: String filename = BufrTables . RESOURCE_PATH + TABLEA_FILENAME ; try ( InputStream is = CodeFlagTables . class . getResourceAsStream ( filename ) ) { HashMap < Integer , String > map = new HashMap < > ( 100 ) ; SAXBuilder builder = new SAXBuilder ( ) ; org . jdom2 . Document tdoc = builder . build ( is ) ; org . jdom2 . Element root = tdoc . getRootElement ( ) ; List < Element > elems = root . getChildren ( ) ; for ( Element elem : elems ) { String line = elem . getChildText ( "No" ) ; String codeS = elem . getChildText ( "CodeFigure" ) ; String desc = elem . getChildText ( "Meaning_en" ) ; try { int code = Integer . parseInt ( codeS ) ; map . put ( code , desc ) ; } catch ( NumberFormatException e ) { log . debug ( "NumberFormatException on line " + line + " in " + codeS ) ; } } tableA = map ; } catch ( Exception e ) { log . error ( "Can't read BUFR code table " + filename , e ) ; }


signature:
public class TableA { /** * data category name , from table A
 * @ param cat data category
 * @ return category name , or null if not found */
static public String getDataCategory ( int cat ) { } }

implementation: if ( tableA == null ) init ( ) ; String result = tableA . get ( cat ) ; return result != null ? result : "Unknown category=" + cat ;


signature:
public class ProjectionImpl { /** * Get the name of the type of the projection .
 * @ return the class name */
public String getClassName ( ) { } }

implementation: String className = getClass ( ) . getName ( ) ; int index = className . lastIndexOf ( "." ) ; if ( index >= 0 ) { className = className . substring ( index + 1 ) ; } return className ;


signature:
public class ProjectionImpl { /** * Add an attribute to this projection
 * @ param name name of the attribute
 * @ param value attribute value as a string */
protected void addParameter ( String name , String value ) { } }

implementation: atts . add ( new Parameter ( name , value ) ) ;


signature:
public class ProjectionImpl { /** * Get a header for display .
 * @ return human readable header for display */
public static String getHeader ( ) { } }

implementation: StringBuilder headerB = new StringBuilder ( 60 ) ; headerB . append ( "Name" ) ; Format . tab ( headerB , 20 , true ) ; headerB . append ( "Class" ) ; Format . tab ( headerB , 40 , true ) ; headerB . append ( "Parameters" ) ; return headerB . toString ( ) ;


signature:
public class ProjectionImpl { /** * Convert projection coordinates to lat / lon coordinate .
 * @ param from array of projection coordinates : from [ 2 ] [ n ] , where
 * ( from [ 0 ] [ i ] , from [ 1 ] [ i ] ) is the ( x , y ) coordinate
 * of the ith point
 * @ param to resulting array of lat / lon coordinates : to [ 2 ] [ n ] where
 * ( to [ 0 ] [ i ] , to [ 1 ] [ i ] ) is the ( lat , lon ) coordinate of
 * the ith point
 * @ return the " to " array */
public double [ ] [ ] projToLatLon ( double [ ] [ ] from , double [ ] [ ] to ) { } }

implementation: if ( ( from == null ) || ( from . length != 2 ) ) { throw new IllegalArgumentException ( "ProjectionImpl.projToLatLon:" + "null array argument or wrong dimension (from)" ) ; } if ( ( to == null ) || ( to . length != 2 ) ) { throw new IllegalArgumentException ( "ProjectionImpl.projToLatLon:" + "null array argument or wrong dimension (to)" ) ; } if ( from [ 0 ] . length != to [ 0 ] . length ) { throw new IllegalArgumentException ( "ProjectionImpl.projToLatLon:" + "from array not same length as to array" ) ; } for ( int i = 0 ; i < from [ 0 ] . length ; i ++ ) { LatLonPoint endL = projToLatLon ( from [ 0 ] [ i ] , from [ 1 ] [ i ] ) ; to [ 0 ] [ i ] = endL . getLatitude ( ) ; to [ 1 ] [ i ] = endL . getLongitude ( ) ; } return to ;


signature:
public class ProjectionImpl { /** * Convert projection coordinates to lat / lon coordinate .
 * @ param from array of projection coordinates : from [ 2 ] [ n ] , where
 * ( from [ 0 ] [ i ] , from [ 1 ] [ i ] ) is the ( x , y ) coordinate
 * of the ith point
 * @ param to resulting array of lat / lon coordinates : to [ 2 ] [ n ] where
 * ( to [ 0 ] [ i ] , to [ 1 ] [ i ] ) is the ( lat , lon ) coordinate of
 * the ith point
 * @ return the " to " array */
public float [ ] [ ] projToLatLon ( float [ ] [ ] from , float [ ] [ ] to ) { } }

implementation: if ( ( from == null ) || ( from . length != 2 ) ) { throw new IllegalArgumentException ( "ProjectionImpl.projToLatLon:" + "null array argument or wrong dimension (from)" ) ; } if ( ( to == null ) || ( to . length != 2 ) ) { throw new IllegalArgumentException ( "ProjectionImpl.projToLatLon:" + "null array argument or wrong dimension (to)" ) ; } if ( from [ 0 ] . length != to [ 0 ] . length ) { throw new IllegalArgumentException ( "ProjectionImpl.projToLatLon:" + "from array not same length as to array" ) ; } ProjectionPointImpl ppi = new ProjectionPointImpl ( ) ; LatLonPointImpl llpi = new LatLonPointImpl ( ) ; for ( int i = 0 ; i < from [ 0 ] . length ; i ++ ) { ppi . setLocation ( ( double ) from [ 0 ] [ i ] , ( double ) from [ 1 ] [ i ] ) ; projToLatLon ( ppi , llpi ) ; to [ 0 ] [ i ] = ( float ) llpi . getLatitude ( ) ; to [ 1 ] [ i ] = ( float ) llpi . getLongitude ( ) ; } return to ;


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

implementation: return latLonToProj ( from , new float [ 2 ] [ from [ 0 ] . length ] , latIndex , lonIndex ) ;


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

implementation:
// ucar . unidata . util . Misc . printStack ( " latLonToProj - " + this + " size = " + from [ 0 ] . length , 4 , null ) ;
if ( ( from == null ) || ( from . length != 2 ) ) { throw new IllegalArgumentException ( "ProjectionImpl.latLonToProj:" + "null array argument or wrong dimension (from)" ) ; } if ( ( to == null ) || ( to . length != 2 ) ) { throw new IllegalArgumentException ( "ProjectionImpl.latLonToProj:" + "null array argument or wrong dimension (to)" ) ; } if ( from [ 0 ] . length != to [ 0 ] . length ) { throw new IllegalArgumentException ( "ProjectionImpl.latLonToProj:" + "from array not same length as to array" ) ; } ProjectionPointImpl ppi = new ProjectionPointImpl ( ) ; LatLonPointImpl llpi = new LatLonPointImpl ( ) ; for ( int i = 0 ; i < from [ 0 ] . length ; i ++ ) { llpi . setLatitude ( from [ latIndex ] [ i ] ) ; llpi . setLongitude ( from [ lonIndex ] [ i ] ) ; latLonToProj ( llpi , ppi ) ; to [ 0 ] [ i ] = ( float ) ppi . getX ( ) ; to [ 1 ] [ i ] = ( float ) ppi . getY ( ) ; } return to ;


signature:
public class ProjectionImpl { /** * Alternate way to calculate latLonToProjBB , originally in GridCoordSys .
 * Difficult to do this in a general way .
 * @ param latlonRect desired lat / lon rectangle
 * @ return a ProjectionRect */
ProjectionRect latLonToProjBB2 ( LatLonRect latlonRect ) { } }

implementation: double minx , maxx , miny , maxy ; LatLonPointImpl llpt = latlonRect . getLowerLeftPoint ( ) ; LatLonPointImpl urpt = latlonRect . getUpperRightPoint ( ) ; LatLonPointImpl lrpt = latlonRect . getLowerRightPoint ( ) ; LatLonPointImpl ulpt = latlonRect . getUpperLeftPoint ( ) ; if ( isLatLon ( ) ) { minx = getMinOrMaxLon ( llpt . getLongitude ( ) , ulpt . getLongitude ( ) , true ) ; miny = Math . min ( llpt . getLatitude ( ) , lrpt . getLatitude ( ) ) ; maxx = getMinOrMaxLon ( urpt . getLongitude ( ) , lrpt . getLongitude ( ) , false ) ; maxy = Math . min ( ulpt . getLatitude ( ) , urpt . getLatitude ( ) ) ; } else { ProjectionPoint ll = latLonToProj ( llpt , new ProjectionPointImpl ( ) ) ; ProjectionPoint ur = latLonToProj ( urpt , new ProjectionPointImpl ( ) ) ; ProjectionPoint lr = latLonToProj ( lrpt , new ProjectionPointImpl ( ) ) ; ProjectionPoint ul = latLonToProj ( ulpt , new ProjectionPointImpl ( ) ) ; minx = Math . min ( ll . getX ( ) , ul . getX ( ) ) ; miny = Math . min ( ll . getY ( ) , lr . getY ( ) ) ; maxx = Math . max ( ur . getX ( ) , lr . getX ( ) ) ; maxy = Math . max ( ul . getY ( ) , ur . getY ( ) ) ; } return new ProjectionRect ( minx , miny , maxx , maxy ) ;


signature:
public class ProjectionImpl { /** * Convert a lat / lon bounding box to a world coordinate bounding box ,
 * by finding the minimum enclosing box .
 * Handles lat / lon points that do not intersect the projection panel .
 * @ param latlonRect input lat , lon bounding box
 * @ return minimum enclosing box in world coordinates , or null if no part of the LatLonRect intersects the projection plane */
public ProjectionRect latLonToProjBB ( LatLonRect latlonRect ) { } }

implementation:
if ( isLatLon ) { LatLonProjection llp = ( LatLonProjection ) this ; llp . setCenterLon ( latlonRect . getCenterLon ( ) ) ; // LOOK side effect BAD ! !
} ProjectionPointImpl w1 = new ProjectionPointImpl ( ) ; ProjectionPointImpl w2 = new ProjectionPointImpl ( ) ; LatLonPoint ll = latlonRect . getLowerLeftPoint ( ) ; LatLonPoint ur = latlonRect . getUpperRightPoint ( ) ; latLonToProj ( ll , w1 ) ; latLonToProj ( ur , w2 ) ; // if ( ! isLatLon & & crossSeam ( w1 , w2 ) ) {
// log . warn ( " CROSS SEAM failure = " + w1 + " " + w2 + " for " + this , new Throwable ( ) ) ;
// make bounding box out of those two corners
ProjectionRect world = new ProjectionRect ( w1 . getX ( ) , w1 . getY ( ) , w2 . getX ( ) , w2 . getY ( ) ) ; LatLonPointImpl la = new LatLonPointImpl ( ) ; LatLonPointImpl lb = new LatLonPointImpl ( ) ; // now extend if needed to the other two corners
la . setLatitude ( ur . getLatitude ( ) ) ; la . setLongitude ( ll . getLongitude ( ) ) ; latLonToProj ( la , w1 ) ; world . add ( w1 ) ; lb . setLatitude ( ll . getLatitude ( ) ) ; lb . setLongitude ( ur . getLongitude ( ) ) ; latLonToProj ( lb , w2 ) ; world . add ( w2 ) ; return world ;


signature:
public class ProjectionImpl { /** * Convert a world coordinate bounding box to a lat / lon bounding box ,
 * by finding the minimum enclosing box .
 * @ param world input world coordinate bounding box
 * @ return minimum enclosing box in lat , lon coordinates . */
public LatLonRect projToLatLonBBold ( ProjectionRect world ) { } }

implementation:
// System . out . println ( " world = " + world ) ;
ProjectionPoint min = world . getMinPoint ( ) ; ProjectionPoint max = world . getMaxPoint ( ) ; // System . out . println ( " min = " + min ) ;
// System . out . println ( " max = " + max ) ;
LatLonRect llbb ; LatLonPointImpl llmin = new LatLonPointImpl ( ) ; LatLonPointImpl llmax = new LatLonPointImpl ( ) ; // make bounding box out of the min , max corners
projToLatLon ( min , llmin ) ; projToLatLon ( max , llmax ) ; llbb = new LatLonRect ( llmin , llmax ) ; // System . out . println ( " llbb = " + llbb ) ;
/* double lona = la . getLongitude ( ) ;
 double lonb = lb . getLongitude ( ) ;
 if ( ( ( lona < lonb ) & & ( lonb - lona < = 180.0 ) )
 | | ( ( lona > lonb ) & & ( lona - lonb > = 180.0 ) ) ) {
 llbb = new LatLonRect ( la , lb ) ;
 } else {
 llbb = new LatLonRect ( lb , la ) ; */
ProjectionPointImpl w1 = new ProjectionPointImpl ( ) ; ProjectionPointImpl w2 = new ProjectionPointImpl ( ) ; // now extend if needed using the other two corners
w1 . setLocation ( min . getX ( ) , max . getY ( ) ) ; projToLatLon ( w1 , llmin ) ; llbb . extend ( llmin ) ; w2 . setLocation ( max . getX ( ) , min . getY ( ) ) ; projToLatLon ( w2 , llmax ) ; llbb . extend ( llmax ) ; return llbb ;


signature:
public class ProjectionImpl { /** * Compute lat / lon bounding box from projection bounding box by finding the minimum enclosing box .
 * @ param bb projection bounding box
 * @ return lat , lon bounding box . */
public LatLonRect projToLatLonBB ( ProjectionRect bb ) { } }

implementation:
// look at all 4 corners of the bounding box
LatLonPoint llpt = projToLatLon ( bb . getLowerLeftPoint ( ) , new LatLonPointImpl ( ) ) ; LatLonPoint lrpt = projToLatLon ( bb . getLowerRightPoint ( ) , new LatLonPointImpl ( ) ) ; LatLonPoint urpt = projToLatLon ( bb . getUpperRightPoint ( ) , new LatLonPointImpl ( ) ) ; LatLonPoint ulpt = projToLatLon ( bb . getUpperLeftPoint ( ) , new LatLonPointImpl ( ) ) ; // Check if grid contains poles .
boolean includesNorthPole = false ; /* int [ ] resultNP ;
 findXYindexFromLatLon ( 90.0 , 0 , resultNP ) ;
 if ( resultNP [ 0 ] ! = - 1 & & resultNP [ 1 ] ! = - 1)
 includesNorthPole = true ; */
boolean includesSouthPole = false ; /* int [ ] resultSP = new int [ 2 ] ;
 findXYindexFromLatLon ( - 90.0 , 0 , resultSP ) ;
 if ( resultSP [ 0 ] ! = - 1 & & resultSP [ 1 ] ! = - 1)
 includesSouthPole = true ; */
LatLonRect llbb ; if ( includesNorthPole && ! includesSouthPole ) { llbb = new LatLonRect ( llpt , new LatLonPointImpl ( 90.0 , 0.0 ) ) ; // ? ? ? lon = ? ? ?
llbb . extend ( lrpt ) ; llbb . extend ( urpt ) ; llbb . extend ( ulpt ) ; // OR
// llbb . extend ( new LatLonRect ( llpt , lrpt ) ) ;
// llbb . extend ( new LatLonRect ( lrpt , urpt ) ) ;
// llbb . extend ( new LatLonRect ( urpt , ulpt ) ) ;
// llbb . extend ( new LatLonRect ( ulpt , llpt ) ) ;
} else if ( includesSouthPole && ! includesNorthPole ) { llbb = new LatLonRect ( llpt , new LatLonPointImpl ( - 90.0 , - 180.0 ) ) ; // ? ? ? lon = ? ? ?
llbb . extend ( lrpt ) ; llbb . extend ( urpt ) ; llbb . extend ( ulpt ) ; } else { double latMin = Math . min ( llpt . getLatitude ( ) , lrpt . getLatitude ( ) ) ; double latMax = Math . max ( ulpt . getLatitude ( ) , urpt . getLatitude ( ) ) ; // longitude is a bit tricky as usual
double lonMin = getMinOrMaxLon ( llpt . getLongitude ( ) , ulpt . getLongitude ( ) , true ) ; double lonMax = getMinOrMaxLon ( lrpt . getLongitude ( ) , urpt . getLongitude ( ) , false ) ; LatLonPointImpl min = new LatLonPointImpl ( latMin , lonMin ) ; LatLonPointImpl max = new LatLonPointImpl ( latMax , lonMax ) ; llbb = new LatLonRect ( min , max ) ; } return llbb ;


signature:
public class MapMath { /** * For negative angles , d should be negative , m & s positive . */
public static double dmsToRad ( double d , double m , double s ) { } }


signature:
public class MapMath { /** * For negative angles , d should be negative , m & s positive . */
public static double dmsToDeg ( double d , double m , double s ) { } }


signature:
public class MapMath { /** * public static void latLongToXYZ ( ProjectionPoint ll , Point3D xyz ) {
 * double c = Math . cos ( ll . y ) ;
 * xyz . x = c * Math . cos ( ll . x ) ;
 * xyz . y = c * Math . sin ( ll . x ) ;
 * xyz . z = Math . sin ( ll . y ) ;
 * public static void xyzToLatLong ( Point3D xyz , ProjectionPoint ll ) {
 * ll . y = MapMath . asin ( xyz . z ) ;
 * ll . x = MapMath . atan2 ( xyz . y , xyz . x ) ; */
public static double greatCircleDistance ( double lon1 , double lat1 , double lon2 , double lat2 ) { } }

implementation: double dlat = Math . sin ( ( lat2 - lat1 ) / 2 ) ; double dlon = Math . sin ( ( lon2 - lon1 ) / 2 ) ; double r = Math . sqrt ( dlat * dlat + Math . cos ( lat1 ) * Math . cos ( lat2 ) * dlon * dlon ) ; return 2.0 * Math . asin ( r ) ;


signature:
public class MapMath { /** * Java translation of " Nice Numbers for Graph Labels "
 * by Paul Heckbert
 * from " Graphics Gems " , Academic Press , 1990 */
public static double niceNumber ( double x , boolean round ) { } }

implementation:
int expv ; /* exponent of x */
double f ; /* fractional part of x */
double nf ; /* nice , rounded fraction */
expv = ( int ) Math . floor ( Math . log ( x ) / Math . log ( 10 ) ) ; f = x / Math . pow ( 10. , expv ) ; /* between 1 and 10 */
if ( round ) { if ( f < 1.5 ) nf = 1. ; else if ( f < 3. ) nf = 2. ; else if ( f < 7. ) nf = 5. ; else nf = 10. ; } else if ( f <= 1. ) nf = 1. ; else if ( f <= 2. ) nf = 2. ; else if ( f <= 5. ) nf = 5. ; else nf = 10. ; return nf * Math . pow ( 10. , expv ) ;


signature:
public class Grib1Customizer { /** * shared by all instances */
protected VertCoordType getLevelType ( int code ) { } }

implementation: VertCoordType result = wmoTable3 . get ( code ) ; if ( result == null ) result = new VertCoordType ( code , "unknownLayer" + code , null , "unknownLayer" + code , null , false , false ) ; return result ;


signature:
public class CF1Convention { /** * Get which CF version this is , ie CF - 1 . x
 * @ param hasConvName extract from convention name or list of names
 * @ return version , or - 1 if not CF */
public static int getVersion ( String hasConvName ) { } }

implementation: int result = extractVersion ( hasConvName ) ; if ( result >= 0 ) return result ; List < String > names = breakupConventionNames ( hasConvName ) ; for ( String name : names ) { result = extractVersion ( name ) ; if ( result >= 0 ) return result ; } return - 1 ;


signature:
public class CF1Convention { /** * Guess the value of ZisPositive based on z axis name and units
 * @ param zaxisName z coordinate axis name
 * @ param vertCoordUnits z coordinate axis name
 * @ return CF . POSITIVE _ UP or CF . POSITIVE _ DOWN */
public static String getZisPositive ( String zaxisName , String vertCoordUnits ) { } }

implementation:
if ( vertCoordUnits == null ) return CF . POSITIVE_UP ; if ( vertCoordUnits . isEmpty ( ) ) return CF . POSITIVE_UP ; if ( SimpleUnit . isCompatible ( "millibar" , vertCoordUnits ) ) return CF . POSITIVE_DOWN ; if ( SimpleUnit . isCompatible ( "m" , vertCoordUnits ) ) return CF . POSITIVE_UP ; // dunno - make it up
return CF . POSITIVE_UP ;


signature:
public class CF1Convention { /** * this is here because it doesnt fit into the 3D array thing . */
private void makeAtmLnCoordinate ( NetcdfDataset ds , Variable v ) { } }

implementation:
// get the formula attribute
String formula = ds . findAttValueIgnoreCase ( v , CF . formula_terms , null ) ; if ( null == formula ) { String msg = " Need attribute 'formula_terms' on Variable " + v . getFullName ( ) + "\n" ; parseInfo . format ( msg ) ; userAdvice . format ( msg ) ; return ; } // parse the formula string
Variable p0Var = null , levelVar = null ; StringTokenizer stoke = new StringTokenizer ( formula , " :" ) ; while ( stoke . hasMoreTokens ( ) ) { String toke = stoke . nextToken ( ) ; if ( toke . equalsIgnoreCase ( "p0" ) ) { String name = stoke . nextToken ( ) ; p0Var = ds . findVariable ( name ) ; } else if ( toke . equalsIgnoreCase ( "lev" ) ) { String name = stoke . nextToken ( ) ; levelVar = ds . findVariable ( name ) ; } } if ( null == p0Var ) { String msg = " Need p0:varName on Variable " + v . getFullName ( ) + " formula_terms\n" ; parseInfo . format ( msg ) ; userAdvice . format ( msg ) ; return ; } if ( null == levelVar ) { String msg = " Need lev:varName on Variable " + v . getFullName ( ) + " formula_terms\n" ; parseInfo . format ( msg ) ; userAdvice . format ( msg ) ; return ; } String units = ds . findAttValueIgnoreCase ( p0Var , CDM . UNITS , "hPa" ) ; // create the data and the variable
try { // p ( k ) = p0 * exp ( - lev ( k ) )
double p0 = p0Var . readScalarDouble ( ) ; Array levelData = levelVar . read ( ) ; Array pressureData = Array . factory ( DataType . DOUBLE , levelData . getShape ( ) ) ; IndexIterator ii = levelData . getIndexIterator ( ) ; IndexIterator iip = pressureData . getIndexIterator ( ) ; while ( ii . hasNext ( ) ) { double val = p0 * Math . exp ( - 1.0 * ii . getDoubleNext ( ) ) ; iip . setDoubleNext ( val ) ; } CoordinateAxis1D p = new CoordinateAxis1D ( ds , null , v . getShortName ( ) + "_pressure" , DataType . DOUBLE , levelVar . getDimensionsString ( ) , units , "Vertical Pressure coordinate synthesized from atmosphere_ln_pressure_coordinate formula" ) ; p . setCachedData ( pressureData , false ) ; p . addAttribute ( new Attribute ( _Coordinate . AxisType , AxisType . Pressure . toString ( ) ) ) ; p . addAttribute ( new Attribute ( _Coordinate . AliasForDimension , p . getDimensionsString ( ) ) ) ; ds . addVariable ( null , p ) ; parseInfo . format ( " added Vertical Pressure coordinate %s from CF-1 %s%n" , p . getFullName ( ) , CF . atmosphere_ln_pressure_coordinate ) ; } catch ( IOException e ) { String msg = " Unable to read variables from " + v . getFullName ( ) + " formula_terms\n" ; parseInfo . format ( msg ) ; userAdvice . format ( msg ) ; }


signature:
public class CF1Convention { /** * Augment COARDS axis type identification with Standard names ( including dimensionless vertical coordinates ) and CF . AXIS attributes */
protected AxisType getAxisType ( NetcdfDataset ncDataset , VariableEnhanced v ) { } }

implementation:
// standard names for unitless vertical coords
String sname = ncDataset . findAttValueIgnoreCase ( ( Variable ) v , CF . STANDARD_NAME , null ) ; if ( sname != null ) { sname = sname . trim ( ) ; for ( String vertical_coord : vertical_coords ) if ( sname . equalsIgnoreCase ( vertical_coord ) ) return AxisType . GeoZ ; } // COARDS - check units
AxisType at = super . getAxisType ( ncDataset , v ) ; if ( at != null ) return at ; // standard names for X , Y : bug in CDO putting wrong standard name , so check units first ( ! )
if ( sname != null ) { if ( sname . equalsIgnoreCase ( CF . ENSEMBLE ) ) return AxisType . Ensemble ; if ( sname . equalsIgnoreCase ( CF . LATITUDE ) ) return AxisType . Lat ; if ( sname . equalsIgnoreCase ( CF . LONGITUDE ) ) return AxisType . Lon ; if ( sname . equalsIgnoreCase ( CF . PROJECTION_X_COORDINATE ) || sname . equalsIgnoreCase ( CF . GRID_LONGITUDE ) || sname . equalsIgnoreCase ( "rotated_longitude" ) ) return AxisType . GeoX ; if ( sname . equalsIgnoreCase ( CF . PROJECTION_Y_COORDINATE ) || sname . equalsIgnoreCase ( CF . GRID_LATITUDE ) || sname . equalsIgnoreCase ( "rotated_latitude" ) ) return AxisType . GeoY ; if ( sname . equalsIgnoreCase ( CF . TIME_REFERENCE ) ) return AxisType . RunTime ; if ( sname . equalsIgnoreCase ( CF . TIME_OFFSET ) ) return AxisType . TimeOffset ; } // check axis attribute - only for X , Y , Z
String axis = ncDataset . findAttValueIgnoreCase ( ( Variable ) v , CF . AXIS , null ) ; if ( axis != null ) { axis = axis . trim ( ) ; String unit = v . getUnitsString ( ) ; if ( axis . equalsIgnoreCase ( "X" ) ) { if ( SimpleUnit . isCompatible ( "m" , unit ) ) return AxisType . GeoX ; } else if ( axis . equalsIgnoreCase ( "Y" ) ) { if ( SimpleUnit . isCompatible ( "m" , unit ) ) return AxisType . GeoY ; } else if ( axis . equalsIgnoreCase ( "Z" ) ) { if ( unit == null ) return AxisType . GeoZ ; if ( SimpleUnit . isCompatible ( "m" , unit ) ) return AxisType . Height ; else if ( SimpleUnit . isCompatible ( "mbar" , unit ) ) return AxisType . Pressure ; else return AxisType . GeoZ ; } } if ( avhrr_oiv2 ) { if ( v . getShortName ( ) . equals ( "zlev" ) ) return AxisType . Height ; } try { String units = v . getUnitsString ( ) ; CalendarDateUnit cd = CalendarDateUnit . of ( null , units ) ; if ( cd != null ) return AxisType . Time ; } catch ( Throwable t ) { // ignore
} return null ;


signature:
public class ImageFactoryRandom { /** * remove last file */
public boolean delete ( ) { } }

implementation: if ( nextFile == null ) return false ; fileList . remove ( nextFile ) ; File f = new File ( "C:/tmp/deleted/" + nextFile . getName ( ) ) ; return nextFile . renameTo ( f ) ;


signature:
public class CoverageRenderer { /** * / * set the Grid */
public DataState setCoverage ( CoverageCollection coverageDataset , Coverage grid ) { } }

implementation: this . dataState = new DataState ( coverageDataset , grid ) ; this . lastGrid = null ; isNewField = true ; return this . dataState ;


signature:
public class CoverageRenderer { /** * Get the data value at this projection ( x , y ) point .
 * @ param loc : point in display projection coordinates ( plan view )
 * @ return String representation of value */
public String getXYvalueStr ( ProjectionPoint loc ) { } }

implementation:
if ( ( lastGrid == null ) || ( geodata == null ) ) return "" ; // convert to dataProjection , where x and y are orthogonal
if ( ! sameProjection ) { LatLonPoint llpt = drawProjection . projToLatLon ( loc ) ; loc = dataProjection . latLonToProj ( llpt ) ; } // find the grid indexes
HorizCoordSys hcs = lastGrid . getCoordSys ( ) . getHorizCoordSys ( ) ; Optional < HorizCoordSys . CoordReturn > opt = hcs . findXYindexFromCoord ( loc . getX ( ) , loc . getY ( ) ) ; // get value , construct the string
if ( ! opt . isPresent ( ) ) return opt . getErrorMessage ( ) ; else { HorizCoordSys . CoordReturn cr = opt . get ( ) ; try { Index imaH = geodata . getIndex ( ) ; double dataValue = geodata . getDouble ( imaH . set ( cr . y , cr . x ) ) ; // int wantz = ( geocs . getZAxis ( ) = = null ) ? - 1 : lastLevel ;
return makeXYZvalueStr ( dataValue , cr ) ; } catch ( Exception e ) { return "error " + cr . x + " " + cr . y ; } }


signature:
public class CoverageRenderer { /** * / * get an x , y , z data volume for the given time
 * private void makeDataVolume ( GridDatatype g , int time ) {
 * try {
 * dataVolume = g . readVolumeData ( time ) ;
 * } catch ( java . io . IOException e ) {
 * System . out . println ( " Error reading netcdf file " + e ) ;
 * dataVolume = null ;
 * lastGrid = g ;
 * lastTime = time ;
 * lastLevel = - 1 ; / / invalidate
 * lastSlice = - 1 ; / / invalidate
 * dataVolumeChanged = true ; */
private GeoReferencedArray readHSlice ( int level , int time , int ensemble , int runtime ) { } }

implementation:
/* make sure x , y exists
 CoverageCS gcs = useG . getCoordinateSystem ( ) ;
 CoordinateAxis xaxis = gcs . getXHorizAxis ( ) ;
 CoordinateAxis yaxis = gcs . getYHorizAxis ( ) ;
 if ( ( xaxis = = null ) | | ( yaxis = = null ) ) / / doesnt exist
 return null ;
 if ( ( xaxis . getSize ( ) < = 1 ) | | ( yaxis . getSize ( ) < = 1 ) ) / / LOOK ? ?
 return null ; */
// make sure we need new one
if ( dataState . grid . equals ( lastGrid ) && ( time == lastTime ) && ( level == lastLevel ) && ( horizStride == lastStride ) && ( ensemble == lastEnsemble ) && ( runtime == lastRunTime ) ) return dataH ; // nothing changed
// get the data slice
// dataH = useG . readDataSlice ( runtime , ensemble , time , level , - 1 , - 1 ) ;
SubsetParams subset = new SubsetParams ( ) ; if ( level >= 0 && dataState . zaxis != null ) { double levelVal = dataState . zaxis . getCoordMidpoint ( level ) ; subset . set ( SubsetParams . vertCoord , levelVal ) ; } if ( time >= 0 && dataState . taxis != null ) { double timeVal = dataState . taxis . getCoordMidpoint ( time ) ; CalendarDate date = dataState . taxis . makeDate ( timeVal ) ; subset . set ( SubsetParams . time , date ) ; } if ( runtime >= 0 && dataState . rtaxis != null ) { double rtimeVal = dataState . rtaxis . getCoordMidpoint ( runtime ) ; CalendarDate date = dataState . rtaxis . makeDate ( rtimeVal ) ; subset . set ( SubsetParams . runtime , date ) ; } if ( ensemble >= 0 && dataState . ensaxis != null ) { double ensVal = dataState . ensaxis . getCoordMidpoint ( ensemble ) ; subset . set ( SubsetParams . ensCoord , ensVal ) ; } if ( horizStride != 1 ) subset . setHorizStride ( horizStride ) ; try { dataH = dataState . grid . readData ( subset ) ; geodata = dataH . getData ( ) . reduce ( ) ; // get rid of n = 1 dimensions
} catch ( IOException | InvalidRangeException e ) { e . printStackTrace ( ) ; } lastGrid = dataState . grid ; lastTime = time ; lastLevel = level ; lastEnsemble = ensemble ; lastRunTime = runtime ; lastStride = horizStride ; /* CoordinateAxis1D zaxis = gcs . getVerticalAxis ( ) ;
 if ( ( zaxis = = null ) | | ( zaxis . getSize ( ) < 1 ) ) {
 dataH = dataVolume ; / / volume is xy plane
 } else {
 dataH = dataVolume . slice ( 0 , level ) ; / / if z exists , always first ( logical ) dimension
 if ( debugArrayShape ) {
 System . out . println ( " Horiz shape = " ) ;
 for ( int i = 0 ; i < dataH . getRank ( ) ; i + + )
 System . out . println ( " shape = " + dataH . getShape ( ) [ i ] ) ; */
return dataH ;


signature:
public class CoverageRenderer { /** * set colorscale limits , missing data */
private void setColorScaleParams ( ) { } }

implementation:
if ( dataMinMaxType == ColorScale . MinMaxType . hold && ! isNewField ) return ; isNewField = false ; GeoReferencedArray dataArr = readHSlice ( wantLevel , wantTime , wantEnsemble , wantRunTime ) ; // else
// dataArr = makeVSlice ( stridedGrid , wantSlice , wantTime , wantEnsemble , wantRunTime ) ;
if ( dataArr != null ) { MAMath . MinMax minmax = MAMath . getMinMaxSkipMissingData ( dataArr . getData ( ) , dataState . grid ) ; colorScale . setMinMax ( minmax . min , minmax . max ) ; colorScale . setGeoGrid ( dataState . grid ) ; }


signature:
public class CoverageRenderer { /** * Do the rendering to the given Graphics2D object .
 * @ param g Graphics2D object : has clipRect and AffineTransform set .
 * @ param dFromN transforms " Normalized Device " to Device coordinates */
public void renderPlanView ( java . awt . Graphics2D g , AffineTransform dFromN ) { } }

implementation:
if ( ( dataState . grid == null ) || ( colorScale == null ) || ( drawProjection == null ) ) return ; if ( ! drawGrid && ! drawContours ) return ; // no anitaliasing
g . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_OFF ) ; dataH = readHSlice ( wantLevel , wantTime , wantEnsemble , wantRunTime ) ; if ( dataH == null ) return ; setColorScaleParams ( ) ; if ( drawGrid ) drawGridHoriz ( g , dataH ) ; // if ( drawContours )
// drawContours ( g , dataH . transpose ( 0 , 1 ) , dFromN ) ;
if ( drawGridLines ) drawGridLines ( g , dataH ) ; if ( drawBB ) drawGridBB ( g , this . dataState . coverageDataset . getLatlonBoundingBox ( ) ) ;


signature:
public class CoverageRenderer { /** * / * draw using GeneralPath shape
 * private GeneralPath gp = new GeneralPath ( GeneralPath . WIND _ EVEN _ ODD , 5 ) ;
 * private Shape makeShape ( double lon1 , double lat1 , double lon2 , double lat2 ) {
 * gp . reset ( ) ;
 * ProjectionPoint pt = drawProjection . latLonToProj ( lat1 , lon1 ) ;
 * gp . moveTo ( ( float ) pt . getX ( ) , ( float ) pt . getY ( ) ) ;
 * ptP1 . setLocation ( pt ) ;
 * pt = drawProjection . latLonToProj ( lat1 , lon2 ) ;
 * gp . lineTo ( ( float ) pt . getX ( ) , ( float ) pt . getY ( ) ) ;
 * if ( drawProjection . crossSeam ( ptP1 , pt ) )
 * return null ;
 * ptP1 . setLocation ( pt ) ;
 * pt = drawProjection . latLonToProj ( lat2 , lon2 ) ;
 * gp . lineTo ( ( float ) pt . getX ( ) , ( float ) pt . getY ( ) ) ;
 * if ( drawProjection . crossSeam ( ptP1 , pt ) )
 * return null ;
 * ptP1 . setLocation ( pt ) ;
 * pt = drawProjection . latLonToProj ( lat2 , lon1 ) ;
 * gp . lineTo ( ( float ) pt . getX ( ) , ( float ) pt . getY ( ) ) ;
 * if ( drawProjection . crossSeam ( ptP1 , pt ) )
 * return null ;
 * return gp ; */
private void drawGridHorizRegular ( java . awt . Graphics2D g , GeoReferencedArray array ) { } }

implementation:
int count = 0 ; CoverageCoordSys gsys = array . getCoordSysForData ( ) ; CoverageCoordAxis1D xaxis = ( CoverageCoordAxis1D ) gsys . getXAxis ( ) ; CoverageCoordAxis1D yaxis = ( CoverageCoordAxis1D ) gsys . getYAxis ( ) ; Array data = array . getData ( ) . reduce ( ) ; if ( data . getRank ( ) != 2 ) { System . out . printf ( "drawGridHorizRegular Rank equals %d, must be 2%n" , data . getRank ( ) ) ; return ; } int nx = xaxis . getNcoords ( ) ; int ny = yaxis . getNcoords ( ) ; // / / drawing optimizations
sameProjection = drawProjection . equals ( dataProjection ) ; if ( drawProjection . isLatLon ( ) ) { projectll = ( LatLonProjection ) drawProjection ; double centerLon = projectll . getCenterLon ( ) ; if ( Debug . isSet ( "projection/LatLonShift" ) ) System . out . println ( "projection/LatLonShift: gridDraw = " + centerLon ) ; } // find the most common color and fill the entire area with it
colorScale . resetHist ( ) ; IndexIterator iiter = array . getData ( ) . getIndexIterator ( ) ; while ( iiter . hasNext ( ) ) { double val = iiter . getDoubleNext ( ) ; colorScale . getIndexFromValue ( val ) ; // accum in histogram
} int modeColor = colorScale . getHistMax ( ) ; if ( debugMiss ) System . out . println ( "mode = " + modeColor + " sameProj= " + sameProjection ) ; if ( sameProjection ) { double xmin = Math . min ( xaxis . getCoordEdge1 ( 0 ) , xaxis . getCoordEdgeLast ( ) ) ; double xmax = Math . max ( xaxis . getCoordEdge1 ( 0 ) , xaxis . getCoordEdgeLast ( ) ) ; double ymin = Math . min ( yaxis . getCoordEdge1 ( 0 ) , yaxis . getCoordEdgeLast ( ) ) ; double ymax = Math . max ( yaxis . getCoordEdge1 ( 0 ) , yaxis . getCoordEdgeLast ( ) ) ; // pre color the drawing area with the most used color
count += drawRect ( g , modeColor , xmin , ymin , xmax , ymax , drawProjection . isLatLon ( ) ) ; } else if ( useModeForProjections ) drawPathShape ( g , modeColor , xaxis , yaxis ) ; debugPts = Debug . isSet ( "GridRenderer/showPts" ) ; // draw individual rects with run length
Index imaH = data . getIndex ( ) ; for ( int y = 0 ; y < ny ; y ++ ) { double ybeg = yaxis . getCoordEdge1 ( y ) ; double yend = yaxis . getCoordEdge2 ( y ) ; int thisColor , lastColor = 0 ; int run = 0 ; int xbeg = 0 ; for ( int x = 0 ; x < nx ; x ++ ) { double val = data . getDouble ( imaH . set ( y , x ) ) ; thisColor = colorScale . getIndexFromValue ( val ) ; if ( ( run == 0 ) || ( lastColor == thisColor ) ) { // same color - keep running
run ++ ; } else { if ( sameProjection ) { if ( lastColor != modeColor ) // dont have to draw these
count += drawRect ( g , lastColor , xaxis . getCoordEdge1 ( xbeg ) , ybeg , xaxis . getCoordEdge2 ( x ) , yend , drawProjection . isLatLon ( ) ) ; } else { if ( ! useModeForProjections || ( lastColor != modeColor ) ) // dont have to draw mode
count += drawPathRun ( g , lastColor , ybeg , yend , xaxis , xbeg , x - 1 , debugPts ) ; } xbeg = x ; } lastColor = thisColor ; } // get the ones at the end
if ( sameProjection ) { if ( lastColor != modeColor ) count += drawRect ( g , lastColor , xaxis . getCoordEdge1 ( xbeg ) , ybeg , xaxis . getCoordEdgeLast ( ) , yend , drawProjection . isLatLon ( ) ) ; } else { if ( ! useModeForProjections || ( lastColor != modeColor ) ) count += drawPathRun ( g , lastColor , ybeg , yend , xaxis , xbeg , nx - 1 , false ) ; // needed ?
} // if ( debugPts ) break ;
} if ( debugHorizDraw ) System . out . println ( "debugHorizDraw = " + count ) ;


signature:
public class H5Group { /** * is this a child of that ? */
boolean isChildOf ( H5Group that ) { } }

implementation: if ( parent == null ) return false ; if ( parent == that ) return true ; return parent . isChildOf ( that ) ;


signature:
public class MessageType { /** * Find the MessageType that matches this name .
 * @ param name find DataTYpe with this name .
 * @ return DataType or null if no match . */
public static MessageType getType ( String name ) { } }

implementation: if ( name == null ) return null ; return hash . get ( name ) ;


signature:
public class HeaderMessage { /** * Read a message
 * @ param filePos at this filePos
 * @ param version header version
 * @ param creationOrderPresent true if bit2 of data object header flags is set
 * @ return number of bytes read
 * @ throws IOException of read error */
int read ( long filePos , int version , boolean creationOrderPresent , String objectName ) throws IOException { } }

implementation:
this . start = filePos ; raf . seek ( filePos ) ; if ( debugPos ) { log . debug ( "  --> Message Header starts at =" + raf . getFilePointer ( ) ) ; } if ( version == 1 ) { type = raf . readShort ( ) ; size = DataType . unsignedShortToInt ( raf . readShort ( ) ) ; headerMessageFlags = raf . readByte ( ) ; raf . skipBytes ( 3 ) ; header_length = 8 ; } else { type = ( short ) raf . readByte ( ) ; size = DataType . unsignedShortToInt ( raf . readShort ( ) ) ; // if ( size > Short . MAX _ VALUE )
// log . debug ( " HEY " ) ;
headerMessageFlags = raf . readByte ( ) ; header_length = 4 ; if ( creationOrderPresent ) { creationOrder = raf . readShort ( ) ; header_length += 2 ; } } mtype = MessageType . getType ( type ) ; if ( debug1 ) { log . debug ( "  -->" + mtype + " messageSize=" + size + " flags = " + Integer . toBinaryString ( headerMessageFlags ) ) ; if ( creationOrderPresent && debugCreationOrder ) { log . debug ( "     creationOrder = " + creationOrder ) ; } } if ( debugPos ) { log . debug ( "  --> Message Data starts at=" + raf . getFilePointer ( ) ) ; } if ( ( headerMessageFlags & 2 ) != 0 ) { // shared
messData = getSharedDataObject ( mtype ) . mdt ; // eg a shared datatype , eg enums
return header_length + size ; } if ( mtype == MessageType . NIL ) { // dont do nuttin
} else if ( mtype == MessageType . SimpleDataspace ) { MessageDataspace data = new MessageDataspace ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . GroupNew ) { MessageGroupNew data = new MessageGroupNew ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . Datatype ) { MessageDatatype data = new MessageDatatype ( ) ; data . read ( objectName ) ; messData = data ; } else if ( mtype == MessageType . FillValueOld ) { MessageFillValueOld data = new MessageFillValueOld ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . FillValue ) { MessageFillValue data = new MessageFillValue ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . Link ) { MessageLink data = new MessageLink ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . Layout ) { MessageLayout data = new MessageLayout ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . GroupInfo ) { // 10
MessageGroupInfo data = new MessageGroupInfo ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . FilterPipeline ) { // 11
MessageFilter data = new MessageFilter ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . Attribute ) { // 12
MessageAttribute data = new MessageAttribute ( ) ; data . read ( raf . getFilePointer ( ) ) ; messData = data ; } else if ( mtype == MessageType . Comment ) { // 13
MessageComment data = new MessageComment ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . LastModifiedOld ) { // 14
MessageLastModifiedOld data = new MessageLastModifiedOld ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . ObjectHeaderContinuation ) { // 16
MessageContinue data = new MessageContinue ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . Group ) { // 17
MessageGroup data = new MessageGroup ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . LastModified ) { // 18
MessageLastModified data = new MessageLastModified ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . AttributeInfo ) { // 21
MessageAttributeInfo data = new MessageAttributeInfo ( ) ; data . read ( ) ; messData = data ; } else if ( mtype == MessageType . ObjectReferenceCount ) { // 21
MessageObjectReferenceCount data = new MessageObjectReferenceCount ( ) ; data . read ( ) ; messData = data ; } else { log . debug ( "****UNPROCESSED MESSAGE type = " + mtype + " raw = " + type ) ; log . warn ( "SKIP UNPROCESSED MESSAGE type = " + mtype + " raw = " + type ) ; // throw new UnsupportedOperationException ( " * * * * UNPROCESSED MESSAGE type = " + mtype + " raw = " + type ) ;
} return header_length + size ;


signature:
public class HeaderMessage { /** * debugging */
public void showCompression ( Formatter f ) { } }

implementation: if ( mtype != H5header . MessageType . AttributeInfo ) { f . format ( "No fractal heap" ) ; return ; } MessageAttributeInfo info = ( MessageAttributeInfo ) messData ; info . showFractalHeap ( f ) ;


signature:
public class TableAligner { /** * Installs alignment decorators in all of the table ' s columns .
 * @ param table a table .
 * @ param alignment one of the following constants :
 * < ul >
 * < li > { @ link SwingConstants # LEFT } < / li >
 * < li > { @ link SwingConstants # CENTER } ( the default for image - only labels ) < / li >
 * < li > { @ link SwingConstants # RIGHT } < / li >
 * < li > { @ link SwingConstants # LEADING } ( the default for text - only labels ) < / li >
 * < li > { @ link SwingConstants # TRAILING } < / li >
 * < / ul > */
public static void installInAllColumns ( JTable table , int alignment ) { } }

implementation:
// We don ' t want to set up completely new cell renderers : rather , we want to use the existing ones but just
// change their alignment .
for ( int colViewIndex = 0 ; colViewIndex < table . getColumnCount ( ) ; ++ colViewIndex ) { installInOneColumn ( table , colViewIndex , alignment ) ; }


signature:
public class TableAligner { /** * Installs alignment decorators in the table column at { @ code colViewIndex } .
 * @ param table a table .
 * @ param colViewIndex the index of the column in the table < i > view < / i > .
 * @ param alignment one of the following constants :
 * < ul >
 * < li > { @ link SwingConstants # LEFT } < / li >
 * < li > { @ link SwingConstants # CENTER } ( the default for image - only labels ) < / li >
 * < li > { @ link SwingConstants # RIGHT } < / li >
 * < li > { @ link SwingConstants # LEADING } ( the default for text - only labels ) < / li >
 * < li > { @ link SwingConstants # TRAILING } < / li >
 * < / ul > */
public static void installInOneColumn ( JTable table , int colViewIndex , int alignment ) { } }

implementation:
TableColumn tableColumn = table . getColumnModel ( ) . getColumn ( colViewIndex ) ; TableCellRenderer headerRenderer = tableColumn . getHeaderRenderer ( ) ; if ( headerRenderer == null ) { headerRenderer = table . getTableHeader ( ) . getDefaultRenderer ( ) ; } if ( ! ( headerRenderer instanceof RendererAlignmentDecorator ) ) { // Don ' t install a redundant decorator .
tableColumn . setHeaderRenderer ( new RendererAlignmentDecorator ( headerRenderer , alignment ) ) ; } TableCellRenderer cellRenderer = tableColumn . getCellRenderer ( ) ; if ( cellRenderer == null ) { cellRenderer = table . getDefaultRenderer ( table . getColumnClass ( colViewIndex ) ) ; } if ( ! ( cellRenderer instanceof RendererAlignmentDecorator ) ) { // Don ' t install a redundant decorator .
tableColumn . setCellRenderer ( new RendererAlignmentDecorator ( cellRenderer , alignment ) ) ; }


signature:
public class S3URI { /** * Returns the key , adding a trailing { @ link # S3 _ DELIMITER delimiter } .
 * Returns { @ code null } if the key is { @ code null } .
 * @ return the key , with a trailing delimiter . */
public String getKeyWithTrailingDelimiter ( ) { } }

implementation: if ( key == null ) { return null ; } else { assert ! key . endsWith ( S3_DELIMITER ) : "Didn't we strip this in the ctor?" ; return key + S3_DELIMITER ; }


signature:
public class S3URI { /** * Returns the parent URI of this URI . The determination is completely text - based , using the
 * { @ link # S3 _ DELIMITER delimiter } . If the key is { @ code null } , { @ code null } is returned . If it is non - { @ code null } ,
 * but doesn ' t have a logical parent , the returned URI will have a { @ code null } key ( but the same bucket ) .
 * For example , the parent of { @ code s3 : / / my - bucket / my - key } ( bucket = " my - bucket " , key = " my - key " ) will be
 * { @ code s3 : / / my - bucket } ( bucket = = " my - bucket " , key = null ) .
 * @ return the parent URI of this URI . */
public S3URI getParent ( ) { } }

implementation: if ( key == null ) { return null ; } int lastDelimPos = key . lastIndexOf ( S3_DELIMITER ) ; if ( lastDelimPos == - 1 ) { return new S3URI ( bucket , null ) ; } else { return new S3URI ( bucket , key . substring ( 0 , lastDelimPos ) ) ; }


signature:
public class S3URI { /** * Creates a new URI by resolving the specified path relative to { @ code this } . If { @ code key = = null } , the key
 * of the returned URI will simply be { @ code relativePath } .
 * @ param relativePath a path relative to { @ code this } . Must be non - null .
 * @ return the child URI .
 * @ throws IllegalArgumentException if the path starts with a { @ link # S3 _ DELIMITER delimiter } .
 * The path must be relative . */
public S3URI getChild ( String relativePath ) throws IllegalArgumentException { } }

implementation: Preconditions . checkNotNull ( relativePath , "relativePath must be non-null." ) ; if ( relativePath . isEmpty ( ) ) { return this ; } else if ( relativePath . startsWith ( S3_DELIMITER ) ) { throw new IllegalArgumentException ( String . format ( "Path '%s' should be relative but begins with the delimiter string '%s'." , relativePath , S3_DELIMITER ) ) ; } if ( key == null ) { return new S3URI ( bucket , relativePath ) ; } else { return new S3URI ( bucket , key + S3_DELIMITER + relativePath ) ; }


signature:
public class S3URI { /** * Gets a temporary file to which the content of the S3Object that this URI points to can be downloaded .
 * The path of the file is { @ code $ { java . io . tmpdir } / S3Objects / $ { hashCode ( ) } / $ { getBaseName ( ) } } .
 * This method does not cause the file to be created ; we ' re just returning a suitable path .
 * @ return a temporary file to which the content of the S3Object that this URI points to can be downloaded . */
public File getTempFile ( ) { } }

implementation:
// To avoid collisions of files with the same name , create a parent dir named after the S3URI ' s hashCode ( ) .
File parentDir = new File ( S3ObjectTempDir , String . valueOf ( hashCode ( ) ) ) ; return new File ( parentDir , getBaseName ( ) ) ;


signature:
public class CoinbaseBuilder { /** * Specify the HMAC api key and secret to be used for authenticated requests
 * Having more than one client with the same api / secret globally is unsupported
 * and will result in sporadic auth errors as the nonce is calculated from the system time .
 * @ param api _ key the HMAC API Key
 * @ param api _ secret the HMAC API Secret
 * @ return this CoinbaseBuilder object */
public CoinbaseBuilder withApiKey ( String api_key , String api_secret ) { } }

implementation: this . api_key = api_key ; this . api_secret = api_secret ; return this ;


signature:
public class CommandRunner { /** * Cross - platform way of finding an executable in the $ PATH . */
static Stream < Path > which ( String program ) { } }

implementation: return which ( program , Optional . ofNullable ( System . getenv ( "PATH" ) ) . orElse ( "" ) ) ;


signature:
public class Label { /** * Create a simple label . Create newlines with \ n .
 * @ param value the label text
 * @ return the Label */
public static Label of ( String value ) { } }

implementation: return new Label ( value , false , false , false , false , null , null ) ;


signature:
public class Label { /** * Create a simple multiline label .
 * @ param just the text justification
 * @ param lines the text lines
 * @ return the Label */
public static Label lines ( Justification just , String ... lines ) { } }

implementation: final String sep = just == LEFT ? "\\l" : just == RIGHT ? "\\r" : "\n" ; final String value = Stream . of ( lines ) . map ( line -> line + sep ) . collect ( joining ( ) ) ; return new Label ( value , false , false , false , false , null , null ) ;


signature:
public class Label { /** * Create a HTML label .
 * @ param value the HTML code
 * @ return the Label
 * @ see < a href = " http : / / www . graphviz . org / doc / info / shapes . html # html " > www . graphviz . org < / a > */
public static Label html ( String value ) { } }

implementation: return new Label ( value , true , false , false , false , null , null ) ;


signature:
public class Label { /** * Create a HTML label from markdown . The following patterns are allowed : < br >
 * \ n newline , * * bold * * , * italics * , ~ ~ strike through ~ ~ , _ underlined _ , ^ overlined ^ , _ _ subscript _ _ , ^ ^ superscript ^ ^ .
 * @ param value the markdown code
 * @ return the Label */
public static Label markdown ( String value ) { } }


signature:
public class Label { /** * Create either a simple , HTML or markdown label .
 * If the value is not surrounded by < and > , a simple Label is created .
 * Otherwise if value contains some HTML tags , a HTML label is created .
 * Otherwise a markdown label is created .
 * @ param value the raw label
 * @ return the Label */
public static Label raw ( String value ) { } }

implementation: final boolean isTagged = value . startsWith ( "<" ) && value . endsWith ( ">" ) ; if ( ! isTagged ) { return of ( value ) ; } final String untagged = value . substring ( 1 , value . length ( ) - 1 ) ; final boolean hasTags = value . contains ( "/>" ) || value . contains ( "</" ) ; return hasTags ? html ( untagged ) : markdown ( untagged ) ;


signature:
public class CoreSocketFactory { /** * Returns the { @ link CoreSocketFactory } singleton . */
public static synchronized CoreSocketFactory getInstance ( ) { } }

implementation: if ( coreSocketFactory == null ) { logger . info ( "First Cloud SQL connection, generating RSA key pair." ) ; KeyPair keyPair = generateRsaKeyPair ( ) ; CredentialFactory credentialFactory ; if ( System . getProperty ( CredentialFactory . CREDENTIAL_FACTORY_PROPERTY ) != null ) { try { credentialFactory = ( CredentialFactory ) Class . forName ( System . getProperty ( CredentialFactory . CREDENTIAL_FACTORY_PROPERTY ) ) . newInstance ( ) ; } catch ( Exception err ) { throw new RuntimeException ( err ) ; } } else { credentialFactory = new ApplicationDefaultCredentialFactory ( ) ; } Credential credential = credentialFactory . create ( ) ; SQLAdmin adminApi = createAdminApiClient ( credential ) ; coreSocketFactory = new CoreSocketFactory ( new Clock ( ) , keyPair , credential , adminApi , DEFAULT_SERVER_PROXY_PORT ) ; } return coreSocketFactory ;