signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class WSJdbcUtil { /** * Utility method to obtain the unique identifier of the data source associated with a JDBC wrapper . * @ param jdbcWrapper proxy for a JDBC resource . * @ return JNDI name of the data source if it has one , otherwise the config . displayId of the data source . */ public static String getDataSourceIdentifier ( WSJdbcWrapper jdbcWrapper ) { } }
DSConfig config = jdbcWrapper . dsConfig . get ( ) ; return config . jndiName == null ? config . id : config . jndiName ;
public class RegionDiskClient { /** * Retrieves the list of persistent disks contained within the specified region . * < p > Sample code : * < pre > < code > * try ( RegionDiskClient regionDiskClient = RegionDiskClient . create ( ) ) { * ProjectRegionName region = ProjectRegionName . of ( " [ PROJECT ] " , " [ REGION ] " ) ; * for ( Disk element : regionDiskClient . listRegionDisks ( region ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param region Name of the region for this request . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final ListRegionDisksPagedResponse listRegionDisks ( ProjectRegionName region ) { } }
ListRegionDisksHttpRequest request = ListRegionDisksHttpRequest . newBuilder ( ) . setRegion ( region == null ? null : region . toString ( ) ) . build ( ) ; return listRegionDisks ( request ) ;
public class MetricServiceClient { /** * Lists metric descriptors that match a filter . This method does not require a Stackdriver * account . * < p > Sample code : * < pre > < code > * try ( MetricServiceClient metricServiceClient = MetricServiceClient . create ( ) ) { * ProjectName name = ProjectName . of ( " [ PROJECT ] " ) ; * for ( MetricDescriptor element : metricServiceClient . listMetricDescriptors ( name ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param name The project on which to execute the request . The format is * ` " projects / { project _ id _ or _ number } " ` . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final ListMetricDescriptorsPagedResponse listMetricDescriptors ( ProjectName name ) { } }
ListMetricDescriptorsRequest request = ListMetricDescriptorsRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . build ( ) ; return listMetricDescriptors ( request ) ;
public class SplitIndexWriter { /** * Generate separate index files , for each Unicode character , listing all * the members starting with the particular unicode character . * @ param indexbuilder IndexBuilder built by { @ link IndexBuilder } * @ throws DocletAbortException */ public static void generate ( ConfigurationImpl configuration , IndexBuilder indexbuilder ) { } }
SplitIndexWriter indexgen ; DocPath filename = DocPath . empty ; DocPath path = DocPaths . INDEX_FILES ; try { Set < Object > keys = new TreeSet < > ( Arrays . asList ( indexbuilder . elements ( ) ) ) ; keys . addAll ( configuration . tagSearchIndexKeys ) ; List < Object > elements = new ArrayList < > ( keys ) ; ListIterator < Object > li = elements . listIterator ( ) ; while ( li . hasNext ( ) ) { Object ch = li . next ( ) ; filename = DocPaths . indexN ( li . nextIndex ( ) ) ; indexgen = new SplitIndexWriter ( configuration , path . resolve ( filename ) , indexbuilder , elements , li . previousIndex ( ) , li . nextIndex ( ) ) ; indexgen . generateIndexFile ( ( Character ) ch ) ; if ( ! li . hasNext ( ) ) { indexgen . createSearchIndexFiles ( ) ; } indexgen . close ( ) ; } } catch ( IOException exc ) { configuration . standardmessage . error ( "doclet.exception_encountered" , exc . toString ( ) , filename . getPath ( ) ) ; throw new DocletAbortException ( exc ) ; }
public class DBInputFormat { /** * { @ inheritDoc } */ public InputSplit [ ] getSplits ( JobConf job , int chunks ) throws IOException { } }
try { Statement statement = connection . createStatement ( ) ; ResultSet results = statement . executeQuery ( getCountQuery ( ) ) ; results . next ( ) ; long count = results . getLong ( 1 ) ; long chunkSize = ( count / chunks ) ; results . close ( ) ; statement . close ( ) ; InputSplit [ ] splits = new InputSplit [ chunks ] ; // Split the rows into n - number of chunks and adjust the last chunk // accordingly for ( int i = 0 ; i < chunks ; i ++ ) { DBInputSplit split ; if ( ( i + 1 ) == chunks ) split = new DBInputSplit ( i * chunkSize , count ) ; else split = new DBInputSplit ( i * chunkSize , ( i * chunkSize ) + chunkSize ) ; splits [ i ] = split ; } return splits ; } catch ( SQLException e ) { throw new IOException ( e . getMessage ( ) ) ; }
public class JstlBundleInterceptor { /** * Sets the Stripes error and field resource bundles in the request , if their names have been configured . */ @ Override protected void setOtherResourceBundles ( HttpServletRequest request ) { } }
Locale locale = request . getLocale ( ) ; if ( errorBundleName != null ) { ResourceBundle errorBundle = getLocalizationBundleFactory ( ) . getErrorMessageBundle ( locale ) ; Config . set ( request , errorBundleName , new LocalizationContext ( errorBundle , locale ) ) ; LOGGER . debug ( "Loaded Stripes error message bundle " , errorBundle , " as " , errorBundleName ) ; } if ( fieldBundleName != null ) { ResourceBundle fieldBundle = getLocalizationBundleFactory ( ) . getFormFieldBundle ( locale ) ; Config . set ( request , fieldBundleName , new LocalizationContext ( fieldBundle , locale ) ) ; LOGGER . debug ( "Loaded Stripes field name bundle " , fieldBundle , " as " , fieldBundleName ) ; }
public class JavacParser { /** * Skip forward until a suitable stop token is found . */ private void skip ( boolean stopAtImport , boolean stopAtMemberDecl , boolean stopAtIdentifier , boolean stopAtStatement ) { } }
while ( true ) { switch ( token . kind ) { case SEMI : nextToken ( ) ; return ; case PUBLIC : case FINAL : case ABSTRACT : case MONKEYS_AT : case EOF : case CLASS : case INTERFACE : case ENUM : return ; case IMPORT : if ( stopAtImport ) return ; break ; case LBRACE : case RBRACE : case PRIVATE : case PROTECTED : case STATIC : case TRANSIENT : case NATIVE : case VOLATILE : case SYNCHRONIZED : case STRICTFP : case LT : case BYTE : case SHORT : case CHAR : case INT : case LONG : case FLOAT : case DOUBLE : case BOOLEAN : case VOID : if ( stopAtMemberDecl ) return ; break ; case UNDERSCORE : case IDENTIFIER : if ( stopAtIdentifier ) return ; break ; case CASE : case DEFAULT : case IF : case FOR : case WHILE : case DO : case TRY : case SWITCH : case RETURN : case THROW : case BREAK : case CONTINUE : case ELSE : case FINALLY : case CATCH : if ( stopAtStatement ) return ; break ; } nextToken ( ) ; }
public class RegexUtils { /** * Returns true if the string matches any of the specified regexes . * @ param str the string to match * @ param regexes the regexes used for matching * @ return true if the string matches one or more of the regexes */ public static boolean matchesAny ( String str , String ... regexes ) { } }
if ( ArrayUtils . isNotEmpty ( regexes ) ) { return matchesAny ( str , Arrays . asList ( regexes ) ) ; } else { return false ; }
public class CountingMemoryCache { /** * Caches the given key - value pair . * < p > Important : the client should use the returned reference instead of the original one . * It is the caller ' s responsibility to close the returned reference once not needed anymore . * @ return the new reference to be used , null if the value cannot be cached */ public CloseableReference < V > cache ( final K key , final CloseableReference < V > valueRef ) { } }
return cache ( key , valueRef , null ) ;
public class CommonOps_ZDRM { /** * Computes the complex conjugate of the input matrix . < br > * < br > * real < sub > i , j < / sub > = real < sub > i , j < / sub > < br > * imaginary < sub > i , j < / sub > = - 1 * imaginary < sub > i , j < / sub > < br > * @ param input Input matrix . Not modified . * @ param output The complex conjugate of the input matrix . Modified . */ public static void conjugate ( ZMatrixD1 input , ZMatrixD1 output ) { } }
if ( input . numCols != output . numCols || input . numRows != output . numRows ) { throw new IllegalArgumentException ( "The matrices are not all the same dimension." ) ; } final int length = input . getDataLength ( ) ; for ( int i = 0 ; i < length ; i += 2 ) { output . data [ i ] = input . data [ i ] ; output . data [ i + 1 ] = - input . data [ i + 1 ] ; }
public class BasicQueryInputProcessor { /** * Removes blocks - such as comments and other possible blocks * @ param originalSql original SQL * @ return SQL string with removed ( they will be filled with { @ link # FILL _ SYMBOL } blocks */ private String removeBlocks ( String originalSql ) { } }
StringBuilder cleanedSql = new StringBuilder ( originalSql . length ( ) ) ; Pattern regexPattern = null ; Matcher regexMatcher = null ; regexPattern = Pattern . compile ( getRegexSkipBlockSearch ( ) , Pattern . CASE_INSENSITIVE ) ; regexMatcher = regexPattern . matcher ( originalSql + "\n" ) ; int prevBlockEnd = 0 ; int blockStart = 0 ; int blockEnd = 0 ; String block = null ; while ( regexMatcher . find ( ) == true ) { blockStart = regexMatcher . start ( ) ; blockEnd = Math . min ( originalSql . length ( ) , regexMatcher . end ( ) ) ; block = originalSql . substring ( blockStart , blockEnd ) ; cleanedSql . append ( originalSql . substring ( prevBlockEnd , blockStart ) ) ; prevBlockEnd = blockEnd ; cleanedSql . append ( fill ( FILL_SYMBOL , block . length ( ) ) ) ; } cleanedSql . append ( originalSql . substring ( prevBlockEnd , originalSql . length ( ) ) ) ; return cleanedSql . toString ( ) ;
public class ExpressionUtils { /** * Create a new Operation expression * @ param type type of expression * @ param operator operator * @ param args operation arguments * @ return operation expression */ @ SuppressWarnings ( "unchecked" ) public static < T > Operation < T > operation ( Class < ? extends T > type , Operator operator , ImmutableList < Expression < ? > > args ) { } }
if ( type . equals ( Boolean . class ) ) { return ( Operation < T > ) new PredicateOperation ( operator , args ) ; } else { return new OperationImpl < T > ( type , operator , args ) ; }
public class TreeMultiMap { /** * { @ inheritDoc } This method runs in constant time , except for the first * time called on a sub - map , when it runs in linear time to the number of * values . */ public int range ( ) { } }
// the current range isn ' t accurate , loop through the values and count if ( recalculateRange ) { recalculateRange = false ; range = 0 ; for ( V v : values ( ) ) range ++ ; } return range ;
public class Metadata { /** * Adds a metadata value to the dictionary . * @ param name the name * @ param value the value */ public void add ( String name , TiffObject value ) { } }
if ( ! metadata . containsKey ( name ) ) { metadata . put ( name , new MetadataObject ( ) ) ; } metadata . get ( name ) . getObjectList ( ) . add ( value ) ;
public class JmxMonitor { /** * Returns the system CPU usage , in percents , between 0 and 100. * @ return total CPU usage of the current OS */ @ Override protected int detectTotalCpuPercent ( ) throws Exception { } }
Double value = ( Double ) mxBean . getSystemLoadAverage ( ) ; return ( int ) Math . max ( value * 100d , 0d ) ;
public class DoubleMatrix { /** * array [ j ] = Aij * @ param i * @ param array * @ param offset */ public void getRow ( int i , double [ ] array , int offset ) { } }
int n = cols ; for ( int j = 0 ; j < n ; j ++ ) { array [ j + offset ] = get ( i , j ) ; }
public class InvertedIndex { /** * Query list . * @ param keys the keys * @ return the list */ public Set < DOCUMENT > query ( Iterable < KEY > keys ) { } }
return query ( keys , d -> true ) ;
public class CassandraDataHandlerBase { /** * Scroll over counter super column . * @ param m * the m * @ param relationNames * the relation names * @ param isWrapReq * the is wrap req * @ param relations * the relations * @ param entityType * the entity type * @ param superColumn * the super column * @ param embeddedObject * the embedded object * @ param superColumnFieldMap * the super column field map */ private void scrollOverCounterSuperColumn ( EntityMetadata m , List < String > relationNames , boolean isWrapReq , Map < String , Object > relations , EntityType entityType , CounterSuperColumn superColumn , Object embeddedObject , Map < String , Field > superColumnFieldMap ) { } }
for ( CounterColumn column : superColumn . getColumns ( ) ) { String thriftColumnName = PropertyAccessorFactory . STRING . fromBytes ( String . class , column . getName ( ) ) ; String thriftColumnValue = new Long ( column . getValue ( ) ) . toString ( ) ; PropertyAccessorHelper . set ( embeddedObject , superColumnFieldMap . get ( thriftColumnName ) , thriftColumnValue ) ; }
public class CmsDomUtil { /** * Sets a CSS class to show or hide a given overlay . Will not add an overlay to the element . < p > * @ param element the parent element of the overlay * @ param show < code > true < / code > to show the overlay */ public static void showOverlay ( Element element , boolean show ) { } }
if ( show ) { element . removeClassName ( I_CmsLayoutBundle . INSTANCE . generalCss ( ) . hideOverlay ( ) ) ; } else { element . addClassName ( I_CmsLayoutBundle . INSTANCE . generalCss ( ) . hideOverlay ( ) ) ; }
public class HttpRequest { /** * Force a removeField . This call ignores the message state and forces a field to be removed * from the request . It is required for the handling of the Connection field . * @ param name The field name * @ return The old value or null . */ Object forceRemoveField ( String name ) { } }
int saved_state = _state ; try { _state = __MSG_EDITABLE ; return removeField ( name ) ; } finally { _state = saved_state ; }
public class FYShuffle { /** * Randomly shuffle the elements in an array * @ param < E > the type of elements in this arrays . * @ param array an array of objects to shuffle . */ public static < E > void shuffle ( E [ ] array ) { } }
int swapPlace = - 1 ; for ( int i = 0 ; i < array . length ; i ++ ) { swapPlace = ( int ) ( Math . random ( ) * ( array . length - 1 ) ) ; TrivialSwap . swap ( array , i , swapPlace ) ; }
public class DeadAssignmentsElimination { /** * Try to remove useless assignments from a control flow graph that has been * annotated with liveness information . * @ param t The node traversal . * @ param cfg The control flow graph of the program annotated with liveness * information . */ private void tryRemoveDeadAssignments ( NodeTraversal t , ControlFlowGraph < Node > cfg , Map < String , Var > allVarsInFn ) { } }
Iterable < DiGraphNode < Node , Branch > > nodes = cfg . getDirectedGraphNodes ( ) ; for ( DiGraphNode < Node , Branch > cfgNode : nodes ) { FlowState < LiveVariableLattice > state = cfgNode . getAnnotation ( ) ; Node n = cfgNode . getValue ( ) ; if ( n == null ) { continue ; } switch ( n . getToken ( ) ) { case IF : case WHILE : case DO : tryRemoveAssignment ( t , NodeUtil . getConditionExpression ( n ) , state , allVarsInFn ) ; continue ; case FOR : case FOR_IN : case FOR_OF : case FOR_AWAIT_OF : if ( n . isVanillaFor ( ) ) { tryRemoveAssignment ( t , NodeUtil . getConditionExpression ( n ) , state , allVarsInFn ) ; } continue ; case SWITCH : case CASE : case RETURN : if ( n . hasChildren ( ) ) { tryRemoveAssignment ( t , n . getFirstChild ( ) , state , allVarsInFn ) ; } continue ; // TODO ( user ) : case VAR : Remove var a = 1 ; a = 2 ; . . . . . default : break ; } tryRemoveAssignment ( t , n , state , allVarsInFn ) ; }
public class AbstractResultSetWrapper { /** * { @ inheritDoc } * @ see java . sql . ResultSet # updateClob ( int , java . io . Reader , long ) */ @ Override public void updateClob ( final int columnIndex , final Reader reader , final long length ) throws SQLException { } }
wrapped . updateClob ( columnIndex , reader , length ) ;
public class PolicyEventsInner { /** * Queries policy events for the resources under the resource group . * @ param subscriptionId Microsoft Azure subscription ID . * @ param resourceGroupName Resource group name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws QueryFailureException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the PolicyEventsQueryResultsInner object if successful . */ public PolicyEventsQueryResultsInner listQueryResultsForResourceGroup ( String subscriptionId , String resourceGroupName ) { } }
return listQueryResultsForResourceGroupWithServiceResponseAsync ( subscriptionId , resourceGroupName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class Stream { /** * Implementation method responsible of producing an Iterator over the elements of the Stream . * This method is called by { @ link # iterator ( ) } with the guarantee that it is called at most * once and with the Stream in the < i > available < / i > state . If the returned Iterator implements * the { @ link Closeable } interface , it will be automatically closed when the Stream is closed . * @ return an Iterator over the elements of the Stream * @ throws Throwable * in case of failure */ protected Iterator < T > doIterator ( ) throws Throwable { } }
final ToHandlerIterator < T > iterator = new ToHandlerIterator < T > ( this ) ; iterator . submit ( ) ; return iterator ;
public class ForeignDestination { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . runtime . SIMPForeignDestinationControllable # getTargetForeignBus ( ) */ public SIMPForeignBusControllable getTargetForeignBus ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getTargetForeignBus" ) ; // Lookup foreign bus BusHandler foreignBus = null ; try { foreignBus = messageProcessor . getDestinationManager ( ) . findBus ( foreignDest . getBus ( ) ) ; } catch ( SIException e ) { FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.runtime.getTargetForeignBus" , "1:114:1.19" , this ) ; SibTr . error ( tc , "INTERNAL_MESSAGING_ERROR_CWSIP0002" , new Object [ ] { "com.ibm.ws.sib.processor.runtime.getTargetForeignBus" , "1:119:1.19" , SIMPUtils . getStackTrace ( e ) } ) ; SibTr . exception ( tc , e ) ; } SIMPForeignBusControllable busControllable = null ; if ( foreignBus != null ) busControllable = ( SIMPForeignBusControllable ) foreignBus . getControlAdapter ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getTargetForeignBus" ) ; return busControllable ;
public class RDBMEntityLockStore { /** * Adds the lock to the underlying store . * @ param lock */ @ Override public void add ( IEntityLock lock ) throws LockingException { } }
Connection conn = null ; try { conn = RDBMServices . getConnection ( ) ; primDeleteExpired ( new Date ( ) , lock . getEntityType ( ) , lock . getEntityKey ( ) , conn ) ; primAdd ( lock , conn ) ; } catch ( SQLException sqle ) { throw new LockingException ( "Problem creating " + lock , sqle ) ; } finally { RDBMServices . releaseConnection ( conn ) ; }
public class Math { /** * Swap two arrays . */ public static < E > void swap ( E [ ] x , E [ ] y ) { } }
if ( x . length != y . length ) { throw new IllegalArgumentException ( String . format ( "Arrays have different length: x[%d], y[%d]" , x . length , y . length ) ) ; } for ( int i = 0 ; i < x . length ; i ++ ) { E s = x [ i ] ; x [ i ] = y [ i ] ; y [ i ] = s ; }
public class Matrix4f { /** * Apply an asymmetric off - center perspective projection frustum transformation for a right - handed coordinate system * using the given NDC z range to this matrix and store the result in < code > dest < / code > . * The given angles < code > offAngleX < / code > and < code > offAngleY < / code > are the horizontal and vertical angles between * the line of sight and the line given by the center of the near and far frustum planes . So , when < code > offAngleY < / code > * is just < code > fovy / 2 < / code > then the projection frustum is rotated towards + Y and the bottom frustum plane * is parallel to the XZ - plane . * If < code > M < / code > is < code > this < / code > matrix and < code > P < / code > the perspective projection matrix , * then the new matrix will be < code > M * P < / code > . So when transforming a * vector < code > v < / code > with the new matrix by using < code > M * P * v < / code > , * the perspective projection will be applied first ! * In order to set the matrix to a perspective frustum transformation without post - multiplying , * use { @ link # setPerspectiveOffCenter ( float , float , float , float , float , float , boolean ) setPerspectiveOffCenter } . * @ see # setPerspectiveOffCenter ( float , float , float , float , float , float , boolean ) * @ param fovy * the vertical field of view in radians ( must be greater than zero and less than { @ link Math # PI PI } ) * @ param offAngleX * the horizontal angle between the line of sight and the line crossing the center of the near and far frustum planes * @ param offAngleY * the vertical angle between the line of sight and the line crossing the center of the near and far frustum planes * @ param aspect * the aspect ratio ( i . e . width / height ; must be greater than zero ) * @ param zNear * near clipping plane distance . If the special value { @ link Float # POSITIVE _ INFINITY } is used , the near clipping plane will be at positive infinity . * In that case , < code > zFar < / code > may not also be { @ link Float # POSITIVE _ INFINITY } . * @ param zFar * far clipping plane distance . If the special value { @ link Float # POSITIVE _ INFINITY } is used , the far clipping plane will be at positive infinity . * In that case , < code > zNear < / code > may not also be { @ link Float # POSITIVE _ INFINITY } . * @ param dest * will hold the result * @ param zZeroToOne * whether to use Vulkan ' s and Direct3D ' s NDC z range of < code > [ 0 . . + 1 ] < / code > when < code > true < / code > * or whether to use OpenGL ' s NDC z range of < code > [ - 1 . . + 1 ] < / code > when < code > false < / code > * @ return dest */ public Matrix4f perspectiveOffCenter ( float fovy , float offAngleX , float offAngleY , float aspect , float zNear , float zFar , boolean zZeroToOne , Matrix4f dest ) { } }
if ( ( properties & PROPERTY_IDENTITY ) != 0 ) return dest . setPerspectiveOffCenter ( fovy , offAngleX , offAngleY , aspect , zNear , zFar , zZeroToOne ) ; return perspectiveOffCenterGeneric ( fovy , offAngleX , offAngleY , aspect , zNear , zFar , zZeroToOne , dest ) ;
public class Marshaller { /** * Creates an IncompleteKey . * @ param parent * the parent key , may be < code > null < / code > . */ private void createIncompleteKey ( Key parent ) { } }
String kind = entityMetadata . getKind ( ) ; if ( parent == null ) { key = entityManager . newNativeKeyFactory ( ) . setKind ( kind ) . newKey ( ) ; } else { key = IncompleteKey . newBuilder ( parent , kind ) . build ( ) ; }
public class ServiceUtils { /** * Find instances of { @ code clazz } among the { @ code instances } . * @ param clazz searched class * @ param instances instances looked at * @ param < T > type of the searched instances * @ return the list of compatible instances */ public static < T > Collection < T > findAmongst ( Class < T > clazz , Collection < ? > instances ) { } }
return findStreamAmongst ( clazz , instances ) . collect ( Collectors . toList ( ) ) ;
public class BeanContextServicesSupport { /** * Fires a < code > BeanContextServiceRevokedEvent < / code > to registered < code > BeanContextServicesListener < / code > s . * @ param event * the event */ protected final void fireServiceRevoked ( BeanContextServiceRevokedEvent event ) { } }
Object listeners [ ] ; synchronized ( bcsListeners ) { listeners = bcsListeners . toArray ( ) ; } for ( int i = 0 ; i < listeners . length ; i ++ ) { BeanContextServicesListener l = ( BeanContextServicesListener ) listeners [ i ] ; l . serviceRevoked ( event ) ; }
public class ChildProcAppHandle { /** * Parses the logs of { @ code spark - submit } and returns the last exception thrown . * Since { @ link SparkLauncher } runs { @ code spark - submit } in a sub - process , it ' s difficult to * accurately retrieve the full { @ link Throwable } from the { @ code spark - submit } process . * This method parses the logs of the sub - process and provides a best - effort attempt at * returning the last exception thrown by the { @ code spark - submit } process . Only the exception * message is parsed , the associated stacktrace is meaningless . * @ return an { @ link Optional } containing a { @ link RuntimeException } with the parsed * exception , otherwise returns a { @ link Optional # EMPTY } */ @ Override public Optional < Throwable > getError ( ) { } }
return redirector != null ? Optional . ofNullable ( redirector . getError ( ) ) : Optional . empty ( ) ;
public class GetCurrentUsersRecentlyPlayedTracksRequest { /** * Get an user ' s recently played tracks . * @ return An user ' s recently played tracks . * @ throws IOException In case of networking issues . * @ throws SpotifyWebApiException The Web API returned an error further specified in this exception ' s root cause . */ @ SuppressWarnings ( "unchecked" ) public PagingCursorbased < PlayHistory > execute ( ) throws IOException , SpotifyWebApiException { } }
return new PlayHistory . JsonUtil ( ) . createModelObjectPagingCursorbased ( getJson ( ) ) ;
public class ChargingStationOcpp15SoapClient { /** * { @ inheritDoc } */ @ Override public boolean hardReset ( ChargingStationId id ) { } }
LOG . info ( "Requesting hard reset on {}" , id ) ; return reset ( id , ResetType . HARD ) ;
public class Levenshtein { /** * Returns an new n - Gram distance ( Kondrak ) instance with compare target string * @ see NGram * @ param baseTarget * @ param compareTarget * @ return */ public static < T extends Levenshtein > T NGram ( String baseTarget , String compareTarget ) { } }
return NGram ( baseTarget , compareTarget , null ) ;
public class CRFFeatureExporter { /** * Output features that have already been converted into features * ( using documentToDataAndLabels ) in format suitable for CRFSuite * Format is with one line per token using the following format * label feat1 feat2 . . . * ( where each space is actually a tab ) * Each document is separated by an empty line * @ param exportFile file to export the features to * @ param docsData array of document features * @ param labels correct labels indexed by document , and position within document */ public void printFeatures ( String exportFile , int [ ] [ ] [ ] [ ] docsData , int [ ] [ ] labels ) { } }
try { PrintWriter pw = IOUtils . getPrintWriter ( exportFile ) ; for ( int i = 0 ; i < docsData . length ; i ++ ) { for ( int j = 0 ; j < docsData [ i ] . length ; j ++ ) { StringBuilder sb = new StringBuilder ( ) ; int label = labels [ i ] [ j ] ; sb . append ( classifier . classIndex . get ( label ) ) ; for ( int k = 0 ; k < docsData [ i ] [ j ] . length ; k ++ ) { for ( int m = 0 ; m < docsData [ i ] [ j ] [ k ] . length ; m ++ ) { String feat = classifier . featureIndex . get ( docsData [ i ] [ j ] [ k ] [ m ] ) ; feat = ubPrefixFeatureString ( feat ) ; sb . append ( delimiter ) ; sb . append ( feat ) ; } } pw . println ( sb . toString ( ) ) ; } pw . println ( ) ; } pw . close ( ) ; } catch ( IOException ex ) { throw new RuntimeException ( ex ) ; }
public class TransferFsImage { /** * Client - side Method to fetch file from a server * Copies the response from the URL to a list of local files . * @ param dstStorage if an error occurs writing to one of the files , * this storage object will be notified . * @ Return a digest of the received file if getChecksum is true */ public static MD5Hash doGetUrl ( URL url , List < OutputStream > outputStreams , Storage dstStorage , boolean getChecksum ) throws IOException { } }
byte [ ] buf = new byte [ BUFFER_SIZE ] ; String str = url . toString ( ) ; HttpURLConnection connection = ( HttpURLConnection ) url . openConnection ( ) ; int timeout = getHttpTimeout ( dstStorage ) ; connection . setConnectTimeout ( timeout ) ; if ( connection . getResponseCode ( ) != HttpURLConnection . HTTP_OK ) { throw new IOException ( "Image transfer servlet at " + url + " failed with status code " + connection . getResponseCode ( ) + "\nResponse message:\n" + connection . getResponseMessage ( ) ) ; } long advertisedSize ; String contentLength = connection . getHeaderField ( CONTENT_LENGTH ) ; if ( contentLength != null ) { advertisedSize = Long . parseLong ( contentLength ) ; } else { throw new IOException ( CONTENT_LENGTH + " header is not provided " + "by the namenode when trying to fetch " + str ) ; } MD5Hash advertisedDigest = parseMD5Header ( connection ) ; long received = 0 ; InputStream stream = connection . getInputStream ( ) ; MessageDigest digester = null ; if ( getChecksum ) { digester = MD5Hash . getDigester ( ) ; stream = new DigestInputStream ( stream , digester ) ; } boolean finishedReceiving = false ; MD5Hash computedDigest = null ; try { int num = 1 ; int lastPrintedProgress = 0 ; while ( num > 0 ) { num = stream . read ( buf ) ; if ( num > 0 ) { received += num ; for ( OutputStream fos : outputStreams ) { fos . write ( buf , 0 , num ) ; } lastPrintedProgress = printProgress ( str , received , advertisedSize , lastPrintedProgress ) ; } } if ( digester != null ) computedDigest = new MD5Hash ( digester . digest ( ) ) ; finishedReceiving = true ; } finally { stream . close ( ) ; if ( outputStreams != null ) { for ( OutputStream os : outputStreams ) { if ( os instanceof FileOutputStream ) ( ( FileOutputStream ) os ) . getChannel ( ) . force ( true ) ; os . close ( ) ; } } if ( finishedReceiving && received != advertisedSize ) { // only throw this exception if we think we read all of it on our end // - - otherwise a client - side IOException would be masked by this // exception that makes it look like a server - side problem ! throw new IOException ( "File " + str + " received length " + received + " is not of the advertised size " + advertisedSize ) ; } } if ( computedDigest != null ) { if ( advertisedDigest != null && ! computedDigest . equals ( advertisedDigest ) ) { throw new IOException ( "File " + str + " computed digest " + computedDigest + " does not match advertised digest " + advertisedDigest ) ; } return computedDigest ; } else { return null ; }
public class KeyDispatcher { /** * documentation inherited from interface KeyEventDispatcher */ public boolean dispatchKeyEvent ( KeyEvent e ) { } }
int lsize = _listeners . size ( ) ; switch ( e . getID ( ) ) { case KeyEvent . KEY_TYPED : // dispatch to all the global listeners for ( int ii = 0 ; ii < lsize ; ii ++ ) { _listeners . get ( ii ) . keyTyped ( e ) ; } // see if a chat grabber needs to grab it if ( _curChatGrabber != null ) { Component target = e . getComponent ( ) ; // if the key was typed on a non - text component or one // that wasn ' t editable . . . if ( isChatCharacter ( e . getKeyChar ( ) ) && ! isTypeableTarget ( target ) ) { // focus our grabby component , and redirect this // key event there _curChatGrabber . requestFocusInWindow ( ) ; KeyboardFocusManager . getCurrentKeyboardFocusManager ( ) . redispatchEvent ( _curChatGrabber , e ) ; return true ; } } break ; case KeyEvent . KEY_PRESSED : if ( lsize > 0 ) { for ( int ii = 0 ; ii < lsize ; ii ++ ) { _listeners . get ( ii ) . keyPressed ( e ) ; } // remember the key event . . _downKeys . put ( e . getKeyCode ( ) , e ) ; } break ; case KeyEvent . KEY_RELEASED : if ( lsize > 0 ) { for ( int ii = 0 ; ii < lsize ; ii ++ ) { _listeners . get ( ii ) . keyReleased ( e ) ; } // forget the key event _downKeys . remove ( e . getKeyCode ( ) ) ; } break ; } return false ;
public class Fraction { /** * Compares this object to another based on size . * Note : this class has a natural ordering that is inconsistent with equals , because , for example , equals treats 1/2 * and 2/4 as different , whereas compareTo treats them as equal . * @ param other * the object to compare to * @ return - 1 if this is less , 0 if equal , + 1 if greater * @ throws ClassCastException * if the object is not a < code > Fraction < / code > * @ throws NullPointerException * if the object is < code > null < / code > */ @ Override public int compareTo ( final Fraction other ) { } }
if ( this == other ) { return 0 ; } if ( numerator == other . numerator && denominator == other . denominator ) { return 0 ; } // otherwise see which is less final long first = ( long ) numerator * ( long ) other . denominator ; final long second = ( long ) other . numerator * ( long ) denominator ; if ( first == second ) { return 0 ; } else if ( first < second ) { return - 1 ; } else { return 1 ; }
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link BridgeFurnitureType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link BridgeFurnitureType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/citygml/bridge/2.0" , name = "BridgeFurniture" , substitutionHeadNamespace = "http://www.opengis.net/citygml/2.0" , substitutionHeadName = "_CityObject" ) public JAXBElement < BridgeFurnitureType > createBridgeFurniture ( BridgeFurnitureType value ) { } }
return new JAXBElement < BridgeFurnitureType > ( _BridgeFurniture_QNAME , BridgeFurnitureType . class , null , value ) ;
public class MessageBirdServiceImpl { /** * Actually sends a HTTP request and returns its body and HTTP status code . * @ param method HTTP method . * @ param url Absolute URL . * @ param payload Payload to JSON encode for the request body . May be null . * @ param < P > Type of the payload . * @ return APIResponse containing the response ' s body and status . */ < P > APIResponse doRequest ( final String method , final String url , final P payload ) throws GeneralException { } }
HttpURLConnection connection = null ; InputStream inputStream = null ; if ( METHOD_PATCH . equalsIgnoreCase ( method ) ) { // It ' d perhaps be cleaner to call this in the constructor , but // we ' d then need to throw GeneralExceptions from there . This means // it wouldn ' t be possible to declare AND initialize _ instance _ // fields of MessageBirdServiceImpl at the same time . This method // already throws this exception , so now we don ' t have to pollute // our public API further . allowPatchRequestsIfNeeded ( ) ; } try { connection = getConnection ( url , payload , method ) ; int status = connection . getResponseCode ( ) ; if ( APIResponse . isSuccessStatus ( status ) ) { inputStream = connection . getInputStream ( ) ; } else { inputStream = connection . getErrorStream ( ) ; } return new APIResponse ( readToEnd ( inputStream ) , status ) ; } catch ( IOException ioe ) { throw new GeneralException ( ioe ) ; } finally { saveClose ( inputStream ) ; if ( connection != null ) { connection . disconnect ( ) ; } }
public class AbstractReady { /** * { @ inheritDoc } */ @ Override public final < C extends Command > List < C > getCommands ( final UniqueKey < C > commandKey ) { } }
localFacade ( ) . globalFacade ( ) . trackEvent ( JRebirthEventType . ACCESS_COMMAND , this . getClass ( ) , commandKey . classField ( ) ) ; return localFacade ( ) . globalFacade ( ) . commandFacade ( ) . retrieveMany ( commandKey ) ;
public class ObjectCreator { /** * Instantaite an Object instance , requires a constractor with parameters * @ param classObject * , Class object representing the object type to be instantiated * @ param params * an array including the required parameters to instantaite the * object * @ return the instantaied Object * @ exception java . lang . Exception * if instantiation failed */ public static Object createObject ( Class classObject , Object [ ] params ) throws Exception { } }
Constructor [ ] constructors = classObject . getConstructors ( ) ; Object object = null ; for ( int counter = 0 ; counter < constructors . length ; counter ++ ) { try { object = constructors [ counter ] . newInstance ( params ) ; } catch ( Exception e ) { if ( e instanceof InvocationTargetException ) ( ( InvocationTargetException ) e ) . getTargetException ( ) . printStackTrace ( ) ; // do nothing , try the next constructor } } if ( object == null ) throw new InstantiationException ( ) ; return object ;
public class MoreCollectors { /** * Returns a { @ code Collector } which performs the bitwise - and operation of a * integer - valued function applied to the input elements . If no elements are * present , the result is empty { @ link OptionalInt } . * This method returns a * < a href = " package - summary . html # ShortCircuitReduction " > short - circuiting * collector < / a > : it may not process all the elements if the result is zero . * @ param < T > the type of the input elements * @ param mapper a function extracting the property to be processed * @ return a { @ code Collector } that produces the bitwise - and operation of a * derived property * @ since 0.4.0 */ public static < T > Collector < T , ? , OptionalInt > andingInt ( ToIntFunction < T > mapper ) { } }
return new CancellableCollectorImpl < > ( PrimitiveBox :: new , ( acc , t ) -> { if ( ! acc . b ) { acc . i = mapper . applyAsInt ( t ) ; acc . b = true ; } else { acc . i &= mapper . applyAsInt ( t ) ; } } , ( acc1 , acc2 ) -> { if ( ! acc1 . b ) return acc2 ; if ( ! acc2 . b ) return acc1 ; acc1 . i &= acc2 . i ; return acc1 ; } , PrimitiveBox :: asInt , acc -> acc . b && acc . i == 0 , UNORDERED_CHARACTERISTICS ) ;
public class PropNbLoops { @ Override public void propagate ( int evtmask ) throws ContradictionException { } }
int min = 0 ; int max = 0 ; ISet nodes = g . getPotentialNodes ( ) ; for ( int i : nodes ) { if ( g . getMandSuccOrNeighOf ( i ) . contains ( i ) ) { min ++ ; max ++ ; } else if ( g . getPotSuccOrNeighOf ( i ) . contains ( i ) ) { max ++ ; } } k . updateLowerBound ( min , this ) ; k . updateUpperBound ( max , this ) ; if ( min == max ) { setPassive ( ) ; } else if ( k . isInstantiated ( ) ) { if ( k . getValue ( ) == max ) { for ( int i : nodes ) { if ( g . getPotSuccOrNeighOf ( i ) . contains ( i ) ) { g . enforceArc ( i , i , this ) ; } } setPassive ( ) ; } else if ( k . getValue ( ) == min ) { for ( int i : nodes ) { if ( ! g . getMandSuccOrNeighOf ( i ) . contains ( i ) ) { g . removeArc ( i , i , this ) ; } } setPassive ( ) ; } }
public class DerValue { /** * Returns a Date if the DerValue is GeneralizedTime . * @ return the Date held in this DER value */ public Date getGeneralizedTime ( ) throws IOException { } }
if ( tag != tag_GeneralizedTime ) { throw new IOException ( "DerValue.getGeneralizedTime, not a GeneralizedTime: " + tag ) ; } return buffer . getGeneralizedTime ( data . available ( ) ) ;
public class ResourceRecordSets { /** * creates mx set of { @ link denominator . model . rdata . MXData MX } records for the specified name and * ttl . * @ param name ex . { @ code denominator . io . } * @ param mxdata mxdata values ex . { @ code [ 1 mx1 . denominator . io . , 2 mx2 . denominator . io . ] } */ public static ResourceRecordSet < MXData > mx ( String name , Collection < String > mxdata ) { } }
return new MXBuilder ( ) . name ( name ) . addAll ( mxdata ) . build ( ) ;
public class XmlParser { /** * 往pojo中指定字段设置值 ( 字段为Collection类型 ) * @ param elements 要设置的数据节点 * @ param attrName 要获取的属性名 , 如果该值不为空则认为数据需要从属性中取而不是从节点数据中取 * @ param pojo pojo * @ param field 字段说明 */ @ SuppressWarnings ( "unchecked" ) private void setValue ( List < Element > elements , String attrName , Object pojo , CustomPropertyDescriptor field ) { } }
XmlNode attrXmlNode = field . getAnnotation ( XmlNode . class ) ; log . debug ( "要赋值的fieldName为{}" , field . getName ( ) ) ; final XmlTypeConvert convert = XmlTypeConverterUtil . resolve ( attrXmlNode , field ) ; Class < ? extends Collection > collectionClass ; Class < ? extends Collection > real = ( Class < ? extends Collection > ) field . getRealType ( ) ; if ( attrXmlNode != null ) { collectionClass = attrXmlNode . arrayType ( ) ; if ( ! collectionClass . equals ( real ) && ! real . isAssignableFrom ( collectionClass ) ) { log . warn ( "用户指定的集合类型[{}]不是字段的实际集合类型[{}]的子类,使用字段的实际集合类型" , collectionClass , real ) ; collectionClass = real ; } } else { collectionClass = real ; } if ( ! StringUtils . isEmpty ( attrXmlNode . arrayRoot ( ) ) && ! elements . isEmpty ( ) ) { elements = elements . get ( 0 ) . elements ( attrXmlNode . arrayRoot ( ) ) ; } // 将数据转换为用户指定数据 List < ? > list = elements . stream ( ) . map ( d -> convert . read ( d , attrName ) ) . collect ( Collectors . toList ( ) ) ; if ( ! trySetValue ( list , pojo , field , collectionClass ) ) { // 使用注解标记的类型赋值失败并且注解的集合类型与实际字段类型不符时尝试使用字段实际类型赋值 if ( ! trySetValue ( list , pojo , field , real ) ) { log . warn ( "无法为字段[{}]赋值" , field . getName ( ) ) ; } }
public class GetLoadBalancerTlsCertificatesRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetLoadBalancerTlsCertificatesRequest getLoadBalancerTlsCertificatesRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getLoadBalancerTlsCertificatesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getLoadBalancerTlsCertificatesRequest . getLoadBalancerName ( ) , LOADBALANCERNAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class MultiFormatParser { /** * / * [ deutsch ] * < p > Erzeugt einen neuen Multiformatinterpretierer . < / p > * @ param < T > generic type of chronological entity * @ param formats list of multiple formats * @ return new immutable instance of MultiFormatParser * @ since 3.14/4.11 */ @ SuppressWarnings ( "unchecked" ) public static < T extends ChronoEntity < T > > MultiFormatParser < T > of ( List < ChronoFormatter < T > > formats ) { } }
ChronoFormatter < T > [ ] parsers = formats . toArray ( ( ChronoFormatter < T > [ ] ) Array . newInstance ( ChronoFormatter . class , formats . size ( ) ) ) ; return new MultiFormatParser < > ( parsers ) ;
public class FailoverProxy { /** * Check if this Sqlerror is a connection exception . if that ' s the case , must be handle by * failover * < p > error codes : 08000 : connection exception 08001 : SQL client unable to establish SQL * connection 08002 : connection name in use 08003 : connection does not exist 08004 : SQL server * rejected SQL connection 08006 : connection failure 08007 : transaction resolution unknown 70100 * : connection was killed if error code is " 1927 " < / p > * @ param exception the Exception * @ return true if there has been a connection error that must be handled by failover */ public boolean hasToHandleFailover ( SQLException exception ) { } }
return exception . getSQLState ( ) != null && ( exception . getSQLState ( ) . startsWith ( "08" ) || ( exception . getSQLState ( ) . equals ( "70100" ) && 1927 == exception . getErrorCode ( ) ) ) ;
public class hqlParser { /** * hql . g : 330:1 : groupByClause : GROUP ^ ' by ' ! expression ( COMMA ! expression ) * ; */ public final hqlParser . groupByClause_return groupByClause ( ) throws RecognitionException { } }
hqlParser . groupByClause_return retval = new hqlParser . groupByClause_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; Token GROUP121 = null ; Token string_literal122 = null ; Token COMMA124 = null ; ParserRuleReturnScope expression123 = null ; ParserRuleReturnScope expression125 = null ; CommonTree GROUP121_tree = null ; CommonTree string_literal122_tree = null ; CommonTree COMMA124_tree = null ; try { // hql . g : 331:2 : ( GROUP ^ ' by ' ! expression ( COMMA ! expression ) * ) // hql . g : 331:4 : GROUP ^ ' by ' ! expression ( COMMA ! expression ) * { root_0 = ( CommonTree ) adaptor . nil ( ) ; GROUP121 = ( Token ) match ( input , GROUP , FOLLOW_GROUP_in_groupByClause1573 ) ; GROUP121_tree = ( CommonTree ) adaptor . create ( GROUP121 ) ; root_0 = ( CommonTree ) adaptor . becomeRoot ( GROUP121_tree , root_0 ) ; string_literal122 = ( Token ) match ( input , LITERAL_by , FOLLOW_LITERAL_by_in_groupByClause1579 ) ; pushFollow ( FOLLOW_expression_in_groupByClause1582 ) ; expression123 = expression ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , expression123 . getTree ( ) ) ; // hql . g : 332:20 : ( COMMA ! expression ) * loop39 : while ( true ) { int alt39 = 2 ; int LA39_0 = input . LA ( 1 ) ; if ( ( LA39_0 == COMMA ) ) { alt39 = 1 ; } switch ( alt39 ) { case 1 : // hql . g : 332:22 : COMMA ! expression { COMMA124 = ( Token ) match ( input , COMMA , FOLLOW_COMMA_in_groupByClause1586 ) ; pushFollow ( FOLLOW_expression_in_groupByClause1589 ) ; expression125 = expression ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , expression125 . getTree ( ) ) ; } break ; default : break loop39 ; } } } retval . stop = input . LT ( - 1 ) ; retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( CommonTree ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { // do for sure before leaving } return retval ;
public class CUtil { /** * Parse a string containing directories into an File [ ] * @ param path * path string , for example " . ; c : \ something \ include " * @ param delim * delimiter , typically ; or : */ public static File [ ] parsePath ( final String path , final String delim ) { } }
final Vector libpaths = new Vector ( ) ; int delimPos = 0 ; for ( int startPos = 0 ; startPos < path . length ( ) ; startPos = delimPos + delim . length ( ) ) { delimPos = path . indexOf ( delim , startPos ) ; if ( delimPos < 0 ) { delimPos = path . length ( ) ; } // don ' t add an entry for zero - length paths if ( delimPos > startPos ) { final String dirName = path . substring ( startPos , delimPos ) ; final File dir = new File ( dirName ) ; if ( dir . exists ( ) && dir . isDirectory ( ) ) { libpaths . addElement ( dir ) ; } } } final File [ ] paths = new File [ libpaths . size ( ) ] ; libpaths . copyInto ( paths ) ; return paths ;
public class ChangeTrackingMap { /** * Roll back all changes made since construction . This is the same function ad { @ link # revertToTag ( ) } . If the map is not in tag mode ( * this means { @ link # isTagged ( ) } returns < code > true < / code > ) this method will do nothing . */ public final void revert ( ) { } }
if ( tagged ) { // Remove the added entries final Iterator < K > addedIt = added . keySet ( ) . iterator ( ) ; while ( addedIt . hasNext ( ) ) { final K key = addedIt . next ( ) ; map . remove ( key ) ; addedIt . remove ( ) ; } // Replace the changed entries final Iterator < K > changedIt = changed . keySet ( ) . iterator ( ) ; while ( changedIt . hasNext ( ) ) { final K key = changedIt . next ( ) ; final V value = changed . get ( key ) ; map . put ( key , value ) ; changedIt . remove ( ) ; } // Add the removed entries final Iterator < K > removedIt = removed . keySet ( ) . iterator ( ) ; while ( removedIt . hasNext ( ) ) { final K key = removedIt . next ( ) ; final V value = removed . get ( key ) ; map . put ( key , value ) ; removedIt . remove ( ) ; } }
public class ResolvableType { /** * Return a { @ link ResolvableType } for the specified { @ link Class } with pre - declared generics . * @ param sourceClass the source class * @ param generics the generics of the class * @ return a { @ link ResolvableType } for the specific class and generics * @ see # forClassWithGenerics ( Class , Class . . . ) */ public static ResolvableType forClassWithGenerics ( Class < ? > sourceClass , ResolvableType ... generics ) { } }
Assert . notNull ( sourceClass , "Source class must not be null" ) ; Assert . notNull ( generics , "Generics must not be null" ) ; TypeVariable < ? > [ ] variables = sourceClass . getTypeParameters ( ) ; Assert . isTrue ( variables . length == generics . length , "Mismatched number of generics specified" ) ; return forType ( sourceClass , new TypeVariablesVariableResolver ( variables , generics ) ) ;
public class version_matrix_status { /** * < pre > * Converts API response of bulk operation into object and returns the object array in case of get request . * < / pre > */ protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } }
version_matrix_status_responses result = ( version_matrix_status_responses ) service . get_payload_formatter ( ) . string_to_resource ( version_matrix_status_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . version_matrix_status_response_array ) ; } version_matrix_status [ ] result_version_matrix_status = new version_matrix_status [ result . version_matrix_status_response_array . length ] ; for ( int i = 0 ; i < result . version_matrix_status_response_array . length ; i ++ ) { result_version_matrix_status [ i ] = result . version_matrix_status_response_array [ i ] . version_matrix_status [ 0 ] ; } return result_version_matrix_status ;
public class GraphicalModel { /** * Add a binary factor , where we just want to hard - code the value of the factor . * @ param a The index of the first variable . * @ param cardA The cardinality ( i . e , dimension ) of the first factor * @ param b The index of the second variable * @ param cardB The cardinality ( i . e , dimension ) of the second factor * @ param value A mapping from assignments of the two variables , to a factor value . * @ return a reference to the created factor . This can be safely ignored , as the factor is already saved in the model */ public Factor addStaticBinaryFactor ( int a , int cardA , int b , int cardB , BiFunction < Integer , Integer , Double > value ) { } }
return addStaticFactor ( new int [ ] { a , b } , new int [ ] { cardA , cardB } , assignment -> value . apply ( assignment [ 0 ] , assignment [ 1 ] ) ) ;
public class FocusManager { /** * Registers the { @ link Focusable } to manage focus for the particular scene object . * The focus manager will not hold strong references to the sceneObject and the focusable . * @ param sceneObject * @ param focusable */ public void register ( final GVRSceneObject sceneObject , final Focusable focusable ) { } }
Log . d ( Log . SUBSYSTEM . FOCUS , TAG , "register sceneObject %s , focusable = %s" , sceneObject . getName ( ) , focusable ) ; mFocusableMap . put ( sceneObject , new WeakReference < > ( focusable ) ) ;
public class HashedArray { /** * Determines if the given { @ link ArrayView } instances contain the same data . * @ param av1 The first instance . * @ param av2 The second instance . * @ return True if both instances have the same length and contain the same data . */ public static boolean arrayEquals ( ArrayView av1 , ArrayView av2 ) { } }
int len = av1 . getLength ( ) ; if ( len != av2 . getLength ( ) ) { return false ; } byte [ ] a1 = av1 . array ( ) ; int o1 = av1 . arrayOffset ( ) ; byte [ ] a2 = av2 . array ( ) ; int o2 = av2 . arrayOffset ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( a1 [ o1 + i ] != a2 [ o2 + i ] ) { return false ; } } return true ;
public class AbstractValueConverterToContainer { /** * This method performs the { @ link # convert ( Object , Object , GenericType ) conversion } for { @ link Collection } * values . * @ param < T > is the generic type of { @ code targetType } . * @ param collectionValue is the { @ link Collection } value to convert . * @ param valueSource describes the source of the value or { @ code null } if NOT available . * @ param targetType is the { @ link # getTargetType ( ) target - type } to convert to . * @ return the converted container . */ protected < T extends CONTAINER > T convertFromCollection ( Collection collectionValue , Object valueSource , GenericType < T > targetType ) { } }
int size = collectionValue . size ( ) ; T container = createContainer ( targetType , size ) ; int i = 0 ; for ( Object element : collectionValue ) { convertContainerEntry ( element , i , container , valueSource , targetType , collectionValue ) ; i ++ ; } return container ;
public class StyleRuntimeException { /** * Throw < code > this < / code > if packed exception is not instanceof among * given classes * @ param classes throw when doesn ' t matches all these classes */ public void throwNotIn ( @ SuppressWarnings ( "unchecked" ) Class < ? extends Throwable > ... classes ) { } }
boolean toThrow = true ; for ( Class < ? extends Throwable > cls : classes ) { if ( cls . isInstance ( super . getCause ( ) ) ) { toThrow = false ; break ; } } if ( toThrow ) { throw this ; }
public class ScopeContext { /** * return the size in bytes of all session contexts * @ return size in bytes * @ throws ExpressionException */ public long getScopesSize ( int scope ) throws ExpressionException { } }
if ( scope == Scope . SCOPE_APPLICATION ) return SizeOf . size ( applicationContexts ) ; if ( scope == Scope . SCOPE_CLUSTER ) return SizeOf . size ( cluster ) ; if ( scope == Scope . SCOPE_SERVER ) return SizeOf . size ( server ) ; if ( scope == Scope . SCOPE_SESSION ) return SizeOf . size ( this . cfSessionContexts ) ; if ( scope == Scope . SCOPE_CLIENT ) return SizeOf . size ( this . cfClientContexts ) ; throw new ExpressionException ( "can only return information of scope that are not request dependent" ) ;
public class MSwingUtilities { /** * Redimensionne une image . * @ param img Image * @ param targetWidth int * @ param targetHeight int * @ return Image */ public static Image getScaledInstance ( Image img , int targetWidth , int targetHeight ) { } }
final int type = BufferedImage . TYPE_INT_ARGB ; Image ret = img ; final int width = ret . getWidth ( null ) ; final int height = ret . getHeight ( null ) ; if ( width != targetWidth && height != targetHeight ) { // a priori plus performant que Image . getScaledInstance final BufferedImage scratchImage = new BufferedImage ( targetWidth , targetHeight , type ) ; final Graphics2D g2 = scratchImage . createGraphics ( ) ; g2 . setRenderingHint ( RenderingHints . KEY_INTERPOLATION , RenderingHints . VALUE_INTERPOLATION_BILINEAR ) ; g2 . drawImage ( ret , 0 , 0 , targetWidth , targetHeight , 0 , 0 , width , height , null ) ; g2 . dispose ( ) ; ret = scratchImage ; } return ret ;
public class OGNL { /** * 检查 paremeter 对象中指定的 fields 是否全是 null , 如果是则抛出异常 * @ param parameter * @ param fields * @ return */ public static boolean notAllNullParameterCheck ( Object parameter , String fields ) { } }
if ( parameter != null ) { try { Set < EntityColumn > columns = EntityHelper . getColumns ( parameter . getClass ( ) ) ; Set < String > fieldSet = new HashSet < String > ( Arrays . asList ( fields . split ( "," ) ) ) ; for ( EntityColumn column : columns ) { if ( fieldSet . contains ( column . getProperty ( ) ) ) { Object value = column . getEntityField ( ) . getValue ( parameter ) ; if ( value != null ) { return true ; } } } } catch ( Exception e ) { throw new MapperException ( SAFE_DELETE_ERROR , e ) ; } } throw new MapperException ( SAFE_DELETE_EXCEPTION ) ;
public class SAXRecords { /** * Get the SAX string of this whole collection . * @ param separatorToken The separator token to use for the string . * @ return The whole data as a string . */ public String getSAXString ( String separatorToken ) { } }
StringBuffer sb = new StringBuffer ( ) ; ArrayList < Integer > index = new ArrayList < Integer > ( ) ; index . addAll ( this . realTSindex . keySet ( ) ) ; Collections . sort ( index , new Comparator < Integer > ( ) { public int compare ( Integer int1 , Integer int2 ) { return int1 . compareTo ( int2 ) ; } } ) ; for ( int i : index ) { sb . append ( this . realTSindex . get ( i ) . getPayload ( ) ) . append ( separatorToken ) ; } return sb . toString ( ) ;
public class DialCodeManager { /** * Get the dial code for the specified country ( in the ISO - 3166 two letter * type ) . * @ param sCountry * The country code . Must be 2 characters long . * @ return < code > null < / code > if no mapping exists . */ @ Nullable public static String getDialCodeOfCountry ( @ Nullable final String sCountry ) { } }
if ( StringHelper . hasNoText ( sCountry ) ) return null ; return s_aCountryToDialCode . get ( sCountry . toUpperCase ( Locale . US ) ) ;
public class MethodCompiler { /** * Create new array * < p > Stack : . . . , = & gt ; . . . , arrayref * @ param type array class eg . String [ ] . class * @ param count array count * @ throws IOException */ public void newarray ( TypeMirror type , int count ) throws IOException { } }
if ( type . getKind ( ) != TypeKind . ARRAY ) { throw new IllegalArgumentException ( type + " is not array" ) ; } ArrayType at = ( ArrayType ) type ; iconst ( count ) ; TypeMirror ct = at . getComponentType ( ) ; switch ( ct . getKind ( ) ) { case BOOLEAN : newarray ( T_BOOLEAN ) ; break ; case CHAR : newarray ( T_CHAR ) ; break ; case FLOAT : newarray ( T_FLOAT ) ; break ; case DOUBLE : newarray ( T_DOUBLE ) ; break ; case BYTE : newarray ( T_BYTE ) ; break ; case SHORT : newarray ( T_SHORT ) ; break ; case INT : newarray ( T_INT ) ; break ; case LONG : newarray ( T_LONG ) ; break ; case DECLARED : { DeclaredType dt = ( DeclaredType ) ct ; int index = subClass . resolveClassIndex ( ( TypeElement ) dt . asElement ( ) ) ; anewarray ( index ) ; } break ; default : throw new IllegalArgumentException ( type + " not supported" ) ; }
public class FlexBase64 { /** * Creates an OutputStream wrapper which base64 encodes and writes to the passed OutputStream target . When this * stream is closed base64 padding will be added if needed . Alternatively if this represents an " inner stream " , * the { @ link FlexBase64 . EncoderOutputStream # complete ( ) } method can be called to close out * the inner stream without closing the wrapped target . * < p > All bytes written will be queued to a buffer in the specified size . This stream , therefore , does not require * BufferedOutputStream , which would lead to double buffering . * @ param target an output target to write to * @ param bufferSize the chunk size to buffer before writing to the target * @ param wrap whether or not the stream should wrap base64 output at 76 characters * @ return an encoded output stream instance . */ public static EncoderOutputStream createEncoderOutputStream ( OutputStream target , int bufferSize , boolean wrap ) { } }
return new EncoderOutputStream ( target , bufferSize , wrap ) ;
public class Capabilities { /** * Use direct Class . forName ( ) to test for the existence of a class . * We should not use BshClassManager here because : * a ) the systems using these tests would probably not load the * classes through it anyway . * b ) bshclassmanager is heavy and touches other class files . * this capabilities code must be light enough to be used by any * system * * including the remote applet * * . */ public static boolean classExists ( String name ) { } }
if ( ! classes . containsKey ( name ) ) try { /* Note : do * not * change this to BshClassManager plainClassForName ( ) or equivalent . This class must not touch any other bsh classes . */ classes . put ( name , Class . forName ( name ) ) ; } catch ( ClassNotFoundException e ) { classes . put ( name , null ) ; } return getExisting ( name ) != null ;
public class PartitionStateManager { /** * Sets the initial partition table and state version . If any partition has a replica , the partition state manager is * set to initialized , otherwise { @ link # isInitialized ( ) } stays uninitialized but the current state will be updated * nevertheless . * @ param partitionTable the initial partition table * @ throws IllegalStateException if the partition manager has already been initialized */ void setInitialState ( PartitionTableView partitionTable ) { } }
if ( initialized ) { throw new IllegalStateException ( "Partition table is already initialized!" ) ; } logger . info ( "Setting cluster partition table..." ) ; boolean foundReplica = false ; PartitionReplica localReplica = PartitionReplica . from ( node . getLocalMember ( ) ) ; for ( int partitionId = 0 ; partitionId < partitionCount ; partitionId ++ ) { InternalPartitionImpl partition = partitions [ partitionId ] ; PartitionReplica [ ] replicas = partitionTable . getReplicas ( partitionId ) ; if ( ! foundReplica && replicas != null ) { for ( int i = 0 ; i < InternalPartition . MAX_REPLICA_COUNT ; i ++ ) { foundReplica |= replicas [ i ] != null ; } } partition . reset ( localReplica ) ; partition . setInitialReplicas ( replicas ) ; } stateVersion . set ( partitionTable . getVersion ( ) ) ; if ( foundReplica ) { setInitialized ( ) ; }
public class LayoutFactory { /** * Returns the layout matching the current definition of the given type . * @ throws PersistException if type represents a new generation , but * persisting this information failed */ public Layout layoutFor ( Class < ? extends Storable > type ) throws FetchException , PersistException { } }
return layoutFor ( type , null ) ;
public class AWSIotClient { /** * Creates a 2048 - bit RSA key pair and issues an X . 509 certificate using the issued public key . * < b > Note < / b > This is the only time AWS IoT issues the private key for this certificate , so it is important to keep * it in a secure location . * @ param createKeysAndCertificateRequest * The input for the CreateKeysAndCertificate operation . * @ return Result of the CreateKeysAndCertificate operation returned by the service . * @ throws InvalidRequestException * The request is not valid . * @ throws ThrottlingException * The rate exceeds the limit . * @ throws UnauthorizedException * You are not authorized to perform this operation . * @ throws ServiceUnavailableException * The service is temporarily unavailable . * @ throws InternalFailureException * An unexpected error has occurred . * @ sample AWSIot . CreateKeysAndCertificate */ @ Override public CreateKeysAndCertificateResult createKeysAndCertificate ( CreateKeysAndCertificateRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeCreateKeysAndCertificate ( request ) ;
public class FFMQAdminClient { /** * / * ( non - Javadoc ) * @ see java . lang . Runnable # run ( ) */ @ Override public void run ( ) { } }
String command = globalSettings . getStringProperty ( FFMQAdminClientSettings . ADM_COMMAND , null ) ; if ( StringTools . isEmpty ( command ) ) { err . println ( "No command specified" ) ; return ; } try { openSession ( ) ; processCommand ( command ) ; } catch ( JMSException e ) { logError ( e ) ; } finally { closeSession ( ) ; }
public class RPSImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . RPS__RLENGTH : return RLENGTH_EDEFAULT == null ? rlength != null : ! RLENGTH_EDEFAULT . equals ( rlength ) ; case AfplibPackage . RPS__RPTDATA : return RPTDATA_EDEFAULT == null ? rptdata != null : ! RPTDATA_EDEFAULT . equals ( rptdata ) ; } return super . eIsSet ( featureID ) ;
public class ZipUtil { /** * Compresses the given directory and all of its sub - directories into the passed in * stream . It is the responsibility of the caller to close the passed in * stream properly . * @ param sourceDir * root directory . * @ param os * output stream ( will be buffered in this method ) . * @ since 1.10 */ public static void pack ( File sourceDir , OutputStream os ) { } }
pack ( sourceDir , os , IdentityNameMapper . INSTANCE , DEFAULT_COMPRESSION_LEVEL ) ;
public class ScopeFactory { /** * cast a int scope definition to a string definition * @ param scope * @ return */ public static String toStringScope ( int scope , String defaultValue ) { } }
switch ( scope ) { case Scope . SCOPE_APPLICATION : return "application" ; case Scope . SCOPE_ARGUMENTS : return "arguments" ; case Scope . SCOPE_CALLER : return "caller" ; case Scope . SCOPE_CGI : return "cgi" ; case Scope . SCOPE_CLIENT : return "client" ; case Scope . SCOPE_COOKIE : return "cookie" ; case Scope . SCOPE_FORM : return "form" ; case Scope . SCOPE_VAR : case Scope . SCOPE_LOCAL : return "local" ; case Scope . SCOPE_REQUEST : return "request" ; case Scope . SCOPE_SERVER : return "server" ; case Scope . SCOPE_SESSION : return "session" ; case Scope . SCOPE_UNDEFINED : return "undefined" ; case Scope . SCOPE_URL : return "url" ; case Scope . SCOPE_VARIABLES : return "variables" ; case Scope . SCOPE_CLUSTER : return "cluster" ; } return defaultValue ;
public class Transmitter { /** * Remove the transmitter from the connection ' s list of allocations . Returns a socket that the * caller should close . */ @ Nullable Socket releaseConnectionNoEvents ( ) { } }
assert ( Thread . holdsLock ( connectionPool ) ) ; int index = - 1 ; for ( int i = 0 , size = this . connection . transmitters . size ( ) ; i < size ; i ++ ) { Reference < Transmitter > reference = this . connection . transmitters . get ( i ) ; if ( reference . get ( ) == this ) { index = i ; break ; } } if ( index == - 1 ) throw new IllegalStateException ( ) ; RealConnection released = this . connection ; released . transmitters . remove ( index ) ; this . connection = null ; if ( released . transmitters . isEmpty ( ) ) { released . idleAtNanos = System . nanoTime ( ) ; if ( connectionPool . connectionBecameIdle ( released ) ) { return released . socket ( ) ; } } return null ;
public class Value { /** * < code > . google . type . DayOfWeek day _ of _ week _ value = 8 ; < / code > */ public com . google . type . DayOfWeek getDayOfWeekValue ( ) { } }
if ( typeCase_ == 8 ) { @ SuppressWarnings ( "deprecation" ) com . google . type . DayOfWeek result = com . google . type . DayOfWeek . valueOf ( ( java . lang . Integer ) type_ ) ; return result == null ? com . google . type . DayOfWeek . UNRECOGNIZED : result ; } return com . google . type . DayOfWeek . DAY_OF_WEEK_UNSPECIFIED ;
public class BeanDeployer { /** * Loads a given class , creates a { @ link SlimAnnotatedTypeContext } for it and stores it in { @ link BeanDeployerEnvironment } . */ public BeanDeployer addClass ( String className , AnnotatedTypeLoader loader ) { } }
addIfNotNull ( loader . loadAnnotatedType ( className , getManager ( ) . getId ( ) ) ) ; return this ;
public class Config { /** * Returns an iterator that returns all of the configuration keys in this config object . */ public Iterator < String > keys ( ) { } }
HashSet < String > matches = new HashSet < String > ( ) ; enumerateKeys ( matches ) ; return matches . iterator ( ) ;
public class TolerantSaxDocumentBuilder { /** * Create a DOM Element for insertion into the current document * @ param namespaceURI * @ param qName * @ param attributes * @ return the created Element */ private Element createElement ( String namespaceURI , String qName , Attributes attributes ) { } }
Element newElement = currentDocument . createElement ( qName ) ; if ( namespaceURI != null && namespaceURI . length ( ) > 0 ) { newElement . setPrefix ( namespaceURI ) ; } for ( int i = 0 ; attributes != null && i < attributes . getLength ( ) ; ++ i ) { newElement . setAttribute ( attributes . getQName ( i ) , attributes . getValue ( i ) ) ; } return newElement ;
public class UpgradeReadCallback { /** * / * ( non - Javadoc ) * @ see com . ibm . wsspi . tcpchannel . TCPReadCompletedCallback # error ( com . ibm . wsspi . channelfw . VirtualConnection , com . ibm . wsspi . tcpchannel . TCPReadRequestContext , java . io . IOException ) */ @ Override @ FFDCIgnore ( IOException . class ) public void error ( VirtualConnection vc , TCPReadRequestContext rsc , IOException ioe ) { } }
boolean closing = false ; boolean isFirstRead = false ; synchronized ( _srtUpgradeStream ) { closing = _upgradeStream . isClosing ( ) ; isFirstRead = _upgradeStream . isFirstRead ( ) ; _upgradeStream . setIsInitialRead ( false ) ; } if ( ! closing ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Encountered an error during the initial read for data : " + ioe + ", " + _rl ) ; } try { // Set the original Context Class Loader before calling the users onDataAvailable // Push the original thread ' s context onto the current thread , also save off the current thread ' s context _contextManager . pushContextData ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Error encountered while we are not closing : " + _rl ) ; } if ( ! isFirstRead ) { if ( WCCustomProperties31 . UPGRADE_READ_TIMEOUT != TCPReadRequestContext . NO_TIMEOUT && ioe instanceof SocketTimeoutException ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Other side did not send data within the timeout time, calling onError : " + _rl ) ; } if ( ! _upgradeStream . isIsonErrorCalled ( ) ) { _upgradeStream . setIsonErrorCalled ( true ) ; _rl . onError ( ioe ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Other side must be closed, check if not called before call onAllDataRead : " + _rl ) ; } if ( ! _upgradeStream . isAlldataReadCalled ( ) ) { try { // We will call onAllDataRead if we encounter the error because we assume the other side has closed the connection since there is no timeout currently // The other side closing the connection means that we have read all the data _upgradeStream . setAlldataReadCalled ( true ) ; _rl . onAllDataRead ( ) ; } catch ( Throwable onAllDataReadException ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Encountered an error during ReadListener.onAllDataRead : " + onAllDataReadException + ", " + _rl ) ; } if ( ! _upgradeStream . isIsonErrorCalled ( ) ) { _upgradeStream . setIsonErrorCalled ( true ) ; _rl . onError ( onAllDataReadException ) ; } } } } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Encountered an error during the first initialRead for data, calling the ReadListener.onError : " + _rl ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isErrorEnabled ( ) ) Tr . error ( tc , "setReadListener.initialread.failed" ) ; if ( ! _upgradeStream . isIsonErrorCalled ( ) ) { _upgradeStream . setIsonErrorCalled ( true ) ; _rl . onError ( ioe ) ; } } } finally { try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "finally call close from ReadListener.onError : " + _rl ) ; } _upgradeStream . getWebConn ( ) . close ( ) ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught exception during WebConnection.close : " + e + "," + _rl ) ; } } // Revert back to the thread ' s current context _contextManager . popContextData ( ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "We are closing, skipping the call to onError" ) ; } synchronized ( _srtUpgradeStream ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Issuing the notify" ) ; } _srtUpgradeStream . notify ( ) ; } }
public class SqlAgentFactoryImpl { /** * { @ inheritDoc } * @ see jp . co . future . uroborosql . SqlAgentFactory # setFetchSize ( int ) */ @ Override public SqlAgentFactory setFetchSize ( final int fetchSize ) { } }
getDefaultProps ( ) . put ( PROPS_KEY_FETCH_SIZE , String . valueOf ( fetchSize ) ) ; return this ;
public class PageBlobInputStream { /** * Reads a byte . */ @ Override public int read ( ) throws IOException { } }
if ( _data == null ) { _data = new byte [ 1 ] ; } int result = _pageReader . read ( _offset , _data , 0 , 1 ) ; if ( result > 0 ) { _offset ++ ; return _data [ 0 ] & 0xff ; } else { return - 1 ; }
public class AbstractHibernateCriteriaBuilder { /** * Applys a " in " contrain on the specified property * @ param propertyName The property name * @ param values A collection of values * @ return A Criterion instance */ @ SuppressWarnings ( "rawtypes" ) public org . grails . datastore . mapping . query . api . Criteria in ( String propertyName , Collection values ) { } }
if ( ! validateSimpleExpression ( ) ) { throwRuntimeException ( new IllegalArgumentException ( "Call to [in] with propertyName [" + propertyName + "] and values [" + values + "] not allowed here." ) ) ; } propertyName = calculatePropertyName ( propertyName ) ; if ( values instanceof List ) { values = convertArgumentList ( ( List ) values ) ; } addToCriteria ( Restrictions . in ( propertyName , values == null ? Collections . EMPTY_LIST : values ) ) ; return this ;
public class ClassSourceImpl_MappedJar { /** * < p > Open the ClassSource for processing . If this is the first open , the underlying jar * file will be opened . < / p > * @ throws ClassSource _ Exception Thrown if the open failed . */ @ Override @ Trivial public void open ( ) throws ClassSource_Exception { } }
String methodName = "open" ; if ( tc . isEntryEnabled ( ) ) { String msg = MessageFormat . format ( "[ {0} ] State [ {1} ]" , new Object [ ] { getHashText ( ) , Integer . valueOf ( opens ) } ) ; Tr . entry ( tc , methodName , msg ) ; } if ( ( opens < 0 ) || ( ( opens == 0 ) && ( jarFile != null ) ) || ( ( opens > 0 ) && ( jarFile == null ) ) ) { Tr . warning ( tc , "ANNO_CLASSSOURCE_JAR_STATE_BAD" , getHashText ( ) , getJarPath ( ) , Integer . valueOf ( opens ) ) ; String eMsg = "[ " + getHashText ( ) + " ]" + " Failed to open [ " + getJarPath ( ) + " ]" + " Count of opens [ " + opens + " ]" + " Jar state [ " + jarFile + " ]" ; throw getFactory ( ) . newClassSourceException ( eMsg ) ; } opens ++ ; if ( jarFile == null ) { try { jarFile = UtilImpl_FileUtils . createJarFile ( jarPath ) ; // throws IOException } catch ( IOException e ) { Tr . warning ( tc , "ANNO_CLASSSOURCE_OPEN4_EXCEPTION" , getHashText ( ) , jarPath ) ; String eMsg = "[ " + getHashText ( ) + " ] Failed to open [ " + jarPath + " ]" ; throw getFactory ( ) . wrapIntoClassSourceException ( CLASS_NAME , methodName , eMsg , e ) ; } if ( tc . isEntryEnabled ( ) ) { Tr . exit ( tc , methodName , MessageFormat . format ( "[ {0} ] RETURN (new open)" , getHashText ( ) ) ) ; } } else { if ( tc . isEntryEnabled ( ) ) { Tr . exit ( tc , methodName , MessageFormat . format ( "[ {0} ] RETURN (already open)" , getHashText ( ) ) ) ; } }
public class PasswordManager { /** * Decrypt a password if it is an encrypted password ( in the form of ENC ( . * ) ) * and a master password file has been provided in the constructor . * Otherwise , return the password as is . */ public String readPassword ( String password ) { } }
if ( password == null || encryptors . size ( ) < 1 ) { return password ; } Matcher matcher = PASSWORD_PATTERN . matcher ( password ) ; if ( matcher . find ( ) ) { return this . decryptPassword ( matcher . group ( 1 ) ) ; } return password ;
public class JsonUtils { /** * Method serialises < code > HppResponse < / code > to JSON . * @ param hppResponse * @ return String */ public static String toJson ( HppResponse hppResponse ) { } }
try { return hppResponseWriter . writeValueAsString ( hppResponse ) ; } catch ( JsonProcessingException ex ) { LOGGER . error ( "Error writing HppResponse to JSON." , ex ) ; throw new RealexException ( "Error writing HppResponse to JSON." , ex ) ; }
public class Id { /** * Compares another Id to this id . Two ids are only comparable if they have the exact same type : if their types are * incompatible then a ClassCastException will be thrown < br / > * If the types are comparable then the result is a case - sensitive comparison of the underlying id valued * @ see java . lang . Comparable # compareTo ( java . lang . Object ) */ @ Override public final int compareTo ( final Id that ) { } }
if ( ! that . getClass ( ) . equals ( this . getClass ( ) ) ) { throw new ClassCastException ( "Incomparable Id types: " + that . getClass ( ) + " being compared to " + this . getClass ( ) ) ; } else { return this . id . compareTo ( that . id ) ; }
public class ModelResourceStructure { /** * < p > fetchHistory . < / p > * @ param id a URI _ ID object . * @ return a { @ link javax . ws . rs . core . Response } object . * @ throws java . lang . Exception if any . */ public Response fetchHistory ( @ PathParam ( "id" ) URI_ID id ) throws Exception { } }
final MODEL_ID mId = tryConvertId ( id ) ; matchedFetchHistory ( mId ) ; final Query < MODEL > query = server . find ( modelType ) ; defaultFindOrderBy ( query ) ; final Ref < FutureRowCount > rowCount = Refs . emptyRef ( ) ; Object entity = executeTx ( t -> { configDefaultQuery ( query ) ; configFetchHistoryQuery ( query , mId ) ; applyUriQuery ( query , false ) ; applyPageConfig ( query ) ; List < Version < MODEL > > list = query . findVersions ( ) ; rowCount . set ( fetchRowCount ( query ) ) ; return processFetchedHistoryModelList ( list , mId ) ; } ) ; if ( isEmptyEntity ( entity ) ) { return Response . noContent ( ) . build ( ) ; } Response response = Response . ok ( entity ) . build ( ) ; applyRowCountHeader ( response . getHeaders ( ) , query , rowCount . get ( ) ) ; return response ;
public class N { /** * Reverses the order of the given array in the given range . * @ param a * @ param fromIndex * @ param toIndex */ public static void reverse ( final char [ ] a , int fromIndex , int toIndex ) { } }
checkFromToIndex ( fromIndex , toIndex , len ( a ) ) ; if ( N . isNullOrEmpty ( a ) || a . length == 1 ) { return ; } char tmp = 0 ; for ( int i = fromIndex , j = toIndex - 1 ; i < j ; i ++ , j -- ) { tmp = a [ i ] ; a [ i ] = a [ j ] ; a [ j ] = tmp ; }
public class DecimalFormatSymbols { /** * Initializes the symbols from the FormatData resource bundle . */ private void initialize ( Locale locale ) { } }
this . locale = locale ; // Android - changed : Removed use of DecimalFormatSymbolsProvider . Switched to ICU . // get resource bundle data - try the cache first boolean needCacheUpdate = false ; Object [ ] data = cachedLocaleData . get ( locale ) ; if ( data == null ) { /* cache miss */ locale = LocaleData . mapInvalidAndNullLocales ( locale ) ; LocaleData localeData = LocaleData . get ( locale ) ; data = new Object [ 3 ] ; String [ ] values = new String [ 11 ] ; values [ 0 ] = String . valueOf ( localeData . decimalSeparator ) ; values [ 1 ] = String . valueOf ( localeData . groupingSeparator ) ; values [ 2 ] = String . valueOf ( localeData . patternSeparator ) ; values [ 3 ] = String . valueOf ( localeData . percent ) ; values [ 4 ] = String . valueOf ( localeData . zeroDigit ) ; values [ 5 ] = "#" ; values [ 6 ] = localeData . minusSign ; values [ 7 ] = localeData . exponentSeparator ; values [ 8 ] = String . valueOf ( localeData . perMill ) ; values [ 9 ] = localeData . infinity ; values [ 10 ] = localeData . NaN ; data [ 0 ] = values ; needCacheUpdate = true ; } String [ ] numberElements = ( String [ ] ) data [ 0 ] ; // Android - changed : Added maybeStripMarkers decimalSeparator = numberElements [ 0 ] . charAt ( 0 ) ; groupingSeparator = numberElements [ 1 ] . charAt ( 0 ) ; patternSeparator = numberElements [ 2 ] . charAt ( 0 ) ; percent = maybeStripMarkers ( numberElements [ 3 ] , '%' ) ; zeroDigit = numberElements [ 4 ] . charAt ( 0 ) ; // different for Arabic , etc . digit = numberElements [ 5 ] . charAt ( 0 ) ; minusSign = maybeStripMarkers ( numberElements [ 6 ] , '-' ) ; exponential = numberElements [ 7 ] . charAt ( 0 ) ; exponentialSeparator = numberElements [ 7 ] ; // string representation new since 1.6 perMill = numberElements [ 8 ] . charAt ( 0 ) ; infinity = numberElements [ 9 ] ; NaN = numberElements [ 10 ] ; // Try to obtain the currency used in the locale ' s country . // Check for empty country string separately because it ' s a valid // country ID for Locale ( and used for the C locale ) , but not a valid // ISO 3166 country code , and exceptions are expensive . if ( ! "" . equals ( locale . getCountry ( ) ) ) { try { currency = Currency . getInstance ( locale ) ; } catch ( IllegalArgumentException e ) { // use default values below for compatibility } } if ( currency != null ) { intlCurrencySymbol = currency . getCurrencyCode ( ) ; if ( data [ 1 ] != null && data [ 1 ] == intlCurrencySymbol ) { currencySymbol = ( String ) data [ 2 ] ; } else { currencySymbol = currency . getSymbol ( locale ) ; data [ 1 ] = intlCurrencySymbol ; data [ 2 ] = currencySymbol ; needCacheUpdate = true ; } } else { // default values intlCurrencySymbol = "XXX" ; try { currency = Currency . getInstance ( intlCurrencySymbol ) ; } catch ( IllegalArgumentException e ) { } currencySymbol = "\u00A4" ; } // Currently the monetary decimal separator is the same as the // standard decimal separator for all locales that we support . // If that changes , add a new entry to NumberElements . monetarySeparator = decimalSeparator ; if ( needCacheUpdate ) { cachedLocaleData . putIfAbsent ( locale , data ) ; }
public class Person { /** * Gets the value of the manager property . * This accessor method returns a reference to the live list , * not a snapshot . Therefore any modification you make to the * returned list will be present inside the JAXB object . * This is why there is not a < CODE > set < / CODE > method for the manager property . * For example , to add a new item , do as follows : * < pre > * getManager ( ) . add ( newItem ) ; * < / pre > * Objects of the following type ( s ) are allowed in the list { @ link com . ibm . wsspi . security . wim . model . IdentifierType } */ public List < com . ibm . wsspi . security . wim . model . IdentifierType > getManager ( ) { } }
if ( manager == null ) { manager = new ArrayList < com . ibm . wsspi . security . wim . model . IdentifierType > ( ) ; } return this . manager ;
public class Cob2CobolTypesGenerator { /** * Given a COBOL copybook , produce a set of java classes ( source code ) used * to convert mainframe data ( matching the copybook ) at runtime . * @ param cobolSource the COBOL copybook source * @ param targetPackageName the java package the generated classes should * reside in * @ param xsltFileName an optional xslt to apply on the XML Schema * @ return a map of java class names to their source code */ public Map < String , String > generate ( String cobolSource , String targetPackageName , final String xsltFileName ) { } }
return generate ( new StringReader ( cobolSource ) , targetPackageName , xsltFileName ) ;
public class MultipleWordsWordRule { /** * @ see IRule # evaluate ( ICharacterScanner ) */ public IToken evaluate ( ICharacterScanner scanner ) { } }
offset = 0 ; int c = read ( scanner ) ; if ( c != ICharacterScanner . EOF && fDetector . isWordStart ( ( char ) c ) ) { if ( fColumn == UNDEFINED || fColumn == scanner . getColumn ( ) - 1 ) { fBuffer . setLength ( 0 ) ; fBuffer . append ( ( char ) c ) ; for ( int i = 0 ; i < getMaxPartCount ( ) ; i ++ ) { // read a word for each part do { c = read ( scanner ) ; fBuffer . append ( ( char ) c ) ; // System . out . println ( " Read : ' " + c + " ' - ' " + ( char ) c + " ' " ) ; } while ( c != ICharacterScanner . EOF && c != ' ' && fDetector . isWordStart ( ( char ) c ) ) ; } // we may have read EOF so unread it popEof ( scanner ) ; final char lastChar = fBuffer . charAt ( fBuffer . length ( ) - 1 ) ; if ( lastChar == ' ' || lastChar == '\t' || lastChar == '\n' || lastChar == '\r' ) { unread ( scanner ) ; // last space fBuffer . delete ( fBuffer . length ( ) - 1 , fBuffer . length ( ) ) ; } String text = fBuffer . toString ( ) . toString ( ) . replace ( '\n' , ' ' ) . replace ( '\r' , ' ' ) . replace ( '\t' , ' ' ) ; String key = text ; // text . substring ( 0 , text . length ( ) - 1 ) ; WordMatch match = checkMatch ( key ) ; if ( match != null ) { if ( match . unMatchedLength > 0 ) { // unread unmatched parts for ( int i = 0 ; i < match . unMatchedLength ; i ++ ) { unread ( scanner ) ; } } return match . token ; } if ( fDefaultToken . isUndefined ( ) ) { unreadBuffer ( scanner ) ; } return returnEmpty ( fDefaultToken ) ; } } unread ( scanner ) ; return returnEmpty ( Token . UNDEFINED ) ;
public class AwtExtensions { /** * Gets the root JDialog from the given Component Object . * @ param component * The Component to find the root JDialog . * @ return ' s the root JDialog . */ public static Component getRootJDialog ( Component component ) { } }
while ( null != component . getParent ( ) ) { component = component . getParent ( ) ; if ( component instanceof JDialog ) { break ; } } return component ;
public class AbstractDocumentationMojo { /** * Create a parser for the given file . * @ param inputFile the file to be parsed . * @ return the parser . * @ throws MojoExecutionException if the parser cannot be created . * @ throws IOException if a classpath entry cannot be found . */ @ SuppressWarnings ( "checkstyle:npathcomplexity" ) protected AbstractMarkerLanguageParser createLanguageParser ( File inputFile ) throws MojoExecutionException , IOException { } }
final AbstractMarkerLanguageParser parser ; if ( isFileExtension ( inputFile , MarkdownParser . MARKDOWN_FILE_EXTENSIONS ) ) { parser = this . injector . getInstance ( MarkdownParser . class ) ; } else { throw new MojoExecutionException ( MessageFormat . format ( Messages . AbstractDocumentationMojo_3 , inputFile ) ) ; } parser . setGithubExtensionEnable ( this . githubExtension ) ; final SarlDocumentationParser internalParser = parser . getDocumentParser ( ) ; if ( this . isLineContinuationEnable ) { internalParser . setLineContinuation ( SarlDocumentationParser . DEFAULT_LINE_CONTINUATION ) ; } else { internalParser . addLowPropertyProvider ( createProjectProperties ( ) ) ; } final ScriptExecutor scriptExecutor = internalParser . getScriptExecutor ( ) ; final StringBuilder cp = new StringBuilder ( ) ; for ( final File cpElement : getClassPath ( ) ) { if ( cp . length ( ) > 0 ) { cp . append ( ":" ) ; // $ NON - NLS - 1 $ } cp . append ( cpElement . getAbsolutePath ( ) ) ; } scriptExecutor . setClassPath ( cp . toString ( ) ) ; final String bootPath = getBootClassPath ( ) ; if ( ! Strings . isEmpty ( bootPath ) ) { scriptExecutor . setBootClassPath ( bootPath ) ; } JavaVersion version = null ; if ( ! Strings . isEmpty ( this . source ) ) { version = JavaVersion . fromQualifier ( this . source ) ; } if ( version == null ) { version = JavaVersion . JAVA8 ; } scriptExecutor . setJavaSourceVersion ( version . getQualifier ( ) ) ; scriptExecutor . setTempFolder ( this . tempDirectory . getAbsoluteFile ( ) ) ; internalParser . addLowPropertyProvider ( createProjectProperties ( ) ) ; internalParser . addLowPropertyProvider ( this . session . getCurrentProject ( ) . getProperties ( ) ) ; internalParser . addLowPropertyProvider ( this . session . getUserProperties ( ) ) ; internalParser . addLowPropertyProvider ( this . session . getSystemProperties ( ) ) ; internalParser . addLowPropertyProvider ( createGeneratorProperties ( ) ) ; final Properties defaultValues = createDefaultValueProperties ( ) ; if ( defaultValues != null ) { internalParser . addLowPropertyProvider ( defaultValues ) ; } return parser ;
public class ColorImg { /** * Clamps all values of all channels ( including alpha if present ) to unit range [ 0,1 ] . * Values less than 0 are set to zero , values greater than 1 are set to 1. * @ return this for chaining * @ see # clampChannelToUnitRange ( int ) */ public ColorImg clampAllChannelsToUnitRange ( ) { } }
clampChannelToUnitRange ( channel_r ) ; clampChannelToUnitRange ( channel_g ) ; clampChannelToUnitRange ( channel_b ) ; if ( hasAlpha ) clampChannelToUnitRange ( channel_a ) ; return this ;
public class FileManager { /** * Creates a default File in case it does not exist yet . Default files can be used to load other files that are * created at runtime ( like properties file ) * @ param defaultFilePath path to default file . txt ( or where it should be created ) * @ param initMessage the string to write in default file * @ throws IOException is thrown by bufferedWriter */ public void createDefaultFile ( String defaultFilePath , String initMessage ) throws IOException { } }
File file = new File ( defaultFilePath ) ; BufferedWriter bufferedWriterInit = null ; try { if ( ! file . exists ( ) ) { file . createNewFile ( ) ; bufferedWriterInit = new BufferedWriter ( new FileWriter ( defaultFilePath ) ) ; bufferedWriterInit . write ( initMessage ) ; } } catch ( IOException e ) { error ( "unable to create the Default-File" , e ) ; } finally { if ( bufferedWriterInit != null ) { try { bufferedWriterInit . close ( ) ; } catch ( IOException e ) { error ( "Unable to close input stream" , e ) ; } } }