signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Algorithms { /** * Returns all algorithms . * @ return a newly - created < code > Set < / code > of < code > Algorithm < / code > * objects . */ public Set < Algorithm > getAlgorithms ( ) { } }
if ( algorithms == null ) { algorithms = Collections . unmodifiableSet ( new HashSet < > ( this . idsToAlgorithms . values ( ) ) ) ; } return algorithms ;
public class LaunchTemplateConfig { /** * Any parameters that you specify override the same parameters in the launch template . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setOverrides ( java . util . Collection ) } or { @ link # withOverrides ( java . util . Collection ) } if you want to * override the existing values . * @ param overrides * Any parameters that you specify override the same parameters in the launch template . * @ return Returns a reference to this object so that method calls can be chained together . */ public LaunchTemplateConfig withOverrides ( LaunchTemplateOverrides ... overrides ) { } }
if ( this . overrides == null ) { setOverrides ( new com . amazonaws . internal . SdkInternalList < LaunchTemplateOverrides > ( overrides . length ) ) ; } for ( LaunchTemplateOverrides ele : overrides ) { this . overrides . add ( ele ) ; } return this ;
public class UEL { /** * Embed the specified expression , if necessary , using the specified triggering character . * @ param expression * @ param trigger * @ return String */ public static String embed ( final String expression , final char trigger ) { } }
return new StringBuilder ( ) . append ( trigger ) . append ( '{' ) . append ( strip ( expression ) ) . append ( '}' ) . toString ( ) ;
public class IndentTracker { /** * Get the current indentation , computed as < code > indentLevel x indendtString < / code > . * @ return the indentation */ String getIndentation ( ) { } }
StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < count ; i ++ ) { sb . append ( indent ) ; } return sb . toString ( ) ;
public class SmtpJmsTransport { /** * Create javax . jms . Message for javax . mail . Message * JMS message contains : * < ul > * < li > protocolToUse ( String ) - destination / final Transport < / li > * < li > addresses ( array javax . mail . Address ) - who to send to < / li > * < li > message ( object javax . mail . Message ) - message content < / li > * < / ul > */ private javax . jms . Message createJmsMessage ( QueueSession queueSession , Message msg , Address [ ] addresses ) throws JMSException , MessagingException { } }
BytesMessage jms = queueSession . createBytesMessage ( ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; try { ObjectOutputStream oos = new ObjectOutputStream ( baos ) ; oos . writeUTF ( protocolToUse ) ; oos . writeObject ( addresses == null ? new Address [ 0 ] : addresses ) ; msg . writeTo ( oos ) ; } catch ( IOException e ) { String [ ] messageId = msg . getHeader ( "Message-ID" ) ; throw new MessagingException ( "Could not send JMS message with mail content for Message-ID:" + ( messageId != null && messageId . length > 0 ? messageId [ 0 ] : "NOT_SET" ) , e ) ; } jms . writeBytes ( baos . toByteArray ( ) ) ; Integer priority = jmsPriority ( msg ) ; if ( priority != null && priority >= 0 ) { jms . setJMSPriority ( priority ) ; } return jms ;
public class ZWaveMultiInstanceCommandClass { /** * Gets a SerialMessage with the MULTI INSTANCE ENCAP command . * Encapsulates a message for a specific instance . * @ param serialMessage the serial message to encapsulate * @ param endpoint the endpoint to encapsulate the message for . * @ return the encapsulated serial message . */ public SerialMessage getMultiChannelEncapMessage ( SerialMessage serialMessage , ZWaveEndpoint endpoint ) { } }
logger . debug ( "Creating new message for application command MULTI_CHANNEL_ENCAP for node {} and endpoint {}" , this . getNode ( ) . getNodeId ( ) , endpoint . getEndpointId ( ) ) ; byte [ ] payload = serialMessage . getMessagePayload ( ) ; byte [ ] newPayload = new byte [ payload . length + 4 ] ; System . arraycopy ( payload , 0 , newPayload , 0 , 2 ) ; System . arraycopy ( payload , 0 , newPayload , 4 , payload . length ) ; newPayload [ 1 ] += 4 ; newPayload [ 2 ] = ( byte ) this . getCommandClass ( ) . getKey ( ) ; newPayload [ 3 ] = MULTI_CHANNEL_ENCAP ; newPayload [ 4 ] = 0x01 ; newPayload [ 5 ] = ( byte ) endpoint . getEndpointId ( ) ; serialMessage . setMessagePayload ( newPayload ) ; return serialMessage ;
public class GDLLoader { /** * Builds an property selector expression like alice . age * @ param ctx the property lookup context that will be parsed * @ return parsed property selector expression */ private PropertySelector buildPropertySelector ( GDLParser . PropertyLookupContext ctx ) { } }
GraphElement element ; String identifier = ctx . Identifier ( 0 ) . getText ( ) ; String property = ctx . Identifier ( 1 ) . getText ( ) ; if ( userVertexCache . containsKey ( identifier ) ) { element = userVertexCache . get ( identifier ) ; } else if ( userEdgeCache . containsKey ( identifier ) ) { element = userEdgeCache . get ( identifier ) ; } else { throw new InvalidReferenceException ( identifier ) ; } return new PropertySelector ( element . getVariable ( ) , property ) ;
public class SyncMembersInner { /** * Creates or updates a sync member . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The name of the server . * @ param databaseName The name of the database on which the sync group is hosted . * @ param syncGroupName The name of the sync group on which the sync member is hosted . * @ param syncMemberName The name of the sync member . * @ param parameters The requested sync member resource state . * @ 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 SyncMemberInner object if successful . */ public SyncMemberInner createOrUpdate ( String resourceGroupName , String serverName , String databaseName , String syncGroupName , String syncMemberName , SyncMemberInner parameters ) { } }
return createOrUpdateWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , syncGroupName , syncMemberName , parameters ) . toBlocking ( ) . last ( ) . body ( ) ;
public class TLSCertificateBuilder { /** * Creates a TLS server certificate key pair with the given DNS subject alternative name * @ param subjectAlternativeName the DNS SAN to be encoded in the certificate * @ return a TLSCertificateKeyPair */ public TLSCertificateKeyPair serverCert ( String subjectAlternativeName ) { } }
try { return createCert ( CertType . SERVER , subjectAlternativeName ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class Environment { /** * Get the lock manager ( or create one if it doesn ' t exist ) . * @ return The lock manager . */ public LockManager getLockManager ( ) { } }
if ( m_lockManager == null ) { m_lockManager = ( LockManager ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( LockManager . CLIENT_LOCK_MANAGER_CLASS ) ; m_lockManager . init ( this ) ; } return m_lockManager ;
public class CYaHPConverter { /** * Convert the document pointed by url in a PDF file . This method * is thread safe . * @ param url Url to the document * @ param size PDF Page size * @ param hf header - footer list * @ param out outputstream to render into * @ param fproperties properties map * @ throws CConvertException if an unexpected error occurs . */ public final void convertToPdf ( final URL url , final IHtmlToPdfTransformer . PageSize size , final List hf , final OutputStream out , final Map fproperties ) throws CConvertException { } }
Map properties = ( fproperties != null ) ? fproperties : new HashMap ( ) ; ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; int priority = Thread . currentThread ( ) . getPriority ( ) ; try { Thread . currentThread ( ) . setContextClassLoader ( new URLClassLoader ( new URL [ 0 ] , this . useClassLoader ? CClassLoader . getLoader ( "/main" ) : this . getClass ( ) . getClassLoader ( ) ) ) ; Thread . currentThread ( ) . setPriority ( Thread . MIN_PRIORITY ) ; String uri = url . toExternalForm ( ) ; if ( uri . indexOf ( "://" ) != - 1 ) { String tmp = uri . substring ( uri . indexOf ( "://" ) + 3 ) ; if ( tmp . indexOf ( '/' ) == - 1 ) { uri += "/" ; } } uri = uri . substring ( 0 , uri . lastIndexOf ( "/" ) + 1 ) ; if ( uri . startsWith ( "file:/" ) ) { uri = uri . substring ( 6 ) ; while ( uri . startsWith ( "/" ) ) { uri = uri . substring ( 1 ) ; } // end while uri = "file:///" + uri ; } // end if try { IHtmlToPdfTransformer transformer = getTransformer ( properties ) ; transformer . transform ( url . openStream ( ) , uri , size , hf , properties , out ) ; } // end try catch ( final CConvertException e ) { throw e ; } catch ( final Exception e ) { throw new CConvertException ( e . getMessage ( ) , e ) ; } // end catch } // end try finally { Thread . currentThread ( ) . setContextClassLoader ( loader ) ; Thread . currentThread ( ) . setPriority ( priority ) ; } // end finally
public class DateUtil { /** * 判断两个日期相差的时长 , 只保留绝对值 * @ param beginDate 起始日期 * @ param endDate 结束日期 * @ param unit 相差的单位 : 相差 天 { @ link DateUnit # DAY } 、 小时 { @ link DateUnit # HOUR } 等 * @ return 日期差 */ public static long between ( Date beginDate , Date endDate , DateUnit unit ) { } }
return between ( beginDate , endDate , unit , true ) ;
public class GroupService { /** * Archive groups of servers * @ param groups groups references list * @ return OperationFuture wrapper for Server list */ public OperationFuture < List < Server > > archive ( Group ... groups ) { } }
return serverService ( ) . archive ( getServerSearchCriteria ( groups ) ) ;
public class XPathParser { /** * Parses the the rule VarRef according to the following production rule : * [ 44 ] VarRef : : = " $ " VarName . */ private void parseVarRef ( ) { } }
consume ( TokenType . DOLLAR , true ) ; final String varName = parseVarName ( ) ; mPipeBuilder . addVarRefExpr ( getTransaction ( ) , varName ) ;
public class ClientStats { /** * < p > Return an average throughput of bytes sent per second over the * network for the duration covered by this stats instance . < / p > * < p > Essentially < code > { @ link # getBytesWritten ( ) } divided by * ( { @ link # getStartTimestamp ( ) } - { @ link # getEndTimestamp ( ) } / 1000.0 ) < / code > , * but with additional safety checks . < / p > * @ return Throughput in bytes sent per second . */ public long getIOWriteThroughput ( ) { } }
assert ( m_startTS != Long . MAX_VALUE ) ; assert ( m_endTS != Long . MIN_VALUE ) ; if ( m_bytesSent == 0 ) return 0 ; if ( m_endTS < m_startTS ) { m_endTS = m_startTS + 1 ; // 1 ms duration is sorta cheatin ' } long durationMs = m_endTS - m_startTS ; return ( long ) ( m_bytesSent / ( durationMs / 1000.0 ) ) ;
public class NumberFormat { /** * Returns a specific style number format for a specific locale . * @ param desiredLocale the specific locale . * @ param choice number format style * @ throws IllegalArgumentException if choice is not one of * NUMBERSTYLE , CURRENCYSTYLE , * PERCENTSTYLE , SCIENTIFICSTYLE , * INTEGERSTYLE , ISOCURRENCYSTYLE , * PLURALCURRENCYSTYLE , ACCOUNTINGCURRENCYSTYLE . * CASHCURRENCYSTYLE , STANDARDCURRENCYSTYLE . */ public static NumberFormat getInstance ( ULocale desiredLocale , int choice ) { } }
if ( choice < NUMBERSTYLE || choice > STANDARDCURRENCYSTYLE ) { throw new IllegalArgumentException ( "choice should be from NUMBERSTYLE to STANDARDCURRENCYSTYLE" ) ; } // if ( shim = = null ) { // return createInstance ( desiredLocale , choice ) ; // } else { // / / TODO : shims must call setLocale ( ) on object they create // return getShim ( ) . createInstance ( desiredLocale , choice ) ; return getShim ( ) . createInstance ( desiredLocale , choice ) ;
public class IfixParser { /** * Extract the files from the zip * @ param zip * @ throws RepositoryArchiveIOException * @ throws RepositoryArchiveException * @ throws RepositoryArchiveEntryNotFoundException */ private void extractFiles ( ArtifactMetadata artifactMetadata ) throws RepositoryArchiveIOException , RepositoryArchiveEntryNotFoundException , RepositoryArchiveException { } }
_readmePayload = artifactMetadata . getFileWithExtension ( ".txt" ) ; if ( _readmePayload == null ) { throw new RepositoryArchiveEntryNotFoundException ( "Unable to find iFix readme .txt file in archive" + artifactMetadata . getArchive ( ) . getAbsolutePath ( ) , artifactMetadata . getArchive ( ) , "*.txt" ) ; }
public class PassiveScan { /** * Get an existing match rule of the scan . * If no match rule exists at the specified index , this method returns null . * @ param index Index of the match rule to return * @ return The match rule at the specified index , or null if none exists */ public MatchRule getMatchRule ( int index ) { } }
if ( index < rules . size ( ) ) { return rules . get ( index ) ; } return null ;
public class JMPath { /** * Gets sub directory path list . * @ param startDirectoryPath the start directory path * @ param maxDepth the max depth * @ return the sub directory path list */ public static List < Path > getSubDirectoryPathList ( Path startDirectoryPath , int maxDepth ) { } }
return getSubPathList ( startDirectoryPath , maxDepth , DirectoryAndNotSymbolicLinkFilter ) ;
public class Entry { /** * Sets the value of { @ link # userObjectProperty ( ) } . * @ param object the new user object */ public final void setUserObject ( T object ) { } }
if ( userObject == null && object == null ) { // no unnecessary property creation if everything is null return ; } userObjectProperty ( ) . set ( object ) ;
public class SchemaModifier { /** * Drops a single table in the schema . */ public void dropTable ( Type < ? > type ) { } }
try ( Connection connection = getConnection ( ) ; Statement statement = connection . createStatement ( ) ) { executeDropStatements ( statement , Collections . < Type < ? > > singletonList ( type ) ) ; } catch ( SQLException e ) { throw new TableModificationException ( e ) ; }
public class AATreeFileAllocator { /** * Find a region of the given size . */ private Region find ( long size ) { } }
validate ( ! VALIDATING || Long . bitCount ( size ) == 1 ) ; Node < Region > currentNode = getRoot ( ) ; Region currentRegion = currentNode . getPayload ( ) ; if ( currentRegion == null || ( currentRegion . available ( ) & size ) == 0 ) { // no region big enough for us . . . return null ; } else { while ( true ) { Region left = currentNode . getLeft ( ) . getPayload ( ) ; if ( left != null && ( left . available ( ) & size ) != 0 ) { currentNode = currentNode . getLeft ( ) ; currentRegion = currentNode . getPayload ( ) ; } else if ( ( currentRegion . availableHere ( ) & size ) != 0 ) { long mask = size - 1 ; long a = ( currentRegion . start ( ) + mask ) & ~ mask ; return new Region ( a , a + size - 1 ) ; } else { Region right = currentNode . getRight ( ) . getPayload ( ) ; if ( right != null && ( right . available ( ) & size ) != 0 ) { currentNode = currentNode . getRight ( ) ; currentRegion = currentNode . getPayload ( ) ; } else { throw new AssertionError ( ) ; } } } }
public class Options { /** * Set the specified option to the value specified in argValue . * @ param oi the option to set * @ param argName the name of the argument as passed on the command line ; used only for debugging * @ param argValue a string representation of the value * @ throws ArgException if there are any errors */ private void setArg ( OptionInfo oi , String argName , @ Nullable String argValue ) throws ArgException { } }
Field f = oi . field ; Class < ? > type = oi . baseType ; // Keep track of all of the options specified if ( optionsString . length ( ) > 0 ) { optionsString += " " ; } optionsString += argName ; if ( argValue != null ) { if ( ! argValue . contains ( " " ) ) { optionsString += "=" + argValue ; } else if ( ! argValue . contains ( "'" ) ) { optionsString += "='" + argValue + "'" ; } else if ( ! argValue . contains ( "\"" ) ) { optionsString += "=\"" + argValue + "\"" ; } else { throw new ArgException ( "Can't quote for internal debugging: " + argValue ) ; } } // Argument values are required for everything but booleans if ( argValue == null ) { if ( ( type != Boolean . TYPE ) || ( type != Boolean . class ) ) { argValue = "true" ; } else { throw new ArgException ( "Value required for option " + argName ) ; } } try { if ( type . isPrimitive ( ) ) { if ( type == Boolean . TYPE ) { boolean val ; String argValueLowercase = argValue . toLowerCase ( ) ; if ( argValueLowercase . equals ( "true" ) || ( argValueLowercase . equals ( "t" ) ) ) { val = true ; } else if ( argValueLowercase . equals ( "false" ) || argValueLowercase . equals ( "f" ) ) { val = false ; } else { throw new ArgException ( "Value \"%s\" for argument %s is not a boolean" , argValue , argName ) ; } argValue = ( val ) ? "true" : "false" ; // System . out . printf ( " Setting % s to % s % n " , argName , val ) ; f . setBoolean ( oi . obj , val ) ; } else if ( type == Byte . TYPE ) { byte val ; try { val = Byte . decode ( argValue ) ; } catch ( Exception e ) { throw new ArgException ( "Value \"%s\" for argument %s is not a byte" , argValue , argName ) ; } f . setByte ( oi . obj , val ) ; } else if ( type == Character . TYPE ) { if ( argValue . length ( ) != 1 ) { throw new ArgException ( "Value \"%s\" for argument %s is not a single character" , argValue , argName ) ; } char val = argValue . charAt ( 0 ) ; f . setChar ( oi . obj , val ) ; } else if ( type == Short . TYPE ) { short val ; try { val = Short . decode ( argValue ) ; } catch ( Exception e ) { throw new ArgException ( "Value \"%s\" for argument %s is not a short integer" , argValue , argName ) ; } f . setShort ( oi . obj , val ) ; } else if ( type == Integer . TYPE ) { int val ; try { val = Integer . decode ( argValue ) ; } catch ( Exception e ) { throw new ArgException ( "Value \"%s\" for argument %s is not an integer" , argValue , argName ) ; } f . setInt ( oi . obj , val ) ; } else if ( type == Long . TYPE ) { long val ; try { val = Long . decode ( argValue ) ; } catch ( Exception e ) { throw new ArgException ( "Value \"%s\" for argument %s is not a long integer" , argValue , argName ) ; } f . setLong ( oi . obj , val ) ; } else if ( type == Float . TYPE ) { Float val ; try { val = Float . valueOf ( argValue ) ; } catch ( Exception e ) { throw new ArgException ( "Value \"%s\" for argument %s is not a float" , argValue , argName ) ; } f . setFloat ( oi . obj , val ) ; } else if ( type == Double . TYPE ) { Double val ; try { val = Double . valueOf ( argValue ) ; } catch ( Exception e ) { throw new ArgException ( "Value \"%s\" for argument %s is not a double" , argValue , argName ) ; } f . setDouble ( oi . obj , val ) ; } else { // unexpected type throw new Error ( "Unexpected type " + type ) ; } } else { // reference type // If the argument is a list , add repeated arguments or multiple // blank separated arguments to the list , otherwise just set the // argument value . if ( oi . list != null ) { if ( spaceSeparatedLists ) { String [ ] aarr = argValue . split ( " *" ) ; for ( String aval : aarr ) { Object val = getRefArg ( oi , argName , aval ) ; oi . list . add ( val ) ; // uncheck cast } } else { Object val = getRefArg ( oi , argName , argValue ) ; oi . list . add ( val ) ; } } else { Object val = getRefArg ( oi , argName , argValue ) ; f . set ( oi . obj , val ) ; } } } catch ( ArgException ae ) { throw ae ; } catch ( Exception e ) { throw new Error ( "Unexpected error " , e ) ; }
public class AmazonCognitoIdentityClient { /** * Deletes an identity pool . Once a pool is deleted , users will not be able to authenticate with the pool . * You must use AWS Developer credentials to call this API . * @ param deleteIdentityPoolRequest * Input to the DeleteIdentityPool action . * @ return Result of the DeleteIdentityPool operation returned by the service . * @ throws InvalidParameterException * Thrown for missing or bad input parameter ( s ) . * @ throws ResourceNotFoundException * Thrown when the requested resource ( for example , a dataset or record ) does not exist . * @ throws NotAuthorizedException * Thrown when a user is not authorized to access the requested resource . * @ throws TooManyRequestsException * Thrown when a request is throttled . * @ throws InternalErrorException * Thrown when the service encounters an error during processing the request . * @ sample AmazonCognitoIdentity . DeleteIdentityPool * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - identity - 2014-06-30 / DeleteIdentityPool " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DeleteIdentityPoolResult deleteIdentityPool ( DeleteIdentityPoolRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteIdentityPool ( request ) ;
public class ClassUtils { /** * 获取默认classloader * @ return 当前默认classloader ( 先从当前线程上下文获取 , 获取不到获取加载该类的ClassLoader , 还获取不到就获取系统classloader ) */ public static ClassLoader getDefaultClassLoader ( ) { } }
ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( loader == null ) { loader = ClassUtils . class . getClassLoader ( ) ; if ( loader == null ) { loader = ClassLoader . getSystemClassLoader ( ) ; } } return loader ;
public class AttributeTypeMarshaller { /** * Marshall the given parameter object . */ public void marshall ( AttributeType attributeType , ProtocolMarshaller protocolMarshaller ) { } }
if ( attributeType == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( attributeType . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( attributeType . getValue ( ) , VALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class FnNumber { /** * Determines whether the result of executing the specified function * on the target object and the specified object parameter are NOT equal * by calling the < tt > equals < / tt > method . * @ param object the object to compare to the target * @ return false if both objects are equal , true if not . */ public static final Function < Number , Boolean > notEqBy ( final IFunction < Number , ? > by , final Number object ) { } }
return FnObject . notEqBy ( by , object ) ;
public class DexProxyBuilder { /** * Generates the { @ link android . view . View # onMeasure ( int , int ) } method for the proxy class . */ private static < T , G extends T > void generateOnMeasureMethod ( DexMaker dexMaker , TypeId < G > generatedType , TypeId < T > baseType ) { } }
final FieldId < G , Interceptor > interceptorField = generatedType . getField ( INTERCEPTOR_TYPE , FIELD_NAME_INTERCEPTOR ) ; final String methodName = ViewMethod . ON_MEASURE . getName ( ) ; final MethodId < T , Void > superMethod = baseType . getMethod ( VOID_TYPE , methodName , TypeId . INT , TypeId . INT ) ; final MethodId < Interceptor , Void > onMeasureMethod = INTERCEPTOR_TYPE . getMethod ( VOID_TYPE , methodName , VIEW_TYPE , TypeId . INT , TypeId . INT ) ; final MethodId < G , Void > methodId = generatedType . getMethod ( VOID_TYPE , methodName , TypeId . INT , TypeId . INT ) ; final Code code = dexMaker . declare ( methodId , PUBLIC ) ; final Local < G > localThis = code . getThis ( generatedType ) ; final Local < Interceptor > nullInterceptor = code . newLocal ( INTERCEPTOR_TYPE ) ; final Local < Interceptor > localInterceptor = code . newLocal ( INTERCEPTOR_TYPE ) ; final Local < Integer > localWidth = code . getParameter ( 0 , TypeId . INT ) ; final Local < Integer > localHeight = code . getParameter ( 1 , TypeId . INT ) ; code . iget ( interceptorField , localInterceptor , localThis ) ; code . loadConstant ( nullInterceptor , null ) ; // Interceptor is not null , call it . final Label interceptorNullCase = new Label ( ) ; code . compare ( Comparison . EQ , interceptorNullCase , nullInterceptor , localInterceptor ) ; code . invokeVirtual ( onMeasureMethod , null , localInterceptor , localThis , localWidth , localHeight ) ; code . returnVoid ( ) ; // Interceptor is null , call super method . code . mark ( interceptorNullCase ) ; code . invokeSuper ( superMethod , null , localThis , localWidth , localHeight ) ; code . returnVoid ( ) ; final MethodId < G , Void > callsSuperMethod = generatedType . getMethod ( VOID_TYPE , ViewMethod . ON_MEASURE . getInvokeName ( ) , TypeId . INT , TypeId . INT ) ; final Code superCode = dexMaker . declare ( callsSuperMethod , PUBLIC ) ; final Local < G > superThis = superCode . getThis ( generatedType ) ; final Local < Integer > superLocalWidth = superCode . getParameter ( 0 , TypeId . INT ) ; final Local < Integer > superLocalHeight = superCode . getParameter ( 1 , TypeId . INT ) ; superCode . invokeSuper ( superMethod , null , superThis , superLocalWidth , superLocalHeight ) ; superCode . returnVoid ( ) ;
public class AbstractSearcher { /** * Searches the @ Searchable annotated object in order to find the element or elements matching the criteria * defined by the Matcher . * @ param < E > the Class type of elements to search in the @ Searchable annotated object . * @ param searchableAnnotatedObject the @ Searchable annotated object to search . * @ return the element in the @ Searchable annotated object matching the search criteria defined by the Matcher . * @ see # getSearchableMetaData ( Object ) * @ see # configureMatcher ( org . cp . elements . util . search . annotation . Searchable ) * @ see # asList ( Object , org . cp . elements . util . search . annotation . Searchable ) * @ see # search ( java . util . Collection ) * @ see org . cp . elements . util . search . annotation . Searchable # listMethod ( ) */ @ Override public < E > E search ( final Object searchableAnnotatedObject ) { } }
try { return search ( this . < E > asList ( searchableAnnotatedObject , configureMatcher ( getSearchableMetaData ( searchableAnnotatedObject ) ) ) ) ; } finally { MatcherHolder . unset ( ) ; }
public class Op { /** * Creates an array with the specified elements and an < i > operation expression < / i > on it . * @ param elements the elements of the array being created * @ return an operator , ready for chaining */ public static < T > Level0ArrayOperator < Timestamp [ ] , Timestamp > onArrayFor ( final Timestamp ... elements ) { } }
return onArrayOf ( Types . forClass ( Timestamp . class ) , VarArgsUtil . asRequiredObjectArray ( elements ) ) ;
public class ListFiltersResult { /** * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setFilterNames ( java . util . Collection ) } or { @ link # withFilterNames ( java . util . Collection ) } if you want to * override the existing values . * @ param filterNames * @ return Returns a reference to this object so that method calls can be chained together . */ public ListFiltersResult withFilterNames ( String ... filterNames ) { } }
if ( this . filterNames == null ) { setFilterNames ( new java . util . ArrayList < String > ( filterNames . length ) ) ; } for ( String ele : filterNames ) { this . filterNames . add ( ele ) ; } return this ;
public class HttpTransport { /** * Makes JSON - RPC batch request against the remote server as a single HTTP request . */ @ SuppressWarnings ( "unchecked" ) public List < RpcResponse > request ( List < RpcRequest > reqList ) { } }
List < RpcResponse > respList = new ArrayList < RpcResponse > ( ) ; List < Map > marshaledReqs = new ArrayList < Map > ( ) ; Map < String , RpcRequest > byReqId = new HashMap < String , RpcRequest > ( ) ; for ( RpcRequest req : reqList ) { try { marshaledReqs . add ( req . marshal ( contract ) ) ; byReqId . put ( req . getId ( ) , req ) ; } catch ( RpcException e ) { respList . add ( new RpcResponse ( req , e ) ) ; } } InputStream is = null ; try { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; serializer . write ( marshaledReqs , bos ) ; bos . close ( ) ; byte [ ] data = bos . toByteArray ( ) ; is = requestRaw ( data ) ; List < Map > responses = serializer . readList ( is ) ; for ( Map map : responses ) { String id = ( String ) map . get ( "id" ) ; if ( id != null ) { RpcRequest req = byReqId . get ( id ) ; if ( req == null ) { // TODO : ? ? log error ? } else { byReqId . remove ( id ) ; respList . add ( unmarshal ( req , map ) ) ; } } else { // TODO : ? ? log error ? } } if ( byReqId . size ( ) > 0 ) { for ( RpcRequest req : byReqId . values ( ) ) { String msg = "No response in batch for request " + req . getId ( ) ; RpcException exc = RpcException . Error . INVALID_RESP . exc ( msg ) ; RpcResponse resp = new RpcResponse ( req , exc ) ; respList . add ( resp ) ; } } } catch ( IOException e ) { String msg = "IOException requesting batch " + " from: " + endpoint + " - " + e . getMessage ( ) ; RpcException exc = RpcException . Error . INTERNAL . exc ( msg ) ; respList . add ( new RpcResponse ( null , exc ) ) ; } finally { closeQuietly ( is ) ; } return respList ;
public class HoughCircles { /** * Convert Values in Hough Space to an 8 - Bit Image Space . */ private void createHoughPixels ( double [ ] [ ] [ ] houghValues , byte houghPixels [ ] ) { } }
double d = - 1D ; for ( int j = 0 ; j < height ; j ++ ) { for ( int k = 0 ; k < width ; k ++ ) { if ( houghValues [ k ] [ j ] [ 0 ] > d ) { d = houghValues [ k ] [ j ] [ 0 ] ; } } } for ( int l = 0 ; l < height ; l ++ ) { for ( int i = 0 ; i < width ; i ++ ) { houghPixels [ i + l * width ] = ( byte ) Math . round ( ( houghValues [ i ] [ l ] [ 0 ] * 255D ) / d ) ; } }
public class MultiNote { /** * Returns the highest note from the given array of notes . * @ param notes An array of notes . * @ return The highes note from the given array of notes . * @ see Note # isHigherThan ( Note ) */ public static Note getHighestNote ( Note [ ] notes ) { } }
Note highestNote = notes [ 0 ] ; for ( int i = 1 ; i < notes . length ; i ++ ) if ( notes [ i ] . isHigherThan ( highestNote ) ) highestNote = notes [ i ] ; return highestNote ;
public class Pubsub { /** * Make an HTTP request . */ private < T > PubsubFuture < T > request ( final String operation , final HttpMethod method , final String path , final Object payload , final ResponseReader < T > responseReader ) { } }
final String uri = baseUri + path ; final RequestBuilder builder = new RequestBuilder ( ) . setUrl ( uri ) . setMethod ( method . toString ( ) ) . setHeader ( "Authorization" , "Bearer " + accessToken ) . setHeader ( "User-Agent" , USER_AGENT ) ; final long payloadSize ; if ( payload != NO_PAYLOAD ) { final byte [ ] json = gzipJson ( payload ) ; payloadSize = json . length ; builder . setHeader ( CONTENT_ENCODING , GZIP ) ; builder . setHeader ( CONTENT_LENGTH , String . valueOf ( json . length ) ) ; builder . setHeader ( CONTENT_TYPE , APPLICATION_JSON_UTF8 ) ; builder . setBody ( json ) ; } else { builder . setHeader ( CONTENT_LENGTH , String . valueOf ( 0 ) ) ; payloadSize = 0 ; } final Request request = builder . build ( ) ; final RequestInfo requestInfo = RequestInfo . builder ( ) . operation ( operation ) . method ( method . toString ( ) ) . uri ( uri ) . payloadSize ( payloadSize ) . build ( ) ; final PubsubFuture < T > future = new PubsubFuture < > ( requestInfo ) ; client . executeRequest ( request , new AsyncHandler < Void > ( ) { private final ByteArrayOutputStream bytes = new ByteArrayOutputStream ( ) ; @ Override public void onThrowable ( final Throwable t ) { future . fail ( t ) ; } @ Override public STATE onBodyPartReceived ( final HttpResponseBodyPart bodyPart ) throws Exception { bytes . write ( bodyPart . getBodyPartBytes ( ) ) ; return STATE . CONTINUE ; } @ Override public STATE onStatusReceived ( final HttpResponseStatus status ) throws Exception { // Return null for 404 ' d GET & DELETE requests if ( status . getStatusCode ( ) == 404 && method == HttpMethod . GET || method == HttpMethod . DELETE ) { future . succeed ( null ) ; return STATE . ABORT ; } // Fail on non - 2xx responses final int statusCode = status . getStatusCode ( ) ; if ( ! ( statusCode >= 200 && statusCode < 300 ) ) { future . fail ( new RequestFailedException ( status . getStatusCode ( ) , status . getStatusText ( ) ) ) ; return STATE . ABORT ; } if ( responseReader == VOID ) { future . succeed ( null ) ; return STATE . ABORT ; } return STATE . CONTINUE ; } @ Override public STATE onHeadersReceived ( final HttpResponseHeaders headers ) throws Exception { return STATE . CONTINUE ; } @ Override public Void onCompleted ( ) throws Exception { if ( future . isDone ( ) ) { return null ; } try { future . succeed ( responseReader . read ( bytes . toByteArray ( ) ) ) ; } catch ( Exception e ) { future . fail ( e ) ; } return null ; } } ) ; return future ;
public class FacetMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Facet facet , ProtocolMarshaller protocolMarshaller ) { } }
if ( facet == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( facet . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( facet . getObjectType ( ) , OBJECTTYPE_BINDING ) ; protocolMarshaller . marshall ( facet . getFacetStyle ( ) , FACETSTYLE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class JawrRequestHandler { /** * Initialize the config property resolver * @ param context * the servlet context */ private void initConfigPropertyResolver ( ServletContext context ) { } }
String configPropertyResolverClass = getInitParameter ( "configPropertyResolverClass" ) ; // Load a custom class to set configPropertyResolver configPropResolver = null ; if ( null != configPropertyResolverClass ) { configPropResolver = ( ConfigPropertyResolver ) ClassLoaderResourceUtils . buildObjectInstance ( configPropertyResolverClass ) ; if ( configPropResolver instanceof ServletContextAware ) { ( ( ServletContextAware ) configPropResolver ) . setServletContext ( context ) ; } }
public class KeyVaultClientBaseImpl { /** * List storage accounts managed by the specified key vault . This operation requires the storage / list permission . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws KeyVaultErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the PagedList & lt ; StorageAccountItem & gt ; object if successful . */ public PagedList < StorageAccountItem > getStorageAccountsNext ( final String nextPageLink ) { } }
ServiceResponse < Page < StorageAccountItem > > response = getStorageAccountsNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < StorageAccountItem > ( response . body ( ) ) { @ Override public Page < StorageAccountItem > nextPage ( String nextPageLink ) { return getStorageAccountsNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ;
public class Setting { /** * Constructs a setting of { @ link Integer } type , which is represented by a { @ link Slider } . * @ param description the title of this setting * @ param property to be bound , saved / loaded and used for undo / redo * @ param min minimum value of the { @ link Slider } * @ param max maximum value of the { @ link Slider } * @ return the constructed setting */ public static Setting of ( String description , IntegerProperty property , int min , int max ) { } }
return new Setting < > ( description , Field . ofIntegerType ( property ) . label ( description ) . render ( new IntegerSliderControl ( min , max ) ) , property ) ;
public class LocalDateTime { /** * Returns a copy of this datetime plus the specified number of months . * This LocalDateTime instance is immutable and unaffected by this method call . * The following three lines are identical in effect : * < pre > * LocalDateTime added = dt . plusMonths ( 6 ) ; * LocalDateTime added = dt . plus ( Period . months ( 6 ) ) ; * LocalDateTime added = dt . withFieldAdded ( DurationFieldType . months ( ) , 6 ) ; * < / pre > * @ param months the amount of months to add , may be negative * @ return the new LocalDateTime plus the increased months */ public LocalDateTime plusMonths ( int months ) { } }
if ( months == 0 ) { return this ; } long instant = getChronology ( ) . months ( ) . add ( getLocalMillis ( ) , months ) ; return withLocalMillis ( instant ) ;
public class ButtonPainter { /** * Determine the button painter variant from the component ' s client * property . * @ param c the component . * @ return the button painter variant . */ private ButtonVariantPainter getButtonPainter ( JComponent c ) { } }
Object buttonType = c . getClientProperty ( "JButton.buttonType" ) ; ButtonVariantPainter button = standard ; if ( "textured" . equals ( buttonType ) || "segmentedTextured" . equals ( buttonType ) ) { button = textured ; } return button ;
public class TaskReactivateOptions { /** * Set a timestamp indicating the last modified time of the resource known to the client . The operation will be performed only if the resource on the service has been modified since the specified time . * @ param ifModifiedSince the ifModifiedSince value to set * @ return the TaskReactivateOptions object itself . */ public TaskReactivateOptions withIfModifiedSince ( DateTime ifModifiedSince ) { } }
if ( ifModifiedSince == null ) { this . ifModifiedSince = null ; } else { this . ifModifiedSince = new DateTimeRfc1123 ( ifModifiedSince ) ; } return this ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcBoundaryCondition ( ) { } }
if ( ifcBoundaryConditionEClass == null ) { ifcBoundaryConditionEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 45 ) ; } return ifcBoundaryConditionEClass ;
public class ArabicShaping { /** * Name : expandCompositCharAtEnd * Function : Expands the LamAlef character to Lam and Alef consuming the * required space from end of the buffer . If the text type was * Visual LTR and the option SPACES _ RELATIVE _ TO _ TEXT _ BEGIN _ END * was used , the spaces will be consumed from begin of buffer . If * there are no spaces to expand the LamAlef , an exception is thrown . */ private boolean expandCompositCharAtEnd ( char [ ] dest , int start , int length , int lacount ) { } }
boolean spaceNotFound = false ; if ( lacount > countSpacesLeft ( dest , start , length ) ) { spaceNotFound = true ; return spaceNotFound ; } for ( int r = start + lacount , w = start , e = start + length ; r < e ; ++ r ) { char ch = dest [ r ] ; if ( isNormalizedLamAlefChar ( ch ) ) { dest [ w ++ ] = convertNormalizedLamAlef [ ch - '\u065C' ] ; dest [ w ++ ] = LAM_CHAR ; } else { dest [ w ++ ] = ch ; } } return spaceNotFound ;
public class AndroidLifecycleScopeProvider { /** * Creates a { @ link AndroidLifecycleScopeProvider } for Android Lifecycles . * @ param owner the owner to scope for . * @ param boundaryResolver function that resolves the event boundary . * @ return a { @ link AndroidLifecycleScopeProvider } against this owner . */ public static AndroidLifecycleScopeProvider from ( LifecycleOwner owner , CorrespondingEventsFunction < Lifecycle . Event > boundaryResolver ) { } }
return from ( owner . getLifecycle ( ) , boundaryResolver ) ;
public class EventSubscriptionManager { /** * Find all signal event subscriptions with the given event name for any tenant . * @ see # findSignalEventSubscriptionsByEventNameAndTenantId ( String , String ) */ @ SuppressWarnings ( "unchecked" ) public List < EventSubscriptionEntity > findSignalEventSubscriptionsByEventName ( String eventName ) { } }
final String query = "selectSignalEventSubscriptionsByEventName" ; Set < EventSubscriptionEntity > eventSubscriptions = new HashSet < EventSubscriptionEntity > ( getDbEntityManager ( ) . selectList ( query , configureParameterizedQuery ( eventName ) ) ) ; // add events created in this command ( not visible yet in query ) for ( EventSubscriptionEntity entity : createdSignalSubscriptions ) { if ( eventName . equals ( entity . getEventName ( ) ) ) { eventSubscriptions . add ( entity ) ; } } return new ArrayList < EventSubscriptionEntity > ( eventSubscriptions ) ;
public class TimeUUIDs { /** * Fabricates a non - unique UUID value for the specified timestamp that sorts relative to other similar UUIDs based * on the value of { @ code sequence } . Be very careful about using this as a unique identifier since the usual * protections against conflicts do not apply . At most , only assume this is unique within a specific context * where the sequence number is unique w / in that context . */ public static UUID uuidForTimeMillis ( long timeMillis , int sequence ) { } }
long time = getRawTimestamp ( timeMillis ) ; return new UUID ( getMostSignificantBits ( time ) , getLeastSignificantBits ( sequence , 0 ) ) ;
public class Dater { /** * Formats a Date into a date / time string with the given style without change the previous style * @ param dateStyle * @ return */ public String asText ( DateStyle dateStyle ) { } }
DateStyle prevStyle = this . style ; checkNotNull ( dateStyle ) . setLocale ( prevStyle . locale ( ) ) ; dateStyle . setFormatSymbols ( prevStyle . formatSymbols ( ) ) ; String dayText = with ( dateStyle ) . asText ( ) ; with ( prevStyle ) ; return dayText ;
public class AWSLogsClient { /** * Lists the resource policies in this account . * @ param describeResourcePoliciesRequest * @ return Result of the DescribeResourcePolicies operation returned by the service . * @ throws InvalidParameterException * A parameter is specified incorrectly . * @ throws ServiceUnavailableException * The service cannot complete the request . * @ sample AWSLogs . DescribeResourcePolicies * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / logs - 2014-03-28 / DescribeResourcePolicies " target = " _ top " > AWS * API Documentation < / a > */ @ Override public DescribeResourcePoliciesResult describeResourcePolicies ( DescribeResourcePoliciesRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeResourcePolicies ( request ) ;
public class PollingManager { /** * Add command polling . Init command cannot be polled . Only command with * parameter void can be polled * @ param commandName the command to poll * @ param pollingPeriod the polling period * @ throws DevFailed */ public void addCommandPolling ( final String commandName , final int pollingPeriod ) throws DevFailed { } }
checkPollingLimits ( commandName , pollingPeriod , minCommandPolling ) ; final CommandImpl command = CommandGetter . getCommand ( commandName , commandList ) ; if ( ! command . getName ( ) . equals ( DeviceImpl . INIT_CMD ) && command . getInType ( ) . equals ( CommandTangoType . VOID ) ) { command . configurePolling ( pollingPeriod ) ; if ( command . getName ( ) . equals ( DeviceImpl . STATE_NAME ) || command . getName ( ) . equals ( DeviceImpl . STATUS_NAME ) ) { // command is also set as polled final AttributeImpl attribute = AttributeGetterSetter . getAttribute ( command . getName ( ) , attributeList ) ; attribute . configurePolling ( pollingPeriod ) ; pollAttributes . put ( attribute . getName ( ) . toLowerCase ( Locale . ENGLISH ) , pollingPeriod ) ; cacheManager . startStateStatusPolling ( command , attribute ) ; pollAttributes . put ( attribute . getName ( ) . toLowerCase ( Locale . ENGLISH ) , pollingPeriod ) ; savePollingConfig ( ) ; } else { cacheManager . startCommandPolling ( command ) ; } }
public class RawDataDumper { /** * Feature SIB0112b . ms . 1 */ private final void _writeCallback ( Persistable persistable ) throws IOException { } }
if ( _callbackToItem ) { try { String className = persistable . getItemClassName ( ) ; AbstractItem item = ( AbstractItem ) ( Class . forName ( className ) . newInstance ( ) ) ; List < DataSlice > dataSlices = _persistentMessageStore . readDataOnly ( persistable ) ; if ( dataSlices != null ) { item . restore ( dataSlices ) ; item . xmlWriteOn ( _writer ) ; } } catch ( IOException ioexc ) { // No FFDC code needed // as this is fault diagnostic code , and the exception // will be dumped to the output anyway _writer . write ( ioexc ) ; throw ioexc ; } catch ( Throwable t ) { // No FFDC code needed // as this is fault diagnostic code , and the exception // will be dumped to the output anyway _writer . write ( t ) ; } }
public class ArrayQueue { /** * Removes the element at the specified position in the elements array , * adjusting head and tail as necessary . This can result in motion of * elements backwards or forwards in the array . * < p > This method is called delete rather than remove to emphasize * that its semantics differ from those of { @ link List # remove ( int ) } . * @ return true if elements moved backwards */ private boolean delete ( int i ) { } }
// checkInvariants ( ) ; final Object [ ] elements = this . elements ; final int mask = elements . length - 1 ; final int h = head ; final int t = tail ; final int front = ( i - h ) & mask ; final int back = ( t - i ) & mask ; // Invariant : head < = i < tail mod circularity if ( front >= ( ( t - h ) & mask ) ) throw new ConcurrentModificationException ( ) ; // Optimize for least element motion if ( front < back ) { if ( h <= i ) { System . arraycopy ( elements , h , elements , h + 1 , front ) ; } else { // Wrap around System . arraycopy ( elements , 0 , elements , 1 , i ) ; elements [ 0 ] = elements [ mask ] ; System . arraycopy ( elements , h , elements , h + 1 , mask - h ) ; } elements [ h ] = null ; head = ( h + 1 ) & mask ; return false ; } else { if ( i < t ) { // Copy the null tail as well System . arraycopy ( elements , i + 1 , elements , i , back ) ; tail = t - 1 ; } else { // Wrap around System . arraycopy ( elements , i + 1 , elements , i , mask - i ) ; elements [ mask ] = elements [ 0 ] ; System . arraycopy ( elements , 1 , elements , 0 , t ) ; tail = ( t - 1 ) & mask ; } return true ; }
public class FullFeaturePhase { /** * { @ inheritDoc } */ @ Override public final boolean read ( final ITask task , final Session session , final ByteBuffer dst , final int logicalBlockAddress , final long length ) throws Exception { } }
if ( dst . remaining ( ) < length ) { throw new IllegalArgumentException ( "Destination buffer is too small." ) ; } int startAddress = logicalBlockAddress ; final long blockSize = session . getBlockSize ( ) ; long totalBlocks = ( long ) Math . ceil ( length / ( double ) blockSize ) ; long bytes2Process = length ; final Connection connection = session . getNextFreeConnection ( ) ; connection . getSession ( ) . addOutstandingTask ( connection , task ) ; // first stage short blocks = ( short ) Math . min ( READ_FIRST_STAGE_BLOCKS , totalBlocks ) ; if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Now reading sequences of length " + blocks + " blocks." ) ; } connection . nextState ( new ReadRequestState ( connection , dst , TaskAttributes . SIMPLE , ( int ) Math . min ( bytes2Process , blocks * blockSize ) , startAddress , blocks ) ) ; startAddress += blocks ; totalBlocks -= blocks ; bytes2Process -= blocks * blockSize ; // second stage blocks = ( short ) Math . min ( READ_SECOND_STAGE_BLOCKS , totalBlocks ) ; if ( blocks > 0 ) { if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Now reading sequences of length " + blocks + " blocks." ) ; } connection . nextState ( new ReadRequestState ( connection , dst , TaskAttributes . SIMPLE , ( int ) Math . min ( bytes2Process , blocks * blockSize ) , startAddress , blocks ) ) ; startAddress += blocks ; totalBlocks -= blocks ; bytes2Process -= blocks * blockSize ; } // third stage blocks = ( short ) Math . min ( READ_THIRD_STAGE_BLOCKS , totalBlocks ) ; while ( blocks > 0 ) { if ( LOGGER . isInfoEnabled ( ) ) { LOGGER . info ( "Now reading sequences of length " + blocks + " blocks." ) ; } connection . nextState ( new ReadRequestState ( connection , dst , TaskAttributes . SIMPLE , ( int ) Math . min ( bytes2Process , blocks * blockSize ) , startAddress , blocks ) ) ; startAddress += blocks ; totalBlocks -= blocks ; blocks = ( short ) Math . min ( READ_THIRD_STAGE_BLOCKS , totalBlocks ) ; } return true ;
public class CQLTranslator { /** * Builds set clause for a given field . * @ param m * the m * @ param builder * the builder * @ param property * the property * @ param value * the value */ public void buildSetClause ( EntityMetadata m , StringBuilder builder , String property , Object value ) { } }
builder = ensureCase ( builder , property , false ) ; builder . append ( EQ_CLAUSE ) ; if ( m . isCounterColumnType ( ) ) { builder = ensureCase ( builder , property , false ) ; builder . append ( INCR_COUNTER ) ; builder . append ( value ) ; } else { appendValue ( builder , value . getClass ( ) , value , false , false ) ; } builder . append ( COMMA_STR ) ;
public class LRImporter { /** * Get an extract request path * @ param dataServiceName name of the data service to use * @ param viewName name of the view to use * @ param from start date from which to extract items * @ param until end date from which to extract items * @ param idsOnly true / false to only extract ids * @ param mainValue value of the main field * @ param partial true / false is the main field is a partial value * @ param mainName name of the main field ( e . g . resource , discriminator ) * @ return the extract request path with the given parameters */ private String getExtractRequestPath ( String dataServiceName , String viewName , Date from , Date until , Boolean idsOnly , String mainValue , Boolean partial , String mainName ) { } }
String path = extractPath ; if ( viewName != null ) { path += "/" + viewName ; } else { return null ; } if ( dataServiceName != null ) { path += "/" + dataServiceName ; } else { return null ; } if ( mainValue != null && mainName != null ) { path += "?" + mainName ; if ( partial ) { path += startsWithParam ; } path += "=" + mainValue ; } else { return null ; } if ( from != null ) { path += "&" + fromParam + "=" + ISO8601 . format ( from ) ; } if ( until != null ) { path += "&" + untilParam + "=" + ISO8601 . format ( until ) ; } if ( idsOnly ) { path += "&" + idsOnlyParam + "=" + booleanTrueString ; } return path ;
public class IllegalMissingAnnotationException { /** * Returns the formatted string { @ link IllegalMissingAnnotationException # MESSAGE _ WITH _ ANNOTATION } with the given * { @ code annotation } . * @ param annotation * the name of the required annotation * @ return a formatted string of message with the given argument name */ @ ArgumentsChecked @ Throws ( IllegalNullArgumentException . class ) private static String format ( @ Nonnull final Class < ? extends Annotation > annotation ) { } }
if ( annotation == null ) { throw new IllegalNullArgumentException ( "annotation" ) ; } return String . format ( MESSAGE_WITH_ANNOTATION , annotation . getName ( ) ) ;
public class WebcamMotionDetector { /** * Get motion center of gravity . When no motion is detected this value points to the image * center . * @ return Center of gravity point */ public Point getMotionCog ( ) { } }
Point cog = algorithm . getCog ( ) ; if ( cog == null ) { // detectorAlgorithm hasn ' t been called so far - get image center int w = webcam . getViewSize ( ) . width ; int h = webcam . getViewSize ( ) . height ; cog = new Point ( w / 2 , h / 2 ) ; } return cog ;
public class DROP_INDEX { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > select a label ( of nodes ) in order to drop an index that was previously created on that label < / i > < / div > * < div color = ' red ' style = " font - size : 18px ; color : red " > < i > e . g . < b > DROP _ INDEX . onLabel ( " Person " ) < / b > . . . < / i > < / div > * < br / > */ public static IndexFor onLabel ( String label ) { } }
IndexFor ret = IFactory . dropOnLabel ( label ) ; ASTNode an = APIObjectAccess . getAstNode ( ret ) ; an . setClauseType ( ClauseType . DROP_INDEX ) ; return ret ;
public class RenderVisitor { /** * Pops the top output buffer off the stack and returns it ( changes the current output buffer ) . */ private Appendable popOutputBuf ( ) { } }
Appendable poppedOutputBuf = outputBufStack . pop ( ) ; currOutputBuf = outputBufStack . peek ( ) ; return poppedOutputBuf ;
public class DescribeListenersRequest { /** * The Amazon Resource Names ( ARN ) of the listeners . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setListenerArns ( java . util . Collection ) } or { @ link # withListenerArns ( java . util . Collection ) } if you want to * override the existing values . * @ param listenerArns * The Amazon Resource Names ( ARN ) of the listeners . * @ return Returns a reference to this object so that method calls can be chained together . */ public DescribeListenersRequest withListenerArns ( String ... listenerArns ) { } }
if ( this . listenerArns == null ) { setListenerArns ( new java . util . ArrayList < String > ( listenerArns . length ) ) ; } for ( String ele : listenerArns ) { this . listenerArns . add ( ele ) ; } return this ;
public class XAttributeMapLazyImpl { /** * / * ( non - Javadoc ) * @ see java . util . Map # get ( java . lang . Object ) */ public synchronized XAttribute get ( Object key ) { } }
if ( backingStore != null ) { return backingStore . get ( key ) ; } else { return null ; }
public class ItemFilter { /** * removes an item at the given position within the existing icons * @ param position the global position */ public ModelAdapter < ? , Item > remove ( int position ) { } }
if ( mOriginalItems != null ) { mOriginalItems . remove ( getAdapterPosition ( mItemAdapter . getAdapterItems ( ) . get ( position ) ) - mItemAdapter . getFastAdapter ( ) . getPreItemCount ( position ) ) ; publishResults ( mConstraint , performFiltering ( mConstraint ) ) ; return mItemAdapter ; } else { return mItemAdapter . remove ( position ) ; }
public class InvocationContextImpl { /** * Initialize a InvocationContext object for a specified bean and * the corresponding { @ link ManagedObjectContext } and array of * interceptor instances created for this bean instance . * @ param bean is the EJB instance for this invocation . * @ param managedObjectContext The managed object state of the bean instance , * or null if not managed . * @ param interceptors is the ordered array of interceptor instances * created for the bean . */ public void initialize ( T bean , ManagedObjectContext managedObjectContext , Object [ ] interceptors ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "initialize for bean = " + bean + ", context = " + managedObjectContext + ", interceptors = " + Arrays . toString ( interceptors ) ) ; ivBean = bean ; ivManagedObjectContext = managedObjectContext ; ivInterceptors = interceptors ; ivInterceptorProxies = null ; ivTimer = null ;
public class KeyArea { /** * Take this BOOKMARK handle and back it into the fields . * @ param bookmark The bookmark handle . * @ param iAreaDesc The area to move it into . */ public void reverseBookmark ( Object bookmark , int iAreaDesc ) { } }
if ( this . getKeyFields ( ) == 1 ) // Special case - single unique key ; { BaseField field = this . getField ( iAreaDesc ) ; boolean [ ] rgbEnabled = field . setEnableListeners ( false ) ; field . setData ( bookmark , DBConstants . DONT_DISPLAY , DBConstants . INIT_MOVE ) ; field . setEnableListeners ( rgbEnabled ) ; } else { BaseBuffer buffer = ( BaseBuffer ) bookmark ; if ( buffer != null ) buffer . resetPosition ( ) ; this . reverseKeyBuffer ( buffer , iAreaDesc ) ; }
public class Money { /** * ( non - Javadoc ) * @ see javax . money . MonetaryAmount # scaleByPowerOfTen ( int ) */ @ Override public Money scaleByPowerOfTen ( int power ) { } }
return new Money ( this . number . scaleByPowerOfTen ( power ) , getCurrency ( ) , monetaryContext ) ;
public class CitrusConfiguration { /** * Constructs Citrus configuration instance from given property set . * @ param extensionProperties * @ return */ public static CitrusConfiguration from ( Properties extensionProperties ) { } }
CitrusConfiguration configuration = new CitrusConfiguration ( extensionProperties ) ; configuration . setCitrusVersion ( getProperty ( extensionProperties , "citrusVersion" ) ) ; if ( extensionProperties . containsKey ( "autoPackage" ) ) { configuration . setAutoPackage ( Boolean . valueOf ( getProperty ( extensionProperties , "autoPackage" ) ) ) ; } if ( extensionProperties . containsKey ( "suiteName" ) ) { configuration . setSuiteName ( getProperty ( extensionProperties , "suiteName" ) ) ; } if ( extensionProperties . containsKey ( "configurationClass" ) ) { String configurationClass = getProperty ( extensionProperties , "configurationClass" ) ; try { Class < ? > configType = Class . forName ( configurationClass ) ; if ( CitrusSpringConfig . class . isAssignableFrom ( configType ) ) { configuration . setConfigurationClass ( ( Class < ? extends CitrusSpringConfig > ) configType ) ; } else { log . warn ( String . format ( "Found invalid Citrus configuration class: %s, must be a subclass of %s" , configurationClass , CitrusSpringConfig . class ) ) ; } } catch ( ClassNotFoundException e ) { log . warn ( String . format ( "Unable to access Citrus configuration class: %s" , configurationClass ) , e ) ; } } log . debug ( String . format ( "Using Citrus configuration:%n%s" , configuration . toString ( ) ) ) ; return configuration ;
public class RemediationExecutionStepMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RemediationExecutionStep remediationExecutionStep , ProtocolMarshaller protocolMarshaller ) { } }
if ( remediationExecutionStep == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( remediationExecutionStep . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( remediationExecutionStep . getState ( ) , STATE_BINDING ) ; protocolMarshaller . marshall ( remediationExecutionStep . getErrorMessage ( ) , ERRORMESSAGE_BINDING ) ; protocolMarshaller . marshall ( remediationExecutionStep . getStartTime ( ) , STARTTIME_BINDING ) ; protocolMarshaller . marshall ( remediationExecutionStep . getStopTime ( ) , STOPTIME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class LinearNNSearch { /** * Returns k nearest instances in the current neighbourhood to the supplied * instance . * @ param target The instance to find the k nearest neighbours for . * @ param kNNThe number of nearest neighbours to find . * @ returnthe k nearest neighbors * @ throws Exception if the neighbours could not be found . */ public Instances kNearestNeighbours ( Instance target , int kNN ) throws Exception { } }
// debug boolean print = false ; MyHeap heap = new MyHeap ( kNN ) ; double distance ; int firstkNN = 0 ; for ( int i = 0 ; i < m_Instances . numInstances ( ) ; i ++ ) { if ( target == m_Instances . instance ( i ) ) // for hold - one - out cross - validation continue ; if ( firstkNN < kNN ) { if ( print ) System . out . println ( "K(a): " + ( heap . size ( ) + heap . noOfKthNearest ( ) ) ) ; distance = m_DistanceFunction . distance ( target , m_Instances . instance ( i ) , Double . POSITIVE_INFINITY ) ; if ( distance == 0.0 && m_SkipIdentical ) if ( i < m_Instances . numInstances ( ) - 1 ) continue ; else heap . put ( i , distance ) ; heap . put ( i , distance ) ; firstkNN ++ ; } else { MyHeapElement temp = heap . peek ( ) ; if ( print ) System . out . println ( "K(b): " + ( heap . size ( ) + heap . noOfKthNearest ( ) ) ) ; distance = m_DistanceFunction . distance ( target , m_Instances . instance ( i ) , temp . distance ) ; if ( distance == 0.0 && m_SkipIdentical ) continue ; if ( distance < temp . distance ) { heap . putBySubstitute ( i , distance ) ; } else if ( distance == temp . distance ) { heap . putKthNearest ( i , distance ) ; } } } Instances neighbours = new Instances ( m_Instances , ( heap . size ( ) + heap . noOfKthNearest ( ) ) ) ; m_Distances = new double [ heap . size ( ) + heap . noOfKthNearest ( ) ] ; int [ ] indices = new int [ heap . size ( ) + heap . noOfKthNearest ( ) ] ; int i = 1 ; MyHeapElement h ; while ( heap . noOfKthNearest ( ) > 0 ) { h = heap . getKthNearest ( ) ; indices [ indices . length - i ] = h . index ; m_Distances [ indices . length - i ] = h . distance ; i ++ ; } while ( heap . size ( ) > 0 ) { h = heap . get ( ) ; indices [ indices . length - i ] = h . index ; m_Distances [ indices . length - i ] = h . distance ; i ++ ; } m_DistanceFunction . postProcessDistances ( m_Distances ) ; for ( int k = 0 ; k < indices . length ; k ++ ) { neighbours . add ( m_Instances . instance ( indices [ k ] ) ) ; } return neighbours ;
public class JschUtil { /** * 获得一个SSH会话 , 重用已经使用的会话 * @ param sshHost 主机 * @ param sshPort 端口 * @ param sshUser 用户名 * @ param sshPass 密码 * @ return SSH会话 */ public static Session getSession ( String sshHost , int sshPort , String sshUser , String sshPass ) { } }
return JschSessionPool . INSTANCE . getSession ( sshHost , sshPort , sshUser , sshPass ) ;
public class RSTImpl { /** * Sets the sentence _ left and sentence _ right properties of the data object of * parent to the min / max of the currNode . */ private void setSentenceSpan ( JSONObject cNode , JSONObject parent ) { } }
try { JSONObject data = cNode . getJSONObject ( "data" ) ; int leftPosC = data . getInt ( SENTENCE_LEFT ) ; int rightPosC = data . getInt ( SENTENCE_RIGHT ) ; data = parent . getJSONObject ( "data" ) ; if ( data . has ( SENTENCE_LEFT ) ) { data . put ( SENTENCE_LEFT , Math . min ( leftPosC , data . getInt ( SENTENCE_LEFT ) ) ) ; } else { data . put ( SENTENCE_LEFT , leftPosC ) ; } if ( data . has ( SENTENCE_RIGHT ) ) { data . put ( SENTENCE_RIGHT , Math . max ( rightPosC , data . getInt ( SENTENCE_RIGHT ) ) ) ; } else { data . put ( SENTENCE_RIGHT , rightPosC ) ; } } catch ( JSONException ex ) { log . debug ( "error while setting left and right position for sentences" , ex ) ; }
public class ClientConnectionManagerImpl { /** * Initialises the Client Connection Manager . * @ see com . ibm . ws . sib . jfapchannel . ClientConnectionManager # initialise ( ) */ public static void initialise ( ) throws SIErrorException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "initialise" ) ; initialisationFailed = true ; Framework framework = Framework . getInstance ( ) ; if ( framework != null ) { tracker = new OutboundConnectionTracker ( framework ) ; initialisationFailed = false ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "initialisation failed" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "initialise" ) ;
public class UnicodeSetStringSpan { /** * Span a string backwards . * @ param s The string to be spanned * @ param spanCondition The span condition * @ return The string index which starts the span ( i . e . inclusive ) . */ public synchronized int spanBack ( CharSequence s , int length , SpanCondition spanCondition ) { } }
if ( spanCondition == SpanCondition . NOT_CONTAINED ) { return spanNotBack ( s , length ) ; } int pos = spanSet . spanBack ( s , length , SpanCondition . CONTAINED ) ; if ( pos == 0 ) { return 0 ; } int spanLength = length - pos ; // Consider strings ; they may overlap with the span . int initSize = 0 ; if ( spanCondition == SpanCondition . CONTAINED ) { // Use offset list to try all possibilities . initSize = maxLength16 ; } offsets . setMaxLength ( initSize ) ; int i , stringsLength = strings . size ( ) ; int spanBackLengthsOffset = 0 ; if ( all ) { spanBackLengthsOffset = stringsLength ; } for ( ; ; ) { if ( spanCondition == SpanCondition . CONTAINED ) { for ( i = 0 ; i < stringsLength ; ++ i ) { int overlap = spanLengths [ spanBackLengthsOffset + i ] ; if ( overlap == ALL_CP_CONTAINED ) { continue ; // Irrelevant string . } String string = strings . get ( i ) ; int length16 = string . length ( ) ; // Try to match this string at pos - ( length16 - overlap ) . . pos - length16. if ( overlap >= LONG_SPAN ) { overlap = length16 ; // While contained : No point matching fully inside the code point span . int len1 = 0 ; len1 = string . offsetByCodePoints ( 0 , 1 ) ; overlap -= len1 ; // Length of the string minus the first code point . } if ( overlap > spanLength ) { overlap = spanLength ; } int dec = length16 - overlap ; // Keep dec + overlap = = length16. for ( ; ; ) { if ( dec > pos ) { break ; } // Try to match if the decrement is not listed already . if ( ! offsets . containsOffset ( dec ) && matches16CPB ( s , pos - dec , length , string , length16 ) ) { if ( dec == pos ) { return 0 ; // Reached the start of the string . } offsets . addOffset ( dec ) ; } if ( overlap == 0 ) { break ; } -- overlap ; ++ dec ; } } } else /* SIMPLE */ { int maxDec = 0 , maxOverlap = 0 ; for ( i = 0 ; i < stringsLength ; ++ i ) { int overlap = spanLengths [ spanBackLengthsOffset + i ] ; // For longest match , we do need to try to match even an all - contained string // to find the match from the latest end . String string = strings . get ( i ) ; int length16 = string . length ( ) ; // Try to match this string at pos - ( length16 - overlap ) . . pos - length16. if ( overlap >= LONG_SPAN ) { overlap = length16 ; // Longest match : Need to match fully inside the code point span // to find the match from the latest end . } if ( overlap > spanLength ) { overlap = spanLength ; } int dec = length16 - overlap ; // Keep dec + overlap = = length16. for ( ; ; ) { if ( dec > pos || overlap < maxOverlap ) { break ; } // Try to match if the string is longer or ends later . if ( ( overlap > maxOverlap || /* redundant overlap = = maxOverlap & & */ dec > maxDec ) && matches16CPB ( s , pos - dec , length , string , length16 ) ) { maxDec = dec ; // Longest match from latest end . maxOverlap = overlap ; break ; } -- overlap ; ++ dec ; } } if ( maxDec != 0 || maxOverlap != 0 ) { // Longest - match algorithm , and there was a string match . // Simply continue before it . pos -= maxDec ; if ( pos == 0 ) { return 0 ; // Reached the start of the string . } spanLength = 0 ; // Match strings from before a string match . continue ; } } // Finished trying to match all strings at pos . if ( spanLength != 0 || pos == length ) { // The position is before an unlimited code point span ( spanLength ! = 0 ) , // not before a string match . // The only position where spanLength = = 0 before a span is pos = = length . // Otherwise , an unlimited code point span is only tried again when no // strings match , and if such a non - initial span fails we stop . if ( offsets . isEmpty ( ) ) { return pos ; // No strings matched before a span . } // Match strings from before the next string match . } else { // The position is before a string match ( or a single code point ) . if ( offsets . isEmpty ( ) ) { // No more strings matched before a previous string match . // Try another code point span from before the last string match . int oldPos = pos ; pos = spanSet . spanBack ( s , oldPos , SpanCondition . CONTAINED ) ; spanLength = oldPos - pos ; if ( pos == 0 || // Reached the start of the string , or spanLength == 0 // neither strings nor span progressed . ) { return pos ; } continue ; // spanLength > 0 : Match strings from before a span . } else { // Try to match only one code point from before a string match if some // string matched beyond it , so that we try all possible positions // and don ' t overshoot . spanLength = spanOneBack ( spanSet , s , pos ) ; if ( spanLength > 0 ) { if ( spanLength == pos ) { return 0 ; // Reached the start of the string . } // Match strings before this code point . // There cannot be any decrements below it because UnicodeSet strings // contain multiple code points . pos -= spanLength ; offsets . shift ( spanLength ) ; spanLength = 0 ; continue ; // Match strings from before a single code point . } // Match strings from before the next string match . } } pos -= offsets . popMinimum ( null ) ; spanLength = 0 ; // Match strings from before a string match . }
public class ConcurrentLinkedHashMap { /** * Notifies the listener of entries that were evicted . */ void notifyListener ( ) { } }
Node < K , V > node ; while ( ( node = pendingNotifications . poll ( ) ) != null ) { listener . onEviction ( node . key , node . getValue ( ) ) ; }
public class CompressUtil { /** * compress a source file / directory to a tar file * @ param sources * @ param target * @ param mode * @ throws IOException */ public static void compressTar ( Resource [ ] sources , Resource target , int mode ) throws IOException { } }
compressTar ( sources , IOUtil . toBufferedOutputStream ( target . getOutputStream ( ) ) , mode ) ;
public class CommercePriceListAccountRelPersistenceImpl { /** * Returns the last commerce price list account rel in the ordered set where commercePriceListId = & # 63 ; . * @ param commercePriceListId the commerce price list ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching commerce price list account rel * @ throws NoSuchPriceListAccountRelException if a matching commerce price list account rel could not be found */ @ Override public CommercePriceListAccountRel findByCommercePriceListId_Last ( long commercePriceListId , OrderByComparator < CommercePriceListAccountRel > orderByComparator ) throws NoSuchPriceListAccountRelException { } }
CommercePriceListAccountRel commercePriceListAccountRel = fetchByCommercePriceListId_Last ( commercePriceListId , orderByComparator ) ; if ( commercePriceListAccountRel != null ) { return commercePriceListAccountRel ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "commercePriceListId=" ) ; msg . append ( commercePriceListId ) ; msg . append ( "}" ) ; throw new NoSuchPriceListAccountRelException ( msg . toString ( ) ) ;
public class NioSelectedKeySet { /** * { @ inheritDoc } */ public boolean add ( final SelectionKey selectionKey ) { } }
if ( null == selectionKey ) { return false ; } ensureCapacity ( size + 1 ) ; keys [ size ++ ] = selectionKey ; return true ;
public class Resource { /** * Set a baseline value . * @ param baselineNumber baseline index ( 1-10) * @ param value baseline value */ public void setBaselineWork ( int baselineNumber , Duration value ) { } }
set ( selectField ( ResourceFieldLists . BASELINE_WORKS , baselineNumber ) , value ) ;
public class LocalStore { /** * Returns the value for the given variable . { @ code element } must come from a call to { @ link * LocalVariableNode # getElement ( ) } or { @ link * org . checkerframework . javacutil . TreeUtils # elementFromDeclaration } ( { @ link * org . checkerframework . dataflow . cfg . node . VariableDeclarationNode # getTree ( ) } ) . */ @ Nullable private V getInformation ( Element element ) { } }
checkElementType ( element ) ; return contents . get ( checkNotNull ( element ) ) ;
public class JedisUtils { /** * Create a new { @ link JedisCluster } with specified pool configs . * @ param poolConfig * @ param hostsAndPorts * format { @ code host1 : port1 , host2 : port2 , . . . } , default Redis port is used if not * specified * @ param password * @ param timeoutMs * @ return */ public static JedisCluster newJedisCluster ( JedisPoolConfig poolConfig , String hostsAndPorts , String password , int timeoutMs ) { } }
return newJedisCluster ( poolConfig , hostsAndPorts , password , timeoutMs , 3 ) ;
public class Infer { /** * Incorporation error : mismatch between two ( or more ) bounds of same kind . */ void reportBoundError ( UndetVar uv , InferenceBound ib ) { } }
reportInferenceError ( String . format ( "incompatible.%s.bounds" , StringUtils . toLowerCase ( ib . name ( ) ) ) , uv . qtype , uv . getBounds ( ib ) ) ;
public class FieldTypeHelper { /** * Determines if this value is the default value for the given field type . * @ param type field type * @ param value value * @ return true if the value is not default */ public static final boolean valueIsNotDefault ( FieldType type , Object value ) { } }
boolean result = true ; if ( value == null ) { result = false ; } else { DataType dataType = type . getDataType ( ) ; switch ( dataType ) { case BOOLEAN : { result = ( ( Boolean ) value ) . booleanValue ( ) ; break ; } case CURRENCY : case NUMERIC : { result = ! NumberHelper . equals ( ( ( Number ) value ) . doubleValue ( ) , 0.0 , 0.00001 ) ; break ; } case DURATION : { result = ( ( ( Duration ) value ) . getDuration ( ) != 0 ) ; break ; } default : { break ; } } } return result ;
public class BatchedJmsTemplate { /** * Method replicates the simple logic from JmsTemplate # doReceive ( MessageConsumer , long ) which is private and therefore cannot be accessed from this class * @ param consumer The consumer to use * @ param timeout The timeout to apply * @ return A Message * @ throws JMSException Indicates an error occurred */ private Message doReceive ( MessageConsumer consumer , long timeout ) throws JMSException { } }
if ( timeout == RECEIVE_TIMEOUT_NO_WAIT ) { return consumer . receiveNoWait ( ) ; } else if ( timeout > 0 ) { return consumer . receive ( timeout ) ; } else { return consumer . receive ( ) ; }
public class ExecutorUtil { /** * 获取 BoundSql 属性值 additionalParameters * @ param boundSql * @ return */ public static Map < String , Object > getAdditionalParameter ( BoundSql boundSql ) { } }
try { return ( Map < String , Object > ) additionalParametersField . get ( boundSql ) ; } catch ( IllegalAccessException e ) { throw new PageException ( "获取 BoundSql 属性值 additionalParameters 失败: " + e , e ) ; }
public class RMItoIDL { /** * Returns the OMG IDL method name for a java overloaded method . < p > * For overloaded RMI / IDL methods , the mangled OMG IDL name is formed * by taking the Java method name and then appending two underscores , * followed by each of the fully qualified OMG IDL types of the * arguments separated by two underscores . < p > * @ param idlName OMG IDL method name for the java method , which may include * ' mangling ' for other conditions . * @ param method java overloaded method . */ private static String getOverloadedIdlName ( String idlName , Method method ) { } }
StringBuilder idlbldr = new StringBuilder ( idlName ) ; Class < ? > [ ] args = method . getParameterTypes ( ) ; if ( args . length == 0 ) { idlbldr . append ( "__" ) ; } else { StringBuilder arrayStr = new StringBuilder ( ) ; for ( Class < ? > argType : args ) { idlbldr . append ( "__" ) ; arrayStr . setLength ( 0 ) ; int arrayDimension = 0 ; while ( argType . isArray ( ) ) { ++ arrayDimension ; argType = argType . getComponentType ( ) ; } if ( arrayDimension > 0 ) { idlbldr . append ( "org_omg_boxedRMI_" ) ; arrayStr . append ( "seq" ) . append ( arrayDimension ) . append ( "_" ) ; } if ( argType . isPrimitive ( ) ) { if ( arrayDimension > 0 ) idlbldr . append ( arrayStr . toString ( ) ) ; if ( argType == Boolean . TYPE ) { idlbldr . append ( "boolean" ) ; } else if ( argType == Character . TYPE ) { idlbldr . append ( "wchar" ) ; } else if ( argType == Byte . TYPE ) { idlbldr . append ( "octet" ) ; } else if ( argType == Short . TYPE ) { idlbldr . append ( "short" ) ; } else if ( argType == Integer . TYPE ) { idlbldr . append ( "long" ) ; } else if ( argType == Long . TYPE ) { idlbldr . append ( "long_long" ) ; } else if ( argType == Float . TYPE ) { idlbldr . append ( "float" ) ; } else if ( argType == Double . TYPE ) { idlbldr . append ( "double" ) ; } } else { int unqualifiedLength = 0 ; if ( argType == String . class ) { idlbldr . append ( "CORBA_WStringValue" ) ; unqualifiedLength = 12 ; } else if ( argType == Class . class ) { idlbldr . append ( "javax_rmi_CORBA_ClassDesc" ) ; unqualifiedLength = 9 ; } else if ( argType == org . omg . CORBA . Object . class ) { idlbldr . append ( "Object" ) ; unqualifiedLength = 6 ; } else { // IDL Entity implementations must be ' boxed ' . d684761 if ( IDLEntity . class . isAssignableFrom ( argType ) && ! argType . isInterface ( ) && ! Throwable . class . isAssignableFrom ( argType ) ) { idlbldr . append ( BOXED_IDL ) ; } String typeName = argType . getName ( ) ; idlbldr . append ( typeName . replace ( '.' , '_' ) ) ; int unqualifiedOffset = typeName . lastIndexOf ( '.' ) + 1 ; unqualifiedLength = typeName . length ( ) - unqualifiedOffset ; } if ( arrayDimension > 0 ) { int seqIndex = idlbldr . length ( ) - unqualifiedLength ; idlbldr . insert ( seqIndex , arrayStr . toString ( ) ) ; } } } } return idlbldr . toString ( ) ;
public class GetRoutesResult { /** * The elements from this collection . * @ param items * The elements from this collection . */ public void setItems ( java . util . Collection < Route > items ) { } }
if ( items == null ) { this . items = null ; return ; } this . items = new java . util . ArrayList < Route > ( items ) ;
public class LDataObject { /** * Sets a new { @ link CEMILData } < code > frame < / code > for this cache object . * The key generated out of < code > frame < / code > ( i . e . out of the KNX address of * < code > frame < / code > ) has to be equal to the key of this { @ link LDataObject } , * as returned from { @ link # getKey ( ) } . Otherwise a * { @ link KNXIllegalArgumentException } will be thrown . < br > * Note that on successful set the timestamp is renewed . * @ param frame the new { @ link CEMILData } frame to set */ public synchronized void setFrame ( CEMILData frame ) { } }
if ( ! frame . getDestination ( ) . equals ( getKey ( ) ) ) throw new KNXIllegalArgumentException ( "frame key differs from cache key" ) ; value = frame ; resetTimestamp ( ) ;
public class ProjectApi { /** * Create a new project in the specified group . * @ param groupId the group ID to create the project under * @ param projectName the name of the project top create * @ return the created project * @ throws GitLabApiException if any exception occurs */ public Project createProject ( Integer groupId , String projectName ) throws GitLabApiException { } }
GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "namespace_id" , groupId ) . withParam ( "name" , projectName , true ) ; Response response = post ( Response . Status . CREATED , formData , "projects" ) ; return ( response . readEntity ( Project . class ) ) ;
public class Validator { /** * Validates that a given field has a numeric value * @ param name The field to check * @ param message A custom error message instead of the default one */ public void expectNumeric ( String name , String message ) { } }
String value = Optional . ofNullable ( get ( name ) ) . orElse ( "" ) ; if ( ! StringUtils . isNumeric ( value ) ) { addError ( name , Optional . ofNullable ( message ) . orElse ( messages . get ( Validation . NUMERIC_KEY . name ( ) , name ) ) ) ; }
public class StringUtil { /** * Finds the first occurrence of the targetString in the array of strings . * Returns - 1 if an occurrence wasn ' t found . This * method will return true if a " null " is contained in the array and the * targetString is also null . * @ param strings The array of strings to search . * @ param targetString The string to search for * @ return The index of the first occurrence , or - 1 if not found . If strings * array is null , will return - 1; */ static public int indexOf ( String [ ] strings , String targetString ) { } }
if ( strings == null ) return - 1 ; for ( int i = 0 ; i < strings . length ; i ++ ) { if ( strings [ i ] == null ) { if ( targetString == null ) { return i ; } } else { if ( targetString != null ) { if ( strings [ i ] . equals ( targetString ) ) { return i ; } } } } return - 1 ;
public class CommerceNotificationQueueEntryPersistenceImpl { /** * Returns the first commerce notification queue entry in the ordered set where sent = & # 63 ; . * @ param sent the sent * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching commerce notification queue entry * @ throws NoSuchNotificationQueueEntryException if a matching commerce notification queue entry could not be found */ @ Override public CommerceNotificationQueueEntry findBySent_First ( boolean sent , OrderByComparator < CommerceNotificationQueueEntry > orderByComparator ) throws NoSuchNotificationQueueEntryException { } }
CommerceNotificationQueueEntry commerceNotificationQueueEntry = fetchBySent_First ( sent , orderByComparator ) ; if ( commerceNotificationQueueEntry != null ) { return commerceNotificationQueueEntry ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "sent=" ) ; msg . append ( sent ) ; msg . append ( "}" ) ; throw new NoSuchNotificationQueueEntryException ( msg . toString ( ) ) ;
public class Clients { /** * Creates a new derived client that connects to the same { @ link URI } with the specified { @ code client } * and the specified { @ code additionalOptions } . * @ see ClientBuilder ClientBuilder , for more information about how the base options and * additional options are merged when a derived client is created . */ public static < T > T newDerivedClient ( T client , Iterable < ClientOptionValue < ? > > additionalOptions ) { } }
final ClientBuilderParams params = builderParams ( client ) ; final ClientBuilder builder = newDerivedBuilder ( params ) ; builder . options ( additionalOptions ) ; return newDerivedClient ( builder , params . clientType ( ) ) ;
public class ScriptPluginProviderLoader { /** * Get plugin metadatat from a zip file */ static PluginMeta loadMeta ( final File jar ) throws IOException { } }
FileInputStream fileInputStream = new FileInputStream ( jar ) ; try { final ZipInputStream zipinput = new ZipInputStream ( fileInputStream ) ; final PluginMeta metadata = ScriptPluginProviderLoader . loadMeta ( jar , zipinput ) ; return metadata ; } finally { fileInputStream . close ( ) ; }
public class JBBPBitInputStream { /** * Inside method to read a byte from stream . * @ return the read byte or - 1 if the end of the stream has been reached * @ throws IOException it will be thrown for transport errors */ private int readByteFromStream ( ) throws IOException { } }
int result = this . in . read ( ) ; if ( result >= 0 && this . msb0 ) { result = JBBPUtils . reverseBitsInByte ( ( byte ) result ) & 0xFF ; } return result ;
public class CharArrayList { /** * Compares this list to another object . If the argument is a { @ link java . util . List } , this method performs a lexicographical comparison ; otherwise , it throws a < code > ClassCastException < / code > . * @ param l a list . * @ return if the argument is a { @ link java . util . List } , a negative integer , zero , or a positive integer as this list is lexicographically less than , equal to , or greater than the argument . * @ throws ClassCastException if the argument is not a list . */ public int compareTo ( final List < ? extends Character > l ) { } }
if ( l == this ) return 0 ; if ( l instanceof CharArrayList ) { final CharListIterator i1 = listIterator ( ) , i2 = ( ( CharArrayList ) l ) . listIterator ( ) ; int r ; char e1 , e2 ; while ( i1 . hasNext ( ) && i2 . hasNext ( ) ) { e1 = i1 . nextChar ( ) ; e2 = i2 . nextChar ( ) ; if ( ( r = ( e1 - e2 ) ) != 0 ) return r ; } return i2 . hasNext ( ) ? - 1 : ( i1 . hasNext ( ) ? 1 : 0 ) ; } ListIterator < ? extends Character > i1 = listIterator ( ) , i2 = l . listIterator ( ) ; int r ; while ( i1 . hasNext ( ) && i2 . hasNext ( ) ) { if ( ( r = ( ( Comparable < ? super Character > ) i1 . next ( ) ) . compareTo ( i2 . next ( ) ) ) != 0 ) return r ; } return i2 . hasNext ( ) ? - 1 : ( i1 . hasNext ( ) ? 1 : 0 ) ;
public class Iterate { /** * Same as the select method with two parameters but uses the specified target collection * Example using Java 8 lambda : * < pre > * MutableList & lt ; Person & gt ; selected = * Iterate . < b > select < / b > ( people , person - > person . person . getLastName ( ) . equals ( " Smith " ) , FastList . newList ( ) ) ; * < / pre > * Example using anonymous inner class : * < pre > * MutableList & lt ; Person & gt ; selected = * Iterate . < b > select < / b > ( people , new Predicate & lt ; Person & gt ; ( ) * public boolean accept ( Person person ) * return person . person . getLastName ( ) . equals ( " Smith " ) ; * } , FastList . newList ( ) ) ; * < / pre > * Example using Predicates factory : * < pre > * MutableList & lt ; Person & gt ; selected = Iterate . < b > select < / b > ( collection , Predicates . attributeEqual ( " lastName " , " Smith " ) , FastList . newList ( ) ) ; * < / pre > */ public static < T , R extends Collection < T > > R select ( Iterable < T > iterable , Predicate < ? super T > predicate , R targetCollection ) { } }
if ( iterable instanceof RichIterable ) { return ( ( RichIterable < T > ) iterable ) . select ( predicate , targetCollection ) ; } if ( iterable instanceof ArrayList ) { return ArrayListIterate . select ( ( ArrayList < T > ) iterable , predicate , targetCollection ) ; } if ( iterable instanceof List ) { return ListIterate . select ( ( List < T > ) iterable , predicate , targetCollection ) ; } if ( iterable != null ) { return IterableIterate . select ( iterable , predicate , targetCollection ) ; } throw new IllegalArgumentException ( "Cannot perform a select on null" ) ;
public class NFSFileShareInfoMarshaller { /** * Marshall the given parameter object . */ public void marshall ( NFSFileShareInfo nFSFileShareInfo , ProtocolMarshaller protocolMarshaller ) { } }
if ( nFSFileShareInfo == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( nFSFileShareInfo . getNFSFileShareDefaults ( ) , NFSFILESHAREDEFAULTS_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getFileShareARN ( ) , FILESHAREARN_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getFileShareId ( ) , FILESHAREID_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getFileShareStatus ( ) , FILESHARESTATUS_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getGatewayARN ( ) , GATEWAYARN_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getKMSEncrypted ( ) , KMSENCRYPTED_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getKMSKey ( ) , KMSKEY_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getPath ( ) , PATH_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getRole ( ) , ROLE_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getLocationARN ( ) , LOCATIONARN_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getDefaultStorageClass ( ) , DEFAULTSTORAGECLASS_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getObjectACL ( ) , OBJECTACL_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getClientList ( ) , CLIENTLIST_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getSquash ( ) , SQUASH_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getReadOnly ( ) , READONLY_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getGuessMIMETypeEnabled ( ) , GUESSMIMETYPEENABLED_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getRequesterPays ( ) , REQUESTERPAYS_BINDING ) ; protocolMarshaller . marshall ( nFSFileShareInfo . getTags ( ) , TAGS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ManagerCommunicationExceptionMapper { /** * Maps exceptions received from * { @ link org . asteriskjava . manager . ManagerConnection } when sending a * { @ link org . asteriskjava . manager . action . ManagerAction } to the corresponding * { @ link org . asteriskjava . live . ManagerCommunicationException } . * @ param actionName name of the action that has been tried to send * @ param exception exception received * @ return the corresponding ManagerCommunicationException */ static ManagerCommunicationException mapSendActionException ( String actionName , Exception exception ) { } }
if ( exception instanceof IllegalStateException ) { return new ManagerCommunicationException ( "Not connected to Asterisk Server" , exception ) ; } else if ( exception instanceof EventTimeoutException ) { return new ManagerCommunicationException ( "Timeout waiting for events from " + actionName + "Action" , exception ) ; } else { return new ManagerCommunicationException ( "Unable to send " + actionName + "Action" , exception ) ; }
public class ArrayQueue { /** * Retrieves and removes the head of the queue represented by this queue . * This method differs from { @ link # poll poll } only in that it throws an * exception if this queue is empty . * @ return the head of the queue represented by this queue * @ throws NoSuchElementException { @ inheritDoc } */ @ Override public E remove ( ) { } }
E x = poll ( ) ; if ( x == null ) throw new NoSuchElementException ( ) ; return x ;
public class URIDestinationCreator { /** * This method is used by encodeMap ( ) to escape ? s and \ s in the dest name . * NB This method will fail if called multiple times on the same string , * e . g . foo ? bar - > foo \ ? bar - > foo \ \ \ ? bar etc . */ public static String escapeDestName ( String destName ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "escapeDestName" , destName ) ; if ( destName != null ) { // check for unescaped ' \ ' chars int nextIndex = 0 ; while ( ( nextIndex = destName . indexOf ( '\\' , nextIndex ) ) != - 1 ) { char nextChar = ( char ) - 1 ; if ( ( nextIndex + 1 ) < destName . length ( ) ) nextChar = destName . charAt ( nextIndex + 1 ) ; if ( nextChar != CHAR_BACKSLASH ) { // add in an escape char destName = destName . substring ( 0 , nextIndex ) + STRING_BACKSLASH + destName . substring ( nextIndex ) ; } nextIndex += 2 ; // need to move on by two } // check for unescaped ' ? ' chars nextIndex = 0 ; while ( ( nextIndex = destName . indexOf ( '?' , nextIndex ) ) != - 1 ) { if ( ! charIsEscaped ( destName , nextIndex ) ) { // add in an escape char destName = destName . substring ( 0 , nextIndex ) + STRING_BACKSLASH + destName . substring ( nextIndex ) ; } nextIndex ++ ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "escapeDestName" , destName ) ; return destName ;
public class StatCollector { /** * { @ inheritDoc } * < p > Climbs the class hierarchy finding all annotated members . */ @ Override public List < MemberAnnotatedWithAtStat > apply ( Class < ? > clazz ) { } }
List < MemberAnnotatedWithAtStat > annotatedMembers = Lists . newArrayList ( ) ; for ( Class < ? > currentClass = clazz ; currentClass != Object . class ; currentClass = currentClass . getSuperclass ( ) ) { for ( Method method : currentClass . getDeclaredMethods ( ) ) { Stat stat = method . getAnnotation ( Stat . class ) ; if ( stat != null && staticMemberPolicy . shouldAccept ( method ) ) { annotatedMembers . add ( new MemberAnnotatedWithAtStat ( stat , method ) ) ; } } for ( Field field : currentClass . getDeclaredFields ( ) ) { Stat stat = field . getAnnotation ( Stat . class ) ; if ( stat != null && staticMemberPolicy . shouldAccept ( field ) ) { annotatedMembers . add ( new MemberAnnotatedWithAtStat ( stat , field ) ) ; } } } return annotatedMembers ;