signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SymbolTable { /** * DeclaredGLobalExternsOnWindow . java pass duplicates all global variables so that : * < pre > * var foo ; * < / pre > * becomes * < pre > * var foo ; * window . foo ; * < / pre > * This function finds all such cases and merges window . foo symbol back to foo . It changes * window . foo references to point to foo symbol . */ private void mergeExternSymbolsDuplicatedOnWindow ( ) { } }
// To find duplicated symbols we rely on the fact that duplicated symbol share the same // source position as original symbol and going to use filename = > sourcePosition = > symbol // table . Table < String , Integer , Symbol > externSymbols = HashBasedTable . create ( ) ; for ( Symbol symbol : ImmutableList . copyOf ( symbols . values ( ) ) ) { if ( symbol . getDeclarationNode ( ) == null || symbol . getDeclarationNode ( ) . getStaticSourceFile ( ) == null || ! symbol . getDeclarationNode ( ) . getStaticSourceFile ( ) . isExtern ( ) ) { continue ; } String sourceFile = symbol . getSourceFileName ( ) ; int position = symbol . getDeclarationNode ( ) . getSourcePosition ( ) ; if ( ! externSymbols . contains ( sourceFile , position ) ) { externSymbols . put ( sourceFile , position , symbol ) ; continue ; } Symbol existingSymbol = externSymbols . get ( sourceFile , position ) ; // Consider 2 possibilies : either symbol or existingSymbol might be the generated symbol we // are looking for . if ( isSymbolDuplicatedExternOnWindow ( existingSymbol ) ) { mergeSymbol ( existingSymbol , symbol ) ; externSymbols . put ( sourceFile , position , symbol ) ; } else if ( isSymbolDuplicatedExternOnWindow ( symbol ) ) { mergeSymbol ( symbol , existingSymbol ) ; } }
public class VoldemortClientShell { /** * package will */ boolean evaluateCommand ( String line , boolean printCommands ) { } }
try { if ( line . toLowerCase ( ) . startsWith ( "put" ) ) { processPut ( line . substring ( "put" . length ( ) ) ) ; } else if ( line . toLowerCase ( ) . startsWith ( "getall" ) ) { processGetAll ( line . substring ( "getall" . length ( ) ) ) ; } else if ( line . toLowerCase ( ) . startsWith ( "getmetadata" ) ) { String [ ] args = line . substring ( "getmetadata" . length ( ) + 1 ) . split ( "\\s+" ) ; int remoteNodeId = Integer . valueOf ( args [ 0 ] ) ; String key = args [ 1 ] ; Versioned < String > versioned = adminClient . metadataMgmtOps . getRemoteMetadata ( remoteNodeId , key ) ; if ( versioned == null ) { commandOutput . println ( "null" ) ; } else { commandOutput . println ( versioned . getVersion ( ) ) ; commandOutput . print ( ": " ) ; commandOutput . println ( versioned . getValue ( ) ) ; commandOutput . println ( ) ; } } else if ( line . toLowerCase ( ) . startsWith ( "get" ) ) { processGet ( line . substring ( "get" . length ( ) ) ) ; } else if ( line . toLowerCase ( ) . startsWith ( "delete" ) ) { processDelete ( line . substring ( "delete" . length ( ) ) ) ; } else if ( line . startsWith ( "preflist" ) ) { processPreflist ( line . substring ( "preflist" . length ( ) ) ) ; } else if ( line . toLowerCase ( ) . startsWith ( "fetchkeys" ) ) { String [ ] args = line . substring ( "fetchkeys" . length ( ) + 1 ) . split ( "\\s+" ) ; int remoteNodeId = Integer . valueOf ( args [ 0 ] ) ; String storeName = args [ 1 ] ; List < Integer > partititionList = parseCsv ( args [ 2 ] ) ; Iterator < ByteArray > partitionKeys = adminClient . bulkFetchOps . fetchKeys ( remoteNodeId , storeName , partititionList , null , false ) ; BufferedWriter writer = null ; try { if ( args . length > 3 ) { writer = new BufferedWriter ( new FileWriter ( new File ( args [ 3 ] ) ) ) ; } else writer = new BufferedWriter ( new OutputStreamWriter ( commandOutput ) ) ; } catch ( IOException e ) { errorStream . println ( "Failed to open the output stream" ) ; e . printStackTrace ( errorStream ) ; } if ( writer != null ) { while ( partitionKeys . hasNext ( ) ) { ByteArray keyByteArray = partitionKeys . next ( ) ; StringBuilder lineBuilder = new StringBuilder ( ) ; lineBuilder . append ( ByteUtils . getString ( keyByteArray . get ( ) , "UTF-8" ) ) ; lineBuilder . append ( "\n" ) ; writer . write ( lineBuilder . toString ( ) ) ; } writer . flush ( ) ; } } else if ( line . toLowerCase ( ) . startsWith ( "fetch" ) ) { String [ ] args = line . substring ( "fetch" . length ( ) + 1 ) . split ( "\\s+" ) ; int remoteNodeId = Integer . valueOf ( args [ 0 ] ) ; String storeName = args [ 1 ] ; List < Integer > partititionList = parseCsv ( args [ 2 ] ) ; Iterator < Pair < ByteArray , Versioned < byte [ ] > > > partitionEntries = adminClient . bulkFetchOps . fetchEntries ( remoteNodeId , storeName , partititionList , null , false ) ; BufferedWriter writer = null ; try { if ( args . length > 3 ) { writer = new BufferedWriter ( new FileWriter ( new File ( args [ 3 ] ) ) ) ; } else writer = new BufferedWriter ( new OutputStreamWriter ( commandOutput ) ) ; } catch ( IOException e ) { errorStream . println ( "Failed to open the output stream" ) ; e . printStackTrace ( errorStream ) ; } if ( writer != null ) { while ( partitionEntries . hasNext ( ) ) { Pair < ByteArray , Versioned < byte [ ] > > pair = partitionEntries . next ( ) ; ByteArray keyByteArray = pair . getFirst ( ) ; Versioned < byte [ ] > versioned = pair . getSecond ( ) ; StringBuilder lineBuilder = new StringBuilder ( ) ; lineBuilder . append ( ByteUtils . getString ( keyByteArray . get ( ) , "UTF-8" ) ) ; lineBuilder . append ( "\t" ) ; lineBuilder . append ( versioned . getVersion ( ) ) ; lineBuilder . append ( "\t" ) ; lineBuilder . append ( ByteUtils . getString ( versioned . getValue ( ) , "UTF-8" ) ) ; lineBuilder . append ( "\n" ) ; writer . write ( lineBuilder . toString ( ) ) ; } writer . flush ( ) ; } } else if ( line . startsWith ( "help" ) ) { commandOutput . println ( ) ; commandOutput . println ( "Commands:" ) ; commandOutput . println ( PROMPT + "put key value --- Associate the given value with the key." ) ; commandOutput . println ( PROMPT + "get key --- Retrieve the value associated with the key." ) ; commandOutput . println ( PROMPT + "getall key1 [key2...] --- Retrieve the value(s) associated with the key(s)." ) ; commandOutput . println ( PROMPT + "delete key --- Remove all values associated with the key." ) ; commandOutput . println ( PROMPT + "preflist key --- Get node preference list for given key." ) ; String metaKeyValues = voldemort . store . metadata . MetadataStore . METADATA_KEYS . toString ( ) ; commandOutput . println ( PROMPT + "getmetadata node_id meta_key --- Get store metadata associated " + "with meta_key from node_id. meta_key may be one of " + metaKeyValues . substring ( 1 , metaKeyValues . length ( ) - 1 ) + "." ) ; commandOutput . println ( PROMPT + "fetchkeys node_id store_name partitions <file_name> --- Fetch all keys " + "from given partitions (a comma separated list) of store_name on " + "node_id. Optionally, write to file_name. " + "Use getmetadata to determine appropriate values for store_name and partitions" ) ; commandOutput . println ( PROMPT + "fetch node_id store_name partitions <file_name> --- Fetch all entries " + "from given partitions (a comma separated list) of store_name on " + "node_id. Optionally, write to file_name. " + "Use getmetadata to determine appropriate values for store_name and partitions" ) ; commandOutput . println ( PROMPT + "help --- Print this message." ) ; commandOutput . println ( PROMPT + "exit --- Exit from this shell." ) ; commandOutput . println ( ) ; commandOutput . println ( "Avro usage:" ) ; commandOutput . println ( "For avro keys or values, ensure that the entire json string is enclosed within single quotes (')." ) ; commandOutput . println ( "Also, the field names and strings should STRICTLY be enclosed by double quotes(\")" ) ; commandOutput . println ( "eg: > put '{\"id\":1,\"name\":\"Vinoth Chandar\"}' '[{\"skill\":\"java\", \"score\":90.27, \"isendorsed\": true}]'" ) ; } else if ( line . equals ( "quit" ) || line . equals ( "exit" ) ) { commandOutput . println ( "bye." ) ; System . exit ( 0 ) ; } else { errorStream . println ( "Invalid command. (Try 'help' for usage.)" ) ; return false ; } } catch ( EndOfFileException e ) { errorStream . println ( "Expected additional token." ) ; } catch ( SerializationException e ) { errorStream . print ( "Error serializing values: " ) ; e . printStackTrace ( errorStream ) ; } catch ( VoldemortException e ) { errorStream . println ( "Exception thrown during operation." ) ; e . printStackTrace ( errorStream ) ; } catch ( ArrayIndexOutOfBoundsException e ) { errorStream . println ( "Invalid command. (Try 'help' for usage.)" ) ; } catch ( Exception e ) { errorStream . println ( "Unexpected error:" ) ; e . printStackTrace ( errorStream ) ; } return true ;
public class CsvProcessor { /** * Read in all of the entities in the reader passed in . It will use an internal buffered reader . * @ param reader * Where to read the header and entities from . It will be closed when the method returns . * @ param parseErrors * If not null , any errors will be added to the collection and null will be returned . If validateHeader * is true and the header does not match then no additional lines will be returned . If this is null then * a ParseException will be thrown on parsing problems . * @ return A list of entities read in or null if parseErrors is not null . * @ throws ParseException * Thrown on any parsing problems . If parseErrors is not null then parse errors will be added there and * an exception should not be thrown . * @ throws IOException * If there are any IO exceptions thrown when reading . */ public List < T > readAll ( Reader reader , Collection < ParseError > parseErrors ) throws IOException , ParseException { } }
checkEntityConfig ( ) ; BufferedReader bufferedReader = new BufferedReaderLineCounter ( reader ) ; try { ParseError parseError = null ; // we do this to reuse the parse error objects if we can if ( parseErrors != null ) { parseError = new ParseError ( ) ; } if ( firstLineHeader ) { if ( readHeader ( bufferedReader , parseError ) == null ) { if ( parseError != null && parseError . isError ( ) ) { parseErrors . add ( parseError ) ; } return null ; } } return readRows ( bufferedReader , parseErrors ) ; } finally { bufferedReader . close ( ) ; }
public class TextMessageFrame { /** * This method is called from within the constructor to * initialize the form . * WARNING : Do NOT modify this code . The content of this method is * always regenerated by the Form Editor . */ @ SuppressWarnings ( "unchecked" ) // < editor - fold defaultstate = " collapsed " desc = " Generated Code " > / / GEN - BEGIN : initComponents private void initComponents ( ) { } }
java . awt . GridBagConstraints gridBagConstraints ; jPanel1 = new javax . swing . JPanel ( ) ; jScrollPane1 = new javax . swing . JScrollPane ( ) ; jTextArea1 = new javax . swing . JTextArea ( ) ; jLabel1 = new javax . swing . JLabel ( ) ; jButton1 = new javax . swing . JButton ( ) ; setDefaultCloseOperation ( javax . swing . WindowConstants . DISPOSE_ON_CLOSE ) ; setMinimumSize ( new java . awt . Dimension ( 700 , 550 ) ) ; getContentPane ( ) . setLayout ( new java . awt . GridBagLayout ( ) ) ; jPanel1 . setLayout ( new java . awt . GridBagLayout ( ) ) ; jTextArea1 . setColumns ( 20 ) ; jTextArea1 . setEditable ( false ) ; jTextArea1 . setRows ( 5 ) ; jTextArea1 . setWrapStyleWord ( true ) ; jTextArea1 . setBackground ( Color . white ) ; jTextArea1 . setFont ( new Font ( "Dialog" , Font . PLAIN , 12 ) ) ; jScrollPane1 . setViewportView ( jTextArea1 ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . gridx = 0 ; gridBagConstraints . gridy = 0 ; gridBagConstraints . fill = java . awt . GridBagConstraints . BOTH ; gridBagConstraints . anchor = java . awt . GridBagConstraints . NORTHWEST ; gridBagConstraints . weightx = 1.0 ; gridBagConstraints . weighty = 1.0 ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; jPanel1 . add ( jScrollPane1 , gridBagConstraints ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . gridx = 0 ; gridBagConstraints . gridy = 1 ; gridBagConstraints . fill = java . awt . GridBagConstraints . HORIZONTAL ; gridBagConstraints . ipady = 5 ; gridBagConstraints . anchor = java . awt . GridBagConstraints . NORTHWEST ; gridBagConstraints . weightx = 1.0 ; jPanel1 . add ( jLabel1 , gridBagConstraints ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . fill = java . awt . GridBagConstraints . BOTH ; gridBagConstraints . ipadx = 20 ; gridBagConstraints . anchor = java . awt . GridBagConstraints . NORTHWEST ; gridBagConstraints . weightx = 1.0 ; gridBagConstraints . weighty = 1.0 ; gridBagConstraints . insets = new java . awt . Insets ( 5 , 5 , 5 , 5 ) ; getContentPane ( ) . add ( jPanel1 , gridBagConstraints ) ; jButton1 . setText ( "close" ) ; jButton1 . setMinimumSize ( new java . awt . Dimension ( 60 , 29 ) ) ; jButton1 . setPreferredSize ( new java . awt . Dimension ( 75 , 29 ) ) ; jButton1 . setRolloverEnabled ( false ) ; jButton1 . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { jButton1ActionPerformed ( evt ) ; } } ) ; gridBagConstraints = new java . awt . GridBagConstraints ( ) ; gridBagConstraints . gridx = 0 ; gridBagConstraints . gridy = 1 ; getContentPane ( ) . add ( jButton1 , gridBagConstraints ) ; pack ( ) ;
public class ClassFile { /** * Returns a descriptor to class at index . * @ param index * @ return */ public String getClassDescription ( int index ) { } }
Clazz cz = ( Clazz ) getConstantInfo ( index ) ; int ni = cz . getName_index ( ) ; return getString ( ni ) ;
public class SchemaExtension { /** * Remove all trace of the extension * @ since 3.2.0 */ public void removeExtension ( ) { } }
if ( geoPackage . isTable ( DataColumns . TABLE_NAME ) ) { geoPackage . dropTable ( DataColumns . TABLE_NAME ) ; } if ( geoPackage . isTable ( DataColumnConstraints . TABLE_NAME ) ) { geoPackage . dropTable ( DataColumnConstraints . TABLE_NAME ) ; } try { if ( extensionsDao . isTableExists ( ) ) { extensionsDao . deleteByExtension ( EXTENSION_NAME ) ; } } catch ( SQLException e ) { throw new GeoPackageException ( "Failed to delete Schema extension. GeoPackage: " + geoPackage . getName ( ) , e ) ; }
public class ParseUtils { /** * Require all the named attributes , returning their values in order . * @ param reader the reader * @ param attributeNames the attribute names * @ return the attribute values in order * @ throws javax . xml . stream . XMLStreamException if an error occurs */ public static String [ ] requireAttributes ( final XMLExtendedStreamReader reader , final String ... attributeNames ) throws XMLStreamException { } }
final int length = attributeNames . length ; final String [ ] result = new String [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { final String name = attributeNames [ i ] ; final String value = reader . getAttributeValue ( null , name ) ; if ( value == null ) { throw missingRequired ( reader , Collections . singleton ( name ) ) ; } result [ i ] = value ; } return result ;
public class HpackEncoder { /** * Returns the header entry with the lowest index value for the header field . Returns null if * header field is not in the dynamic table . */ private HeaderEntry getEntry ( CharSequence name , CharSequence value ) { } }
if ( length ( ) == 0 || name == null || value == null ) { return null ; } int h = AsciiString . hashCode ( name ) ; int i = index ( h ) ; for ( HeaderEntry e = headerFields [ i ] ; e != null ; e = e . next ) { // To avoid short circuit behavior a bitwise operator is used instead of a boolean operator . if ( e . hash == h && ( equalsConstantTime ( name , e . name ) & equalsConstantTime ( value , e . value ) ) != 0 ) { return e ; } } return null ;
public class AndRange { /** * ( non - Javadoc ) * @ see net . ossindex . version . IVersionRange # intersects ( net . ossindex . version . IVersionRange ) */ @ Override public boolean intersects ( IVersionRange yourRange ) { } }
return range1 . intersects ( yourRange ) && range2 . intersects ( yourRange ) ;
public class SipServletRequestImpl { /** * { @ inheritDoc } */ public void pushRoute ( Address address ) { } }
checkReadOnly ( ) ; if ( address . getURI ( ) instanceof TelURL ) { throw new IllegalArgumentException ( "Cannot push a TelUrl as a route !" ) ; } javax . sip . address . SipURI sipUri = ( javax . sip . address . SipURI ) ( ( AddressImpl ) address ) . getAddress ( ) . getURI ( ) ; pushRoute ( sipUri ) ;
public class ContentKeyPoliciesInner { /** * List Content Key Policies . * Lists the Content Key Policies in the account . * @ param resourceGroupName The name of the resource group within the Azure subscription . * @ param accountName The Media Services account name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; ContentKeyPolicyInner & gt ; object */ public Observable < Page < ContentKeyPolicyInner > > listAsync ( final String resourceGroupName , final String accountName ) { } }
return listWithServiceResponseAsync ( resourceGroupName , accountName ) . map ( new Func1 < ServiceResponse < Page < ContentKeyPolicyInner > > , Page < ContentKeyPolicyInner > > ( ) { @ Override public Page < ContentKeyPolicyInner > call ( ServiceResponse < Page < ContentKeyPolicyInner > > response ) { return response . body ( ) ; } } ) ;
public class FaceListsImpl { /** * Retrieve information about all existing face lists . Only faceListId , name and userData will be returned . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < List < FaceList > > listAsync ( final ServiceCallback < List < FaceList > > serviceCallback ) { } }
return ServiceFuture . fromResponse ( listWithServiceResponseAsync ( ) , serviceCallback ) ;
public class OptionsBuilder { /** * Sets the configuration format ( xml or yml ) * @ param configurationFormat * configuration format ( file extension ) * @ return updated OptionBuilder instance * @ see Options # CONFIGURATION _ FILE _ FORMAT */ public OptionsBuilder configurationFormat ( String configurationFormat ) { } }
String aux = configurationFormat . toLowerCase ( ) . trim ( ) ; if ( aux . equals ( "yaml" ) || aux . equals ( "json" ) ) { aux = "yml" ; } if ( aux . equals ( "xml" ) || aux . equals ( "yml" ) ) { options . put ( Options . CONFIGURATION_FILE_FORMAT , aux ) ; } else { throw new IllegalArgumentException ( "The configuration format " + aux + " is not supported" ) ; } return this ;
public class BcExtensionUtils { /** * Convert a collection of X . 509 general names to Bouncy Castle general names . * @ param genNames a collection of X . 509 general names . * @ return a bouncy castle general names . */ public static GeneralNames getGeneralNames ( X509GeneralName [ ] genNames ) { } }
GeneralName [ ] names = new GeneralName [ genNames . length ] ; int i = 0 ; for ( X509GeneralName name : genNames ) { if ( name instanceof BcGeneralName ) { names [ i ++ ] = ( ( BcGeneralName ) name ) . getGeneralName ( ) ; } else { throw new IllegalArgumentException ( "Unexpected general name: " + name . getClass ( ) . toString ( ) ) ; } } return new GeneralNames ( names ) ;
public class AbstractMemberPropertyAccessor { /** * Returns the root property of an indexed property . The root property is * the property that contains no indices . * @ param propertyName the name of the property . * @ return the root property . */ protected String getRootPropertyName ( String propertyName ) { } }
int location = propertyName . indexOf ( PROPERTY_KEY_PREFIX ) ; return location == - 1 ? propertyName : propertyName . substring ( 0 , location ) ;
public class IntDoubleHashMap { /** * Check if the tables contain an element associated with specified key * at specified index . * @ param key key to check * @ param index index to check * @ return true if an element is associated with key at index */ private boolean contains ( final int key , final int index ) { } }
return ( key != 0 || states [ index ] == FULL ) && keys [ index ] == key ;
public class TimeZoneFormat { /** * Reads a single decimal digit , either localized digits used by this object * or any Unicode numeric character . * @ param text the text * @ param start the start index * @ param len the actual length read from the text * the start index is not a decimal number . * @ return the integer value of the parsed digit , or - 1 on failure . */ private int parseSingleLocalizedDigit ( String text , int start , int [ ] len ) { } }
int digit = - 1 ; len [ 0 ] = 0 ; if ( start < text . length ( ) ) { int cp = Character . codePointAt ( text , start ) ; // First , try digits configured for this instance for ( int i = 0 ; i < _gmtOffsetDigits . length ; i ++ ) { if ( cp == _gmtOffsetDigits [ i ] . codePointAt ( 0 ) ) { digit = i ; break ; } } // If failed , check if this is a Unicode digit if ( digit < 0 ) { digit = UCharacter . digit ( cp ) ; } if ( digit >= 0 ) { len [ 0 ] = Character . charCount ( cp ) ; } } return digit ;
public class ExecutionLogger { /** * ( non - Javadoc ) * @ see com . technophobia . substeps . runner . INotifier # notifyNodeFinished ( com . * technophobia . substeps . execution . node . IExecutionNode ) */ public void onNodeFinished ( final IExecutionNode node ) { } }
if ( node . equals ( this . theLastNode ) ) { printPassed ( "Passed: " + format ( this . theLastNode ) ) ; } else { // print the last one first if ( this . theLastNode != null ) { printStarted ( "Starting: " + format ( this . theLastNode ) ) ; } printPassed ( "Passed: " + format ( node ) ) ; } this . theLastNode = null ;
public class SibRaDispatcher { /** * Deletes the given message under the given transaction . * @ param message * the message to delete * @ param transaction * the transaction to delete it under , if any * @ throws ResourceException * if the delete fails */ protected final void deleteMessage ( SIBusMessage message , SITransaction transaction ) throws ResourceException { } }
final String methodName = "deleteMessage" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { message , transaction } ) ; } deleteMessages ( new SIMessageHandle [ ] { message . getMessageHandle ( ) } , transaction ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName ) ; }
public class DateUtils { /** * Get how many minutes between two date . * @ param date1 date to be tested . * @ param date2 date to be tested . * @ return how many minutes between two date . */ public static long subMinutes ( final Date date1 , final Date date2 ) { } }
return subTime ( date1 , date2 , DatePeriod . MINUTE ) ;
public class GCMRKRGImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case AfplibPackage . GCMRKRG__XPOS : setXPOS ( ( Integer ) newValue ) ; return ; case AfplibPackage . GCMRKRG__YPOS : setYPOS ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class RemoveConverterOnCloseHandler { /** * Free the dependent object . */ public void removeConverter ( ) { } }
if ( m_converter != null ) { Converter converter = m_converter ; m_converter = null ; // This keeps this from being called twice converter . removeComponent ( null ) ; // Just in case a converter was used ( removes converter , leaves field ! ) if ( m_converter instanceof BaseField ) { // Special case - free this field if it is temporary and belongs to no records . if ( ( ( BaseField ) m_converter ) . getRecord ( ) == null ) m_converter . free ( ) ; } } m_converter = null ;
public class HalResource { /** * Get property value by parsing raw JSON as an object / array . * @ param name property name * @ param type Type * @ return Object representation of raw JSON */ public < T > Optional < T > getValueAsObject ( final String name , final TypeToken < T > type ) { } }
try { final Optional < String > raw = getValueAsString ( name ) ; if ( raw . isPresent ( ) ) { // noinspection unchecked return Optional . ofNullable ( ( T ) objectMapper . readValue ( raw . get ( ) , objectMapper . constructType ( type . getType ( ) ) ) ) ; } else { return Optional . empty ( ) ; } } catch ( IOException e ) { LOGGER . warn ( "failed to get value '{}' as object {} - will return an absent value, reason: {}" , name , type , e . getMessage ( ) ) ; return Optional . empty ( ) ; }
public class RoundRobinList { public void addAddresses ( List < ESAddress > address ) { } }
try { lock . lock ( ) ; this . elements . addAll ( address ) ; this . iterator = elements . iterator ( ) ; } finally { lock . unlock ( ) ; }
public class Matrix { /** * Alters row i of < i > this < / i > matrix , such that * < i > A [ i , : ] = A [ i , : ] + c * < b > b < / b > < / i > * @ param i the index of the row to update * @ param c the scalar constant to multiply the vector by * @ param b the vector to add to the specified row */ public void updateRow ( int i , double c , Vec b ) { } }
if ( b . length ( ) != this . cols ( ) ) throw new ArithmeticException ( "vector is not of the same column length" ) ; if ( b . isSparse ( ) ) for ( IndexValue iv : b ) this . increment ( i , iv . getIndex ( ) , c * iv . getValue ( ) ) ; else for ( int j = 0 ; j < b . length ( ) ; j ++ ) this . increment ( i , j , c * b . get ( j ) ) ;
public class AbstractVendorPolicy { /** * This function initializes the vendor policy . * @ param flowOwner * The flow owner ( the servlet , CLI main , . . . . ) */ public final synchronized void initialize ( Object flowOwner ) { } }
if ( this . initialized ) { throw new FaxException ( "Vendor policy already initialized." ) ; } if ( flowOwner == null ) { throw new FaxException ( "Flow owner not provided." ) ; } // set flag this . initialized = true ; // get flow owner this . vendorPolicyFlowOwner = flowOwner ; // initialize this . initializeImpl ( ) ;
public class EmailIntentBuilder { /** * Set the text body for this email intent . * @ param body * the text body * @ return This { @ code EmailIntentBuilder } for method chaining */ @ NonNull public EmailIntentBuilder body ( @ NonNull String body ) { } }
checkNotNull ( body ) ; this . body = fixLineBreaks ( body ) ; return this ;
public class JsonTranscoder { /** * Converts a { @ link ByteBuf } to a { @ link JsonObject } , < b > without releasing the buffer < / b > * @ param input the buffer to convert . It won ' t be cleared ( contrary to { @ link # doDecode ( String , ByteBuf , long , int , int , ResponseStatus ) classical decode } ) * @ return a JsonObject decoded from the buffer * @ throws Exception */ public JsonObject byteBufToJsonObject ( ByteBuf input ) throws Exception { } }
return TranscoderUtils . byteBufToClass ( input , JsonObject . class , JacksonTransformers . MAPPER ) ;
public class ParallelRunner { /** * Move a { @ link Path } . * This method submits a task to move a { @ link Path } and returns immediately * after the task is submitted . * @ param src path to be moved * @ param dstFs the destination { @ link FileSystem } * @ param dst the destination path * @ param group an optional group name for the destination path */ public void movePath ( final Path src , final FileSystem dstFs , final Path dst , final Optional < String > group ) { } }
movePath ( src , dstFs , dst , false , group ) ;
public class XpiDriverService { /** * Configures and returns a new { @ link XpiDriverService } using the default configuration . In * this configuration , the service will use the firefox executable identified by the * { @ link FirefoxDriver . SystemProperty # BROWSER _ BINARY } system property on a free port . * @ return A new XpiDriverService using the default configuration . */ public static XpiDriverService createDefaultService ( ) { } }
try { return new Builder ( ) . build ( ) ; } catch ( WebDriverException e ) { throw new IllegalStateException ( e . getMessage ( ) , e . getCause ( ) ) ; }
public class ProcessUtil { private static void addShutdownHook ( final Logger log , final Process process , final String command ) { } }
Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( command ) { @ Override public void run ( ) { if ( process != null ) { log . info ( "Terminating process [" + command + "]" ) ; try { process . destroy ( ) ; } catch ( Exception e ) { log . error ( "Failed to terminate process [" + command + "]" ) ; } } } } ) ;
public class KeyboardHelper { /** * Shows soft keyboard and requests focus for given view . */ public static void showSoftKeyboard ( Context context , View view ) { } }
if ( view == null ) { return ; } final InputMethodManager manager = ( InputMethodManager ) context . getSystemService ( Context . INPUT_METHOD_SERVICE ) ; view . requestFocus ( ) ; manager . showSoftInput ( view , 0 ) ;
public class Functions { /** * Create a { @ link Function } that is backed by the given map . * Modifications of the given map will be visible through * the returned function . * @ param < K > The key type * @ param < V > The value type * @ param map The backing map * @ param defaultValue The default value to return when a * function argument is not contained in the map . * @ return The new function */ public static < K , V > Function < K , V > fromMap ( final Map < ? super K , ? extends V > map , final V defaultValue ) { } }
return new Function < K , V > ( ) { @ Override public V apply ( K k ) { V result = map . get ( k ) ; if ( result == null ) { if ( ! map . containsKey ( k ) ) { return defaultValue ; } } return result ; } } ;
public class SerializationFormat { /** * Finds the { @ link SerializationFormat } which is accepted by any of the specified media ranges . */ public static Optional < SerializationFormat > find ( MediaType ... ranges ) { } }
requireNonNull ( ranges , "ranges" ) ; if ( ranges . length == 0 ) { return Optional . empty ( ) ; } for ( SerializationFormat f : values ( ) ) { if ( f . isAccepted ( Arrays . asList ( ranges ) ) ) { return Optional . of ( f ) ; } } return Optional . empty ( ) ;
public class ApiOvhSecret { /** * Retrieve a secret sent by email * REST : POST / secret / retrieve * @ param id [ required ] The secret ID */ public OvhSecret retrieve_POST ( String id ) throws IOException { } }
String qPath = "/secret/retrieve" ; StringBuilder sb = path ( qPath ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "id" , id ) ; String resp = execN ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhSecret . class ) ;
public class HttpRequestManager { /** * Unregisters active request */ synchronized void unregisterRequest ( HttpRequest request ) { } }
assertTrue ( this == request . requestManager ) ; boolean removed = activeRequests . remove ( request ) ; assertTrue ( removed , "Attempted to unregister missing request: %s" , request ) ; if ( removed ) { notifyRequestFinished ( request ) ; }
public class ValidationViolationChecker { /** * This method checks the violations against expected violations . * @ param violations * validation violations * @ param expectedValidationViolations * list of expected validation violation message templates */ public void checkExpectedValidationViolations ( Set < ConstraintViolation < T > > violations , List < String > expectedValidationViolations ) { } }
if ( violations != null && expectedValidationViolations != null ) { List < String > givenViolations = new ArrayList < String > ( ) ; for ( ConstraintViolation < T > violation : violations ) { givenViolations . add ( violation . getMessageTemplate ( ) ) ; } checkViolations ( givenViolations , expectedValidationViolations ) ; }
public class FeatureOverlayQuery { /** * Perform a query based upon the map click location and build a info message * @ param latLng location * @ param zoom current zoom level * @ param mapBounds map view bounds * @ param tolerance tolerance distance * @ return information message on what was clicked , or nil * @ since 2.0.0 */ public String buildMapClickMessageWithMapBounds ( LatLng latLng , double zoom , BoundingBox mapBounds , double tolerance ) { } }
return buildMapClickMessageWithMapBounds ( latLng , zoom , mapBounds , tolerance , null ) ;
public class ObjectDigestUtil { /** * 转换字节数组为16进制字串 * @ param b 字节数组 * @ return 16进制字串 */ public static String byteArrayToHexString ( byte [ ] b ) { } }
StringBuilder resultSb = new StringBuilder ( ) ; for ( byte aB : b ) { resultSb . append ( byteToHexString ( aB ) ) ; } return resultSb . toString ( ) ;
public class BasicDatum { /** * Removes all currently assigned labels for this Datum then adds all * of the given Labels . */ public void setLabels ( Collection < LabelType > labels ) { } }
this . labels . clear ( ) ; if ( labels != null ) { this . labels . addAll ( labels ) ; }
public class ExecutionEngineJNI { /** * Read a large table block from disk and write it to a ByteBuffer . * Block will still be stored on disk when this operation completes . * @ param siteId The originating site id of the block to load * @ param blockCounter The id of the block to load * @ param block The buffer to write the block to * @ return The original address of the block ( so that its internal pointers may get updated ) */ public boolean loadLargeTempTableBlock ( long siteId , long blockCounter , ByteBuffer block ) { } }
LargeBlockTask task = LargeBlockTask . getLoadTask ( new BlockId ( siteId , blockCounter ) , block ) ; return executeLargeBlockTaskSynchronously ( task ) ;
public class PrivateKeyUsageExtension { /** * Set the attribute value . * @ exception CertificateException on attribute handling errors . */ public void set ( String name , Object obj ) throws CertificateException , IOException { } }
if ( ! ( obj instanceof Date ) ) { throw new CertificateException ( "Attribute must be of type Date." ) ; } if ( name . equalsIgnoreCase ( NOT_BEFORE ) ) { notBefore = ( Date ) obj ; } else if ( name . equalsIgnoreCase ( NOT_AFTER ) ) { notAfter = ( Date ) obj ; } else { throw new CertificateException ( "Attribute name not recognized by" + " CertAttrSet:PrivateKeyUsage." ) ; } encodeThis ( ) ;
public class Lazy { /** * < p > Gets or creates the object as needed . < / p > * @ return the object wrapped by Lazy */ public T get ( ) { } }
T value = object ; if ( value == null ) { synchronized ( this ) { value = object ; if ( object == null ) { object = value = supplier . get ( ) ; } } } return value ;
public class HashCalculationResult { /** * / * - - - Overridden - - - */ @ Override public int compareTo ( Object o ) { } }
HashCalculationResult myClass = ( HashCalculationResult ) o ; return new CompareToBuilder ( ) . append ( this . fullHash , myClass . fullHash ) . append ( this . mostSigBitsHash , myClass . mostSigBitsHash ) . append ( this . leastSigBitsHash , myClass . leastSigBitsHash ) . toComparison ( ) ;
public class FastCopy { /** * Expand a single file , if its a file pattern list out all files matching the * pattern , if its a directory return all files under the directory . * @ param src * the file to be expanded * @ param dstPath * the destination * @ return the expanded file list for this file / filepattern * @ throws IOException */ private static List < CopyPath > expandSingle ( Path src , Path dstPath ) throws IOException { } }
List < Path > expandedPaths = new ArrayList < Path > ( ) ; FileSystem fs = src . getFileSystem ( defaultConf ) ; FileStatus [ ] stats = fs . globStatus ( src ) ; if ( stats == null || stats . length == 0 ) { throw new IOException ( "Path : " + src + " is invalid" ) ; } for ( FileStatus stat : stats ) { expandedPaths . add ( stat . getPath ( ) ) ; } List < CopyPath > expandedDirs = expandDirectories ( fs , expandedPaths , dstPath ) ; return expandedDirs ;
public class ServiceActor { /** * run & connect a service with given cmdline args and classes * @ param args * @ param serviceClazz * @ param argsClazz * @ return * @ throws IllegalAccessException * @ throws InstantiationException */ public static ServiceActor RunTCP ( String args [ ] , Class < ? extends ServiceActor > serviceClazz , Class < ? extends ServiceArgs > argsClazz ) { } }
ServiceActor myService = AsActor ( serviceClazz ) ; ServiceArgs options = null ; try { options = ServiceRegistry . parseCommandLine ( args , null , argsClazz . newInstance ( ) ) ; } catch ( Exception e ) { FSTUtil . rethrow ( e ) ; } TCPConnectable connectable = new TCPConnectable ( ServiceRegistry . class , options . getRegistryHost ( ) , options . getRegistryPort ( ) ) ; myService . init ( connectable , options , true ) . await ( 30_000 ) ; Log . Info ( myService . getClass ( ) , "Init finished" ) ; return myService ;
public class ConcurrentLinkedList { /** * Add a new item to the tail of the queue and return a Node reference . * This reference can be used as a handle that can be passed to * remove ( Node ) where constand time removes are necessary . Calls to * this method and poll ( ) do not mutually block , however , concurrent * calls to this method are serialized . */ public Node < E > offerAndGetNode ( E e ) { } }
mPutLock . lock ( ) ; try { Node newNode = mNodePool . borrowNode ( e ) ; if ( mSize . get ( ) > 0 ) newNode . mPrev = mTail ; mTail . mNext = newNode ; if ( mSize . get ( ) <= 1 ) { mPollLock . lock ( ) ; try { if ( mSize . get ( ) == 0 ) mHead . mNext = newNode ; else mHead . mNext = newNode . mPrev ; } finally { mPollLock . unlock ( ) ; } } mSize . incrementAndGet ( ) ; mTail = newNode ; return newNode ; } finally { mPutLock . unlock ( ) ; }
public class Team { /** * List all oTask / Activity records within a team * @ param company Company ID * @ throwsJSONException If error occurred * @ return { @ link JSONObject } */ public JSONObject getList ( String company , String team ) throws JSONException { } }
return _getByType ( company , team , null ) ;
public class TextUtil { /** * Enforced version of the equality test on two strings with case ignoring . * This enforced version supported < code > null < / code > values * given as parameters . * @ param firstText first text . * @ param secondText second text . * @ param isNullEmptyEquivalence indicates if the < code > null < / code > value * is assimilated to the empty string . * @ return < code > true < / code > if a is equal to b ; otherwise < code > false < / code > . */ @ Pure public static boolean equalsIgnoreCase ( String firstText , String secondText , boolean isNullEmptyEquivalence ) { } }
final String aa = ( firstText != null || ! isNullEmptyEquivalence ) ? firstText : "" ; // $ NON - NLS - 1 $ final String bb = ( secondText != null || ! isNullEmptyEquivalence ) ? secondText : "" ; // $ NON - NLS - 1 $ if ( aa == null ) { return bb == null ; } if ( bb == null ) { return false ; } return aa . equalsIgnoreCase ( bb ) ;
public class StanfordAgigaSentence { /** * / * ( non - Javadoc ) * @ see edu . jhu . hltcoe . sp . data . depparse . AgigaSentence # getStanfordTypedDependencies ( edu . jhu . hltcoe . sp . data . depparse . AgigaConstants . DependencyForm ) */ public List < TypedDependency > getStanfordTypedDependencies ( DependencyForm form ) { } }
List < TypedDependency > dependencies = new ArrayList < TypedDependency > ( ) ; if ( this . nodes == null ) nodes = getStanfordTreeGraphNodes ( form ) ; List < AgigaTypedDependency > agigaDeps = getAgigaDeps ( form ) ; for ( AgigaTypedDependency agigaDep : agigaDeps ) { // Add one , since the tokens are zero - indexed but the TreeGraphNodes are one - indexed TreeGraphNode gov = nodes . get ( agigaDep . getGovIdx ( ) + 1 ) ; TreeGraphNode dep = nodes . get ( agigaDep . getDepIdx ( ) + 1 ) ; // Create the typed dependency TypedDependency typedDep = new TypedDependency ( GrammaticalRelation . valueOf ( agigaDep . getType ( ) ) , gov , dep ) ; dependencies . add ( typedDep ) ; } return dependencies ;
public class AbstractDocBuilder { /** * Parse tags to get modification records . */ protected LinkedList < ModificationRecord > parseModificationRecords ( Tag [ ] tags ) { } }
LinkedList < ModificationRecord > result = new LinkedList < ModificationRecord > ( ) ; for ( int i = 0 ; i < tags . length ; i ++ ) { if ( "@author" . equalsIgnoreCase ( tags [ i ] . name ( ) ) ) { ModificationRecord record = new ModificationRecord ( ) ; record . setModifier ( tags [ i ] . text ( ) ) ; if ( i + 1 < tags . length ) { if ( "@version" . equalsIgnoreCase ( tags [ i + 1 ] . name ( ) ) ) { record . setVersion ( tags [ i + 1 ] . text ( ) ) ; if ( i + 2 < tags . length && ( "@" + WRMemoTaglet . NAME ) . equalsIgnoreCase ( tags [ i + 2 ] . name ( ) ) ) { record . setMemo ( tags [ i + 2 ] . text ( ) ) ; } } else if ( ( "@" + WRMemoTaglet . NAME ) . equalsIgnoreCase ( tags [ i + 1 ] . name ( ) ) ) { record . setMemo ( tags [ i + 1 ] . text ( ) ) ; } } result . add ( record ) ; } } return result ;
public class ThriftToThriftEnvelopeEvent { /** * Given a generic thrift object ( class generated by the thrift compiler ) , create a ThriftEnvelopeEvent . * @ param eventName Thrift schema name * @ param eventDateTime the event timestamp * @ param thriftObject Thrift instance * @ param < T > any Thrift class generated by the thrift compiler * @ return ThriftEnvelopeEvent which wraps all thrift fields as ThriftFields */ public static < T extends Serializable > ThriftEnvelopeEvent extractEvent ( final String eventName , final DateTime eventDateTime , final T thriftObject ) { } }
final List < ThriftField > thriftFieldList = new ArrayList < ThriftField > ( ) ; final Field [ ] fields = thriftObject . getClass ( ) . getFields ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { try { // Thrift fields start at 1 , not 0 final ThriftField field = ThriftField . createThriftField ( fields [ i ] . getType ( ) , fields [ i ] . get ( thriftObject ) , ( short ) ( i + 1 ) ) ; // null for the Thrift metaData map and potential other non - supported attributes added by the caller in the thriftObject if ( field != null ) { thriftFieldList . add ( field ) ; } } catch ( IllegalAccessException ignored ) { } } final ThriftEnvelope envelope = new ThriftEnvelope ( eventName , thriftFieldList ) ; return new ThriftEnvelopeEvent ( eventDateTime , envelope ) ;
public class AbstractAppender { /** * Handles an install response . */ protected void handleInstallResponse ( MemberState member , InstallRequest request , InstallResponse response ) { } }
if ( response . status ( ) == Response . Status . OK ) { handleInstallResponseOk ( member , request , response ) ; } else { handleInstallResponseError ( member , request , response ) ; }
public class Join { /** * join ( input , glue = ' ' ) * Join elements of the array with certain character between them */ @ Override public Object apply ( Object value , Object ... params ) { } }
if ( value == null ) { return "" ; } StringBuilder builder = new StringBuilder ( ) ; Object [ ] array = super . asArray ( value ) ; String glue = params . length == 0 ? " " : super . asString ( super . get ( 0 , params ) ) ; for ( int i = 0 ; i < array . length ; i ++ ) { builder . append ( super . asString ( array [ i ] ) ) ; if ( i < array . length - 1 ) { builder . append ( glue ) ; } } return builder . toString ( ) ;
public class InstanceProfile { /** * The role associated with the instance profile . * @ param roles * The role associated with the instance profile . */ public void setRoles ( java . util . Collection < Role > roles ) { } }
if ( roles == null ) { this . roles = null ; return ; } this . roles = new com . amazonaws . internal . SdkInternalList < Role > ( roles ) ;
public class MapIterator { /** * Remove the current item in the iterator . */ public void remove ( ) { } }
if ( _mapIterator == null ) throw new UnsupportedOperationException ( Bundle . getErrorString ( "IteratorFactory_Iterator_removeUnsupported" , new Object [ ] { this . getClass ( ) . getName ( ) } ) ) ; else _mapIterator . remove ( ) ;
public class FrenchRepublicanCalendar { /** * / * [ deutsch ] * < p > Pr & uuml ; ft , ob die angegebenen Parameter ein wohldefiniertes Kalenderdatum beschreiben . < / p > * @ param year the year of era to be checked * @ param month the month to be checked * @ param dayOfMonth the day of month to be checked * @ return { @ code true } if valid else { @ code false } * @ see # of ( int , int , int ) * @ since 3.34/4.29 */ public static boolean isValid ( int year , int month , int dayOfMonth ) { } }
return ( ( year >= 1 ) && ( year <= MAX_YEAR ) && ( month >= 1 ) && ( month <= 12 ) && ( dayOfMonth >= 1 ) && ( dayOfMonth <= 30 ) ) ;
public class CPDefinitionSpecificationOptionValuePersistenceImpl { /** * Returns the cp definition specification option values before and after the current cp definition specification option value in the ordered set where CPSpecificationOptionId = & # 63 ; . * @ param CPDefinitionSpecificationOptionValueId the primary key of the current cp definition specification option value * @ param CPSpecificationOptionId the cp specification option ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the previous , current , and next cp definition specification option value * @ throws NoSuchCPDefinitionSpecificationOptionValueException if a cp definition specification option value with the primary key could not be found */ @ Override public CPDefinitionSpecificationOptionValue [ ] findByCPSpecificationOptionId_PrevAndNext ( long CPDefinitionSpecificationOptionValueId , long CPSpecificationOptionId , OrderByComparator < CPDefinitionSpecificationOptionValue > orderByComparator ) throws NoSuchCPDefinitionSpecificationOptionValueException { } }
CPDefinitionSpecificationOptionValue cpDefinitionSpecificationOptionValue = findByPrimaryKey ( CPDefinitionSpecificationOptionValueId ) ; Session session = null ; try { session = openSession ( ) ; CPDefinitionSpecificationOptionValue [ ] array = new CPDefinitionSpecificationOptionValueImpl [ 3 ] ; array [ 0 ] = getByCPSpecificationOptionId_PrevAndNext ( session , cpDefinitionSpecificationOptionValue , CPSpecificationOptionId , orderByComparator , true ) ; array [ 1 ] = cpDefinitionSpecificationOptionValue ; array [ 2 ] = getByCPSpecificationOptionId_PrevAndNext ( session , cpDefinitionSpecificationOptionValue , CPSpecificationOptionId , orderByComparator , false ) ; return array ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; }
public class ArticleConsumerLogMessages { /** * Logs the occurance of an exception while retrieving the input file . * @ param logger * reference to the logger * @ param archive * reference to the archive * @ param e * reference to the exception */ public static void logExceptionRetrieveArchive ( final Logger logger , final ArchiveDescription archive , final Exception e ) { } }
logger . logException ( Level . ERROR , "Exception while accessing archive " + archive . toString ( ) , e ) ;
public class CertificatesInner { /** * Retrieve a list of certificates . * @ param resourceGroupName Name of an Azure Resource group . * @ param automationAccountName The name of the automation account . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; CertificateInner & gt ; object */ public Observable < Page < CertificateInner > > listByAutomationAccountAsync ( final String resourceGroupName , final String automationAccountName ) { } }
return listByAutomationAccountWithServiceResponseAsync ( resourceGroupName , automationAccountName ) . map ( new Func1 < ServiceResponse < Page < CertificateInner > > , Page < CertificateInner > > ( ) { @ Override public Page < CertificateInner > call ( ServiceResponse < Page < CertificateInner > > response ) { return response . body ( ) ; } } ) ;
public class LispUtil { /** * Identical to Preconditions . checkArgument but throws an * { @ code EvalError } instead of an IllegalArgumentException . * Use this check to verify properties of a Lisp program * execution , i . e . , whenever the raised exception should be * catchable by the evaluator of the program . * @ param condition * @ param message * @ param values */ public static void checkArgument ( boolean condition , String message , Object ... values ) { } }
if ( ! condition ) { throw new EvalError ( String . format ( message , values ) ) ; }
public class FactoryInterestPointAlgs { /** * Creates a { @ link FeaturePyramid } which is uses a hessian blob detector . * @ param extractRadius Size of the feature used to detect the corners . * @ param detectThreshold Minimum corner intensity required * @ param maxFeatures Max number of features that can be found . * @ param imageType Type of input image . * @ param derivType Image derivative type . * @ return CornerLaplaceScaleSpace */ public static < T extends ImageGray < T > , D extends ImageGray < D > > FeaturePyramid < T , D > hessianPyramid ( int extractRadius , float detectThreshold , int maxFeatures , Class < T > imageType , Class < D > derivType ) { } }
GeneralFeatureIntensity < T , D > intensity = new WrapperHessianBlobIntensity < > ( HessianBlobIntensity . Type . DETERMINANT , derivType ) ; NonMaxSuppression extractor = FactoryFeatureExtractor . nonmax ( new ConfigExtract ( extractRadius , detectThreshold , extractRadius , true ) ) ; GeneralFeatureDetector < T , D > detector = new GeneralFeatureDetector < > ( intensity , extractor ) ; detector . setMaxFeatures ( maxFeatures ) ; AnyImageDerivative < T , D > deriv = GImageDerivativeOps . derivativeForScaleSpace ( imageType , derivType ) ; return new FeaturePyramid < > ( detector , deriv , 2 ) ;
public class SynchronousRequest { /** * For more info on legends API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / legends " > here < / a > < br / > * Get all legend id ( s ) * @ return list of legend info * @ throws GuildWars2Exception see { @ link ErrorCode } for detail * @ see Legend legend info */ public List < String > getAllLegendID ( ) throws GuildWars2Exception { } }
try { Response < List < String > > response = gw2API . getAllLegendIDs ( ) . execute ( ) ; if ( ! response . isSuccessful ( ) ) throwError ( response . code ( ) , response . errorBody ( ) ) ; return response . body ( ) ; } catch ( IOException e ) { throw new GuildWars2Exception ( ErrorCode . Network , "Network Error: " + e . getMessage ( ) ) ; }
public class AmazonConfigClient { /** * Returns details about the specified delivery channel . If a delivery channel is not specified , this action returns * the details of all delivery channels associated with the account . * < note > * Currently , you can specify only one delivery channel per region in your account . * < / note > * @ param describeDeliveryChannelsRequest * The input for the < a > DescribeDeliveryChannels < / a > action . * @ return Result of the DescribeDeliveryChannels operation returned by the service . * @ throws NoSuchDeliveryChannelException * You have specified a delivery channel that does not exist . * @ sample AmazonConfig . DescribeDeliveryChannels * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / config - 2014-11-12 / DescribeDeliveryChannels " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DescribeDeliveryChannelsResult describeDeliveryChannels ( DescribeDeliveryChannelsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeDeliveryChannels ( request ) ;
public class AbstractCamtParser { /** * Entfernt die Whitespaces des Textes . * Manche Banken fuellen den Gegenkontoinhaber rechts auf 70 Zeichen mit Leerzeichen auf . * @ param s der Text . NPE - Sicher . * @ return der getrimmte Text . */ protected String trim ( String s ) { } }
if ( s == null || s . length ( ) == 0 ) return s ; return s . trim ( ) ;
public class SwitchSubScreenHandler { /** * The Field has Changed . * Get the value of this listener ' s field and setup the new sub - screen . * @ param bDisplayOption If true , display the change . * @ param iMoveMode The type of move being done ( init / read / screen ) . * @ return The error code ( or NORMAL _ RETURN if okay ) . * Change the sub - screen to coorespond to this screen number . */ public int fieldChanged ( boolean bDisplayOption , int moveMode ) { } }
int iScreenNo = ( int ) ( ( NumberField ) m_owner ) . getValue ( ) ; if ( ( iScreenNo == - 1 ) || ( iScreenNo == m_iCurrentScreenNo ) ) return DBConstants . NORMAL_RETURN ; ScreenLocation screenLocation = null ; // First , find the current sub - screen this . setCurrentSubScreen ( null ) ; // Make your best guess as to the old sub - screen // Display wait cursor BaseAppletReference applet = null ; if ( m_screenParent . getTask ( ) instanceof BaseAppletReference ) applet = ( BaseAppletReference ) m_screenParent . getTask ( ) ; Object oldCursor = null ; if ( applet != null ) oldCursor = applet . setStatus ( DBConstants . WAIT , applet , null ) ; ScreenField sField = m_screenParent . getSField ( m_iScreenSeq ) ; if ( ( sField != null ) && ( sField instanceof BaseScreen ) ) { // First , get rid of the old screen screenLocation = sField . getScreenLocation ( ) ; m_screenParent = sField . getParentScreen ( ) ; sField . free ( ) ; sField = null ; if ( m_screenParent == null ) if ( this . getOwner ( ) . getComponent ( 0 ) instanceof ScreenField ) // Always m_screenParent = ( ( ScreenField ) this . getOwner ( ) . getComponent ( 0 ) ) . getParentScreen ( ) ; } if ( screenLocation == null ) screenLocation = m_screenParent . getNextLocation ( ScreenConstants . FLUSH_LEFT , ScreenConstants . FILL_REMAINDER ) ; sField = this . getSubScreen ( m_screenParent , screenLocation , null , iScreenNo ) ; if ( applet != null ) applet . setStatus ( 0 , applet , oldCursor ) ; if ( sField == null ) m_iCurrentScreenNo = - 1 ; else m_iCurrentScreenNo = iScreenNo ; return DBConstants . NORMAL_RETURN ;
public class InternalXbaseParser { /** * InternalXbase . g : 567:1 : ruleXCastedExpression : ( ( rule _ _ XCastedExpression _ _ Group _ _ 0 ) ) ; */ public final void ruleXCastedExpression ( ) throws RecognitionException { } }
int stackSize = keepStackSize ( ) ; try { // InternalXbase . g : 571:2 : ( ( ( rule _ _ XCastedExpression _ _ Group _ _ 0 ) ) ) // InternalXbase . g : 572:2 : ( ( rule _ _ XCastedExpression _ _ Group _ _ 0 ) ) { // InternalXbase . g : 572:2 : ( ( rule _ _ XCastedExpression _ _ Group _ _ 0 ) ) // InternalXbase . g : 573:3 : ( rule _ _ XCastedExpression _ _ Group _ _ 0 ) { if ( state . backtracking == 0 ) { before ( grammarAccess . getXCastedExpressionAccess ( ) . getGroup ( ) ) ; } // InternalXbase . g : 574:3 : ( rule _ _ XCastedExpression _ _ Group _ _ 0 ) // InternalXbase . g : 574:4 : rule _ _ XCastedExpression _ _ Group _ _ 0 { pushFollow ( FOLLOW_2 ) ; rule__XCastedExpression__Group__0 ( ) ; state . _fsp -- ; if ( state . failed ) return ; } if ( state . backtracking == 0 ) { after ( grammarAccess . getXCastedExpressionAccess ( ) . getGroup ( ) ) ; } } } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { restoreStackSize ( stackSize ) ; } return ;
public class ListRulesRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListRulesRequest listRulesRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listRulesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listRulesRequest . getNamePrefix ( ) , NAMEPREFIX_BINDING ) ; protocolMarshaller . marshall ( listRulesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listRulesRequest . getLimit ( ) , LIMIT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class FastTrackData { /** * Read a FastTrack file . * @ param file FastTrack file */ public void process ( File file ) throws Exception { } }
openLogFile ( ) ; int blockIndex = 0 ; int length = ( int ) file . length ( ) ; m_buffer = new byte [ length ] ; FileInputStream is = new FileInputStream ( file ) ; try { int bytesRead = is . read ( m_buffer ) ; if ( bytesRead != length ) { throw new RuntimeException ( "Read count different" ) ; } } finally { is . close ( ) ; } List < Integer > blocks = new ArrayList < Integer > ( ) ; for ( int index = 64 ; index < m_buffer . length - 11 ; index ++ ) { if ( matchPattern ( PARENT_BLOCK_PATTERNS , index ) ) { blocks . add ( Integer . valueOf ( index ) ) ; } } int startIndex = 0 ; for ( int endIndex : blocks ) { int blockLength = endIndex - startIndex ; readBlock ( blockIndex , startIndex , blockLength ) ; startIndex = endIndex ; ++ blockIndex ; } int blockLength = m_buffer . length - startIndex ; readBlock ( blockIndex , startIndex , blockLength ) ; closeLogFile ( ) ;
public class DHistogram { /** * Find Inclusive _ max2 */ public void setMax ( float max ) { } }
int imax = Float . floatToRawIntBits ( max ) ; float old = _maxIn ; while ( max > old && ! _unsafe . compareAndSwapInt ( this , _max2Offset , Float . floatToRawIntBits ( old ) , imax ) ) old = _maxIn ;
public class IntDiGraph { /** * Returns a new graph whose nodes are the edges of this graph with and edge * from ( i , j ) to ( s , t ) if j = = s and i ! = t ; if selfAvoiding is false , then * i = t is allowed ; the id of the nodes correspond to the position in the edgeList of this graph ; * the nodes are added in that order ; edges are created in the order of the source nodes following successor pointers */ public Pair < IntDiGraph , IntObjectBimap < DiEdge > > edgeGraph ( boolean selfAvoiding ) { } }
IntDiGraph g = new IntDiGraph ( ) ; IntObjectBimap < DiEdge > edgeToNodeMap = new IntObjectBimap < > ( g . edges . size ( ) ) ; edgeToNodeMap . startGrowth ( ) ; for ( DiEdge e : edges ) { g . addNode ( edgeToNodeMap . lookupIndex ( e ) ) ; } edgeToNodeMap . stopGrowth ( ) ; // loop over edges for ( Indexed < DiEdge > e : enumerate ( edges ) ) { int newS = e . index ( ) ; int oldS = e . get ( ) . get1 ( ) ; int oldT = e . get ( ) . get2 ( ) ; // loop over successors for ( int oldV : successors . get ( oldT ) ) { // skip if self avoiding and s = = v if ( selfAvoiding && oldS == oldV ) { continue ; } int newT = edgeToNodeMap . lookupIndex ( edge ( oldT , oldV ) ) ; g . addEdge ( newS , newT ) ; } } return new Pair < > ( g , edgeToNodeMap ) ;
public class LogInterceptor { /** * 取得结果字符串 * @ param result * @ return */ protected String getResultString ( Object result ) { } }
if ( result == null ) { return StringUtils . EMPTY ; } if ( result instanceof Map ) { // 处理map return getMapResultString ( ( Map ) result ) ; } else if ( result instanceof List ) { // 处理list return getListResultString ( ( List ) result ) ; } else if ( result . getClass ( ) . isArray ( ) ) { // 处理array return getArrayResultString ( ( Object [ ] ) result ) ; } else { // 直接处理string return ObjectUtils . toString ( result , StringUtils . EMPTY ) . toString ( ) ; // return ToStringBuilder . reflectionToString ( result , ToStringStyle . SIMPLE _ STYLE ) ; }
public class GSCAImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . GSCA__XPOS : return getXPOS ( ) ; case AfplibPackage . GSCA__YPOS : return getYPOS ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class CmsGalleryController { /** * Adds a folder to the current search object . < p > * @ param folder the folder to add */ public void addFolder ( String folder ) { } }
m_searchObject . addFolder ( folder ) ; m_searchObjectChanged = true ; ValueChangeEvent . fire ( this , m_searchObject ) ;
public class CheckParameterizables { /** * Check for a V3 constructor . */ private State checkV3Parameterization ( Class < ? > cls , State state ) throws NoClassDefFoundError { } }
// check for a V3 Parameterizer class for ( Class < ? > inner : cls . getDeclaredClasses ( ) ) { if ( AbstractParameterizer . class . isAssignableFrom ( inner ) ) { try { Class < ? extends AbstractParameterizer > pcls = inner . asSubclass ( AbstractParameterizer . class ) ; pcls . newInstance ( ) ; if ( checkParameterizer ( cls , pcls ) ) { if ( state == State . INSTANTIABLE ) { LOG . warning ( "More than one parameterization method in class " + cls . getName ( ) ) ; } state = State . INSTANTIABLE ; } } catch ( Exception | Error e ) { LOG . verbose ( "Could not run Parameterizer: " + inner . getName ( ) + ": " + e . getMessage ( ) ) ; // continue . Probably non - public } } } return state ;
public class AbstractParser { /** * Store capacity * @ param e The extension * @ param writer The writer * @ param elementName the element name * @ exception XMLStreamException Thrown if an error occurs */ protected void storeExtension ( Extension e , XMLStreamWriter writer , String elementName ) throws XMLStreamException { } }
writer . writeStartElement ( elementName ) ; writer . writeAttribute ( CommonXML . ATTRIBUTE_CLASS_NAME , e . getValue ( CommonXML . ATTRIBUTE_CLASS_NAME , e . getClassName ( ) ) ) ; if ( e . getModuleName ( ) != null ) writer . writeAttribute ( CommonXML . ATTRIBUTE_MODULE_NAME , e . getValue ( CommonXML . ATTRIBUTE_MODULE_NAME , e . getModuleName ( ) ) ) ; if ( e . getModuleSlot ( ) != null ) writer . writeAttribute ( CommonXML . ATTRIBUTE_MODULE_SLOT , e . getValue ( CommonXML . ATTRIBUTE_MODULE_SLOT , e . getModuleSlot ( ) ) ) ; if ( ! e . getConfigPropertiesMap ( ) . isEmpty ( ) ) { Iterator < Map . Entry < String , String > > it = e . getConfigPropertiesMap ( ) . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry < String , String > entry = it . next ( ) ; writer . writeStartElement ( CommonXML . ELEMENT_CONFIG_PROPERTY ) ; writer . writeAttribute ( CommonXML . ATTRIBUTE_NAME , entry . getKey ( ) ) ; writer . writeCharacters ( e . getValue ( CommonXML . ELEMENT_CONFIG_PROPERTY , entry . getKey ( ) , entry . getValue ( ) ) ) ; writer . writeEndElement ( ) ; } } writer . writeEndElement ( ) ;
public class AbstractGrabber { /** * / * ( non - Javadoc ) * @ see au . edu . jcu . v4l4j . FrameGrabber # setVideoInputNStandard ( ) */ @ Override public void setVideoInputNStandard ( int input , int standard ) throws VideoStandardException , CaptureChannelException { } }
state . checkReleased ( ) ; doSetVideoInputNStandard ( object , input , standard ) ;
public class MotionEventUtils { /** * Calculate the vertical move motion direction . * @ param e1 start point of the motion . * @ param e2 end point of the motion . * @ return the motion direction for the vertical axis . */ public static MotionDirection getVerticalMotionDirection ( MotionEvent e1 , MotionEvent e2 ) { } }
return getVerticalMotionDirection ( e1 , e2 , DEFAULT_THRESHOLD ) ;
public class Utilities { /** * Null - safe comparison . * @ param < T > - type of the comparable element . * @ param object1 the first object . * @ param object2 the second object . * @ return Negative number if a lower than b . * Positive number if a greater than b . * < code > 0 < / code > if a is equal to b . */ public static < T > int compareTo ( Comparable < T > object1 , T object2 ) { } }
if ( object1 == object2 ) { return 0 ; } if ( object1 == null ) { return Integer . MIN_VALUE ; } if ( object2 == null ) { return Integer . MAX_VALUE ; } assert object1 != null && object2 != null ; return object1 . compareTo ( object2 ) ;
public class SSLSocketFactoryEx { /** * Initializes the SSL Socket Factory Extension . * @ param km the key managers * @ param tm the trust managers * @ param random the secure random number generator * @ throws NoSuchAlgorithmException thrown when an algorithm is not * supported * @ throws KeyManagementException thrown if initialization fails */ private void initSSLSocketFactoryEx ( KeyManager [ ] km , TrustManager [ ] tm , SecureRandom random ) throws NoSuchAlgorithmException , KeyManagementException { } }
sslCtxt = SSLContext . getInstance ( "TLS" ) ; sslCtxt . init ( km , tm , random ) ; protocols = getProtocolList ( ) ;
public class RBBIRuleScanner { /** * / CLOVER : OFF */ void printNodeStack ( String title ) { } }
int i ; System . out . println ( title + ". Dumping node stack...\n" ) ; for ( i = fNodeStackPtr ; i > 0 ; i -- ) { fNodeStack [ i ] . printTree ( true ) ; }
public class DatastoreHelper { /** * Make an array value containing the specified values . */ public static Value . Builder makeValue ( Value . Builder value1 , Value . Builder value2 , Value . Builder ... rest ) { } }
ArrayValue . Builder arrayValue = ArrayValue . newBuilder ( ) ; arrayValue . addValues ( value1 ) ; arrayValue . addValues ( value2 ) ; for ( Value . Builder builder : rest ) { arrayValue . addValues ( builder ) ; } return Value . newBuilder ( ) . setArrayValue ( arrayValue ) ;
public class ResourceManager { /** * Notifies the ResourceManager that a fatal error has occurred and it cannot proceed . * @ param t The exception describing the fatal error */ protected void onFatalError ( Throwable t ) { } }
try { log . error ( "Fatal error occurred in ResourceManager." , t ) ; } catch ( Throwable ignored ) { } // The fatal error handler implementation should make sure that this call is non - blocking fatalErrorHandler . onFatalError ( t ) ;
public class SpatialiteWKBWriter { /** * Writes a { @ link Geometry } to an { @ link OutStream } . * @ param geom the geometry to write * @ param os the out stream to write to * @ throws IOException if an I / O error occurs */ public void writeSpatialiteGeometry ( Geometry geom , OutStream os ) throws IOException { } }
// geom starts with byte 0x00 buf [ 0 ] = 0x00 ; os . write ( buf , 1 ) ; writeByteOrder ( os ) ; writeInt ( geom . getSRID ( ) , os ) ; // 6 - 13 MBR _ MIN _ X a double value [ little - big - endian ordered , accordingly with the // precedent one ] // corresponding to the MBR minimum X coordinate for this GEOMETRY // 14 - 21 MBR _ MIN _ Y a double value corresponding to the MBR minimum Y coordinate // 22 - 29 MBR _ MAX _ X a double value corresponding to the MBR maximum X coordinate // 30 - 37 MBR _ MAX _ Y a double value corresponding to the MBR maximum Y coordinate Envelope envInt = geom . getEnvelopeInternal ( ) ; writeDouble ( envInt . getMinX ( ) , os ) ; writeDouble ( envInt . getMinY ( ) , os ) ; writeDouble ( envInt . getMaxX ( ) , os ) ; writeDouble ( envInt . getMaxY ( ) , os ) ; // / / 38 MBR _ END [ hex 7C ] a GEOMETRY encoded BLOB value must always have an 0x7C byte in // this // / / position buf [ 0 ] = 0x7C ; os . write ( buf , 1 ) ; if ( geom instanceof Point ) writePoint ( ( Point ) geom , os ) ; // LinearRings will be written as LineStrings else if ( geom instanceof LineString ) writeLineString ( ( LineString ) geom , os ) ; else if ( geom instanceof Polygon ) writePolygon ( ( Polygon ) geom , os ) ; else if ( geom instanceof MultiPoint ) writeGeometryCollection ( WKBConstants . wkbMultiPoint , ( MultiPoint ) geom , os ) ; else if ( geom instanceof MultiLineString ) writeGeometryCollection ( WKBConstants . wkbMultiLineString , ( MultiLineString ) geom , os ) ; else if ( geom instanceof MultiPolygon ) writeGeometryCollection ( WKBConstants . wkbMultiPolygon , ( MultiPolygon ) geom , os ) ; else if ( geom instanceof GeometryCollection ) writeGeometryCollection ( WKBConstants . wkbGeometryCollection , ( GeometryCollection ) geom , os ) ; else { Assert . shouldNeverReachHere ( "Unknown Geometry type" ) ; }
public class JsonQueryObjectModelConverter { /** * TODO thread safety and cache invalidation on file updates */ public Include getDefineFromFile ( String includeName , boolean useCaching ) throws QueryException { } }
Include include = null ; if ( useCaching ) { include = CACHED_DEFINES . get ( includeName ) ; } if ( include != null ) { return include ; } String namespaceString = includeName . substring ( 0 , includeName . indexOf ( ":" ) ) ; String singleIncludeName = includeName . substring ( includeName . indexOf ( ":" ) + 1 ) ; URL resource ; try { resource = getClass ( ) . getClassLoader ( ) . loadClass ( "org.bimserver.database.queries.StartFrame" ) . getResource ( "json/" + namespaceString + ".json" ) ; if ( resource == null ) { throw new QueryException ( "Could not find '" + namespaceString + "' namespace in predefined queries" ) ; } } catch ( ClassNotFoundException e1 ) { throw new QueryException ( "Could not find '" + namespaceString + "' namespace in predefined queries" ) ; } OBJECT_MAPPER . configure ( JsonParser . Feature . ALLOW_UNQUOTED_FIELD_NAMES , true ) ; try { ObjectNode predefinedQuery = OBJECT_MAPPER . readValue ( resource , ObjectNode . class ) ; Query query = parseJson ( namespaceString , predefinedQuery ) ; Include define = query . getDefine ( singleIncludeName ) ; if ( copyExternalDefines ) { define = define . copy ( ) ; } if ( define == null ) { throw new QueryException ( "Could not find '" + singleIncludeName + "' in defines in namespace " + query . getName ( ) ) ; } if ( useCaching ) { CACHED_DEFINES . put ( includeName , define ) ; } return define ; } catch ( JsonParseException e ) { throw new QueryException ( e ) ; } catch ( JsonMappingException e ) { throw new QueryException ( e ) ; } catch ( IOException e ) { throw new QueryException ( e ) ; }
public class JShellTool { /** * Print command - line error using resource bundle look - up , MessageFormat * @ param key the resource key * @ param args */ void startmsg ( String key , Object ... args ) { } }
cmderr . println ( messageFormat ( key , args ) ) ;
public class EnvUtil { /** * Convert docker host URL to an http URL */ public static String convertTcpToHttpUrl ( String connect ) { } }
String protocol = connect . contains ( ":" + DOCKER_HTTPS_PORT ) ? "https:" : "http:" ; return connect . replaceFirst ( "^tcp:" , protocol ) ;
public class MessageBirdClient { /** * Convenient function to send a simple message to a list of recipients * @ param voiceMessage Voice message object * @ return VoiceMessageResponse * @ throws UnauthorizedException if client is unauthorized * @ throws GeneralException general exception */ public VoiceMessageResponse sendVoiceMessage ( final VoiceMessage voiceMessage ) throws UnauthorizedException , GeneralException { } }
return messageBirdService . sendPayLoad ( VOICEMESSAGESPATH , voiceMessage , VoiceMessageResponse . class ) ;
public class ModelsImpl { /** * Deletes a closed list model from the application . * @ param appId The application ID . * @ param versionId The version ID . * @ param clEntityId The closed list model ID . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < OperationStatus > deleteClosedListAsync ( UUID appId , String versionId , UUID clEntityId , final ServiceCallback < OperationStatus > serviceCallback ) { } }
return ServiceFuture . fromResponse ( deleteClosedListWithServiceResponseAsync ( appId , versionId , clEntityId ) , serviceCallback ) ;
public class SessionConfigTypeImpl { /** * Returns the < code > session - timeout < / code > element * @ return the node defined for the element < code > session - timeout < / code > */ public Integer getSessionTimeout ( ) { } }
if ( childNode . getTextValueForPatternName ( "session-timeout" ) != null && ! childNode . getTextValueForPatternName ( "session-timeout" ) . equals ( "null" ) ) { return Integer . valueOf ( childNode . getTextValueForPatternName ( "session-timeout" ) ) ; } return null ;
public class GreenMailBean { /** * Invoked by a BeanFactory after it has set all bean properties supplied ( and satisfied * BeanFactoryAware and ApplicationContextAware ) . < p > This method allows the bean instance to * perform initialization only possible when all bean properties have been set and to throw an * exception in the event of misconfiguration . * @ throws Exception in the event of misconfiguration ( such as failure to set an essential * property ) or if initialization fails . */ @ Override public void afterPropertiesSet ( ) throws Exception { } }
greenMail = new GreenMail ( createServerSetup ( ) ) ; if ( null != users ) { for ( String user : users ) { int posColon = user . indexOf ( ':' ) ; int posAt = user . indexOf ( '@' ) ; String login = user . substring ( 0 , posColon ) ; String pwd = user . substring ( posColon + 1 , posAt ) ; String domain = user . substring ( posAt + 1 ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Adding user {}:{}@{}" , login , pwd , domain ) ; } greenMail . setUser ( login + '@' + domain , login , pwd ) ; } } if ( autostart ) { greenMail . start ( ) ; started = true ; }
public class SystemUtils { /** * Helper method that consumes the output and error streams of a process . * This should avoid deadlocks where , e . g . the process won ' t complete because * it is waiting for output to be read from stdout or stderr . * @ param process A running process . * @ param outputWriter Where to write output . If null , System . out is used . * @ param errorWriter Where to write error output . If null , System . err is used . */ private static void consume ( Process process , Writer outputWriter , Writer errorWriter ) throws IOException , InterruptedException { } }
if ( outputWriter == null ) { outputWriter = new OutputStreamWriter ( System . out ) ; } if ( errorWriter == null ) { errorWriter = new OutputStreamWriter ( System . err ) ; } WriterThread outputThread = new WriterThread ( process . getInputStream ( ) , outputWriter ) ; WriterThread errorThread = new WriterThread ( process . getErrorStream ( ) , errorWriter ) ; outputThread . start ( ) ; errorThread . start ( ) ; outputThread . join ( ) ; errorThread . join ( ) ;
public class CmsSubscriptionCollector { /** * Returns the configured subscription filter to use . < p > * @ param cms the current users context * @ param params the optional collector parameters * @ return the configured subscription filter to use * @ throws CmsException if something goes wrong */ protected CmsSubscriptionFilter getSubscriptionFilter ( CmsObject cms , Map < String , String > params ) throws CmsException { } }
CmsSubscriptionFilter filter = new CmsSubscriptionFilter ( ) ; // initialize the filter initVisitedByFilter ( filter , cms , params , false ) ; // set subscription filter specific parameters // determine the mode to read subscribed resources if ( params . containsKey ( PARAM_KEY_MODE ) ) { String modeName = params . get ( PARAM_KEY_MODE ) ; filter . setMode ( CmsSubscriptionReadMode . modeForName ( modeName ) ) ; } // determine the groups to set in the filter if ( params . containsKey ( PARAM_KEY_GROUPS ) ) { List < String > groupNames = CmsStringUtil . splitAsList ( params . get ( PARAM_KEY_GROUPS ) , ',' , true ) ; for ( Iterator < String > i = groupNames . iterator ( ) ; i . hasNext ( ) ; ) { String groupName = i . next ( ) ; try { CmsGroup group = cms . readGroup ( groupName ) ; filter . addGroup ( group ) ; } catch ( CmsException e ) { // error reading a group LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_COLLECTOR_PARAM_INVALID_1 , PARAM_KEY_GROUPS + "=" + params . get ( PARAM_KEY_GROUPS ) ) ) ; throw e ; } } } boolean includeUserGroups = Boolean . valueOf ( params . get ( PARAM_KEY_INCLUDEGROUPS ) ) . booleanValue ( ) ; if ( filter . getGroups ( ) . isEmpty ( ) && includeUserGroups ) { // include the given or current users groups String userName = null ; if ( filter . getUser ( ) != null ) { userName = filter . getUser ( ) . getName ( ) ; } else { userName = cms . getRequestContext ( ) . getCurrentUser ( ) . getName ( ) ; } filter . setGroups ( cms . getGroupsOfUser ( userName , false ) ) ; } return filter ;
public class LinkState { /** * Method choosePtoPOutputHandler * < p > Choose OutputHandler for Link . * @ param linkUuid * @ return * @ throws SIResourceException */ public OutputHandler choosePtoPOutputHandler ( SIBUuid12 linkUuid ) throws SIResourceException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "choosePtoPOutputHandler" , linkUuid ) ; OutputHandler result = null ; LinkSelection s = null ; if ( isLocalMsgsItemStream ( ) ) { result = ( OutputHandler ) getLocalPtoPConsumerManager ( ) ; result . setWLMGuess ( false ) ; } else { // Pick an ME to send the message to . s = _localisationManager . getTRMFacade ( ) . chooseLink ( linkUuid ) ; // If the link is not available in WLM , we either continue putting the // messages to where we think the bridge is , but marking them as // guesses , or if we dont know where the bridge is , we put them // to the uuid SIMPConstants . UNKNOWN _ UUID if ( s == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Link not available in WLM" ) ; // lastKnownMEOutputHandler should only ever be null if no outputhandlers exist // for the link . In this case , one should be created . As TRM / WLM cannot // provide one , a temporary localisation is set up to hold the messages // until TRM can provide a proper response . if ( _lastKnownMEOutputHandler == null ) { SIBUuid8 localisingME = new SIBUuid8 ( SIMPConstants . UNKNOWN_UUID ) ; updateLocalisationSet ( localisingME , localisingME ) ; } result = _lastKnownMEOutputHandler ; result . setWLMGuess ( true ) ; } else { SIBUuid8 choiceUuid = s . getInboundMeUuid ( ) ; SIBUuid8 routingUuid = s . getOutboundMeUuid ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "InboundMeUuid is " + choiceUuid + " OutboundMeUuid is " + routingUuid ) ; if ( choiceUuid == null ) { // In the MQLink case there is no inboundMeUuid , so send the message // to the outboundMeUuid choiceUuid = s . getOutboundMeUuid ( ) ; } result = getQueuePointOutputHandler ( choiceUuid ) ; if ( result == null ) { updateLocalisationSet ( choiceUuid , routingUuid ) ; result = getQueuePointOutputHandler ( choiceUuid ) ; } result . setWLMGuess ( false ) ; if ( routingUuid != null ) { // If this is the ME hosting the link then send to // the foreign ME of the link ( choiceUuid ) // Otherwise send to the ME hosting the link in this bus if ( routingUuid . equals ( _messageProcessor . getMessagingEngineUuid ( ) ) ) { routingUuid = choiceUuid ; } // Currently Links only have one queue point so preferLocal is always true . // When multiple links are introduced it will be possible for the result here // to be a ConsumerDispatcher and therefore this cast will fail . ( ( PtoPOutputHandler ) result ) . updateRoutingCellule ( routingUuid ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "choosePtoPOutputHandler" , result ) ; return result ;
public class ContactDetailMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ContactDetail contactDetail , ProtocolMarshaller protocolMarshaller ) { } }
if ( contactDetail == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( contactDetail . getFirstName ( ) , FIRSTNAME_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getLastName ( ) , LASTNAME_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getContactType ( ) , CONTACTTYPE_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getOrganizationName ( ) , ORGANIZATIONNAME_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getAddressLine1 ( ) , ADDRESSLINE1_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getAddressLine2 ( ) , ADDRESSLINE2_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getCity ( ) , CITY_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getState ( ) , STATE_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getCountryCode ( ) , COUNTRYCODE_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getZipCode ( ) , ZIPCODE_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getPhoneNumber ( ) , PHONENUMBER_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getEmail ( ) , EMAIL_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getFax ( ) , FAX_BINDING ) ; protocolMarshaller . marshall ( contactDetail . getExtraParams ( ) , EXTRAPARAMS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SqlQueryStatement { /** * Get the column name from the indirection table . * @ param mnAlias * @ param path */ private String getIndirectionTableColName ( TableAlias mnAlias , String path ) { } }
int dotIdx = path . lastIndexOf ( "." ) ; String column = path . substring ( dotIdx ) ; return mnAlias . alias + column ;
public class MasterClock { /** * If the value is too small , it will be overwritten by { @ link # MIN _ PERIOD } * ( non - Javadoc ) * @ see com . github . thehilikus . jrobocom . timing . Clock # setPeriod ( int ) */ @ Override public void setPeriod ( int pPeriod ) { } }
if ( pPeriod < 0 ) { throw new IllegalArgumentException ( "Period cannot be negative" ) ; } int actual = Math . max ( pPeriod , MIN_PERIOD ) ; log . debug ( "Changing clock period to {}" , actual ) ; period = actual ; if ( isRunning ( ) ) { stop ( ) ; start ( false ) ; }
public class RangeFieldPartitioner { /** * Transforms a Range predicate to a closed range on this partitioner ' s upper * bounds . Handles edge cases correctly . * @ param range a Range of Strings * @ return a Range of upper - bound Strings */ private Range < String > transformClosed ( Range < String > range ) { } }
if ( range . hasLowerBound ( ) ) { String lower = range . lowerEndpoint ( ) ; // the special case , ( a , _ ] and apply ( a ) = = a is handled by skipping a String afterLower = domain . next ( apply ( lower ) ) ; if ( afterLower != null ) { if ( range . hasUpperBound ( ) ) { String upper = range . upperEndpoint ( ) ; String upperImage = apply ( upper ) ; // meaning : at the endpoint if ( upper . equals ( upperImage ) && range . isUpperBoundClosed ( ) ) { // include upper return Ranges . closed ( afterLower , upperImage ) ; } else { String beforeUpper = domain . previous ( upperImage ) ; if ( afterLower . compareTo ( beforeUpper ) <= 0 ) { return Ranges . closed ( afterLower , beforeUpper ) ; } } } else { return Ranges . atLeast ( afterLower ) ; } } } else if ( range . hasUpperBound ( ) ) { String upper = range . upperEndpoint ( ) ; String upperImage = apply ( upper ) ; if ( upper . equals ( upperImage ) && range . isUpperBoundClosed ( ) ) { // include upper return Ranges . atMost ( upperImage ) ; } else { String beforeUpper = domain . previous ( upperImage ) ; if ( beforeUpper != null ) { return Ranges . atMost ( beforeUpper ) ; } } } return null ;
public class SftpSubsystemChannel { /** * Performs an optimized write of a file through asynchronous messaging and * through buffering the local file into memory . * @ param handle * the open file handle to write to * @ param blocksize * the block size to send data , should be between 4096 and 65535 * @ param outstandingRequests * the maximum number of requests that can be outstanding at any * one time * @ param in * the InputStream to read from * @ param buffersize * the size of the temporary buffer to read from the InputStream . * Data is buffered into a temporary buffer so that the number of * local filesystem reads is reducted to a minimum . This * increases performance and so the buffer size should be as high * as possible . The default operation , if buffersize < = 0 is to * allocate a buffer the same size as the blocksize , meaning no * buffer optimization is performed . * @ param progress * provides progress information , may be null . * @ throws SshException */ public void performOptimizedWrite ( byte [ ] handle , int blocksize , int outstandingRequests , java . io . InputStream in , int buffersize , FileTransferProgress progress ) throws SftpStatusException , SshException , TransferCancelledException { } }
performOptimizedWrite ( handle , blocksize , outstandingRequests , in , buffersize , progress , 0 ) ;
public class JFapUtils { /** * Dumps useful info about a WsByteBuffer ( stops short of its actual contents ) * @ param _ this * @ param _ tc * @ param buffer * @ param string */ public static void debugTraceWsByteBufferInfo ( Object _this , TraceComponent _tc , WsByteBuffer buffer , String string ) { } }
if ( buffer != null ) { StringBuffer sb = new StringBuffer ( buffer . getClass ( ) . toString ( ) ) ; sb . append ( "@" ) ; sb . append ( Integer . toHexString ( System . identityHashCode ( buffer ) ) ) ; sb . append ( " pos=" ) ; sb . append ( buffer . position ( ) ) ; sb . append ( " limit=" ) ; sb . append ( buffer . limit ( ) ) ; sb . append ( " - " ) ; sb . append ( string ) ; SibTr . debug ( _this , _tc , sb . toString ( ) ) ; } else { SibTr . debug ( _this , _tc , "WsByteBuffer: null - " + string ) ; }