signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class IotHubResourcesInner { /** * Delete an IoT hub .
* Delete an IoT hub .
* @ param resourceGroupName The name of the resource group that contains the IoT hub .
* @ param resourceName The name of the IoT hub .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorDetailsException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the Object object if successful . */
public Object delete ( String resourceGroupName , String resourceName ) { } } | return deleteWithServiceResponseAsync ( resourceGroupName , resourceName ) . toBlocking ( ) . last ( ) . body ( ) ; |
public class CustomFieldValueReader { /** * Convert raw value as read from the MPP file into a Java type .
* @ param type MPP value type
* @ param value raw value data
* @ return Java object */
protected Object getTypedValue ( int type , byte [ ] value ) { } } | Object result ; switch ( type ) { case 4 : // Date
{ result = MPPUtility . getTimestamp ( value , 0 ) ; break ; } case 6 : // Duration
{ TimeUnit units = MPPUtility . getDurationTimeUnits ( MPPUtility . getShort ( value , 4 ) , m_properties . getDefaultDurationUnits ( ) ) ; result = MPPUtility . getAdjustedDuration ( m_properties , MPPUtility . getInt ( value , 0 ) , units ) ; break ; } case 9 : // Cost
{ result = Double . valueOf ( MPPUtility . getDouble ( value , 0 ) / 100 ) ; break ; } case 15 : // Number
{ result = Double . valueOf ( MPPUtility . getDouble ( value , 0 ) ) ; break ; } case 36058 : case 21 : // Text
{ result = MPPUtility . getUnicodeString ( value , 0 ) ; break ; } default : { result = value ; break ; } } return result ; |
public class WebUtils { /** * 执行HTTP POST请求 , 可使用代理proxy 。
* @ param url 请求地址
* @ param params 请求参数
* @ param charset 字符集 , 如UTF - 8 , GBK , GB2312
* @ param connectTimeout 连接超时时间
* @ param readTimeout 请求超时时间
* @ param proxyHost 代理host , 传null表示不使用代理
* @ param proxyPort 代理端口 , 传0表示不使用代理
* @ return 响应字符串
* @ throws IOException */
public static String doPost ( String url , Map < String , String > params , String charset , int connectTimeout , int readTimeout , String proxyHost , int proxyPort ) throws IOException { } } | String ctype = "application/x-www-form-urlencoded;charset=" + charset ; String query = buildQuery ( params , charset ) ; byte [ ] content = { } ; if ( query != null ) { content = query . getBytes ( charset ) ; } return doPost ( url , ctype , content , connectTimeout , readTimeout , proxyHost , proxyPort ) ; |
public class Block { /** * { @ inheritDoc } */
public int compareTo ( Block b ) { } } | // Wildcard generationStamp is NOT ALLOWED here
validateGenerationStamp ( this . generationStamp ) ; validateGenerationStamp ( b . generationStamp ) ; if ( blockId < b . blockId ) { return - 1 ; } else if ( blockId == b . blockId ) { return GenerationStamp . compare ( generationStamp , b . generationStamp ) ; } else { return 1 ; } |
public class CountingLruMap { /** * Removes all the matching elements from the map . */
public synchronized ArrayList < V > removeAll ( @ Nullable Predicate < K > predicate ) { } } | ArrayList < V > oldValues = new ArrayList < > ( ) ; Iterator < LinkedHashMap . Entry < K , V > > iterator = mMap . entrySet ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { LinkedHashMap . Entry < K , V > entry = iterator . next ( ) ; if ( predicate == null || predicate . apply ( entry . getKey ( ) ) ) { oldValues . add ( entry . getValue ( ) ) ; mSizeInBytes -= getValueSizeInBytes ( entry . getValue ( ) ) ; iterator . remove ( ) ; } } return oldValues ; |
public class BytecodeHelper { /** * array types are special :
* eg . : String [ ] : classname : [ Ljava . lang . String ;
* Object : classname : java . lang . Object
* int [ ] : classname : [ I
* unlike getTypeDescription ' . ' is not replaced by ' / ' .
* it seems that makes problems for
* the class loading if ' . ' is replaced by ' / '
* @ return the ASM type description for class loading */
public static String getClassLoadingTypeDescription ( ClassNode c ) { } } | StringBuilder buf = new StringBuilder ( ) ; boolean array = false ; while ( true ) { if ( c . isArray ( ) ) { buf . append ( '[' ) ; c = c . getComponentType ( ) ; array = true ; } else { if ( ClassHelper . isPrimitiveType ( c ) ) { buf . append ( getTypeDescription ( c ) ) ; } else { if ( array ) buf . append ( 'L' ) ; buf . append ( c . getName ( ) ) ; if ( array ) buf . append ( ';' ) ; } return buf . toString ( ) ; } } |
public class KeyVaultClientBaseImpl { /** * Deletes a certificate from a specified key vault .
* Deletes all versions of a certificate object along with its associated policy . Delete certificate cannot be used to remove individual versions of a certificate object . This operation requires the certificates / delete permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param certificateName The name of the certificate .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the DeletedCertificateBundle object */
public Observable < DeletedCertificateBundle > deleteCertificateAsync ( String vaultBaseUrl , String certificateName ) { } } | return deleteCertificateWithServiceResponseAsync ( vaultBaseUrl , certificateName ) . map ( new Func1 < ServiceResponse < DeletedCertificateBundle > , DeletedCertificateBundle > ( ) { @ Override public DeletedCertificateBundle call ( ServiceResponse < DeletedCertificateBundle > response ) { return response . body ( ) ; } } ) ; |
public class LoggerWrapper { /** * Delegate to the appropriate method of the underlying logger . */
public void warn ( String format , Object arg1 , Object arg2 ) { } } | if ( ! logger . isWarnEnabled ( ) ) return ; if ( instanceofLAL ) { String formattedMessage = MessageFormatter . format ( format , arg1 , arg2 ) . getMessage ( ) ; ( ( LocationAwareLogger ) logger ) . log ( null , fqcn , LocationAwareLogger . WARN_INT , formattedMessage , new Object [ ] { arg1 , arg2 } , null ) ; } else { logger . warn ( format , arg1 , arg2 ) ; } |
public class AssignedDeclaration { /** * Computes the priority order of the declaration based on its origin and importance
* according to the CSS specification .
* @ return The priority order ( 1 . . 5 ) .
* @ see < a href = " http : / / www . w3 . org / TR / CSS21 / cascade . html # cascading - order " > http : / / www . w3 . org / TR / CSS21 / cascade . html # cascading - order < / a > */
public int getOriginOrder ( ) { } } | if ( important ) { if ( origin == StyleSheet . Origin . AUTHOR ) return 4 ; else if ( origin == StyleSheet . Origin . AGENT ) return 1 ; else return 5 ; } else { if ( origin == StyleSheet . Origin . AUTHOR ) return 3 ; else if ( origin == StyleSheet . Origin . AGENT ) return 1 ; else return 2 ; } |
public class Img { /** * Creates an Img sharing the specified BufferedImage ' s data . Changes in
* the BufferdImage are reflected in the created Img and vice versa .
* Only BufferedImages with DataBuffer of { @ link DataBuffer # TYPE _ INT } can
* be used since the Img class uses an int [ ] to store its data . An
* IllegalArgumentException will be thrown if a BufferedImage with a
* different DataBufferType is provided .
* @ param bimg BufferedImage with TYPE _ INT DataBuffer .
* @ return Img sharing the BufferedImages data .
* @ throws IllegalArgumentException if a BufferedImage with a DataBufferType
* other than { @ link DataBuffer # TYPE _ INT } is provided .
* @ see # getRemoteBufferedImage ( )
* @ see # Img ( BufferedImage )
* @ since 1.0 */
public static Img createRemoteImg ( BufferedImage bimg ) { } } | int type = bimg . getRaster ( ) . getDataBuffer ( ) . getDataType ( ) ; if ( type != DataBuffer . TYPE_INT ) { throw new IllegalArgumentException ( String . format ( "cannot create Img as remote of provided BufferedImage!%n" + "Need BufferedImage with DataBuffer of type TYPE_INT (%d). Provided type: %d" , DataBuffer . TYPE_INT , type ) ) ; } Img img = new Img ( new Dimension ( bimg . getWidth ( ) , bimg . getHeight ( ) ) , ( ( DataBufferInt ) bimg . getRaster ( ) . getDataBuffer ( ) ) . getData ( ) ) ; return img ; |
public class CleaneLingSolver { /** * Distills units and subsumes / strengthens clauses . */
private void distill ( ) { } } | final long steps = this . limits . simpSteps ; assert this . level == 0 ; assert ! this . config . plain ; if ( ! this . config . distill ) { return ; } final long limit = this . stats . steps + steps / sizePenalty ( ) ; boolean changed = false ; boolean done = this . clauses . empty ( ) ; if ( this . distilled >= this . clauses . size ( ) ) { this . distilled = 0 ; } while ( this . empty == null && ! done && this . stats . steps ++ < limit ) { final CLClause c = this . clauses . get ( this . distilled ) ; if ( ! c . redundant ( ) && ! c . dumped ( ) && c . large ( ) && ! satisfied ( c ) ) { CLClause conflict = null ; assert this . ignore == null ; this . ignore = c ; int lit ; for ( int p = 0 ; conflict == null && p < c . lits ( ) . size ( ) ; p ++ ) { lit = c . lits ( ) . get ( p ) ; final byte v = val ( lit ) ; if ( v == VALUE_FALSE ) { continue ; } if ( v == VALUE_TRUE ) { this . stats . distillStrengthened ++ ; strengthen ( c , lit ) ; changed = true ; break ; } assume ( - lit ) ; conflict = bcp ( ) ; } this . ignore = null ; if ( conflict != null ) { analyze ( conflict ) ; if ( this . level == 0 ) { assert this . next < this . trail . size ( ) ; this . stats . distillUnits ++ ; changed = true ; conflict = bcp ( ) ; if ( conflict != null ) { analyze ( conflict ) ; assert this . empty != null ; } } else { this . stats . distillSubsumed ++ ; dumpClause ( c ) ; } } backtrack ( ) ; } if ( ++ this . distilled == this . clauses . size ( ) ) { if ( changed ) { changed = false ; } else { done = true ; } this . distilled = 0 ; } } |
public class Traverson { /** * Iterates over pages by following ' prev ' links . For every page , a { @ code Traverson } is created and provided as a
* parameter to the callback function .
* < pre >
* prev
* . . . - - & gt ; HalRepresentation - - & gt ; HalRepresentation
* v N item v N item
* & lt ; embedded type & gt ; & lt ; embedded type & gt ;
* < / pre >
* The { @ code Traverson } is backed by a { @ link HalRepresentation } with { @ link EmbeddedTypeInfo } . This way it
* is possible to access items embedded into the page resources as specific subtypes of HalRepresentation .
* Iteration stops if the callback returns { @ code false } , or if the last page is processed .
* @ param embeddedTypeInfo type information of the ( possibly embedded ) items of a page
* @ param pageHandler callback function called for every page
* @ throws IOException if a low - level I / O problem ( unexpected end - of - input , network error ) occurs .
* @ throws JsonParseException if the json document can not be parsed by Jackson ' s ObjectMapper
* @ throws JsonMappingException if the input JSON structure can not be mapped to the specified HalRepresentation type
* @ since 1.0.0 */
public void paginatePrev ( final EmbeddedTypeInfo embeddedTypeInfo , final PageHandler pageHandler ) throws IOException { } } | paginateAs ( "prev" , HalRepresentation . class , embeddedTypeInfo , pageHandler ) ; |
public class Str { /** * use { @ link Str # joinArgs ( String , Object . . . ) }
* @ param separator
* @ param strings
* @ return */
@ Deprecated public < T > String join1 ( String separator , Object ... strings ) { } } | return joinArgs ( separator , strings ) ; |
public class scpolicy { /** * Use this API to fetch all the scpolicy resources that are configured on netscaler . */
public static scpolicy [ ] get ( nitro_service service ) throws Exception { } } | scpolicy obj = new scpolicy ( ) ; scpolicy [ ] response = ( scpolicy [ ] ) obj . get_resources ( service ) ; return response ; |
public class ExpressionParser { /** * The auxiliary method allows to form a function and its arguments as a tree
* @ param function the function which arguments will be read from the stream , must not be null
* @ param reader the reader to be used as the character source , must not be null
* @ param context a preprocessor context , it will be used for a user functions and variables
* @ param includeStack the current file include stack , can be null
* @ param sources the current source line , can be null
* @ return an expression tree containing parsed function arguments
* @ throws IOException it will be thrown if there is any problem to read chars */
@ Nonnull private ExpressionTree readFunction ( @ Nonnull final AbstractFunction function , @ Nonnull final PushbackReader reader , @ Nonnull final PreprocessorContext context , @ Nullable @ MustNotContainNull final FilePositionInfo [ ] includeStack , @ Nullable final String sources ) throws IOException { } } | final ExpressionItem expectedBracket = nextItem ( reader , context ) ; if ( expectedBracket == null ) { throw context . makeException ( "Detected function without params [" + function . getName ( ) + ']' , null ) ; } final int arity = function . getArity ( ) ; ExpressionTree functionTree ; if ( arity == 0 ) { final ExpressionTree subExpression = new ExpressionTree ( includeStack , sources ) ; final ExpressionItem lastItem = readFunctionArgument ( reader , subExpression , context , includeStack , sources ) ; if ( SpecialItem . BRACKET_CLOSING != lastItem ) { throw context . makeException ( "There is not closing bracket for function [" + function . getName ( ) + ']' , null ) ; } else if ( ! subExpression . getRoot ( ) . isEmptySlot ( ) ) { throw context . makeException ( "The function \'" + function . getName ( ) + "\' doesn't need arguments" , null ) ; } else { functionTree = new ExpressionTree ( includeStack , sources ) ; functionTree . addItem ( function ) ; } } else { final List < ExpressionTree > arguments = new ArrayList < > ( arity ) ; for ( int i = 0 ; i < function . getArity ( ) ; i ++ ) { final ExpressionTree subExpression = new ExpressionTree ( includeStack , sources ) ; final ExpressionItem lastItem = readFunctionArgument ( reader , subExpression , context , includeStack , sources ) ; if ( SpecialItem . BRACKET_CLOSING == lastItem ) { arguments . add ( subExpression ) ; break ; } else if ( SpecialItem . COMMA == lastItem ) { arguments . add ( subExpression ) ; } else { throw context . makeException ( "Wrong argument for function [" + function . getName ( ) + ']' , null ) ; } } functionTree = new ExpressionTree ( includeStack , sources ) ; functionTree . addItem ( function ) ; ExpressionTreeElement functionTreeElement = functionTree . getRoot ( ) ; if ( arguments . size ( ) != functionTreeElement . getArity ( ) ) { throw context . makeException ( "Wrong argument number detected \'" + function . getName ( ) + "\', must be " + function . getArity ( ) + " argument(s)" , null ) ; } functionTreeElement . fillArguments ( arguments ) ; } return functionTree ; |
public class DocumentRootImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public void setStringParameter ( StringParameterType newStringParameter ) { } } | ( ( FeatureMap . Internal ) getMixed ( ) ) . set ( BpsimPackage . Literals . DOCUMENT_ROOT__STRING_PARAMETER , newStringParameter ) ; |
public class IncludeValue { /** * Get configuration name of the linked config
* @ return configuration name of the linked config */
public ConfigurationSourceKey getConfigName ( ) { } } | return new ConfigurationSourceKey ( ConfigurationSourceKey . Type . FILE , ConfigurationSourceKey . Format . JSON , configurationName ) ; |
public class AstBuilder { /** * statement { - - - - - */
@ Override public AssertStatement visitAssertStatement ( AssertStatementContext ctx ) { } } | visitingAssertStatementCnt ++ ; Expression conditionExpression = ( Expression ) this . visit ( ctx . ce ) ; if ( conditionExpression instanceof BinaryExpression ) { BinaryExpression binaryExpression = ( BinaryExpression ) conditionExpression ; if ( binaryExpression . getOperation ( ) . getType ( ) == Types . ASSIGN ) { throw createParsingFailedException ( "Assignment expression is not allowed in the assert statement" , conditionExpression ) ; } } BooleanExpression booleanExpression = configureAST ( new BooleanExpression ( conditionExpression ) , conditionExpression ) ; if ( ! asBoolean ( ctx . me ) ) { return configureAST ( new AssertStatement ( booleanExpression ) , ctx ) ; } AssertStatement result = configureAST ( new AssertStatement ( booleanExpression , ( Expression ) this . visit ( ctx . me ) ) , ctx ) ; visitingAssertStatementCnt -- ; return result ; |
public class AntTask { /** * Creates a instance of an annotation class name that suppresses error reporting in classes / methods / fields . */
public SuppressAnnotationType createSuppressAnnotation ( ) { } } | final SuppressAnnotationType s = new SuppressAnnotationType ( ) ; s . setProject ( getProject ( ) ) ; suppressAnnotations . add ( s ) ; return s ; |
public class Call { /** * Abbreviation for { { @ link # methodForSetOf ( Type , String , Object . . . ) } .
* @ since 1.1
* @ param methodName the name of the method
* @ param optionalParameters the ( optional ) parameters of the method .
* @ return the result of the method execution */
public static < R > Function < Object , Set < R > > setOf ( final Type < R > resultType , final String methodName , final Object ... optionalParameters ) { } } | return methodForSetOf ( resultType , methodName , optionalParameters ) ; |
public class DWOF { /** * This method applies a density based clustering algorithm .
* It looks for an unclustered object and builds a new cluster for it , then
* adds all the points within its radius to that cluster .
* nChain represents the points to be added to the cluster and its
* radius - neighbors
* @ param ids Database IDs to process
* @ param rnnQuery Data to process
* @ param radii Radii to cluster accordingly
* @ param labels Label storage . */
private void clusterData ( DBIDs ids , RangeQuery < O > rnnQuery , WritableDoubleDataStore radii , WritableDataStore < ModifiableDBIDs > labels ) { } } | FiniteProgress clustProg = LOG . isVerbose ( ) ? new FiniteProgress ( "Density-Based Clustering" , ids . size ( ) , LOG ) : null ; // Iterate over all objects
for ( DBIDIter iter = ids . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { if ( labels . get ( iter ) != null ) { continue ; } ModifiableDBIDs newCluster = DBIDUtil . newArray ( ) ; newCluster . add ( iter ) ; labels . put ( iter , newCluster ) ; LOG . incrementProcessed ( clustProg ) ; // container of the points to be added and their radii neighbors to the
// cluster
ModifiableDBIDs nChain = DBIDUtil . newArray ( ) ; nChain . add ( iter ) ; // iterate over nChain
for ( DBIDIter toGetNeighbors = nChain . iter ( ) ; toGetNeighbors . valid ( ) ; toGetNeighbors . advance ( ) ) { double range = radii . doubleValue ( toGetNeighbors ) ; DoubleDBIDList nNeighbors = rnnQuery . getRangeForDBID ( toGetNeighbors , range ) ; for ( DoubleDBIDListIter iter2 = nNeighbors . iter ( ) ; iter2 . valid ( ) ; iter2 . advance ( ) ) { if ( DBIDUtil . equal ( toGetNeighbors , iter2 ) ) { continue ; } if ( labels . get ( iter2 ) == null ) { newCluster . add ( iter2 ) ; labels . put ( iter2 , newCluster ) ; nChain . add ( iter2 ) ; LOG . incrementProcessed ( clustProg ) ; } else if ( labels . get ( iter2 ) != newCluster ) { ModifiableDBIDs toBeDeleted = labels . get ( iter2 ) ; newCluster . addDBIDs ( toBeDeleted ) ; for ( DBIDIter iter3 = toBeDeleted . iter ( ) ; iter3 . valid ( ) ; iter3 . advance ( ) ) { labels . put ( iter3 , newCluster ) ; } toBeDeleted . clear ( ) ; } } } } LOG . ensureCompleted ( clustProg ) ; |
public class BlockCanaryUi { /** * Converts from device independent pixels ( dp or dip ) to
* device dependent pixels . This method returns the input
* multiplied by the display ' s density . The result is not
* rounded nor clamped .
* The value returned by this method is well suited for
* drawing with the Canvas API but should not be used to
* set layout dimensions .
* @ param dp The value in dp to convert to pixels
* @ param resources An instances of Resources */
static float dpToPixel ( float dp , Resources resources ) { } } | DisplayMetrics metrics = resources . getDisplayMetrics ( ) ; return metrics . density * dp ; |
public class BufferingHintsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BufferingHints bufferingHints , ProtocolMarshaller protocolMarshaller ) { } } | if ( bufferingHints == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( bufferingHints . getSizeInMBs ( ) , SIZEINMBS_BINDING ) ; protocolMarshaller . marshall ( bufferingHints . getIntervalInSeconds ( ) , INTERVALINSECONDS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ResourcePathComponentMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ResourcePathComponent resourcePathComponent , ProtocolMarshaller protocolMarshaller ) { } } | if ( resourcePathComponent == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( resourcePathComponent . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( resourcePathComponent . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ThreadContextAccessor { /** * Resets the context class loader of the current thread after a call to { @ link # pushContextClassLoaderForUnprivileged } or { @ link # repushContextClassLoaderForUnprivileged } .
* This method does
* nothing if the specified class loader is { @ link # UNCHANGED } . Otherwise ,
* this method is equivalent to calling { @ link # setContextClassLoaderForUnprivileged }
* @ param origLoader the result of { @ link # pushContextClassLoaderForUnprivileged } or { @ link # repushContextClassLoaderForUnprivileged } */
public void popContextClassLoaderForUnprivileged ( Object origLoader ) { } } | if ( origLoader != UNCHANGED ) { setContextClassLoaderForUnprivileged ( Thread . currentThread ( ) , ( ClassLoader ) origLoader ) ; } |
public class QueuedFuture { /** * { @ inheritDoc } */
@ Override @ FFDCIgnore ( { } } | ExecutionException . class } ) public boolean isCancelled ( ) { Future < Future < R > > resultFuture = getResultFuture ( ) ; if ( resultFuture . isDone ( ) ) { if ( resultFuture . isCancelled ( ) ) { return true ; } else { try { Future < R > innerFuture = resultFuture . get ( ) ; return innerFuture . isCancelled ( ) ; } catch ( InterruptedException e ) { // outerFuture was done so we should never get an interrupted exception
throw new FaultToleranceException ( e ) ; } catch ( ExecutionException e ) { // this is most likely to be caused if an exception is thrown from the business method . . . or a TimeoutException
// either way , the future was not cancelled
return false ; } } } else { return false ; } |
public class DistributedExceptionInfo { /** * Get a specific exception in a possible chain of exceptions .
* If there are multiple exceptions in the chain , the most recent one thrown
* will be returned .
* If the exceptions does not exist or no exceptions have been chained ,
* null will be returned .
* @ exception com . ibm . websphere . exception . ExceptionInstantiationException
* An exception occurred while trying to instantiate an exception object .
* If this exception is thrown , the relevant information can be retrieved
* using the getPreviousExceptionInfo ( ) method .
* @ param String exceptionClassName the class name of the specific exception .
* @ return java . lang . Throwable The specific exception in a chain of
* exceptions . If no exceptions have been chained , null will be returned . */
public Throwable getException ( String exceptionClassName ) throws ExceptionInstantiationException { } } | if ( exceptionClassName == null ) { return null ; } Throwable ex = null ; if ( previousExceptionInfo != null ) { if ( previousExceptionInfo . getClassName ( ) . equals ( exceptionClassName ) ) { ex = getPreviousException ( ) ; } else { ex = previousExceptionInfo . getException ( exceptionClassName ) ; } } return ex ; |
public class BaseApplet { /** * Display the logon dialog and login .
* @ return */
public int onLogonDialog ( ) { } } | String strDisplay = "Login required" ; strDisplay = this . getTask ( ) . getString ( strDisplay ) ; for ( int i = 1 ; i < 3 ; i ++ ) { String strUserName = this . getProperty ( Params . USER_NAME ) ; Frame frame = ScreenUtil . getFrame ( this ) ; LoginDialog dialog = new LoginDialog ( frame , true , strDisplay , strUserName ) ; if ( frame != null ) ScreenUtil . centerDialogInFrame ( dialog , frame ) ; dialog . setVisible ( true ) ; int iOption = dialog . getReturnStatus ( ) ; if ( iOption == LoginDialog . NEW_USER_OPTION ) iOption = this . createNewUser ( dialog ) ; if ( iOption != JOptionPane . OK_OPTION ) return iOption ; // Canceled dialog = You don ' t get in .
strUserName = dialog . getUserName ( ) ; String strPassword = dialog . getPassword ( ) ; try { byte [ ] bytes = strPassword . getBytes ( Base64 . DEFAULT_ENCODING ) ; bytes = Base64 . encodeSHA ( bytes ) ; char [ ] chars = Base64 . encode ( bytes ) ; strPassword = new String ( chars ) ; } catch ( NoSuchAlgorithmException ex ) { ex . printStackTrace ( ) ; } catch ( UnsupportedEncodingException ex ) { ex . printStackTrace ( ) ; } String strDomain = this . getProperty ( Params . DOMAIN ) ; int iSuccess = this . getApplication ( ) . login ( this , strUserName , strPassword , strDomain ) ; if ( iSuccess == Constants . NORMAL_RETURN ) { // If they want to save the user . . . save it in a muffin .
if ( this . getApplication ( ) . getMuffinManager ( ) != null ) if ( this . getApplication ( ) . getMuffinManager ( ) . isServiceAvailable ( ) ) { if ( dialog . getSaveState ( ) == true ) this . getApplication ( ) . getMuffinManager ( ) . setMuffin ( Params . USER_ID , this . getApplication ( ) . getProperty ( Params . USER_ID ) ) ; // Set muffin to current user .
else this . getApplication ( ) . getMuffinManager ( ) . setMuffin ( Params . USER_ID , null ) ; // Set muffin to current user .
} return iSuccess ; } // Otherwise , continue looping ( 3 times )
} return this . setLastError ( strDisplay ) ; |
public class UpdatePrimaryEmailAddressRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdatePrimaryEmailAddressRequest updatePrimaryEmailAddressRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updatePrimaryEmailAddressRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updatePrimaryEmailAddressRequest . getOrganizationId ( ) , ORGANIZATIONID_BINDING ) ; protocolMarshaller . marshall ( updatePrimaryEmailAddressRequest . getEntityId ( ) , ENTITYID_BINDING ) ; protocolMarshaller . marshall ( updatePrimaryEmailAddressRequest . getEmail ( ) , EMAIL_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ChannelFrameworkImpl { /** * @ seecom . ibm . wsspi . channelfw . ChannelFramework # removeGroupEventListener (
* ChainEventListener , String ) */
@ Override public synchronized void removeGroupEventListener ( ChainEventListener cel , String groupName ) throws ChainGroupException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "removeGroupEventListener" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "groupName=" + groupName ) ; Tr . debug ( tc , "Listener=" + cel ) ; } // Find the chain group .
ChainGroupDataImpl groupData = ( ChainGroupDataImpl ) chainGroups . get ( groupName ) ; // Verify the group is in the framework .
if ( null == groupData ) { ChainGroupException e = new ChainGroupException ( "Unable to unregister listener for unknown group, " + groupName ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".removeGroupEventListener" , "3011" , this , new Object [ ] { groupName } ) ; throw e ; } groupData . removeChainEventListener ( cel ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "removeGroupEventListener" ) ; } |
public class GenericDao { /** * 查询符合条件组合的记录数
* @ param matches
* @ return 2013-8-26 下午3:04:02 created by wangchongjie */
public int count ( List < Match > matches ) { } } | Query query = queryGenerator . getCountQuery ( matches ) ; // 执行操作
String sql = query . getSql ( ) ; return countBySQL ( sql , query . getParams ( ) ) ; |
public class Cycles { /** * Obtain the bond between the atoms at index ' u ' and ' v ' . If the ' bondMap '
* is non - null it is used for direct lookup otherwise the slower linear
* lookup in ' container ' is used .
* @ param container a structure
* @ param bondMap optimised map of atom indices to bond instances
* @ param u an atom index
* @ param v an atom index ( connected to u )
* @ return the bond between u and v */
private static IBond getBond ( IAtomContainer container , EdgeToBondMap bondMap , int u , int v ) { } } | if ( bondMap != null ) return bondMap . get ( u , v ) ; return container . getBond ( container . getAtom ( u ) , container . getAtom ( v ) ) ; |
public class AuthTokenUtil { /** * Adds a digital signature to the auth token .
* @ param token the auth token */
public static final void signAuthToken ( AuthToken token ) { } } | String signature = generateSignature ( token ) ; token . setSignature ( signature ) ; |
public class MIORGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . MIORG__RG_LENGTH : setRGLength ( ( Integer ) newValue ) ; return ; case AfplibPackage . MIORG__TRIPLETS : getTriplets ( ) . clear ( ) ; getTriplets ( ) . addAll ( ( Collection < ? extends Triplet > ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class ObjectAnimator { /** * Constructs and returns an ObjectAnimator that animates between float values . A single
* value implies that that value is the one being animated to . Two values imply a starting
* and ending values . More than two values imply a starting value , values to animate through
* along the way , and an ending value ( these values will be distributed evenly across
* the duration of the animation ) .
* @ param target The object whose property is to be animated .
* @ param property The property being animated .
* @ param values A set of values that the animation will animate between over time .
* @ return An ObjectAnimator object that is set up to animate between the given values . */
public static < T > ObjectAnimator ofFloat ( T target , Property < T , Float > property , float ... values ) { } } | ObjectAnimator anim = new ObjectAnimator ( target , property ) ; anim . setFloatValues ( values ) ; return anim ; |
public class CommerceNotificationTemplateLocalServiceBaseImpl { /** * Returns all the commerce notification templates matching the UUID and company .
* @ param uuid the UUID of the commerce notification templates
* @ param companyId the primary key of the company
* @ return the matching commerce notification templates , or an empty list if no matches were found */
@ Override public List < CommerceNotificationTemplate > getCommerceNotificationTemplatesByUuidAndCompanyId ( String uuid , long companyId ) { } } | return commerceNotificationTemplatePersistence . findByUuid_C ( uuid , companyId ) ; |
public class AbstractCache { /** * The static method removes all values in all caches . */
public static void clearCaches ( ) { } } | synchronized ( AbstractCache . CACHES ) { for ( final AbstractCache < ? > cache : AbstractCache . CACHES ) { cache . getCache4Id ( ) . clear ( ) ; cache . getCache4Name ( ) . clear ( ) ; cache . getCache4UUID ( ) . clear ( ) ; } } |
public class AmazonCloudWatchClient { /** * Deletes all dashboards that you specify . You may specify up to 100 dashboards to delete . If there is an error
* during this call , no dashboards are deleted .
* @ param deleteDashboardsRequest
* @ return Result of the DeleteDashboards operation returned by the service .
* @ throws InvalidParameterValueException
* The value of an input parameter is bad or out - of - range .
* @ throws DashboardNotFoundErrorException
* The specified dashboard does not exist .
* @ throws InternalServiceException
* Request processing has failed due to some unknown error , exception , or failure .
* @ sample AmazonCloudWatch . DeleteDashboards
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / monitoring - 2010-08-01 / DeleteDashboards " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public DeleteDashboardsResult deleteDashboards ( DeleteDashboardsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDeleteDashboards ( request ) ; |
public class StepImpl { /** * If not already created , a new < code > partition < / code > element with the given value will be created .
* Otherwise , the existing < code > partition < / code > element will be returned .
* @ return a new or existing instance of < code > Partition < Step < T > > < / code > */
public Partition < Step < T > > getOrCreatePartition ( ) { } } | Node node = childNode . getOrCreate ( "partition" ) ; Partition < Step < T > > partition = new PartitionImpl < Step < T > > ( this , "partition" , childNode , node ) ; return partition ; |
public class ParallelScanner { /** * This method gets a segmentedScanResult and submits the next scan request for that segment , if there is one .
* @ return the next available ScanResult
* @ throws ExecutionException if one of the segment pages threw while executing
* @ throws InterruptedException if one of the segment pages was interrupted while executing . */
private ScanContext grab ( ) throws ExecutionException , InterruptedException { } } | final Future < ScanContext > ret = exec . take ( ) ; final ScanRequest originalRequest = ret . get ( ) . getScanRequest ( ) ; final int segment = originalRequest . getSegment ( ) ; final ScanSegmentWorker sw = workers [ segment ] ; if ( sw . hasNext ( ) ) { currentFutures [ segment ] = exec . submit ( sw ) ; } else { finishSegment ( segment ) ; currentFutures [ segment ] = null ; } // FYI , This might block if nothing is available .
return ret . get ( ) ; |
public class JmsJMSContextImpl { /** * ( non - Javadoc )
* @ see javax . jms . JMSContext # createBrowser ( javax . jms . Queue , java . lang . String ) */
@ Override public QueueBrowser createBrowser ( Queue queue , String messageSelector ) throws JMSRuntimeException , InvalidDestinationRuntimeException , InvalidSelectorRuntimeException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "createBrowser" , new Object [ ] { queue , messageSelector } ) ; QueueBrowser queueBrowser = null ; try { queueBrowser = jmsSession . createBrowser ( queue , messageSelector ) ; } catch ( InvalidDestinationException ide ) { throw ( InvalidDestinationRuntimeException ) JmsErrorUtils . getJMS2Exception ( ide , InvalidDestinationRuntimeException . class ) ; } catch ( InvalidSelectorException ise ) { throw ( InvalidSelectorRuntimeException ) JmsErrorUtils . getJMS2Exception ( ise , InvalidSelectorRuntimeException . class ) ; } catch ( JMSException jmse ) { throw ( JMSRuntimeException ) JmsErrorUtils . getJMS2Exception ( jmse , JMSRuntimeException . class ) ; } finally { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "createBrowser" ) ; } return queueBrowser ; |
public class KeyStoreHelper { /** * Load the specified secret key entry from the provided key store .
* @ param aKeyStore
* The key store to load the key from . May not be < code > null < / code > .
* @ param sKeyStorePath
* Key store path . For nice error messages only . May be
* < code > null < / code > .
* @ param sKeyStoreKeyAlias
* The alias to be resolved in the key store . Must be non -
* < code > null < / code > to succeed .
* @ param aKeyStoreKeyPassword
* The key password for the key store . Must be non - < code > null < / code > to
* succeed .
* @ return The key loading result . Never < code > null < / code > . */
@ Nonnull public static LoadedKey < KeyStore . SecretKeyEntry > loadSecretKey ( @ Nonnull final KeyStore aKeyStore , @ Nonnull final String sKeyStorePath , @ Nullable final String sKeyStoreKeyAlias , @ Nullable final char [ ] aKeyStoreKeyPassword ) { } } | return _loadKey ( aKeyStore , sKeyStorePath , sKeyStoreKeyAlias , aKeyStoreKeyPassword , KeyStore . SecretKeyEntry . class ) ; |
public class BuildUtil { /** * Read the value of an extra property of the project .
* @ param pExtraPropName the reference to the extra property name
* @ param < T > type of the property value
* @ return the property ' s value */
@ SuppressWarnings ( "unchecked" ) public < T > T getExtraPropertyValue ( @ Nonnull final ExtProp pExtraPropName ) { } } | ExtraPropertiesExtension extraProps = project . getExtensions ( ) . getByType ( ExtraPropertiesExtension . class ) ; if ( extraProps . has ( pExtraPropName . getPropertyName ( ) ) ) { return ( T ) extraProps . get ( pExtraPropName . getPropertyName ( ) ) ; } throw new GradleException ( "Reference to non-existent project extra property '" + pExtraPropName . getPropertyName ( ) + "'" ) ; |
public class BaseDaoImpl { /** * 分页查询list总条目数 */
@ Override public int count ( HashMap < Object , Object > hashMap ) { } } | String count = "count" + clazz . getSimpleName ( ) + "sByConditions" ; System . out . println ( count ) ; return sqlSessionTemplate . selectOne ( count , hashMap ) ; |
public class PolicyDefinitionsInner { /** * Creates or updates a policy definition .
* @ param policyDefinitionName The name of the policy definition to create .
* @ param parameters The policy definition properties .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the PolicyDefinitionInner object if successful . */
public PolicyDefinitionInner createOrUpdate ( String policyDefinitionName , PolicyDefinitionInner parameters ) { } } | return createOrUpdateWithServiceResponseAsync ( policyDefinitionName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ClassLoaderUtils { /** * Gets an appropriate classloader for usage when performing classpath
* lookups and scanning .
* @ return */
public static ClassLoader getParentClassLoader ( ) { } } | logger . debug ( "getParentClassLoader() invoked, web start mode: {}" , IS_WEB_START ) ; if ( IS_WEB_START ) { return Thread . currentThread ( ) . getContextClassLoader ( ) ; } else { return ClassLoaderUtils . class . getClassLoader ( ) ; } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link TextType }
* { @ code > } */
@ XmlElementDecl ( namespace = "http://www.w3.org/2005/Atom" , name = "rights" , scope = SourceType . class ) public JAXBElement < TextType > createSourceTypeRights ( TextType value ) { } } | return new JAXBElement < TextType > ( ENTRY_TYPE_RIGHTS_QNAME , TextType . class , SourceType . class , value ) ; |
public class Optional { /** * Returns an empty { @ code Optional } .
* @ param < T > the type of value
* @ return an { @ code Optional } */
@ NotNull @ Contract ( pure = true ) @ SuppressWarnings ( "unchecked" ) public static < T > Optional < T > empty ( ) { } } | return ( Optional < T > ) EMPTY ; |
public class MockArtifactStore { /** * { @ inheritDoc } */
public synchronized long getLastModified ( Artifact artifact ) throws IOException , ArtifactNotFoundException { } } | Map < String , Map < String , Map < Artifact , Content > > > artifactMap = contents . get ( artifact . getGroupId ( ) ) ; Map < String , Map < Artifact , Content > > versionMap = ( artifactMap == null ? null : artifactMap . get ( artifact . getArtifactId ( ) ) ) ; Map < Artifact , Content > filesMap = ( versionMap == null ? null : versionMap . get ( artifact . getVersion ( ) ) ) ; Content content = ( filesMap == null ? null : filesMap . get ( artifact ) ) ; if ( content == null ) { if ( artifact . isSnapshot ( ) && artifact . getTimestamp ( ) == null && filesMap != null ) { Artifact best = null ; for ( Map . Entry < Artifact , Content > entry : filesMap . entrySet ( ) ) { Artifact a = entry . getKey ( ) ; if ( artifact . equalSnapshots ( a ) && ( best == null || best . compareTo ( a ) < 0 ) ) { best = a ; content = entry . getValue ( ) ; } } if ( content == null ) { throw new ArtifactNotFoundException ( artifact ) ; } } else { throw new ArtifactNotFoundException ( artifact ) ; } } return content . getLastModified ( ) ; |
public class KieModuleDeploymentHelperImpl { /** * Create the pom that will be placed in the KJar .
* @ param releaseId The release ( deployment ) id .
* @ param dependencies The list of dependendencies to be added to the pom
* @ return A string representation of the pom . */
private static String getPomText ( ReleaseId releaseId , ReleaseId ... dependencies ) { } } | String pom = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + " xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n" + " <modelVersion>4.0.0</modelVersion>\n" + "\n" + " <groupId>" + releaseId . getGroupId ( ) + "</groupId>\n" + " <artifactId>" + releaseId . getArtifactId ( ) + "</artifactId>\n" + " <version>" + releaseId . getVersion ( ) + "</version>\n" + "\n" ; if ( dependencies != null && dependencies . length > 0 ) { pom += "<dependencies>\n" ; for ( ReleaseId dep : dependencies ) { pom += "<dependency>\n" ; pom += " <groupId>" + dep . getGroupId ( ) + "</groupId>\n" ; pom += " <artifactId>" + dep . getArtifactId ( ) + "</artifactId>\n" ; pom += " <version>" + dep . getVersion ( ) + "</version>\n" ; pom += "</dependency>\n" ; } pom += "</dependencies>\n" ; } pom += "</project>" ; return pom ; |
public class TupleMRConfigBuilder { /** * Adds a Map - output schema . Tuples emitted by TupleMapper will use one of the
* schemas added by this method . Schemas added in consecutive calls to this
* method must be named differently . */
public void addIntermediateSchema ( Schema schema ) throws TupleMRException { } } | if ( schemaAlreadyExists ( schema . getName ( ) ) ) { throw new TupleMRException ( "There's a schema with that name '" + schema . getName ( ) + "'" ) ; } schemas . add ( schema ) ; |
public class BaseClassFinderService { /** * Convert this encoded string back to a Java Object .
* @ param versionRange version
* @ param string The string to convert .
* @ return The java object . */
public Object convertStringToObject ( Object resource , String className , String versionRange , String string ) { } } | if ( ( string == null ) || ( string . length ( ) == 0 ) ) return null ; Object object = null ; try { if ( resource == null ) { Object classAccess = this . getClassBundleService ( null , className , versionRange , null , 0 ) ; if ( classAccess != null ) object = this . convertStringToObject ( string ) ; } else { /* Bundle bundle = */
this . findBundle ( resource , bundleContext , ClassFinderActivator . getPackageName ( className , false ) , versionRange ) ; object = this . convertStringToObject ( string ) ; } } catch ( ClassNotFoundException e ) { e . printStackTrace ( ) ; } return object ; |
public class ObjectInputStream { /** * Reads an object from the input stream that was previously written with { @ link
* ObjectOutputStream # writeBareObject ( Object ) } .
* @ param object the object to be populated from data on the stream . It cannot be
* < code > null < / code > . */
public void readBareObject ( Object object ) throws IOException , ClassNotFoundException { } } | readBareObject ( object , Streamer . getStreamer ( object . getClass ( ) ) , true ) ; |
public class AlexaRequestStreamHandler { /** * Provides the speechlet used to handle the request .
* @ return speechlet used to handle the request . */
public Class < ? extends AlexaSpeechlet > getSpeechlet ( ) { } } | final AlexaApplication app = this . getClass ( ) . getAnnotation ( AlexaApplication . class ) ; return app != null ? app . speechlet ( ) : AlexaSpeechlet . class ; |
public class ScreenSizeExtensions { /** * Gets the screen ID from the given component
* @ param component
* the component
* @ return the screen ID */
public static int getScreenID ( Component component ) { } } | int screenID ; final AtomicInteger counter = new AtomicInteger ( - 1 ) ; Stream . of ( getScreenDevices ( ) ) . forEach ( graphicsDevice -> { GraphicsConfiguration gc = graphicsDevice . getDefaultConfiguration ( ) ; Rectangle rectangle = gc . getBounds ( ) ; if ( rectangle . contains ( component . getLocation ( ) ) ) { try { Object object = ReflectionExtensions . getFieldValue ( graphicsDevice , "screen" ) ; Integer sid = ( Integer ) object ; counter . set ( sid ) ; } catch ( NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e ) { e . printStackTrace ( ) ; } } } ) ; screenID = counter . get ( ) ; return screenID ; |
public class Mapping { /** * Map a bean to a column mutation . i . e . set the columns in the mutation to
* the corresponding values from the instance
* @ param instance
* instance
* @ param mutation
* mutation */
public void fillMutation ( T instance , ColumnListMutation < String > mutation ) { } } | for ( String fieldName : getNames ( ) ) { Coercions . setColumnMutationFromField ( instance , fields . get ( fieldName ) , fieldName , mutation ) ; } |
public class EventSubscriber { /** * This method validates the given ( received ) NOTIFY request , updates the subscription information
* based on the NOTIFY contents , and creates and returns the correctly formed response that should
* be sent back in reply to the NOTIFY , based on the NOTIFY content that was received . Call this
* method after getting a NOTIFY request from method waitNotify ( ) .
* If a null value is returned by this method , call getReturnCode ( ) and / or getErrorMessage ( ) to
* see why .
* If a non - null response object is returned by this method , it doesn ' t mean that NOTIFY
* validation passed . If there was invalid content in the NOTIFY , the response object returned by
* this method will have the appropriate error code ( 489 Bad Event , etc . ) that should be sent in
* reply to the NOTIFY . You can call getReturnCode ( ) to find out the status code contained in the
* returned response ( or you can examine the response in detail using JAIN - SIP API ) . A return code
* of 200 OK means that the received NOTIFY had correct content and the event information stored
* in this Subscription object has been updated with the NOTIFY message contents . In this case you
* can call methods isSubscriptionActive / Pending / Terminated ( ) , getTerminationReason ( ) and / or
* getTimeLeft ( ) for updated subscription information , and for event - specific information that may
* have been updated by the received NOTIFY , call the appropriate Subscription subclass methods .
* The next step after this is to invoke replyToNotify ( ) to send the response to the network . You
* may modify / corrupt the response returned by this method ( using the JAIN - SIP API ) before passing
* it to replyToNotify ( ) .
* Validation performed by this method includes : event header existence , correct event type ( done
* by the event - specific subclass ) , NOTIFY event ID matches that in the sent request ( SUBSCRIBE ,
* REFER ) , subscription state header existence , received expiry not greater than that sent in the
* request if it was included there , catch illegal reception of NOTIFY request without having sent
* a request , supported content type / subtype in NOTIFY ( done by the event - specific subclass ) , and
* other event - specific validation ( such as , for presence : matching ( correct ) presentity in NOTIFY
* body , correctly formed xml body document , valid document content ) .
* @ param requestEvent the NOTIFY request event obtained from waitNotify ( )
* @ return a correct javax . sip . message . Response that should be sent back in reply , or null if an
* error was encountered . */
public Response processNotify ( RequestEvent requestEvent ) { } } | initErrorInfo ( ) ; String cseqStr = "CSEQ x" ; try { if ( ( requestEvent == null ) || ( getLastSentRequest ( ) == null ) ) { setReturnCode ( SipSession . INVALID_OPERATION ) ; setErrorMessage ( "Request event is null and/or last sent request is null" ) ; return null ; } Request request = requestEvent . getRequest ( ) ; cseqStr = "CSEQ " + ( ( CSeqHeader ) request . getHeader ( CSeqHeader . NAME ) ) . getSeqNumber ( ) ; LOG . trace ( "Processing NOTIFY {} request for subscription to {}" , cseqStr , targetUri ) ; // validate received event header against the one sent
validateEventHeader ( ( EventHeader ) request . getHeader ( EventHeader . NAME ) , ( EventHeader ) getLastSentRequest ( ) . getHeader ( EventHeader . NAME ) ) ; // get subscription state info from message
SubscriptionStateHeader subsHdr = ( SubscriptionStateHeader ) request . getHeader ( SubscriptionStateHeader . NAME ) ; if ( subsHdr == null ) { throw new SubscriptionError ( SipResponse . BAD_REQUEST , "no subscription state header received" ) ; } validateSubscriptionStateHeader ( subsHdr ) ; int expires = subsHdr . getExpires ( ) ; if ( ! subsHdr . getState ( ) . equalsIgnoreCase ( SubscriptionStateHeader . TERMINATED ) ) { // SIP list TODO - it ' s optional for presence - how to know if
// didn ' t get it ?
if ( getLastSentRequest ( ) . getExpires ( ) != null ) { validateExpiresDuration ( expires , true ) ; } } updateEventInfo ( request ) ; // all is well , update our subscription state information
if ( subscriptionState . equalsIgnoreCase ( SubscriptionStateHeader . TERMINATED ) == false ) { subscriptionState = subsHdr . getState ( ) ; } if ( subscriptionState . equalsIgnoreCase ( SubscriptionStateHeader . TERMINATED ) ) { terminationReason = subsHdr . getReasonCode ( ) ; // this is the last NOTIFY for this subscription , whether we
// terminated
// it from our end , or the other end just terminated it - don ' t
// accept
// any more by clearing out lastSentRequest , if one is received
// after
// this , SipPhone will respond with 481
setLastSentRequest ( null ) ; Response response = createNotifyResponse ( requestEvent , SipResponse . OK , "OK" ) ; if ( response != null ) { setReturnCode ( SipResponse . OK ) ; } return response ; } // subscription is active or pending - update time left
LOG . trace ( "{}: received expiry = {}, updating current expiry which was {}" , targetUri , expires , getTimeLeft ( ) ) ; setTimeLeft ( expires ) ; Response response = createNotifyResponse ( requestEvent , SipResponse . OK , "OK" ) ; if ( response != null ) { setReturnCode ( SipResponse . OK ) ; } return response ; } catch ( SubscriptionError e ) { String err = "*** NOTIFY REQUEST ERROR *** (" + cseqStr + ", " + targetUri + ") - " + e . getReason ( ) ; LOG . error ( err ) ; Response response = createNotifyResponse ( requestEvent , e . getStatusCode ( ) , e . getReason ( ) ) ; if ( response != null ) { setReturnCode ( e . getStatusCode ( ) ) ; setErrorMessage ( e . getReason ( ) ) ; } return response ; } |
public class OpChain { /** * { @ inheritDoc }
* This is an intermediate result . Its result is not directly returned .
* Assign the value to a variable if you need access to it later . */
@ Override public void resolve ( final ValueStack values ) throws Exception { } } | if ( values . size ( ) < 2 ) throw new ParseException ( "missing operand" , 0 ) ; try { final Object rightSideResult = values . popWhatever ( ) ; values . popWhatever ( ) ; values . push ( rightSideResult ) ; } catch ( final ParseException e ) { e . fillInStackTrace ( ) ; throw new Exception ( toString ( ) + "; " + e . getMessage ( ) , e ) ; } |
public class ComputerVisionImpl { /** * This operation generates a list of words , or tags , that are relevant to the content of the supplied image . The Computer Vision API can return tags based on objects , living beings , scenery or actions found in images . Unlike categories , tags are not organized according to a hierarchical classification system , but correspond to image content . Tags may contain hints to avoid ambiguity or provide context , for example the tag ' cello ' may be accompanied by the hint ' musical instrument ' . All tags are in English .
* @ param url Publicly reachable URL of an image
* @ param tagImageOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the TagResult object */
public Observable < ServiceResponse < TagResult > > tagImageWithServiceResponseAsync ( String url , TagImageOptionalParameter tagImageOptionalParameter ) { } } | if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( url == null ) { throw new IllegalArgumentException ( "Parameter url is required and cannot be null." ) ; } final String language = tagImageOptionalParameter != null ? tagImageOptionalParameter . language ( ) : null ; return tagImageWithServiceResponseAsync ( url , language ) ; |
public class Page { /** * Finds a Page by its name ( not the full qualified name ) .
* Create a instance or use instance if already exist ( com . google . inject . @ Singleton ) .
* @ param className
* The name of the class to find . Full qualified name is not required .
* Ex : ' MyPage ' or ' mypackageinpages . MyPage '
* @ return
* A Page instance
* @ throws TechnicalException
* if ClassNotFoundException in getInstance ( ) of Page . */
public static Page getInstance ( String className ) throws TechnicalException { } } | try { return ( Page ) NoraUiInjector . getNoraUiInjectorSource ( ) . getInstance ( Class . forName ( pagesPackage + className ) ) ; } catch ( final ClassNotFoundException e ) { throw new TechnicalException ( Messages . format ( Messages . getMessage ( PAGE_UNABLE_TO_RETRIEVE ) , className ) , e ) ; } |
public class ManagementLocksInner { /** * Gets a management lock at the resource group level .
* @ param resourceGroupName The name of the locked resource group .
* @ param lockName The name of the lock to get .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ManagementLockObjectInner object if successful . */
public ManagementLockObjectInner getByResourceGroup ( String resourceGroupName , String lockName ) { } } | return getByResourceGroupWithServiceResponseAsync ( resourceGroupName , lockName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ArgumentConvertor { /** * If argument is annotated with JsonUnmarshaller annotation , get the JsonUnmarshaller class
* @ param annotations
* @ param paramType
* @ return */
Class < ? extends IJsonMarshaller > getMarshallerAnnotation ( Annotation [ ] annotations ) { } } | JsonUnmarshaller ju = getJsonUnmarshallerAnnotation ( annotations ) ; return ( ju != null ) ? ju . value ( ) : null ; |
public class ModCheckBase { /** * valid check .
* @ param value value to check .
* @ param context constraint validator context
* @ return true if valid */
public boolean isValid ( final CharSequence value , final ConstraintValidatorContext context ) { } } | if ( value == null ) { return true ; } final String valueAsString = value . toString ( ) ; String digitsAsString ; char checkDigit ; try { digitsAsString = this . extractVerificationString ( valueAsString ) ; checkDigit = this . extractCheckDigit ( valueAsString ) ; } catch ( final IndexOutOfBoundsException e ) { return false ; } digitsAsString = this . stripNonDigitsIfRequired ( digitsAsString ) ; List < Integer > digits ; try { digits = this . extractDigits ( digitsAsString ) ; } catch ( final NumberFormatException e ) { return false ; } return this . isCheckDigitValid ( digits , checkDigit ) ; |
public class LogBase { /** * Log a message , with an array of object arguments .
* If the logger is currently enabled for the given message
* level then the given message is forwarded to all the
* registered LogTarget objects .
* @ param level the level to log with
* @ param message the message to log
* @ param arguments the array of arguments for the message */
public void log ( LogLevel level , String message , Object ... arguments ) { } } | this . log ( level , null , message , arguments ) ; |
public class SetLabelsForNumbersBot { /** * Main method to run the bot .
* @ param args
* @ throws LoginFailedException
* @ throws IOException
* @ throws MediaWikiApiErrorException */
public static void main ( String [ ] args ) throws LoginFailedException , IOException , MediaWikiApiErrorException { } } | ExampleHelpers . configureLogging ( ) ; printDocumentation ( ) ; SetLabelsForNumbersBot bot = new SetLabelsForNumbersBot ( ) ; ExampleHelpers . processEntitiesFromWikidataDump ( bot ) ; bot . finish ( ) ; System . out . println ( "*** Done." ) ; |
public class Scte35TimeSignalScheduleActionSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Scte35TimeSignalScheduleActionSettings scte35TimeSignalScheduleActionSettings , ProtocolMarshaller protocolMarshaller ) { } } | if ( scte35TimeSignalScheduleActionSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( scte35TimeSignalScheduleActionSettings . getScte35Descriptors ( ) , SCTE35DESCRIPTORS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getIfcRoofTypeEnum ( ) { } } | if ( ifcRoofTypeEnumEEnum == null ) { ifcRoofTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 889 ) ; } return ifcRoofTypeEnumEEnum ; |
public class NumberParser { /** * Scan the string for an SVG number .
* Assumes maxPos will not be greater than str . length ( ) . */
float parseNumber ( String input , int startpos , int len ) { } } | boolean isNegative = false ; long significand = 0 ; int numDigits = 0 ; int numLeadingZeroes = 0 ; int numTrailingZeroes = 0 ; boolean decimalSeen = false ; int sigStart ; int decimalPos = 0 ; int exponent ; long TOO_BIG = Long . MAX_VALUE / 10 ; pos = startpos ; if ( pos >= len ) return Float . NaN ; // String is empty - no number found
char ch = input . charAt ( pos ) ; switch ( ch ) { case '-' : isNegative = true ; // fall through
case '+' : pos ++ ; } sigStart = pos ; while ( pos < len ) { ch = input . charAt ( pos ) ; if ( ch == '0' ) { if ( numDigits == 0 ) { numLeadingZeroes ++ ; } else { // We potentially skip trailing zeroes . Keep count for now .
numTrailingZeroes ++ ; } } else if ( ch >= '1' && ch <= '9' ) { // Multiply any skipped zeroes into buffer
numDigits += numTrailingZeroes ; while ( numTrailingZeroes > 0 ) { if ( significand > TOO_BIG ) { // Log . e ( " Number is too large " ) ;
return Float . NaN ; } significand *= 10 ; numTrailingZeroes -- ; } if ( significand > TOO_BIG ) { // We will overflow if we continue . . .
// Log . e ( " Number is too large " ) ;
return Float . NaN ; } significand = significand * 10 + ( ( int ) ch - ( int ) '0' ) ; numDigits ++ ; if ( significand < 0 ) return Float . NaN ; // overflowed from + ve to - ve
} else if ( ch == '.' ) { if ( decimalSeen ) { // Stop parsing here . We may be looking at a new number .
break ; } decimalPos = pos - sigStart ; decimalSeen = true ; } else break ; pos ++ ; } if ( decimalSeen && pos == ( decimalPos + 1 ) ) { // No digits following decimal point ( eg . " 1 . " )
// Log . e ( " Missing fraction part of number " ) ;
return Float . NaN ; } // Have we seen anything number - ish at all so far ?
if ( numDigits == 0 ) { if ( numLeadingZeroes == 0 ) { // Log . e ( " Number not found " ) ;
return Float . NaN ; } // Leading zeroes have been seen though , so we
// treat that as a ' 0 ' .
numDigits = 1 ; } if ( decimalSeen ) { exponent = decimalPos - numLeadingZeroes - numDigits ; } else { exponent = numTrailingZeroes ; } // Now look for exponent
if ( pos < len ) { ch = input . charAt ( pos ) ; if ( ch == 'E' || ch == 'e' ) { boolean expIsNegative = false ; int expVal = 0 ; boolean abortExponent = false ; pos ++ ; if ( pos == len ) { // Incomplete exponent .
// Log . e ( " Incomplete exponent of number " ) ;
return Float . NaN ; } switch ( input . charAt ( pos ) ) { case '-' : expIsNegative = true ; // fall through
case '+' : pos ++ ; break ; case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : break ; // acceptable next char
default : // any other character is a failure , ie no exponent .
// Could be something legal like " em " though .
abortExponent = true ; pos -- ; // reset pos to position of ' E ' / ' e '
} if ( ! abortExponent ) { int expStart = pos ; while ( pos < len ) { ch = input . charAt ( pos ) ; if ( ch >= '0' && ch <= '9' ) { if ( expVal > TOO_BIG ) { // We will overflow if we continue . . .
// Log . e ( " Exponent of number is too large " ) ;
return Float . NaN ; } expVal = expVal * 10 + ( ( int ) ch - ( int ) '0' ) ; pos ++ ; } else break ; } // Check that at least some exponent digits were read
if ( pos == expStart ) { // Log . e ( " " Incomplete exponent of number " " ) ;
return Float . NaN ; } if ( expIsNegative ) exponent -= expVal ; else exponent += expVal ; } } } // Quick check to eliminate huge exponents .
// Biggest float is ( 2 - 2 ^ 23 ) . 2 ^ 127 ~ = = 3.4e38
// Biggest negative float is 2 ^ - 149 ~ = = 1.4e - 45
// Some numbers that will overflow will get through the scan
// and be returned as ' valid ' , yet fail when value ( ) is called .
// However they will be very rare and not worth slowing down
// the parse for .
if ( ( exponent + numDigits ) > 39 || ( exponent + numDigits ) < - 44 ) return Float . NaN ; float f = ( float ) significand ; if ( significand != 0 ) { // Do exponents > 0
if ( exponent > 0 ) { f *= positivePowersOf10 [ exponent ] ; } else if ( exponent < 0 ) { // Some valid numbers can have an exponent greater than the max ( ie . < - 38)
// for a float . For example , significand = 123 , exponent = - 40
// If that ' s the case , we need to apply the exponent in two steps .
if ( exponent < - 38 ) { // Long . MAX _ VALUE is 19 digits , so taking 20 off the exponent should be enough .
f *= 1e-20 ; exponent += 20 ; } // Do exponents < 0
f *= negativePowersOf10 [ - exponent ] ; } } return ( isNegative ) ? - f : f ; |
public class WorkflowExecutionCancelRequestedEventAttributesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( WorkflowExecutionCancelRequestedEventAttributes workflowExecutionCancelRequestedEventAttributes , ProtocolMarshaller protocolMarshaller ) { } } | if ( workflowExecutionCancelRequestedEventAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( workflowExecutionCancelRequestedEventAttributes . getExternalWorkflowExecution ( ) , EXTERNALWORKFLOWEXECUTION_BINDING ) ; protocolMarshaller . marshall ( workflowExecutionCancelRequestedEventAttributes . getExternalInitiatedEventId ( ) , EXTERNALINITIATEDEVENTID_BINDING ) ; protocolMarshaller . marshall ( workflowExecutionCancelRequestedEventAttributes . getCause ( ) , CAUSE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class XmlReport { /** * { @ inheritDoc } */
public void generate ( Execution execution ) { } } | createEmptyDocument ( ) ; Element element = dom . createElement ( DOCUMENT ) ; root . appendChild ( element ) ; if ( execution . getSections ( ) != null ) { Element sections = dom . createElement ( SECTIONS ) ; root . appendChild ( sections ) ; StringTokenizer st = new StringTokenizer ( execution . getSections ( ) , "," , false ) ; while ( st . hasMoreTokens ( ) ) { addTextValue ( sections , SECTION , st . nextToken ( ) , true ) ; } } Element stats = dom . createElement ( STATISTICS ) ; element . appendChild ( stats ) ; addTextValue ( element , RESULTS , execution . getResults ( ) , true ) ; addIntValue ( stats , SUCCESS , execution . getSuccess ( ) ) ; addIntValue ( stats , FAILURE , execution . getFailures ( ) ) ; addIntValue ( stats , ERROR , execution . getErrors ( ) ) ; addIntValue ( stats , IGNORED , execution . getIgnored ( ) ) ; |
public class ResultUtils { /** * Build single result value from the column
* @ param result
* result
* @ param column
* column index
* @ param dataType
* GeoPackage data type
* @ return value
* @ since 3.1.0 */
public static Object buildSingleResult ( Result result , int column , GeoPackageDataType dataType ) { } } | Object value = null ; try { if ( result . moveToNext ( ) ) { value = result . getValue ( column , dataType ) ; } } finally { result . close ( ) ; } return value ; |
public class ChannelzService { /** * Returns a subchannel . */
@ Override public void getSubchannel ( GetSubchannelRequest request , StreamObserver < GetSubchannelResponse > responseObserver ) { } } | InternalInstrumented < ChannelStats > s = channelz . getSubchannel ( request . getSubchannelId ( ) ) ; if ( s == null ) { responseObserver . onError ( Status . NOT_FOUND . withDescription ( "Can't find subchannel " + request . getSubchannelId ( ) ) . asRuntimeException ( ) ) ; return ; } GetSubchannelResponse resp ; try { resp = GetSubchannelResponse . newBuilder ( ) . setSubchannel ( ChannelzProtoUtil . toSubchannel ( s ) ) . build ( ) ; } catch ( StatusRuntimeException e ) { responseObserver . onError ( e ) ; return ; } responseObserver . onNext ( resp ) ; responseObserver . onCompleted ( ) ; |
public class BDDFactory { /** * Returns an arbitrary model for a given BDD or { @ code null } if there is none .
* @ param bdd the BDD
* @ return an arbitrary model of the BDD */
public Assignment model ( final BDD bdd ) { } } | final int modelBDD = this . kernel . satOne ( bdd . index ( ) ) ; return createAssignment ( modelBDD ) ; |
public class FileHelper { /** * * Method that returns the file contents
* @ param pFileName
* @ return FileContents */
public static String getFileContents ( String pFileName ) throws IOException { } } | String fileContents = null ; InputStream is = new FileInputStream ( pFileName ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( is ) ) ; StringBuffer xml = new StringBuffer ( ) ; String aLine = null ; while ( ( aLine = reader . readLine ( ) ) != null ) { xml . append ( aLine ) ; xml . append ( "\n" ) ; } reader . close ( ) ; fileContents = xml . toString ( ) ; return fileContents ; |
public class TurfMeasurement { /** * Takes a line and returns a point at a specified distance along the line .
* @ param line that the point should be placed upon
* @ param distance along the linestring geometry which the point should be placed on
* @ param units one of the units found inside { @ link TurfConstants . TurfUnitCriteria }
* @ return a { @ link Point } which is on the linestring provided and at the distance from the origin
* of that line to the end of the distance
* @ since 1.3.0 */
public static Point along ( @ NonNull LineString line , @ FloatRange ( from = 0 ) double distance , @ NonNull @ TurfConstants . TurfUnitCriteria String units ) { } } | List < Point > coords = line . coordinates ( ) ; double travelled = 0 ; for ( int i = 0 ; i < coords . size ( ) ; i ++ ) { if ( distance >= travelled && i == coords . size ( ) - 1 ) { break ; } else if ( travelled >= distance ) { double overshot = distance - travelled ; if ( overshot == 0 ) { return coords . get ( i ) ; } else { double direction = bearing ( coords . get ( i ) , coords . get ( i - 1 ) ) - 180 ; return destination ( coords . get ( i ) , overshot , direction , units ) ; } } else { travelled += distance ( coords . get ( i ) , coords . get ( i + 1 ) , units ) ; } } return coords . get ( coords . size ( ) - 1 ) ; |
public class MtasCRMParser { /** * Process CRM pair .
* @ param mtasTokenIdFactory the mtas token id factory
* @ param position the position
* @ param name the name
* @ param text the text
* @ param currentOffset the current offset
* @ param functionOutputList the function output list
* @ param unknownAncestors the unknown ancestors
* @ param currentList the current list
* @ param updateList the update list
* @ param idPositions the id positions
* @ param idOffsets the id offsets
* @ throws MtasParserException the mtas parser exception
* @ throws MtasConfigException the mtas config exception */
private void processCRMPair ( MtasTokenIdFactory mtasTokenIdFactory , int position , String name , String text , Integer currentOffset , List < MtasCRMParserFunctionOutput > functionOutputList , MtasCRMAncestors unknownAncestors , Map < String , List < MtasParserObject > > currentList , Map < String , Map < Integer , Set < String > > > updateList , Map < String , Set < Integer > > idPositions , Map < String , Integer [ ] > idOffsets ) throws MtasParserException , MtasConfigException { } } | MtasParserType tmpCurrentType ; MtasParserObject currentObject ; if ( ( tmpCurrentType = crmPairTypes . get ( name ) ) != null ) { // get history
HashMap < String , MtasParserObject > currentNamePairHistory ; if ( ! historyPair . containsKey ( name ) ) { currentNamePairHistory = new HashMap < > ( ) ; historyPair . put ( name , currentNamePairHistory ) ; } else { currentNamePairHistory = historyPair . get ( name ) ; } Matcher m = pairPattern . matcher ( text ) ; if ( m . find ( ) ) { String thisKey = m . group ( 1 ) + m . group ( 2 ) ; String otherKey = ( m . group ( 1 ) . equals ( "b" ) ? "e" : "b" ) + m . group ( 2 ) ; if ( currentNamePairHistory . containsKey ( otherKey ) ) { currentObject = currentNamePairHistory . remove ( otherKey ) ; currentObject . setText ( currentObject . getText ( ) + "+" + text ) ; currentObject . addPosition ( position ) ; processFunctions ( name , text , MAPPING_TYPE_CRM_PAIR , functionOutputList ) ; currentObject . setRealOffsetEnd ( currentOffset + 1 ) ; currentObject . setOffsetEnd ( currentOffset + 1 ) ; idPositions . put ( currentObject . getId ( ) , currentObject . getPositions ( ) ) ; idOffsets . put ( currentObject . getId ( ) , currentObject . getOffset ( ) ) ; currentObject . updateMappings ( idPositions , idOffsets ) ; unknownAncestors . unknown = currentObject . getUnknownAncestorNumber ( ) ; computeMappingsFromObject ( mtasTokenIdFactory , currentObject , currentList , updateList ) ; } else { currentObject = new MtasParserObject ( tmpCurrentType ) ; currentObject . setUnknownAncestorNumber ( unknownAncestors . unknown ) ; currentObject . setRealOffsetStart ( currentOffset ) ; currentObject . setOffsetStart ( currentOffset ) ; currentObject . setText ( text ) ; currentObject . addPosition ( position ) ; if ( ! prevalidateObject ( currentObject , currentList ) ) { unknownAncestors . unknown ++ ; } else { currentNamePairHistory . put ( thisKey , currentObject ) ; processFunctions ( name , text , MAPPING_TYPE_CRM_PAIR , functionOutputList ) ; currentObject . setRealOffsetEnd ( currentOffset + 1 ) ; currentObject . setOffsetEnd ( currentOffset + 1 ) ; idPositions . put ( currentObject . getId ( ) , currentObject . getPositions ( ) ) ; idOffsets . put ( currentObject . getId ( ) , currentObject . getOffset ( ) ) ; // offset always null , so update later with word ( should be
// possible )
if ( ( currentObject . getId ( ) != null ) && ( ! currentList . get ( MAPPING_TYPE_WORD ) . isEmpty ( ) ) ) { currentList . get ( MAPPING_TYPE_WORD ) . get ( ( currentList . get ( MAPPING_TYPE_WORD ) . size ( ) - 1 ) ) . addUpdateableIdWithOffset ( currentObject . getId ( ) ) ; } } } } } |
public class GetSizeConstraintSetRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetSizeConstraintSetRequest getSizeConstraintSetRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getSizeConstraintSetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getSizeConstraintSetRequest . getSizeConstraintSetId ( ) , SIZECONSTRAINTSETID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class XmlUtils { /** * Helper method for getting qualified name from stax reader given a set of specified schema namespaces
* @ param xmlReader stax reader
* @ param namespaces specified schema namespaces
* @ return qualified element name */
public static String getElementQualifiedName ( XMLStreamReader xmlReader , Map < String , String > namespaces ) { } } | String namespaceUri = null ; String localName = null ; switch ( xmlReader . getEventType ( ) ) { case XMLStreamConstants . START_ELEMENT : case XMLStreamConstants . END_ELEMENT : namespaceUri = xmlReader . getNamespaceURI ( ) ; localName = xmlReader . getLocalName ( ) ; break ; default : localName = StringUtils . EMPTY ; break ; } return namespaces . get ( namespaceUri ) + ":" + localName ; |
public class PojoSerializerSnapshot { /** * Checks if the new { @ link PojoSerializer } is compatible with a reconfigured instance . */
private static < T > boolean newPojoSerializerIsCompatibleWithReconfiguredSerializer ( PojoSerializer < T > newPojoSerializer , IntermediateCompatibilityResult < T > fieldSerializerCompatibility , IntermediateCompatibilityResult < T > preExistingRegistrationsCompatibility , LinkedOptionalMap < Class < ? > , TypeSerializerSnapshot < ? > > registeredSubclassSerializerSnapshots , LinkedOptionalMap < Class < ? > , TypeSerializerSnapshot < ? > > nonRegisteredSubclassSerializerSnapshots ) { } } | return newPojoHasDifferentSubclassRegistrationOrder ( registeredSubclassSerializerSnapshots , newPojoSerializer ) || previousSerializerHasNonRegisteredSubclasses ( nonRegisteredSubclassSerializerSnapshots ) || fieldSerializerCompatibility . isCompatibleWithReconfiguredSerializer ( ) || preExistingRegistrationsCompatibility . isCompatibleWithReconfiguredSerializer ( ) ; |
public class EnvLoader { /** * Sets a local variable for the current environment .
* @ param name the attribute name
* @ param value the new attribute value
* @ return the old attribute value */
public static Object setAttribute ( String name , Object value ) { } } | ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; return setAttribute ( name , value , loader ) ; |
public class MessageHeader { /** * Prepends a key value pair to the beginning of the
* header . Duplicates are allowed */
public synchronized void prepend ( String k , String v ) { } } | grow ( ) ; for ( int i = nkeys ; i > 0 ; i -- ) { keys [ i ] = keys [ i - 1 ] ; values [ i ] = values [ i - 1 ] ; } keys [ 0 ] = k ; values [ 0 ] = v ; nkeys ++ ; |
public class ProgressionUtil { /** * Initialize the given task progression if not < code > null < / code > .
* < p > The inderterminate state is not changed .
* @ param model is the task progression to initialize .
* @ param min is the minimum value .
* @ param max is the maximum value .
* @ param isAdjusting indicates if the value is still under changes . */
public static void init ( Progression model , int min , int max , boolean isAdjusting ) { } } | if ( model != null ) { model . setProperties ( min , min , max , isAdjusting ) ; } |
public class ReUtil { /** * 取得内容中匹配的所有结果 , 获得匹配的所有结果中正则对应分组1的内容
* @ param regex 正则
* @ param content 被查找的内容
* @ return 结果列表
* @ since 3.1.2 */
public static List < String > findAllGroup1 ( String regex , CharSequence content ) { } } | return findAll ( regex , content , 1 ) ; |
public class ClientSocketFactory { /** * Returns the latency factory */
public double getLatencyFactor ( ) { } } | long now = CurrentTime . currentTime ( ) ; long decayPeriod = 60000 ; long delta = decayPeriod - ( now - _lastSuccessTime ) ; // decay the latency factor over 60s
if ( delta <= 0 ) return 0 ; else return ( _latencyFactor * delta ) / decayPeriod ; |
public class CommonOps_DSCC { /** * Computes the sum of each row in the input matrix and returns the results in a vector : < br >
* < br >
* b < sub > j < / sub > = sum ( i = 1 : n ; a < sub > ji < / sub > )
* @ param input Input matrix
* @ param output Optional storage for output . Reshaped into a column vector . Modified .
* @ return Vector containing the sum of each row */
public static DMatrixRMaj sumRows ( DMatrixSparseCSC input , @ Nullable DMatrixRMaj output ) { } } | if ( output == null ) { output = new DMatrixRMaj ( input . numRows , 1 ) ; } else { output . reshape ( input . numRows , 1 ) ; } Arrays . fill ( output . data , 0 , input . numRows , 0 ) ; for ( int col = 0 ; col < input . numCols ; col ++ ) { int idx0 = input . col_idx [ col ] ; int idx1 = input . col_idx [ col + 1 ] ; for ( int i = idx0 ; i < idx1 ; i ++ ) { output . data [ input . nz_rows [ i ] ] += input . nz_values [ i ] ; } } return output ; |
public class ImgWMF { /** * Reads the WMF into a template .
* @ param template the template to read to
* @ throws IOException on error
* @ throws DocumentException on error */
public void readWMF ( PdfTemplate template ) throws IOException , DocumentException { } } | setTemplateData ( template ) ; template . setWidth ( getWidth ( ) ) ; template . setHeight ( getHeight ( ) ) ; InputStream is = null ; try { if ( rawData == null ) { is = url . openStream ( ) ; } else { is = new java . io . ByteArrayInputStream ( rawData ) ; } MetaDo meta = new MetaDo ( is , template ) ; meta . readAll ( ) ; } finally { if ( is != null ) { is . close ( ) ; } } |
public class CmsStaticResourceHandler { /** * Returns whether this servlet should attempt to serve a precompressed
* version of the given static resource . If this method returns true , the
* suffix { @ code . gz } is appended to the URL and the corresponding resource
* is served if it exists . It is assumed that the compression method used is
* gzip . If this method returns false or a compressed version is not found ,
* the original URL is used . < p >
* The base implementation of this method returns true if and only if the
* request indicates that the client accepts gzip compressed responses and
* the filename extension of the requested resource is . js , . css , or . html . < p >
* @ param request the request for the resource
* @ param url the URL of the requested resource
* @ return true if the servlet should attempt to serve a precompressed version of the resource , false otherwise */
protected boolean allowServePrecompressedResource ( HttpServletRequest request , String url ) { } } | String accept = request . getHeader ( "Accept-Encoding" ) ; return ( accept != null ) && accept . contains ( "gzip" ) && ( url . endsWith ( ".js" ) || url . endsWith ( ".css" ) || url . endsWith ( ".html" ) ) ; |
public class TransformRdfGraph { /** * TODO only transform blank nodes that appear within the given graph */
public static void main ( String [ ] args ) throws IOException , TrustyUriException { } } | if ( args . length < 2 ) { throw new RuntimeException ( "Not enough arguments: <file> <graph-uri1> (<graph-uri2> ...)" ) ; } File inputFile = new File ( args [ 0 ] ) ; List < IRI > baseUris = new ArrayList < IRI > ( ) ; for ( int i = 1 ; i < args . length ; i ++ ) { String arg = args [ i ] ; if ( arg . contains ( "://" ) ) { baseUris . add ( SimpleValueFactory . getInstance ( ) . createIRI ( arg ) ) ; } else { BufferedReader reader = new BufferedReader ( new FileReader ( arg ) ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { baseUris . add ( SimpleValueFactory . getInstance ( ) . createIRI ( line ) ) ; } reader . close ( ) ; } } RdfFileContent content = RdfUtils . load ( new TrustyUriResource ( inputFile ) ) ; String outputFilePath = inputFile . getPath ( ) . replaceFirst ( "[.][^.]+$" , "" ) + ".t" ; RDFFormat format = content . getOriginalFormat ( ) ; if ( ! format . getFileExtensions ( ) . isEmpty ( ) ) { outputFilePath += "." + format . getFileExtensions ( ) . get ( 0 ) ; } transform ( content , new File ( outputFilePath ) , baseUris . toArray ( new IRI [ baseUris . size ( ) ] ) ) ; |
public class JwtEndpointServices { /** * Extracts the { @ value WebConstants # JWT _ REQUEST _ ATTR } attribute from the
* provided request . That particular attribute is supposed to be created and
* set by the filter directing the request .
* @ param request
* @ param response
* @ return
* @ throws IOException */
private JwtRequest getJwtRequest ( HttpServletRequest request , HttpServletResponse response ) throws IOException { } } | JwtRequest jwtRequest = ( JwtRequest ) request . getAttribute ( WebConstants . JWT_REQUEST_ATTR ) ; if ( jwtRequest == null ) { String errorMsg = Tr . formatMessage ( tc , "JWT_REQUEST_ATTRIBUTE_MISSING" , new Object [ ] { request . getRequestURI ( ) , WebConstants . JWT_REQUEST_ATTR } ) ; Tr . error ( tc , errorMsg ) ; response . sendError ( HttpServletResponse . SC_NOT_FOUND , errorMsg ) ; } return jwtRequest ; |
public class AbstractParser { /** * Check to make sure the JSONObject has the specified key and if so return
* the value as a JSONObject . If no key is found null is returned .
* @ param key name of the field to fetch from the json object
* @ param jsonObject object from which to fetch the value
* @ return json object value corresponding to the key or null if key not found */
protected JSONObject getJSONObject ( final String key , final JSONObject jsonObject ) { } } | JSONObject json = null ; try { if ( hasKey ( key , jsonObject ) ) { json = jsonObject . getJSONObject ( key ) ; } } catch ( JSONException e ) { LOGGER . error ( "Could not get JSONObject from JSONObject for key: " + key , e ) ; } return json ; |
public class GCRLINERGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . GCRLINERG__XOSSF : return getXOSSF ( ) ; case AfplibPackage . GCRLINERG__YOFFS : return getYOFFS ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class UpdateGameSessionQueueRequest { /** * Collection of latency policies to apply when processing game sessions placement requests with player latency
* information . Multiple policies are evaluated in order of the maximum latency value , starting with the lowest
* latency values . With just one policy , it is enforced at the start of the game session placement for the duration
* period . With multiple policies , each policy is enforced consecutively for its duration period . For example , a
* queue might enforce a 60 - second policy followed by a 120 - second policy , and then no policy for the remainder of
* the placement . When updating policies , provide a complete collection of policies .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setPlayerLatencyPolicies ( java . util . Collection ) } or
* { @ link # withPlayerLatencyPolicies ( java . util . Collection ) } if you want to override the existing values .
* @ param playerLatencyPolicies
* Collection of latency policies to apply when processing game sessions placement requests with player
* latency information . Multiple policies are evaluated in order of the maximum latency value , starting with
* the lowest latency values . With just one policy , it is enforced at the start of the game session placement
* for the duration period . With multiple policies , each policy is enforced consecutively for its duration
* period . For example , a queue might enforce a 60 - second policy followed by a 120 - second policy , and then no
* policy for the remainder of the placement . When updating policies , provide a complete collection of
* policies .
* @ return Returns a reference to this object so that method calls can be chained together . */
public UpdateGameSessionQueueRequest withPlayerLatencyPolicies ( PlayerLatencyPolicy ... playerLatencyPolicies ) { } } | if ( this . playerLatencyPolicies == null ) { setPlayerLatencyPolicies ( new java . util . ArrayList < PlayerLatencyPolicy > ( playerLatencyPolicies . length ) ) ; } for ( PlayerLatencyPolicy ele : playerLatencyPolicies ) { this . playerLatencyPolicies . add ( ele ) ; } return this ; |
public class Utils { /** * 配列を { @ link List } に変換します 。
* プリミティブ型の配列をを考慮して処理します 。
* @ param object 変換対象の配列
* @ param componentType 配列の要素のタイプ
* @ return 配列がnullの場合は 、 空のリストに変換します 。
* @ throws IllegalArgumentException { @ literal arrayが配列でない場合 。 componentTypeがサポートしていないプリミティブ型の場合 。 } */
public static List < Object > asList ( final Object object , final Class < ? > componentType ) { } } | ArgUtils . notNull ( componentType , "componentType" ) ; if ( object == null ) { return new ArrayList < > ( ) ; } if ( ! object . getClass ( ) . isArray ( ) ) { throw new IllegalArgumentException ( String . format ( "args0 is not arrays : %s." , object . getClass ( ) . getName ( ) ) ) ; } if ( ! componentType . isPrimitive ( ) ) { return Arrays . asList ( ( Object [ ] ) object ) ; } if ( componentType . equals ( boolean . class ) ) { boolean [ ] array = ( boolean [ ] ) object ; List < Object > list = new ArrayList < > ( array . length ) ; for ( boolean v : array ) { list . add ( v ) ; } return list ; } else if ( componentType . equals ( char . class ) ) { char [ ] array = ( char [ ] ) object ; List < Object > list = new ArrayList < > ( array . length ) ; for ( char v : array ) { list . add ( v ) ; } return list ; } else if ( componentType . equals ( byte . class ) ) { byte [ ] array = ( byte [ ] ) object ; List < Object > list = new ArrayList < > ( array . length ) ; for ( byte v : array ) { list . add ( v ) ; } return list ; } else if ( componentType . equals ( short . class ) ) { short [ ] array = ( short [ ] ) object ; List < Object > list = new ArrayList < > ( array . length ) ; for ( short v : array ) { list . add ( v ) ; } return list ; } else if ( componentType . equals ( int . class ) ) { int [ ] array = ( int [ ] ) object ; List < Object > list = new ArrayList < > ( array . length ) ; for ( int v : array ) { list . add ( v ) ; } return list ; } else if ( componentType . equals ( long . class ) ) { long [ ] array = ( long [ ] ) object ; List < Object > list = new ArrayList < > ( array . length ) ; for ( long v : array ) { list . add ( v ) ; } return list ; } else if ( componentType . equals ( float . class ) ) { float [ ] array = ( float [ ] ) object ; List < Object > list = new ArrayList < > ( array . length ) ; for ( float v : array ) { list . add ( v ) ; } return list ; } else if ( componentType . equals ( double . class ) ) { double [ ] array = ( double [ ] ) object ; List < Object > list = new ArrayList < > ( array . length ) ; for ( double v : array ) { list . add ( v ) ; } return list ; } throw new IllegalArgumentException ( String . format ( "not support primitive type : %s." , componentType . getName ( ) ) ) ; |
public class WebSocketClientStepInvoker { /** * this is called by web socket thread not Chorus interpreter so log don ' t throw ChorusException , log errors instead */
public void stepFailed ( StepFailedMessage stepFailedMessage ) { } } | ExecutingStep s = executingStep . get ( ) ; if ( ! s . getExecutionUUID ( ) . equals ( stepFailedMessage . getExecutionId ( ) ) ) { // This could happen if chorus interpreter timed out the previous step while waiting for the reply
// Hence log to debug rather than error
log . debug ( "Received a StepFailedMessage for execution id " + stepFailedMessage . getExecutionId ( ) + " which did not match the currently executing step " + s . getExecutionUUID ( ) ) ; } else { StepFailedException stepFailedException = new StepFailedException ( stepFailedMessage . getDescription ( ) , stepFailedMessage . getErrorText ( ) ) ; s . getCompletableFuture ( ) . completeExceptionally ( stepFailedException ) ; } |
public class SchemaUpdater { /** * Returns the SQL which located within a package specified by the packageName as
* " dialectname _ version . sql " or " version . sql " .
* @ param version the version number
* @ return SQL or null if the SQL file does not exist */
protected String getSql ( int version ) { } } | Dialect dialect = ( ( SqlManagerImpl ) sqlManager ) . getDialect ( ) ; ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; InputStream in = classLoader . getResourceAsStream ( String . format ( "%s/%s_%d.sql" , packageName , dialect . getName ( ) . toLowerCase ( ) , version ) ) ; if ( in == null ) { in = classLoader . getResourceAsStream ( String . format ( "%s/%d.sql" , packageName , version ) ) ; if ( in == null ) { return null ; } } byte [ ] buf = IOUtil . readStream ( in ) ; return new String ( buf , StandardCharsets . UTF_8 ) ; |
public class BitsUtil { /** * Clear bit number " off " in v .
* Low - endian layout for the array .
* @ param v Buffer
* @ param off Offset to clear */
public static long [ ] clearI ( long [ ] v , int off ) { } } | final int wordindex = off >>> LONG_LOG2_SIZE ; v [ wordindex ] &= ~ ( 1L << off ) ; return v ; |
public class MagnetManager { /** * Right now it only works with provided FOUR or EIGHT cardinals , anything else will break WiresConnector autoconnection
* @ param wiresShape
* @ param requestedCardinals
* @ return */
public Magnets createMagnets ( final WiresShape wiresShape , final Direction [ ] requestedCardinals ) { } } | final IPrimitive < ? > primTarget = wiresShape . getGroup ( ) ; final Point2DArray points = getWiresIntersectionPoints ( wiresShape , requestedCardinals ) ; final ControlHandleList list = new ControlHandleList ( primTarget ) ; final BoundingBox box = wiresShape . getPath ( ) . getBoundingBox ( ) ; final Point2D primLoc = primTarget . getComputedLocation ( ) ; final Magnets magnets = new Magnets ( this , list , wiresShape ) ; int i = 0 ; for ( final Point2D p : points ) { final double mx = primLoc . getX ( ) + p . getX ( ) ; final double my = primLoc . getY ( ) + p . getY ( ) ; final WiresMagnet m = new WiresMagnet ( magnets , null , i ++ , p . getX ( ) , p . getY ( ) , getControlPrimitive ( mx , my ) , true ) ; final Direction d = getDirection ( p , box ) ; m . setDirection ( d ) ; list . add ( m ) ; } final String uuid = primTarget . uuid ( ) ; m_magnetRegistry . put ( uuid , magnets ) ; wiresShape . setMagnets ( magnets ) ; return magnets ; |
public class ConnectionUtils { /** * Remove the { @ link ConnectionData } associated to the provider ID and user ID .
* @ param providerId the provider ID of the connection
* @ param providerUserId the provider user ID
* @ param profile the profile where to remove the data from */
public static void removeConnectionData ( String providerId , String providerUserId , Profile profile ) { } } | Map < String , List < Map < String , Object > > > allConnections = profile . getAttribute ( CONNECTIONS_ATTRIBUTE_NAME ) ; if ( MapUtils . isNotEmpty ( allConnections ) ) { List < Map < String , Object > > connectionsForProvider = allConnections . get ( providerId ) ; if ( CollectionUtils . isNotEmpty ( connectionsForProvider ) ) { for ( Iterator < Map < String , Object > > iter = connectionsForProvider . iterator ( ) ; iter . hasNext ( ) ; ) { Map < String , Object > connectionDataMap = iter . next ( ) ; if ( providerUserId . equals ( connectionDataMap . get ( "providerUserId" ) ) ) { iter . remove ( ) ; } } } } |
public class WikipediaXMLReader { /** * Reads the namespaces from the siteinfo section and processes them
* in order to initialize the ArticleFilter */
private void initNamespaces ( ) { } } | Map < Integer , String > namespaceMap = new HashMap < Integer , String > ( ) ; try { int b = read ( ) ; this . keywords . reset ( ) ; StringBuilder buffer = null ; while ( b != - 1 ) { // System . out . print ( ( char ) b ) ;
if ( buffer != null ) { buffer . append ( ( char ) b ) ; } if ( this . keywords . check ( ( char ) b ) ) { switch ( this . keywords . getValue ( ) ) { case KEY_START_NAMESPACES : buffer = new StringBuilder ( WikipediaXMLKeys . KEY_START_NAMESPACES . getKeyword ( ) ) ; break ; case KEY_END_NAMESPACES : DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setIgnoringElementContentWhitespace ( true ) ; Document namespaces = factory . newDocumentBuilder ( ) . parse ( new InputSource ( new StringReader ( buffer . toString ( ) ) ) ) ; NodeList nsList = namespaces . getChildNodes ( ) . item ( 0 ) . getChildNodes ( ) ; for ( int i = 0 ; i < nsList . getLength ( ) ; i ++ ) { Node curNamespace = nsList . item ( i ) ; // get the prefix for the current namespace
String prefix = curNamespace . getTextContent ( ) . trim ( ) ; if ( ! prefix . isEmpty ( ) ) { NamedNodeMap nsAttributes = curNamespace . getAttributes ( ) ; String namespace = nsAttributes . getNamedItem ( "key" ) . getTextContent ( ) ; namespaceMap . put ( Integer . parseInt ( namespace ) , prefix ) ; } } buffer = null ; articleFilter . initializeNamespaces ( namespaceMap ) ; return ; // init done
} this . keywords . reset ( ) ; } b = read ( ) ; } } catch ( IOException e ) { System . err . println ( "Error reading namespaces from xml dump." ) ; } catch ( ParserConfigurationException e ) { System . err . println ( "Error parsing namespace data." ) ; } catch ( SAXException e ) { System . err . println ( "Error parsing namespace data." ) ; } |
public class SeleniumHelper { /** * Simulates ' cut ' ( e . g . Ctrl + X on Windows ) on the active element , copying the current selection to the clipboard
* and removing that selection .
* @ return whether an active element was found . */
public boolean cut ( ) { } } | boolean result = false ; WebElement element = getActiveElement ( ) ; if ( element != null ) { if ( connectedToMac ( ) ) { element . sendKeys ( Keys . chord ( Keys . CONTROL , Keys . INSERT ) , Keys . BACK_SPACE ) ; } else { element . sendKeys ( Keys . CONTROL , "x" ) ; } result = true ; } return result ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.