signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class IPv6AddressSection { /** * Merges this with the list of sections to produce the smallest array of prefix blocks , going from smallest to largest
* @ param sections the sections to merge with this
* @ return */
public IPv6AddressSection [ ] mergeToPrefixBlocks ( IPv6AddressSection ... sections ) throws SizeMismatchException , AddressPositionException { } } | for ( int i = 0 ; i < sections . length ; i ++ ) { IPv6AddressSection section = sections [ i ] ; if ( section . addressSegmentIndex != addressSegmentIndex ) { throw new AddressPositionException ( section , section . addressSegmentIndex , addressSegmentIndex ) ; } } List < IPAddressSegmentSeries > blocks = getMergedPrefixBlocks ( this , sections , true ) ; return blocks . toArray ( new IPv6AddressSection [ blocks . size ( ) ] ) ; |
public class CStrChunk { /** * Optimized trim ( ) method to operate across the entire CStrChunk buffer in one pass .
* This mimics Java String . trim ( ) by only considering characters of value
* < code > ' & # 92 ; u0020 ' < / code > or less as whitespace to be trimmed . This means that like
* Java ' s String . trim ( ) it ignores 16 of the 17 characters regarded as a space in UTF .
* NewChunk is the same size as the original , despite trimming .
* @ param nc NewChunk to be filled with trimmed version of strings in this chunk
* @ return Filled NewChunk */
public NewChunk asciiTrim ( NewChunk nc ) { } } | // copy existing data
nc = this . extractRows ( nc , 0 , _len ) ; // update offsets and byte array
for ( int i = 0 ; i < _len ; i ++ ) { int j = 0 ; int off = UnsafeUtils . get4 ( _mem , idx ( i ) ) ; if ( off != NA ) { // UTF chars will appear as negative values . In Java spec , space is any char 0x20 and lower
while ( _mem [ _valstart + off + j ] > 0 && _mem [ _valstart + off + j ] < 0x21 ) j ++ ; if ( j > 0 ) nc . set_is ( i , off + j ) ; while ( _mem [ _valstart + off + j ] != 0 ) j ++ ; // Find end
j -- ; while ( _mem [ _valstart + off + j ] > 0 && _mem [ _valstart + off + j ] < 0x21 ) { // March back to find first non - space
nc . _ss [ off + j ] = 0 ; // Set new end
j -- ; } } } return nc ; |
public class DefaultGridRegistry { /** * mark the session as finished for the registry . The resources that were associated to it are now
* free to be reserved by other tests
* @ param session The session
* @ param reason the reason for the release */
private void release ( TestSession session , SessionTerminationReason reason ) { } } | try { lock . lock ( ) ; boolean removed = activeTestSessions . remove ( session , reason ) ; if ( removed ) { fireMatcherStateChanged ( ) ; } } finally { lock . unlock ( ) ; } |
public class WDataTableRenderer { /** * Paint the rowSelection aspects of the WDataTable .
* @ param table the WDataTable being rendered
* @ param xml the string builder in use */
private void paintRowSelectionElement ( final WDataTable table , final XmlStringBuilder xml ) { } } | boolean multiple = table . getSelectMode ( ) == SelectMode . MULTIPLE ; xml . appendTagOpen ( "ui:rowselection" ) ; xml . appendOptionalAttribute ( "multiple" , multiple , "true" ) ; if ( multiple ) { switch ( table . getSelectAllMode ( ) ) { case CONTROL : xml . appendAttribute ( "selectAll" , "control" ) ; break ; case TEXT : xml . appendAttribute ( "selectAll" , "text" ) ; break ; case NONE : break ; default : throw new SystemException ( "Unknown select-all mode: " + table . getSelectAllMode ( ) ) ; } } xml . appendOptionalAttribute ( "groupName" , table . getSelectGroup ( ) ) ; xml . appendEnd ( ) ; |
public class InstrumentedExecutors { /** * Creates a single - threaded instrumented executor that can schedule commands
* to run after a given delay , or to execute periodically . ( Note
* however that if this single thread terminates due to a failure
* during execution prior to shutdown , a new one will take its
* place if needed to execute subsequent tasks . ) Tasks are
* guaranteed to execute sequentially , and no more than one task
* will be active at any given time . Unlike the otherwise
* equivalent { @ code newScheduledThreadPool ( 1 , threadFactory ) }
* the returned executor is guaranteed not to be reconfigurable to
* use additional threads .
* @ param threadFactory the factory to use when creating new threads
* @ param registry the { @ link MetricRegistry } that will contain the metrics .
* @ param name the ( metrics ) name for this executor service , see { @ link MetricRegistry # name ( String , String . . . ) } .
* @ return a newly created scheduled executor
* @ throws NullPointerException if threadFactory is null
* @ see Executors # newSingleThreadExecutor ( ThreadFactory ) */
public static InstrumentedScheduledExecutorService newSingleThreadScheduledExecutor ( ThreadFactory threadFactory , MetricRegistry registry , String name ) { } } | return new InstrumentedScheduledExecutorService ( Executors . newSingleThreadScheduledExecutor ( threadFactory ) , registry , name ) ; |
public class RepeaterComponent { /** * { @ inheritDoc } */
@ Override public void updateComponent ( final Object data ) { } } | SomeDataBean bean = ( SomeDataBean ) data ; field1Text . setText ( bean . getField1 ( ) ) ; field2Text . setText ( bean . getField2 ( ) ) ; |
public class CTInboxStyleConfig { /** * Sets the name of the optional two tabs .
* The contents of the tabs are filtered based on the name of the tab .
* @ param tabs ArrayList of Strings */
public void setTabs ( ArrayList < String > tabs ) { } } | if ( tabs == null || tabs . size ( ) <= 0 ) return ; if ( platformSupportsTabs ) { ArrayList < String > toAdd ; if ( tabs . size ( ) > MAX_TABS ) { toAdd = new ArrayList < > ( tabs . subList ( 0 , MAX_TABS ) ) ; } else { toAdd = tabs ; } this . tabs = toAdd . toArray ( new String [ 0 ] ) ; } else { Logger . d ( "Please upgrade com.android.support:design library to v28.0.0 to enable Tabs for App Inbox, dropping Tabs" ) ; } |
public class AVIMConversation { /** * 获取最新的消息记录
* @ param limit
* @ param callback */
public void queryMessages ( final int limit , final AVIMMessagesQueryCallback callback ) { } } | if ( limit <= 0 || limit > 1000 ) { if ( callback != null ) { callback . internalDone ( null , new AVException ( new IllegalArgumentException ( "limit should be in [1, 1000]" ) ) ) ; } } // 如果屏蔽了本地缓存则全部走网络
if ( ! AVIMOptions . getGlobalOptions ( ) . isMessageQueryCacheEnabled ( ) ) { queryMessagesFromServer ( null , 0 , limit , null , 0 , new AVIMMessagesQueryCallback ( ) { @ Override public void done ( List < AVIMMessage > messages , AVIMException e ) { if ( callback != null ) { if ( e != null ) { callback . internalDone ( e ) ; } else { callback . internalDone ( messages , null ) ; } } } } ) ; return ; } if ( ! AppConfiguration . getGlobalNetworkingDetector ( ) . isConnected ( ) ) { queryMessagesFromCache ( null , 0 , limit , callback ) ; } else { // 选择最后一条有 breakpoint 为 false 的消息做截断 , 因为是 true 的话 , 会造成两次查询 。
// 在 queryMessages 还是遇到 breakpoint , 再次查询了
long cacheMessageCount = storage . getMessageCount ( conversationId ) ; long toTimestamp = 0 ; String toMsgId = null ; // 如果本地的缓存的量都不够的情况下 , 应该要去服务器查询 , 以免第一次查询的时候出现limit跟返回值不一致让用户认为聊天记录已经到头的问题
if ( cacheMessageCount >= limit ) { final AVIMMessage latestMessage = storage . getLatestMessageWithBreakpoint ( conversationId , false ) ; if ( latestMessage != null ) { toMsgId = latestMessage . getMessageId ( ) ; toTimestamp = latestMessage . getTimestamp ( ) ; } } // 去服务器查询最新消息 , 看是否在其它终端产生过消息 。 为省流量 , 服务器会截断至 toMsgId 、 toTimestamp
queryMessagesFromServer ( null , 0 , limit , toMsgId , toTimestamp , new AVIMMessagesQueryCallback ( ) { @ Override public void done ( List < AVIMMessage > messages , AVIMException e ) { if ( e != null ) { // 如果遇到本地错误或者网络错误 , 直接返回缓存数据
if ( e . getCode ( ) == AVIMException . TIMEOUT || e . getCode ( ) == 0 || e . getCode ( ) == 3000 ) { queryMessagesFromCache ( null , 0 , limit , callback ) ; } else { if ( callback != null ) { callback . internalDone ( e ) ; } } } else { if ( null == messages || messages . size ( ) < 1 ) { // 这种情况就说明我们的本地消息缓存是最新的
} else { /* * 1 . messages . size ( ) < = limit & & messages . contains ( latestMessage )
* 这种情况就说明在本地客户端退出后 , 该用户在其他客户端也产生了聊天记录而没有缓存到本地来 , 且产生了小于一页的聊天记录
* 2 . messages = = limit & & ! messages . contains ( latestMessage )
* 这种情况就说明在本地客户端退出后 , 该用户在其他客户端也产生了聊天记录而没有缓存到本地来 , 且产生了大于一页的聊天记录 */
processContinuousMessages ( messages ) ; } queryMessagesFromCache ( null , 0 , limit , callback ) ; } } } ) ; } |
public class StylesheetHandler { /** * Pop the last stylesheet pushed , and return the stylesheet that this
* handler is constructing , and set the last popped stylesheet member .
* Also pop the stylesheet locator stack .
* @ return The stylesheet popped off the stack , or the last popped stylesheet . */
Stylesheet popStylesheet ( ) { } } | // The stylesheetLocatorStack needs to be popped because
// a locator was pushed in for this stylesheet by the SAXparser by calling
// setDocumentLocator ( ) .
if ( ! m_stylesheetLocatorStack . isEmpty ( ) ) m_stylesheetLocatorStack . pop ( ) ; if ( ! m_stylesheets . isEmpty ( ) ) m_lastPoppedStylesheet = ( Stylesheet ) m_stylesheets . pop ( ) ; // Shouldn ' t this be null if stylesheets is empty ? - sb
return m_lastPoppedStylesheet ; |
public class ConverterForRSS091Userland { /** * synd . description - > rss . description */
@ Override protected Item createRSSItem ( final SyndEntry sEntry ) { } } | final Item item = super . createRSSItem ( sEntry ) ; item . setComments ( sEntry . getComments ( ) ) ; final SyndContent sContent = sEntry . getDescription ( ) ; if ( sContent != null ) { item . setDescription ( createItemDescription ( sContent ) ) ; } final List < SyndContent > contents = sEntry . getContents ( ) ; if ( Lists . isNotEmpty ( contents ) ) { final SyndContent syndContent = contents . get ( 0 ) ; final Content cont = new Content ( ) ; cont . setValue ( syndContent . getValue ( ) ) ; cont . setType ( syndContent . getType ( ) ) ; item . setContent ( cont ) ; } return item ; |
public class JobResourceMarshaller { /** * Marshall the given parameter object . */
public void marshall ( JobResource jobResource , ProtocolMarshaller protocolMarshaller ) { } } | if ( jobResource == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( jobResource . getS3Resources ( ) , S3RESOURCES_BINDING ) ; protocolMarshaller . marshall ( jobResource . getLambdaResources ( ) , LAMBDARESOURCES_BINDING ) ; protocolMarshaller . marshall ( jobResource . getEc2AmiResources ( ) , EC2AMIRESOURCES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ApkBuilder { /** * Checks whether a folder and its content is valid for packaging into the . apk as
* standard Java resource .
* @ param folderName the name of the folder . */
public static boolean checkFolderForPackaging ( String folderName ) { } } | return ! folderName . equalsIgnoreCase ( "CVS" ) && ! folderName . equalsIgnoreCase ( ".svn" ) && ! folderName . equalsIgnoreCase ( "SCCS" ) && ! folderName . startsWith ( "_" ) ; |
public class SerializerIntrinsics { /** * Accumulate CRC32 Value ( polynomial 0x11EDC6F41 ) ( SSE4.2 ) . */
public final void crc32 ( Register dst , Register src ) { } } | assert ( dst . isRegType ( REG_GPD ) || dst . isRegType ( REG_GPQ ) ) ; emitX86 ( INST_CRC32 , dst , src ) ; |
public class XianDataSource { /** * parse the url and get the host and port string .
* @ return the host : port string */
private String hostAndPort ( ) { } } | int start = url . indexOf ( "://" ) + 3 ; int end = url . indexOf ( "/" , start ) ; return url . substring ( start , end ) ; |
public class QueryAndParameterAppender { /** * Range query parameters - - - - - */
public < T > void addRangeQueryParameters ( List < ? extends Object > paramList , String listId , Class < T > type , String fieldName , String joinClause , boolean union ) { } } | List < T > listIdParams ; if ( paramList != null && paramList . size ( ) > 0 ) { Object inputObject = paramList . get ( 0 ) ; if ( inputObject == null ) { inputObject = paramList . get ( 1 ) ; if ( inputObject == null ) { return ; } } listIdParams = checkAndConvertListToType ( paramList , inputObject , listId , type ) ; } else { return ; } T min = listIdParams . get ( 0 ) ; T max = listIdParams . get ( 1 ) ; Map < String , T > paramNameMinMaxMap = new HashMap < String , T > ( 2 ) ; StringBuilder queryClause = new StringBuilder ( "( " ) ; if ( joinClause != null ) { queryClause . append ( "( " ) ; } queryClause . append ( fieldName ) ; if ( min == null ) { if ( max == null ) { return ; } else { // only max
String maxParamName = generateParamName ( ) ; queryClause . append ( " <= :" + maxParamName + " " ) ; paramNameMinMaxMap . put ( maxParamName , max ) ; } } else if ( max == null ) { // only min
String minParamName = generateParamName ( ) ; queryClause . append ( " >= :" + minParamName + " " ) ; paramNameMinMaxMap . put ( minParamName , min ) ; } else { // both min and max
String minParamName = generateParamName ( ) ; String maxParamName = generateParamName ( ) ; if ( union ) { queryClause . append ( " >= :" + minParamName + " OR " + fieldName + " <= :" + maxParamName + " " ) ; } else { queryClause . append ( " BETWEEN :" + minParamName + " AND :" + maxParamName + " " ) ; } paramNameMinMaxMap . put ( minParamName , min ) ; paramNameMinMaxMap . put ( maxParamName , max ) ; } if ( joinClause != null ) { queryClause . append ( ") and " + joinClause . trim ( ) + " " ) ; } queryClause . append ( ")" ) ; // add query string to query builder and fill params map
internalAddToQueryBuilder ( queryClause . toString ( ) , union ) ; for ( Entry < String , T > nameMinMaxEntry : paramNameMinMaxMap . entrySet ( ) ) { addNamedQueryParam ( nameMinMaxEntry . getKey ( ) , nameMinMaxEntry . getValue ( ) ) ; } queryBuilderModificationCleanup ( ) ; |
public class GeoPackageCoreConnection { /** * Query the SQL for a single result object
* @ param sql
* sql statement
* @ param args
* arguments
* @ param column
* column index
* @ return result , null if no result
* @ since 3.1.0 */
public Object querySingleResult ( String sql , String [ ] args , int column ) { } } | return querySingleResult ( sql , args , column , null ) ; |
public class Range { /** * < p > Checks whether this range is completely before the specified range . < / p >
* < p > This method may fail if the ranges have two different comparators or element types . < / p >
* @ param otherRange the range to check , null returns false
* @ return true if this range is completely before the specified range
* @ throws RuntimeException if ranges cannot be compared */
public boolean isBeforeRange ( final Range < T > otherRange ) { } } | if ( otherRange == null ) { return false ; } return isBefore ( otherRange . minimum ) ; |
public class ConfluenceGreenPepper { /** * < p > getText . < / p >
* @ param key a { @ link java . lang . String } object .
* @ param arguments a { @ link java . lang . Object } object .
* @ return a { @ link java . lang . String } object . */
@ HtmlSafe public String getText ( String key , Object ... arguments ) { } } | return I18nUtil . getText ( key , getResourceBundle ( ) , arguments ) ; |
public class BigDecimal { /** * Reconstitute the { @ code BigDecimal } instance from a stream ( that is ,
* deserialize it ) .
* @ param s the stream being read . */
private void readObject ( java . io . ObjectInputStream s ) throws java . io . IOException , ClassNotFoundException { } } | // Read in all fields
s . defaultReadObject ( ) ; // validate possibly bad fields
if ( intVal == null ) { String message = "BigDecimal: null intVal in stream" ; throw new java . io . StreamCorruptedException ( message ) ; // [ all values of scale are now allowed ]
} UnsafeHolder . setIntCompactVolatile ( this , compactValFor ( intVal ) ) ; |
public class ApiOvhDedicatedserver { /** * Request an acces on KVM IPMI interface
* REST : POST / dedicated / server / { serviceName } / features / ipmi / access
* @ param ttl [ required ] Session access time to live in minutes
* @ param type [ required ] IPMI console access
* @ param ipToAllow [ required ] IP to allow connection from for this IPMI session
* @ param sshKey [ required ] SSH key name to allow access on KVM / IP interface with ( name from / me / sshKey )
* @ param serviceName [ required ] The internal name of your dedicated server */
public OvhTask serviceName_features_ipmi_access_POST ( String serviceName , String ipToAllow , String sshKey , OvhCacheTTLEnum ttl , OvhIpmiAccessTypeEnum type ) throws IOException { } } | String qPath = "/dedicated/server/{serviceName}/features/ipmi/access" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "ipToAllow" , ipToAllow ) ; addBody ( o , "sshKey" , sshKey ) ; addBody ( o , "ttl" , ttl ) ; addBody ( o , "type" , type ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhTask . class ) ; |
public class Utils { /** * range iterator */
public static List < Integer > range ( final int begin , final int end ) { } } | return new AbstractList < Integer > ( ) { @ Override public Integer get ( int index ) { return begin + index ; } @ Override public int size ( ) { return end - begin ; } } ; |
public class SQLTransformer { /** * Gets the sql transform .
* @ param typeName
* the type name
* @ return the sql transform */
static SQLTransform getSqlTransform ( TypeName typeName ) { } } | if ( Time . class . getName ( ) . equals ( typeName . toString ( ) ) ) { return new SQLTimeSQLTransform ( ) ; } if ( java . sql . Date . class . getName ( ) . equals ( typeName . toString ( ) ) ) { return new SQLDateSQLTransform ( ) ; } return null ; |
public class Utils { /** * Get max image size .
* @ return max image size
* @ see # MAX _ IMAGE _ SIDE _ SIZE _ IN _ PIXELS
* @ see # PROPERTY _ MAX _ EMBEDDED _ IMAGE _ SIDE _ SIZE */
public static int getMaxImageSize ( ) { } } | int result = MAX_IMAGE_SIDE_SIZE_IN_PIXELS ; try { final String defined = System . getProperty ( PROPERTY_MAX_EMBEDDED_IMAGE_SIDE_SIZE ) ; if ( defined != null ) { LOGGER . info ( "Detected redefined max size for embedded image side : " + defined ) ; // NOI18N
result = Math . max ( 8 , Integer . parseInt ( defined . trim ( ) ) ) ; } } catch ( NumberFormatException ex ) { LOGGER . error ( "Error during image size decoding : " , ex ) ; // NOI18N
} return result ; |
public class CategoryGraph { /** * Serializes the graph to the given destination .
* @ param destination The destination to which should be saved .
* @ throws WikiApiException Thrown if errors occurred . */
public void saveGraph ( String destination ) throws WikiApiException { } } | try { GraphSerialization . saveGraph ( graph , destination ) ; } catch ( IOException e ) { throw new WikiApiException ( e ) ; } |
public class Encoder { /** * Create the temp parity file and rename to the partial parity directory */
public boolean encodeTmpParityFile ( Configuration jobConf , StripeReader sReader , FileSystem parityFs , Path partialTmpParity , Path parityFile , short tmpRepl , long blockSize , long expectedPartialParityBlocks , long expectedPartialParityFileSize , Progressable reporter ) throws IOException , InterruptedException { } } | // Create a tmp file to which we will write first .
String jobID = RaidNode . getJobID ( jobConf ) ; Path tmpDir = new Path ( codec . tmpParityDirectory , jobID ) ; if ( ! parityFs . mkdirs ( tmpDir ) ) { throw new IOException ( "Could not create tmp dir " + tmpDir ) ; } Path parityTmp = new Path ( tmpDir , parityFile . getName ( ) + rand . nextLong ( ) ) ; FSDataOutputStream out = parityFs . create ( parityTmp , true , conf . getInt ( "io.file.buffer.size" , 64 * 1024 ) , tmpRepl , blockSize ) ; try { CRC32 [ ] crcOuts = null ; if ( checksumStore != null ) { crcOuts = new CRC32 [ ( int ) expectedPartialParityBlocks ] ; } encodeFileToStream ( sReader , blockSize , out , crcOuts , reporter ) ; out . close ( ) ; out = null ; LOG . info ( "Wrote temp parity file " + parityTmp ) ; FileStatus tmpStat = parityFs . getFileStatus ( parityTmp ) ; if ( tmpStat . getLen ( ) != expectedPartialParityFileSize ) { InjectionHandler . processEventIO ( InjectionEvent . RAID_ENCODING_FAILURE_PARTIAL_PARITY_SIZE_MISMATCH ) ; throw new IOException ( "Expected partial parity size " + expectedPartialParityFileSize + " does not match actual " + tmpStat . getLen ( ) + " in path " + tmpStat . getPath ( ) ) ; } InjectionHandler . processEventIO ( InjectionEvent . RAID_ENCODING_FAILURE_PUT_CHECKSUM ) ; if ( checksumStore != null ) { this . writeToChecksumStore ( ( DistributedFileSystem ) parityFs , crcOuts , parityTmp , expectedPartialParityFileSize , reporter ) ; } if ( ! parityFs . rename ( parityTmp , partialTmpParity ) ) { LOG . warn ( "Fail to rename file " + parityTmp + " to " + partialTmpParity ) ; return false ; } LOG . info ( "renamed " + parityTmp + " to " + partialTmpParity ) ; return true ; } finally { try { if ( out != null ) { out . close ( ) ; } } finally { parityFs . delete ( parityTmp , false ) ; } } |
public class MediaClient { /** * Retrieve the status of a job .
* @ param request The request object containing all options for retrieving job status .
* @ return The status of a job . */
public GetTranscodingJobResponse getTranscodingJob ( GetTranscodingJobRequest request ) { } } | checkNotNull ( request , "The parameter request should NOT be null." ) ; checkStringNotEmpty ( request . getJobId ( ) , "The parameter jobId should NOT be null or empty string." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . GET , request , TRANSCODE_JOB , request . getJobId ( ) ) ; return invokeHttpClient ( internalRequest , GetTranscodingJobResponse . class ) ; |
public class FileUtil { /** * 删除文件或者文件夹 < br >
* 注意 : 删除文件夹时不会判断文件夹是否为空 , 如果不空则递归删除子文件或文件夹 < br >
* 某个文件删除失败会终止删除操作
* @ param file 文件对象
* @ return 成功与否
* @ throws IORuntimeException IO异常 */
public static boolean del ( File file ) throws IORuntimeException { } } | if ( file == null || false == file . exists ( ) ) { // 如果文件不存在或已被删除 , 此处返回true表示删除成功
return true ; } if ( file . isDirectory ( ) ) { // 清空目录下所有文件和目录
boolean isOk = clean ( file ) ; if ( false == isOk ) { return false ; } } // 删除文件或清空后的目录
return file . delete ( ) ; |
public class CoGProperties { /** * Retrieves the location of the proxy file .
* It first checks the X509 _ USER _ PROXY system property . If the property
* is not set , it checks next the ' proxy ' property in the current
* configuration . If that property is not set , then it defaults to a
* value based on the following rules : < BR >
* If a UID system property is set , and running on a Unix machine it
* returns / tmp / x509up _ u $ { UID } . If any other machine then Unix , it returns
* $ { tempdir } / x509up _ u $ { UID } , where tempdir is a platform - specific
* temporary directory as indicated by the java . io . tmpdir system property .
* If a UID system property is not set , the username will be used instead
* of the UID . That is , it returns $ { tempdir } / x509up _ u _ $ { username }
* < BR >
* This is done this way because Java is not able to obtain the current
* uid .
* @ return < code > String < / code > the location of the proxy file */
public String getProxyFile ( ) { } } | String location ; location = System . getProperty ( "X509_USER_PROXY" ) ; if ( location != null ) { return location ; } location = getProperty ( "proxy" ) ; if ( location != null ) { return location ; } return ConfigUtil . discoverProxyLocation ( ) ; |
public class MQLinkControl { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . runtime . MediatedMessageHandlerControl # getState ( ) */
public String getState ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getState" ) ; String state = messageProcessor . getDestinationManager ( ) . getLinkIndex ( ) . getState ( baseDest ) . toString ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "getState" , state ) ; return state ; |
public class EmbeddableTranManagerSet { /** * / * Called by ConnectO and LocalTransactionWrapper */
public boolean enlistOnePhase ( UOWCoordinator coord , OnePhaseXAResource opXaRes ) throws RollbackException , IllegalStateException , SystemException { } } | final boolean traceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "enlistOnePhase" , new Object [ ] { coord , opXaRes } ) ; boolean result = false ; if ( coord instanceof TransactionImpl ) { try { result = ( ( TransactionImpl ) coord ) . enlistResource ( opXaRes ) ; } finally { if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistOnePhase" , result ) ; } } else { final SystemException se = new SystemException ( "Invalid UOWCoordinator" ) ; FFDCFilter . processException ( se , "com.ibm.ws.Transaction.JTA.TranManagerSet.enlistOnePhase" , "405" , this ) ; if ( traceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "enlistOnePhase" , se ) ; throw se ; } return result ; |
public class CmsADESessionCache { /** * Get cached value that is dynamically loaded by the Acacia content editor .
* @ param attribute the attribute to load the value to
* @ return the cached value */
public String getDynamicValue ( String attribute ) { } } | return null == m_dynamicValues ? null : m_dynamicValues . get ( attribute ) ; |
public class Histogram { /** * Returns the number of bins by Scott ' s rule h = 3.5 * & sigma ; / ( n < sup > 1/3 < / sup > ) .
* @ param x the data set .
* @ return the number of bins */
public static int scott ( double [ ] x ) { } } | double h = Math . ceil ( 3.5 * Math . sd ( x ) / Math . pow ( x . length , 1.0 / 3 ) ) ; return bins ( x , h ) ; |
public class ConfigurationImpl { /** * Decide the page which will appear first in the right - hand frame . It will
* be " overview - summary . html " if " - overview " option is used or no
* " - overview " but the number of packages is more than one . It will be
* " package - summary . html " of the respective package if there is only one
* package to document . It will be a class page ( first in the sorted order ) ,
* if only classes are provided on the command line .
* @ param root Root of the program structure . */
protected void setTopFile ( RootDoc root ) { } } | if ( ! checkForDeprecation ( root ) ) { return ; } if ( createoverview ) { topFile = DocPaths . OVERVIEW_SUMMARY ; } else { if ( packages . length == 1 && packages [ 0 ] . name ( ) . equals ( "" ) ) { if ( root . classes ( ) . length > 0 ) { ClassDoc [ ] classarr = root . classes ( ) ; Arrays . sort ( classarr ) ; ClassDoc cd = getValidClass ( classarr ) ; topFile = DocPath . forClass ( cd ) ; } } else { topFile = DocPath . forPackage ( packages [ 0 ] ) . resolve ( DocPaths . PACKAGE_SUMMARY ) ; } } |
public class ResourceBundlesHandlerImpl { /** * ( non - Javadoc )
* @ see net . jawr . web . resource . bundle . handler . ResourceBundlesHandler #
* setBundlingProcessLifeCycleListeners ( java . util . List ) */
@ Override public void setBundlingProcessLifeCycleListeners ( List < BundlingProcessLifeCycleListener > listeners ) { } } | this . lifeCycleListeners . clear ( ) ; this . lifeCycleListeners . addAll ( listeners ) ; |
public class af_persistant_stat_info { /** * < pre >
* Use this operation to delete a property .
* < / pre > */
public static af_persistant_stat_info delete ( nitro_service client , af_persistant_stat_info resource ) throws Exception { } } | resource . validate ( "delete" ) ; return ( ( af_persistant_stat_info [ ] ) resource . delete_resource ( client ) ) [ 0 ] ; |
public class ST_Interpolate3DLine { /** * Interpolate a linestring according the start and the end coordinates z
* value . If the start or the end z is NaN return the input linestring
* @ param lineString
* @ return */
private static LineString linearZInterpolation ( LineString lineString ) { } } | double startz = lineString . getStartPoint ( ) . getCoordinate ( ) . z ; double endz = lineString . getEndPoint ( ) . getCoordinate ( ) . z ; if ( Double . isNaN ( startz ) || Double . isNaN ( endz ) ) { return lineString ; } else { double length = lineString . getLength ( ) ; lineString . apply ( new LinearZInterpolationFilter ( startz , endz , length ) ) ; return lineString ; } |
public class Matrix3f { /** * Apply an oblique projection transformation to this matrix with the given values for < code > a < / code > and
* < code > b < / code > .
* If < code > M < / code > is < code > this < / code > matrix and < code > O < / code > the oblique transformation matrix ,
* then the new matrix will be < code > M * O < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * O * v < / code > , the
* oblique transformation will be applied first !
* The oblique transformation is defined as :
* < pre >
* x ' = x + a * z
* y ' = y + a * z
* z ' = z
* < / pre >
* or in matrix form :
* < pre >
* 1 0 a
* 0 1 b
* 0 0 1
* < / pre >
* @ param a
* the value for the z factor that applies to x
* @ param b
* the value for the z factor that applies to y
* @ return this */
public Matrix3f obliqueZ ( float a , float b ) { } } | this . m20 = m00 * a + m10 * b + m20 ; this . m21 = m01 * a + m11 * b + m21 ; this . m22 = m02 * a + m12 * b + m22 ; return this ; |
public class EmbeddedCLIServiceClient { /** * / * ( non - Javadoc )
* @ see org . apache . hive . service . cli . CLIServiceClient # openSession ( java . lang . String , java . lang . String , java . util . Map ) */
@ Override public SessionHandle openSession ( String username , String password , Map < String , String > configuration ) throws HiveSQLException { } } | return cliService . openSession ( username , password , configuration ) ; |
public class AlignmentTools { /** * Applies an alignment k times . Eg if alignmentMap defines function f ( x ) ,
* this returns a function f ^ k ( x ) = f ( f ( . . . f ( x ) . . . ) ) .
* To allow for functions with different domains and codomains , the identity
* function allows converting back in a reasonable way . For instance , if
* alignmentMap represented an alignment between two proteins with different
* numbering schemes , the identity function could calculate the offset
* between residue numbers , eg I ( x ) = x - offset .
* When an identity function is provided , the returned function calculates
* f ^ k ( x ) = f ( I ( f ( I ( . . . f ( x ) . . . ) ) ) ) .
* @ param < S >
* @ param < T >
* @ param alignmentMap The input function , as a map ( see { @ link AlignmentTools # alignmentAsMap ( AFPChain ) } )
* @ param identity An identity - like function providing the isomorphism between
* the codomain of alignmentMap ( of type < T > ) and the domain ( type < S > ) .
* @ param k The number of times to apply the alignment
* @ return A new alignment . If the input function is not automorphic
* ( one - to - one ) , then some inputs may map to null , indicating that the
* function is undefined for that input . */
public static < S , T > Map < S , T > applyAlignment ( Map < S , T > alignmentMap , Map < T , S > identity , int k ) { } } | // This implementation simply applies the map k times .
// If k were large , it would be more efficient to do this recursively ,
// ( eg f ^ 4 = ( f ^ 2 ) ^ 2 ) but k will usually be small .
if ( k < 0 ) throw new IllegalArgumentException ( "k must be positive" ) ; if ( k == 1 ) { return new HashMap < S , T > ( alignmentMap ) ; } // Convert to lists to establish a fixed order
List < S > preimage = new ArrayList < S > ( alignmentMap . keySet ( ) ) ; // currently unmodified
List < S > image = new ArrayList < S > ( preimage ) ; for ( int n = 1 ; n < k ; n ++ ) { // apply alignment
for ( int i = 0 ; i < image . size ( ) ; i ++ ) { S pre = image . get ( i ) ; T intermediate = ( pre == null ? null : alignmentMap . get ( pre ) ) ; S post = ( intermediate == null ? null : identity . get ( intermediate ) ) ; image . set ( i , post ) ; } } Map < S , T > imageMap = new HashMap < S , T > ( alignmentMap . size ( ) ) ; // TODO handle nulls consistently .
// assure that all the residues in the domain are valid keys
/* for ( int i = 0 ; i < preimage . size ( ) ; i + + ) {
S pre = preimage . get ( i ) ;
T intermediate = ( pre = = null ? null : alignmentMap . get ( pre ) ) ;
S post = ( intermediate = = null ? null : identity . get ( intermediate ) ) ;
imageMap . put ( post , null ) ; */
// now populate with actual values
for ( int i = 0 ; i < preimage . size ( ) ; i ++ ) { S pre = preimage . get ( i ) ; // image is currently f ^ k - 1 ( x ) , so take the final step
S preK1 = image . get ( i ) ; T postK = ( preK1 == null ? null : alignmentMap . get ( preK1 ) ) ; imageMap . put ( pre , postK ) ; } return imageMap ; |
public class BindingHelper { /** * Associates programmatically a view with its variant , taking it from its ` variant ` layout attribute .
* @ param view any existing view .
* @ param attrs the view ' s AttributeSet .
* @ return the previous variant for this view , if any . */
@ Nullable public static String setVariantForView ( @ NonNull View view , @ NonNull AttributeSet attrs ) { } } | String previousVariant ; final TypedArray styledAttributes = view . getContext ( ) . getTheme ( ) . obtainStyledAttributes ( attrs , R . styleable . View , 0 , 0 ) ; try { previousVariant = setVariantForView ( view , styledAttributes . getString ( R . styleable . View_variant ) ) ; } finally { styledAttributes . recycle ( ) ; } return previousVariant ; |
public class BaseHapiFhirResourceDao { /** * Get the resource definition from the criteria which specifies the resource type
* @ param criteria
* @ return */
@ Override public RuntimeResourceDefinition validateCriteriaAndReturnResourceDefinition ( String criteria ) { } } | String resourceName ; if ( criteria == null || criteria . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Criteria cannot be empty" ) ; } if ( criteria . contains ( "?" ) ) { resourceName = criteria . substring ( 0 , criteria . indexOf ( "?" ) ) ; } else { resourceName = criteria ; } return getContext ( ) . getResourceDefinition ( resourceName ) ; |
public class LSSerializerImpl { /** * Serializes the specified node to the specified LSOutput and returns true if the Node
* was successfully serialized .
* @ see org . w3c . dom . ls . LSSerializer # write ( org . w3c . dom . Node , org . w3c . dom . ls . LSOutput )
* @ since DOM Level 3
* @ param nodeArg The Node to serialize .
* @ throws org . w3c . dom . ls . LSException SERIALIZE _ ERR : Raised if the
* LSSerializer was unable to serialize the node . */
public boolean write ( Node nodeArg , LSOutput destination ) throws LSException { } } | // If the destination is null
if ( destination == null ) { String msg = Utils . messages . createMessage ( MsgKey . ER_NO_OUTPUT_SPECIFIED , null ) ; if ( fDOMErrorHandler != null ) { fDOMErrorHandler . handleError ( new DOMErrorImpl ( DOMError . SEVERITY_FATAL_ERROR , msg , MsgKey . ER_NO_OUTPUT_SPECIFIED ) ) ; } throw new LSException ( LSException . SERIALIZE_ERR , msg ) ; } // If nodeArg is null , return false . Should we throw and LSException instead ?
if ( nodeArg == null ) { return false ; } // Obtain a reference to the serializer to use
// Serializer serializer = getXMLSerializer ( xmlVersion ) ;
Serializer serializer = fXMLSerializer ; serializer . reset ( ) ; // If the node has not been seen
if ( nodeArg != fVisitedNode ) { // Determine the XML Document version of the Node
String xmlVersion = getXMLVersion ( nodeArg ) ; // Determine the encoding : 1 . LSOutput . encoding , 2 . Document . inputEncoding , 3 . Document . xmlEncoding .
fEncoding = destination . getEncoding ( ) ; if ( fEncoding == null ) { fEncoding = getInputEncoding ( nodeArg ) ; fEncoding = fEncoding != null ? fEncoding : getXMLEncoding ( nodeArg ) == null ? "UTF-8" : getXMLEncoding ( nodeArg ) ; } // If the encoding is not recognized throw an exception .
// Note : The serializer defaults to UTF - 8 when created
if ( ! Encodings . isRecognizedEncoding ( fEncoding ) ) { String msg = Utils . messages . createMessage ( MsgKey . ER_UNSUPPORTED_ENCODING , null ) ; if ( fDOMErrorHandler != null ) { fDOMErrorHandler . handleError ( new DOMErrorImpl ( DOMError . SEVERITY_FATAL_ERROR , msg , MsgKey . ER_UNSUPPORTED_ENCODING ) ) ; } throw new LSException ( LSException . SERIALIZE_ERR , msg ) ; } serializer . getOutputFormat ( ) . setProperty ( "version" , xmlVersion ) ; // Set the output encoding and xml version properties
fDOMConfigProperties . setProperty ( DOMConstants . S_XERCES_PROPERTIES_NS + DOMConstants . S_XML_VERSION , xmlVersion ) ; fDOMConfigProperties . setProperty ( DOMConstants . S_XSL_OUTPUT_ENCODING , fEncoding ) ; // If the node to be serialized is not a Document , Element , or Entity
// node
// then the XML declaration , or text declaration , should be never be
// serialized .
if ( ( nodeArg . getNodeType ( ) != Node . DOCUMENT_NODE || nodeArg . getNodeType ( ) != Node . ELEMENT_NODE || nodeArg . getNodeType ( ) != Node . ENTITY_NODE ) && ( ( fFeatures & XMLDECL ) != 0 ) ) { fDOMConfigProperties . setProperty ( DOMConstants . S_XSL_OUTPUT_OMIT_XML_DECL , DOMConstants . DOM3_DEFAULT_FALSE ) ; } fVisitedNode = nodeArg ; } // Update the serializer properties
fXMLSerializer . setOutputFormat ( fDOMConfigProperties ) ; try { // The LSSerializer will use the LSOutput object to determine
// where to serialize the output to in the following order the
// first one that is not null and not an empty string will be
// used : 1 . LSOutput . characterStream , 2 . LSOutput . byteStream ,
// 3 . LSOutput . systemId
// 1 . LSOutput . characterStream
Writer writer = destination . getCharacterStream ( ) ; if ( writer == null ) { // 2 . LSOutput . byteStream
OutputStream outputStream = destination . getByteStream ( ) ; if ( outputStream == null ) { // 3 . LSOutput . systemId
String uri = destination . getSystemId ( ) ; if ( uri == null ) { String msg = Utils . messages . createMessage ( MsgKey . ER_NO_OUTPUT_SPECIFIED , null ) ; if ( fDOMErrorHandler != null ) { fDOMErrorHandler . handleError ( new DOMErrorImpl ( DOMError . SEVERITY_FATAL_ERROR , msg , MsgKey . ER_NO_OUTPUT_SPECIFIED ) ) ; } throw new LSException ( LSException . SERIALIZE_ERR , msg ) ; } else { // Expand the System Id and obtain an absolute URI for it .
String absoluteURI = SystemIDResolver . getAbsoluteURI ( uri ) ; URL url = new URL ( absoluteURI ) ; OutputStream urlOutStream = null ; String protocol = url . getProtocol ( ) ; String host = url . getHost ( ) ; // For file protocols , there is no need to use a URL to get its
// corresponding OutputStream
// Scheme names consist of a sequence of characters . The lower case
// letters " a " - - " z " , digits , and the characters plus ( " + " ) , period
// ( " . " ) , and hyphen ( " - " ) are allowed . For resiliency , programs
// interpreting URLs should treat upper case letters as equivalent to
// lower case in scheme names ( e . g . , allow " HTTP " as well as " http " ) .
if ( protocol . equalsIgnoreCase ( "file" ) && ( host == null || host . length ( ) == 0 || host . equals ( "localhost" ) ) ) { // do we also need to check for host . equals ( hostname )
urlOutStream = new FileOutputStream ( getPathWithoutEscapes ( url . getPath ( ) ) ) ; } else { // This should support URL ' s whose schemes are mentioned in
// RFC1738 other than file
URLConnection urlCon = url . openConnection ( ) ; urlCon . setDoInput ( false ) ; urlCon . setDoOutput ( true ) ; urlCon . setUseCaches ( false ) ; urlCon . setAllowUserInteraction ( false ) ; // When writing to a HTTP URI , a HTTP PUT is performed .
if ( urlCon instanceof HttpURLConnection ) { HttpURLConnection httpCon = ( HttpURLConnection ) urlCon ; httpCon . setRequestMethod ( "PUT" ) ; } urlOutStream = urlCon . getOutputStream ( ) ; } // set the OutputStream to that obtained from the systemId
serializer . setOutputStream ( urlOutStream ) ; } } else { // 2 . LSOutput . byteStream
serializer . setOutputStream ( outputStream ) ; } } else { // 1 . LSOutput . characterStream
serializer . setWriter ( writer ) ; } // The associated media type by default is set to text / xml on
// org . apache . xml . serializer . SerializerBase .
// Get a reference to the serializer then lets you serilize a DOM
// Use this hack till Xalan support JAXP1.3
if ( fDOMSerializer == null ) { fDOMSerializer = ( DOM3Serializer ) serializer . asDOM3Serializer ( ) ; } // Set the error handler on the DOM3Serializer interface implementation
if ( fDOMErrorHandler != null ) { fDOMSerializer . setErrorHandler ( fDOMErrorHandler ) ; } // Set the filter on the DOM3Serializer interface implementation
if ( fSerializerFilter != null ) { fDOMSerializer . setNodeFilter ( fSerializerFilter ) ; } // Set the NewLine character to be used
fDOMSerializer . setNewLine ( fEndOfLine . toCharArray ( ) ) ; // Serializer your DOM , where node is an org . w3c . dom . Node
// Assuming that Xalan ' s serializer can serialize any type of DOM node
fDOMSerializer . serializeDOM3 ( nodeArg ) ; } catch ( UnsupportedEncodingException ue ) { String msg = Utils . messages . createMessage ( MsgKey . ER_UNSUPPORTED_ENCODING , null ) ; if ( fDOMErrorHandler != null ) { fDOMErrorHandler . handleError ( new DOMErrorImpl ( DOMError . SEVERITY_FATAL_ERROR , msg , MsgKey . ER_UNSUPPORTED_ENCODING , ue ) ) ; } throw ( LSException ) createLSException ( LSException . SERIALIZE_ERR , ue ) . fillInStackTrace ( ) ; } catch ( LSException lse ) { // Rethrow LSException .
throw lse ; } catch ( RuntimeException e ) { throw ( LSException ) createLSException ( LSException . SERIALIZE_ERR , e ) . fillInStackTrace ( ) ; } catch ( Exception e ) { if ( fDOMErrorHandler != null ) { fDOMErrorHandler . handleError ( new DOMErrorImpl ( DOMError . SEVERITY_FATAL_ERROR , e . getMessage ( ) , null , e ) ) ; } throw ( LSException ) createLSException ( LSException . SERIALIZE_ERR , e ) . fillInStackTrace ( ) ; } return true ; |
public class DepsGenerator { /** * Writes goog . addDependency ( ) lines for each DependencyInfo in depInfos . */
private static void writeDepInfos ( PrintStream out , Collection < DependencyInfo > depInfos ) throws IOException { } } | // Print dependencies .
// Lines look like this :
// goog . addDependency ( ' . . / . . / path / to / file . js ' , [ ' goog . Delay ' ] ,
// [ ' goog . Disposable ' , ' goog . Timer ' ] ) ;
for ( DependencyInfo depInfo : depInfos ) { DependencyInfo . Util . writeAddDependency ( out , depInfo ) ; } |
public class GaugeBenchmark { /** * Set . */
@ Benchmark @ BenchmarkMode ( { } } | Mode . AverageTime } ) @ OutputTimeUnit ( TimeUnit . NANOSECONDS ) public void prometheusGaugeSetBenchmark ( ) { prometheusGauge . newPartial ( ) . apply ( ) . set ( 42 ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcSpecularExponent ( ) { } } | if ( ifcSpecularExponentEClass == null ) { ifcSpecularExponentEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 870 ) ; } return ifcSpecularExponentEClass ; |
public class JCGLTextureUpdates { /** * Create a new update that will replace the given { @ code area } of { @ code t } .
* { @ code area } must be included within the area of { @ code t } .
* @ param t The texture
* @ param update _ area The area that will be updated
* @ return A new update
* @ throws RangeCheckException Iff { @ code area } is not included within { @ code */
public static JCGLTextureCubeUpdateType newUpdateReplacingAreaCube ( final JCGLTextureCubeUsableType t , final AreaL update_area ) { } } | NullCheck . notNull ( t , "Texture" ) ; NullCheck . notNull ( update_area , "Area" ) ; final AreaL texture_area = AreaSizesL . area ( t . size ( ) ) ; if ( ! AreasL . contains ( texture_area , update_area ) ) { final StringBuilder sb = new StringBuilder ( 128 ) ; sb . append ( "Target area is not contained within the texture's area." ) ; sb . append ( System . lineSeparator ( ) ) ; sb . append ( " Texture area: " ) ; sb . append ( t . size ( ) ) ; sb . append ( System . lineSeparator ( ) ) ; sb . append ( " Target area: " ) ; sb . append ( update_area ) ; sb . append ( System . lineSeparator ( ) ) ; throw new RangeCheckException ( sb . toString ( ) ) ; } final long width = update_area . width ( ) ; final long height = update_area . height ( ) ; final int bpp = t . format ( ) . getBytesPerPixel ( ) ; final long size = width * height * ( long ) bpp ; final ByteBuffer data = ByteBuffer . allocateDirect ( Math . toIntExact ( size ) ) ; data . order ( ByteOrder . nativeOrder ( ) ) ; return new UpdateCube ( t , update_area , data ) ; |
public class CmsToolbarNewButton { /** * Creates a list item representing a redirect . < p >
* @ return the new list item */
private CmsCreatableListItem makeRedirectItem ( ) { } } | CmsNewResourceInfo typeInfo = getController ( ) . getData ( ) . getNewRedirectElementInfo ( ) ; CmsListInfoBean info = new CmsListInfoBean ( ) ; info . setTitle ( typeInfo . getTitle ( ) ) ; info . setSubTitle ( Messages . get ( ) . key ( Messages . GUI_REDIRECT_SUBTITLE_0 ) ) ; CmsListItemWidget widget = new CmsListItemWidget ( info ) ; widget . setIcon ( typeInfo . getBigIconClasses ( ) ) ; CmsCreatableListItem listItem = new CmsCreatableListItem ( widget , typeInfo , NewEntryType . redirect ) ; listItem . initMoveHandle ( CmsSitemapView . getInstance ( ) . getTree ( ) . getDnDHandler ( ) ) ; return listItem ; |
public class DescribeClientPropertiesResult { /** * Information about the specified Amazon WorkSpaces clients .
* @ param clientPropertiesList
* Information about the specified Amazon WorkSpaces clients . */
public void setClientPropertiesList ( java . util . Collection < ClientPropertiesResult > clientPropertiesList ) { } } | if ( clientPropertiesList == null ) { this . clientPropertiesList = null ; return ; } this . clientPropertiesList = new com . amazonaws . internal . SdkInternalList < ClientPropertiesResult > ( clientPropertiesList ) ; |
public class InstantSearch { /** * Finds the empty view in the given rootView .
* @ param rootView the topmost view in the view hierarchy of the Activity .
* @ return the empty view if it was in the rootView .
* @ throws RuntimeException if the rootView is null . */
@ Nullable private static View getEmptyView ( @ Nullable View rootView ) { } } | if ( rootView == null ) { throw new RuntimeException ( "A null rootView was passed to getEmptyView, but Hits/RefinementList require one." ) ; } return rootView . findViewById ( android . R . id . empty ) ; |
public class Humanize { /** * Tries to parse a date string applying an array of non lenient format
* patterns . The formats are automatically cached .
* @ param dateStr
* The date string
* @ param separator
* The separator regexp
* @ param fmts
* An array of formats
* @ return the converted Date
* @ see # parseSmartDate ( String , String . . . ) */
public static Date parseSmartDateWithSeparator ( final String dateStr , final String separator , final String ... fmts ) { } } | String tmp = dateStr . replaceAll ( separator , "/" ) ; for ( String fmt : fmts ) { try { DateFormat df = dateFormat ( fmt ) ; // cached
df . setLenient ( false ) ; return df . parse ( tmp ) ; } catch ( ParseException ignored ) { } } throw new IllegalArgumentException ( "Unable to parse date '" + dateStr + "'" ) ; |
public class AnalysisContext { /** * Lookup a class .
* < em > Use this method instead of Repository . lookupClass ( ) . < / em >
* @ param className
* the name of the class
* @ return the JavaClass representing the class
* @ throws ClassNotFoundException
* ( but not really ) */
public JavaClass lookupClass ( @ Nonnull @ DottedClassName String className ) throws ClassNotFoundException { } } | try { if ( className . length ( ) == 0 ) { throw new IllegalArgumentException ( "Class name is empty" ) ; } if ( ! ClassName . isValidClassName ( className ) ) { throw new ClassNotFoundException ( "Invalid class name: " + className ) ; } return Global . getAnalysisCache ( ) . getClassAnalysis ( JavaClass . class , DescriptorFactory . instance ( ) . getClassDescriptor ( ClassName . toSlashedClassName ( className ) ) ) ; } catch ( CheckedAnalysisException e ) { throw new ClassNotFoundException ( "Class not found: " + className , e ) ; } |
public class CaptchaUtil { /** * 创建扭曲干扰的验证码 , 默认5位验证码
* @ param width 图片宽
* @ param height 图片高
* @ param codeCount 字符个数
* @ param thickness 干扰线宽度
* @ return { @ link ShearCaptcha }
* @ since 3.3.0 */
public static ShearCaptcha createShearCaptcha ( int width , int height , int codeCount , int thickness ) { } } | return new ShearCaptcha ( width , height , codeCount , thickness ) ; |
public class ObjectSnoop { /** * collects all methods of the given interface conflicting with the wrapped object
* @ param interfaceClazz
* the interface to check on conflicts
* @ return a list of methods conflicting */
public List < Method > isUnlockable ( Class < ? > interfaceClazz ) { } } | List < Method > conflicts = new LinkedList < Method > ( ) ; for ( Method method : interfaceClazz . getDeclaredMethods ( ) ) { try { findInvocationHandler ( method ) ; } catch ( NoSuchMethodException e ) { conflicts . add ( method ) ; } } return conflicts ; |
public class AbstractSlingBean { /** * This basic initialization sets up the context and resource attributes only ,
* all the other attributes are set ' lazy ' during their getter calls .
* @ param context the scripting context ( e . g . a JSP PageContext or a Groovy scripting context )
* @ param resource the resource to use ( normally the resource addressed by the request ) */
public void initialize ( BeanContext context , Resource resource ) { } } | if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "initialize (" + context + ", " + resource + ")" ) ; } this . context = context ; this . resource = ResourceHandle . use ( resource ) ; |
public class Weld { /** * Reset the synthetic bean archive ( bean classes and enablement ) , explicitly added extensions and services .
* @ return self */
public Weld reset ( ) { } } | beanClasses . clear ( ) ; packages . clear ( ) ; selectedAlternatives . clear ( ) ; selectedAlternativeStereotypes . clear ( ) ; enabledInterceptors . clear ( ) ; enabledDecorators . clear ( ) ; extensions . clear ( ) ; containerLifecycleObservers . clear ( ) ; additionalServices . clear ( ) ; return this ; |
public class SlotSharingGroupAssignment { /** * Called from { @ link org . apache . flink . runtime . instance . SharedSlot # releaseSlot ( Throwable ) } .
* @ param sharedSlot The slot to be released . */
void releaseSharedSlot ( SharedSlot sharedSlot ) { } } | synchronized ( lock ) { if ( sharedSlot . markCancelled ( ) ) { // we are releasing this slot
if ( sharedSlot . hasChildren ( ) ) { final FlinkException cause = new FlinkException ( "Releasing shared slot parent." ) ; // by simply releasing all children , we should eventually release this slot .
Set < Slot > children = sharedSlot . getSubSlots ( ) ; while ( children . size ( ) > 0 ) { children . iterator ( ) . next ( ) . releaseSlot ( cause ) ; } } else { // if there are no children that trigger the release , we trigger it directly
internalDisposeEmptySharedSlot ( sharedSlot ) ; } } } |
public class AutoValueOrOneOfProcessor { /** * Returns the ordered set of { @ link Property } definitions for the given { @ code @ AutoValue } or
* { @ code AutoOneOf } type .
* @ param annotatedPropertyMethods a map from property methods to the method annotations that
* should go on the implementation of those methods . These annotations are method annotations
* specifically . Type annotations do not appear because they are considered part of the return
* type and will appear when that is spelled out . Annotations that are excluded by { @ code
* AutoValue . CopyAnnotations } also do not appear here . */
final ImmutableSet < Property > propertySet ( TypeElement type , ImmutableSet < ExecutableElement > propertyMethods , ImmutableListMultimap < ExecutableElement , AnnotationMirror > annotatedPropertyFields , ImmutableListMultimap < ExecutableElement , AnnotationMirror > annotatedPropertyMethods ) { } } | ImmutableBiMap < ExecutableElement , String > methodToPropertyName = propertyNameToMethodMap ( propertyMethods ) . inverse ( ) ; Map < ExecutableElement , String > methodToIdentifier = new LinkedHashMap < > ( methodToPropertyName ) ; fixReservedIdentifiers ( methodToIdentifier ) ; EclipseHack eclipseHack = new EclipseHack ( processingEnv ) ; DeclaredType declaredType = MoreTypes . asDeclared ( type . asType ( ) ) ; ImmutableMap < ExecutableElement , TypeMirror > returnTypes = eclipseHack . methodReturnTypes ( propertyMethods , declaredType ) ; ImmutableSet . Builder < Property > props = ImmutableSet . builder ( ) ; for ( ExecutableElement propertyMethod : propertyMethods ) { TypeMirror returnType = returnTypes . get ( propertyMethod ) ; String propertyType = TypeEncoder . encodeWithAnnotations ( returnType , getExcludedAnnotationTypes ( propertyMethod ) ) ; String propertyName = methodToPropertyName . get ( propertyMethod ) ; String identifier = methodToIdentifier . get ( propertyMethod ) ; ImmutableList < String > fieldAnnotations = annotationStrings ( annotatedPropertyFields . get ( propertyMethod ) ) ; ImmutableList < AnnotationMirror > methodAnnotationMirrors = annotatedPropertyMethods . get ( propertyMethod ) ; ImmutableList < String > methodAnnotations = annotationStrings ( methodAnnotationMirrors ) ; Optional < String > nullableAnnotation = nullableAnnotationForMethod ( propertyMethod ) ; Property p = new Property ( propertyName , identifier , propertyMethod , propertyType , fieldAnnotations , methodAnnotations , nullableAnnotation ) ; props . add ( p ) ; if ( p . isNullable ( ) && returnType . getKind ( ) . isPrimitive ( ) ) { errorReporter ( ) . reportError ( "Primitive types cannot be @Nullable" , propertyMethod ) ; } } return props . build ( ) ; |
public class XTokenQueue { /** * Unescaped a \ escaped string .
* @ param in backslash escaped string
* @ return unescaped string */
public static String unescape ( String in ) { } } | StringBuilder out = new StringBuilder ( ) ; char last = 0 ; for ( char c : in . toCharArray ( ) ) { if ( c == ESC ) { if ( last != 0 && last == ESC ) out . append ( c ) ; } else out . append ( c ) ; last = c ; } return out . toString ( ) ; |
public class Paginator { /** * This method will return a list of records for a specific page .
* @ param pageNumber page number to return . This is indexed at 1 , not 0 . Any value below 1 is illegal and will
* be rejected .
* @ return list of records that match a query make up a " page " . */
public LazyList < T > getPage ( int pageNumber ) { } } | if ( pageNumber < 1 ) throw new IllegalArgumentException ( "minimum page index == 1" ) ; try { LazyList < T > list = find ( query , params ) . offset ( ( pageNumber - 1 ) * pageSize ) . limit ( pageSize ) ; if ( orderBys != null ) { list . orderBy ( orderBys ) ; } currentPageIndex = pageNumber ; return list ; } catch ( Exception mustNeverHappen ) { throw new InternalException ( mustNeverHappen ) ; } |
public class RestoreManagerImpl { /** * / * ( non - Javadoc )
* @ see org . duracloud . snapshot . service . RestoreManager # requestRestoreSnapshot ( java . lang . String , org . duracloud
* . snapshot . db . model . DuracloudEndPointConfig , java . lang . String ) */
@ Override public Snapshot requestRestoreSnapshot ( String snapshotId , DuracloudEndPointConfig destination , String userEmail ) throws SnapshotException { } } | checkInitialized ( ) ; Snapshot snapshot = getSnapshot ( snapshotId ) ; String host = destination . getHost ( ) ; String port = destination . getPort ( ) + "" ; String storeId = destination . getStoreId ( ) ; String url = "http" + ( port . endsWith ( "443" ) ? "s" : "" ) + "://" + host + ":" + port + "/duradmin/spaces/sm/" + storeId + "/" + snapshotId + "?snapshot=true" ; // send email to DuraCloud team to request starting a restore
String subject = "Snapshot Restoration Request for Snapshot ID = " + snapshotId ; String format = "Please initiate a snapshot restore via the duracloud interface ( {0} ).\n" + "\nSnapshot ID: {1}\nHost:{2}\nPort: {3}\nStore ID: {4}\nRequestor email: {5}" ; String body = MessageFormat . format ( format , url , snapshotId , host , port , storeId , userEmail ) ; String [ ] duracloudEmailAddresses = this . config . getDuracloudEmailAddresses ( ) ; notificationManager . sendNotification ( NotificationType . EMAIL , subject , body , duracloudEmailAddresses ) ; log . info ( "sent email to {}: message body = {}" , duracloudEmailAddresses , body ) ; return snapshot ; |
public class JingleContentDescriptionProvider { /** * Parse a iq / jingle / description element .
* @ param parser the input to parse
* @ return a description element
* @ throws IOException
* @ throws XmlPullParserException */
@ Override public JingleContentDescription parse ( XmlPullParser parser , int initialDepth , XmlEnvironment xmlEnvironment ) throws XmlPullParserException , IOException { } } | boolean done = false ; JingleContentDescription desc = getInstance ( ) ; while ( ! done ) { int eventType = parser . next ( ) ; String name = parser . getName ( ) ; if ( eventType == XmlPullParser . START_TAG ) { if ( name . equals ( JingleContentDescription . JinglePayloadType . NODENAME ) ) { desc . addJinglePayloadType ( parsePayload ( parser ) ) ; } else { // TODO : Should be SmackParseException .
throw new IOException ( "Unknow element \"" + name + "\" in content." ) ; } } else if ( eventType == XmlPullParser . END_TAG ) { if ( name . equals ( JingleContentDescription . NODENAME ) ) { done = true ; } } } return desc ; |
public class PeerNode { /** * documentation inherited from interface ClientObserver */
public void clientDidLogon ( Client client ) { } } | log . info ( "Connected to peer " + _record + "." ) ; // subscribe to this peer ' s node object
PeerBootstrapData pdata = ( PeerBootstrapData ) client . getBootstrapData ( ) ; client . getDObjectManager ( ) . subscribeToObject ( pdata . nodeOid , this ) ; |
public class TransformedMirage { /** * documentation inherited from interface Mirage */
public BufferedImage getSnapshot ( ) { } } | BufferedImage baseSnap = _base . getSnapshot ( ) ; BufferedImage img = new BufferedImage ( _bounds . width , _bounds . height , baseSnap . getType ( ) ) ; Graphics2D gfx = ( Graphics2D ) img . getGraphics ( ) ; try { gfx . transform ( _transform ) ; gfx . drawImage ( baseSnap , 0 , 0 , null ) ; } finally { gfx . dispose ( ) ; } return img ; |
public class CPMeasurementUnitLocalServiceUtil { /** * Adds the cp measurement unit to the database . Also notifies the appropriate model listeners .
* @ param cpMeasurementUnit the cp measurement unit
* @ return the cp measurement unit that was added */
public static com . liferay . commerce . product . model . CPMeasurementUnit addCPMeasurementUnit ( com . liferay . commerce . product . model . CPMeasurementUnit cpMeasurementUnit ) { } } | return getService ( ) . addCPMeasurementUnit ( cpMeasurementUnit ) ; |
public class Location { /** * Return the adjacent location of specified length directly upstream of this location .
* @ return Upstream location .
* @ param length The length of the upstream location .
* @ throws IndexOutOfBoundsException Specified length causes crossing of origin . */
public Location upstream ( int length ) { } } | if ( length < 0 ) { throw new IllegalArgumentException ( "Parameter must be >= 0; is=" + length ) ; } if ( Math . signum ( mStart - length ) == Math . signum ( mStart ) || 0 == Math . signum ( mStart - length ) ) { return new Location ( mStart - length , mStart ) ; } else { throw new IndexOutOfBoundsException ( "Specified length causes crossing of origin: " + length + "; " + toString ( ) ) ; } |
public class MapJsonBuilder { /** * Converts an object to a JSON object
* @ param obj the object to convert
* @ param factory a factory used to create JSON builders
* @ return the JSON object */
private static Object toJson ( Object obj , JsonBuilderFactory factory ) { } } | if ( obj instanceof JsonObject ) { return ( ( JsonObject ) obj ) . toJson ( factory . createJsonBuilder ( ) ) ; } else if ( obj . getClass ( ) . isArray ( ) ) { List < Object > r = new ArrayList < > ( ) ; int len = Array . getLength ( obj ) ; for ( int i = 0 ; i < len ; ++ i ) { Object ao = Array . get ( obj , i ) ; r . add ( toJson ( ao , factory ) ) ; } return r ; } else if ( obj instanceof Collection ) { Collection < ? > coll = ( Collection < ? > ) obj ; List < Object > r = new ArrayList < > ( ) ; for ( Object ao : coll ) { r . add ( toJson ( ao , factory ) ) ; } return r ; } else if ( obj instanceof Map ) { Map < ? , ? > m = ( Map < ? , ? > ) obj ; Map < String , Object > r = new LinkedHashMap < > ( ) ; for ( Map . Entry < ? , ? > e : m . entrySet ( ) ) { String key = toJson ( e . getKey ( ) , factory ) . toString ( ) ; Object value = toJson ( e . getValue ( ) , factory ) ; r . put ( key , value ) ; } return r ; } return obj ; |
public class LocalDeviceManagementUsb { /** * Sets property value elements of an interface object property .
* @ param objectType the interface object type
* @ param objectInstance the interface object instance ( usually 1)
* @ param propertyId the property identifier ( PID )
* @ param start start index in the property value to start writing to
* @ param elements number of elements to set
* @ param data byte array containing the property data
* @ throws KNXTimeoutException on timeout setting the property elements
* @ throws KNXRemoteException on remote error or invalid response
* @ throws KNXPortClosedException if adapter is closed
* @ throws InterruptedException on interrupt */
public void setProperty ( final int objectType , final int objectInstance , final int propertyId , final int start , final int elements , final byte ... data ) throws KNXTimeoutException , KNXRemoteException , KNXPortClosedException , InterruptedException { } } | final CEMIDevMgmt req = new CEMIDevMgmt ( CEMIDevMgmt . MC_PROPWRITE_REQ , objectType , objectInstance , propertyId , start , elements , data ) ; send ( req , null ) ; findFrame ( CEMIDevMgmt . MC_PROPWRITE_CON , req ) ; |
public class FileUtil { /** * This class copies an input file to output file
* @ param String
* input file to copy from
* @ param String
* output file */
public static boolean copy ( String input , String output ) throws Exception { } } | int BUFSIZE = 65536 ; FileInputStream fis = new FileInputStream ( input ) ; FileOutputStream fos = new FileOutputStream ( output ) ; try { int s ; byte [ ] buf = new byte [ BUFSIZE ] ; while ( ( s = fis . read ( buf ) ) > - 1 ) { fos . write ( buf , 0 , s ) ; } } catch ( Exception ex ) { throw new Exception ( "makehome" + ex . getMessage ( ) ) ; } finally { fis . close ( ) ; fos . close ( ) ; } return true ; |
public class ST_3DPerimeter { /** * Compute the 3D perimeter of a polygon or a multipolygon .
* @ param geometry
* @ return */
public static Double st3Dperimeter ( Geometry geometry ) { } } | if ( geometry == null ) { return null ; } if ( geometry . getDimension ( ) < 2 ) { return 0d ; } return compute3DPerimeter ( geometry ) ; |
public class UpdateGameSessionQueueRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateGameSessionQueueRequest updateGameSessionQueueRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateGameSessionQueueRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateGameSessionQueueRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( updateGameSessionQueueRequest . getTimeoutInSeconds ( ) , TIMEOUTINSECONDS_BINDING ) ; protocolMarshaller . marshall ( updateGameSessionQueueRequest . getPlayerLatencyPolicies ( ) , PLAYERLATENCYPOLICIES_BINDING ) ; protocolMarshaller . marshall ( updateGameSessionQueueRequest . getDestinations ( ) , DESTINATIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class DefaultBeanProcessor { /** * Creates a new object and initializes its fields from the ResultSet .
* @ param < T > The type of bean to create
* @ param rs The result set .
* @ param type The bean type ( the return type of the object ) .
* @ param props The property descriptors .
* @ param columnToProperty The column indices in the result set .
* @ return An initialized object .
* @ throws SQLException if a database error occurs . */
private < T > T createBean ( ResultSet rs , Class < T > type , PropertyDescriptor [ ] props , int [ ] columnToProperty ) throws SQLException { } } | T bean = this . newInstance ( type ) ; return populateBean ( rs , bean , props , columnToProperty ) ; |
public class IIDImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . IID__CON_DATA1 : setConData1 ( CON_DATA1_EDEFAULT ) ; return ; case AfplibPackage . IID__XBASE : setXBase ( XBASE_EDEFAULT ) ; return ; case AfplibPackage . IID__YBASE : setYBase ( YBASE_EDEFAULT ) ; return ; case AfplibPackage . IID__XUNITS : setXUnits ( XUNITS_EDEFAULT ) ; return ; case AfplibPackage . IID__YUNITS : setYUnits ( YUNITS_EDEFAULT ) ; return ; case AfplibPackage . IID__XSIZE : setXSize ( XSIZE_EDEFAULT ) ; return ; case AfplibPackage . IID__YSIZE : setYSize ( YSIZE_EDEFAULT ) ; return ; case AfplibPackage . IID__CON_DATA2 : setConData2 ( CON_DATA2_EDEFAULT ) ; return ; case AfplibPackage . IID__XC_SIZE_D : setXCSizeD ( XC_SIZE_D_EDEFAULT ) ; return ; case AfplibPackage . IID__YC_SIZE_D : setYCSizeD ( YC_SIZE_D_EDEFAULT ) ; return ; case AfplibPackage . IID__CON_DATA3 : setConData3 ( CON_DATA3_EDEFAULT ) ; return ; case AfplibPackage . IID__COLOR : setColor ( COLOR_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class AbstractBeanInitializer { @ SuppressWarnings ( "unchecked" ) public T getInstance ( ) { } } | if ( beanClassName == null ) { return null ; } else try { T beanInstance ; Class < T > beanClass = null ; try { try { ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; beanClass = ( Class < T > ) Class . forName ( beanClassName , true , classLoader ) ; } catch ( ClassNotFoundException cnfe ) { throw new RuntimeException ( "Unknown class " + beanClassName , cnfe ) ; } // Instancjonowanie i inicjalizcja w oparciu o konstruktor inicjujący :
Constructor < T > constructor = ( Constructor < T > ) beanClass . getConstructor ( Collection . class ) ; beanInstance = constructor . newInstance ( properties ) ; } catch ( NoSuchMethodException nsme ) { // Instancjonowanie i inicjalizacja w oparciu o konstruktor bezargumentowy
// i publiczne setter ' y Java Beans :
beanInstance = beanClass . newInstance ( ) ; if ( properties != null && ! properties . isEmpty ( ) ) { BeanInfo validatorInfo = Introspector . getBeanInfo ( beanClass ) ; PropertyDescriptor [ ] propertyDescriptors = validatorInfo . getPropertyDescriptors ( ) ; for ( BeanProperty beanProperty : properties ) { String propertyName = beanProperty . getPropertyName ( ) ; Method writeMethod = null ; for ( PropertyDescriptor propertyDescriptor : propertyDescriptors ) { if ( propertyDescriptor . getName ( ) . equals ( propertyName ) ) { writeMethod = propertyDescriptor . getWriteMethod ( ) ; break ; } } if ( writeMethod == null ) { throw new RuntimeException ( "No public setter found for property '" + propertyName + "' " + "in validator class " + beanClass . getCanonicalName ( ) ) ; } Class < ? > parameterType = writeMethod . getParameterTypes ( ) [ 0 ] ; if ( BeanProperty . class . equals ( parameterType ) ) { writeMethod . invoke ( beanInstance , beanProperty ) ; } else if ( String . class . equals ( parameterType ) ) { if ( beanProperty . hasAttributes ( ) ) { throw new RuntimeException ( "BeanProperty '" + propertyName + "' setter should has " + Parameter . class . getSimpleName ( ) + " type parameter" ) ; } writeMethod . invoke ( beanInstance , beanProperty . getPropertyValue ( ) ) ; } } } } return beanInstance ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } |
public class PatchRuleGroup { /** * The rules that make up the rule group .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setPatchRules ( java . util . Collection ) } or { @ link # withPatchRules ( java . util . Collection ) } if you want to
* override the existing values .
* @ param patchRules
* The rules that make up the rule group .
* @ return Returns a reference to this object so that method calls can be chained together . */
public PatchRuleGroup withPatchRules ( PatchRule ... patchRules ) { } } | if ( this . patchRules == null ) { setPatchRules ( new com . amazonaws . internal . SdkInternalList < PatchRule > ( patchRules . length ) ) ; } for ( PatchRule ele : patchRules ) { this . patchRules . add ( ele ) ; } return this ; |
public class Is { /** * Determines whether the element is an input or not . An input could be an
* input element , a textarea , or a select
* @ return Boolean : whether the element is an input or not */
public boolean input ( ) { } } | boolean isInput = false ; try { WebElement webElement = element . getWebElement ( ) ; if ( "input" . equalsIgnoreCase ( webElement . getTagName ( ) ) || "textarea" . equalsIgnoreCase ( webElement . getTagName ( ) ) || SELECT . equalsIgnoreCase ( webElement . getTagName ( ) ) ) { isInput = true ; } } catch ( NoSuchElementException e ) { log . info ( e ) ; } return isInput ; |
public class RenderOnlySoyMsgBundleImpl { /** * Brings a message back to life from only its ID and parts . */
@ SuppressWarnings ( "unchecked" ) // The constructor guarantees the type of ImmutableList .
private SoyMsg resurrectMsg ( long id , ImmutableList < SoyMsgPart > parts ) { } } | return SoyMsg . builder ( ) . setId ( id ) . setLocaleString ( localeString ) . setIsPlrselMsg ( MsgPartUtils . hasPlrselPart ( parts ) ) . setParts ( parts ) . build ( ) ; |
public class ProxyService { /** * Constructs , configures and initializes a single ( Singleton ) instance of the { @ link ProxyService } class .
* @ param < T > { @ link Class } type of the { @ link Object } to proxy .
* @ return a single instance of the { @ link ProxyService } class .
* @ see org . cp . elements . lang . reflect . ProxyService */
@ SuppressWarnings ( "unchecked" ) public static synchronized < T > ProxyService < T > newProxyService ( ) { } } | proxyServiceInstance = Optional . ofNullable ( proxyServiceInstance ) . orElseGet ( ProxyService :: new ) ; return proxyServiceInstance ; |
public class DataSourceFactory { /** * Gets a { @ link DataSource } constructing a new one if needed .
* @ return a { @ link DataSource } . */
public DataSource getDataSource ( ) { } } | if ( dataSource == null ) { LOG . info ( "Having to construct a new DataSource" ) ; dataSource = new DataSource ( ) ; dataSource . setDriverClassName ( dbSettings . getDriver ( ) ) ; dataSource . setUrl ( dbSettings . getJdbcUrl ( ) ) ; dataSource . setUsername ( dbSettings . getUser ( ) ) ; dataSource . setPassword ( dbSettings . getPass ( ) ) ; dataSource . setMaxActive ( dbSettings . getMaxActive ( ) ) ; dataSource . setMaxIdle ( dbSettings . getMaxIdle ( ) ) ; dataSource . setMinIdle ( dbSettings . getMinIdle ( ) ) ; dataSource . setInitialSize ( dbSettings . getInitialSize ( ) ) ; dataSource . setTestOnBorrow ( dbSettings . getTestOnBorrow ( ) ) ; dataSource . setTestOnReturn ( dbSettings . getTestOnReturn ( ) ) ; dataSource . setTestWhileIdle ( dbSettings . getTestWhileIdle ( ) ) ; dataSource . setValidationQuery ( dbSettings . getValidationQuery ( ) ) ; dataSource . setLogValidationErrors ( dbSettings . getLogValidationErrors ( ) ) ; // a catch - all for any other properties that are needed
dataSource . setDbProperties ( dbSettings . getProperties ( ) ) ; } return dataSource ; |
public class AbstractUsernamePasswordAuthenticationHandler { /** * Transform password .
* @ param userPass the user pass
* @ throws FailedLoginException the failed login exception
* @ throws AccountNotFoundException the account not found exception */
protected void transformPassword ( final UsernamePasswordCredential userPass ) throws FailedLoginException , AccountNotFoundException { } } | if ( StringUtils . isBlank ( userPass . getPassword ( ) ) ) { throw new FailedLoginException ( "Password is null." ) ; } LOGGER . debug ( "Attempting to encode credential password via [{}] for [{}]" , this . passwordEncoder . getClass ( ) . getName ( ) , userPass . getUsername ( ) ) ; val transformedPsw = this . passwordEncoder . encode ( userPass . getPassword ( ) ) ; if ( StringUtils . isBlank ( transformedPsw ) ) { throw new AccountNotFoundException ( "Encoded password is null." ) ; } userPass . setPassword ( transformedPsw ) ; |
public class HammingCode { /** * Gets codes .
* @ param fromKey the from key
* @ return the codes */
public SortedMap < Bits , T > getCodes ( final Bits fromKey ) { } } | final Bits next = fromKey . next ( ) ; final SortedMap < Bits , T > subMap = null == next ? this . forwardIndex . tailMap ( fromKey ) : this . forwardIndex . subMap ( fromKey , next ) ; return subMap ; |
public class CmsByteBuffer { /** * Writes some bytes to this buffer , expanding the buffer if necessary . < p >
* @ param src the source from which to write the bytes
* @ param srcStart the start index in the source array
* @ param destStart the start index in this buffer
* @ param len the number of bytes to write */
public void writeBytes ( byte [ ] src , int srcStart , int destStart , int len ) { } } | int newEnd = destStart + len ; ensureCapacity ( newEnd ) ; if ( newEnd > m_size ) { m_size = newEnd ; } System . arraycopy ( src , srcStart , m_buffer , destStart , len ) ; |
public class CompareUtil { /** * Checks if the element is not contained within the list of values . If the element , or the list are null then true is returned .
* @ param element to check
* @ param values to check in
* @ param < T > the type of the element
* @ return { @ code true } if the element and values are not { @ code null } and the values does not contain the element , { @ code false } otherwise */
public static < T > boolean elementIsNotContainedInList ( T element , Collection < T > values ) { } } | if ( element != null && values != null ) { return ! values . contains ( element ) ; } else { return false ; } |
public class ExposeLinearLayoutManagerEx { /** * Used for debugging .
* Logs the internal representation of children to default logger . */
private void logChildren ( ) { } } | Log . d ( TAG , "internal representation of views on the screen" ) ; for ( int i = 0 ; i < getChildCount ( ) ; i ++ ) { View child = getChildAt ( i ) ; Log . d ( TAG , "item " + getPosition ( child ) + ", coord:" + mOrientationHelper . getDecoratedStart ( child ) ) ; } Log . d ( TAG , "==============" ) ; |
public class JSMessageImpl { /** * concurrency issues . */
boolean consistentChoice ( int varIndex ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . entry ( this , tc , "consistentChoice" , new Object [ ] { Integer . valueOf ( varIndex ) } ) ; JSType field = findDominatingCase ( variants [ varIndex ] ) ; JSVariant parent = ( JSVariant ) field . getParent ( ) ; if ( parent == null ) { // This choice is not dominated by any others , so it must be consistent
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "consistentChoice" , Boolean . TRUE ) ; return true ; } int domIndex = parent . getIndex ( ) ; if ( choiceCache [ domIndex ] != field . getSiblingPosition ( ) ) { // This choice is inconsistent with its immediate dominator
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "consistentChoice" , Boolean . FALSE ) ; return false ; } // This choice is consistent with its immediate dominator , but is that
// dominator itself consistent ?
if ( ! consistentChoice ( domIndex ) ) { choiceCache [ domIndex ] = - 1 ; // Mark dominator as inconsistent
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "consistentChoice" , Boolean . FALSE ) ; return false ; // and this choice is inconsistent as well
} // Otherwise , we are consistent with our dominator , which is itself
// consistent , so victory .
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "consistentChoice" , Boolean . TRUE ) ; return true ; |
public class GoogleMapShapeConverter { /** * Transform the bounding box in the feature projection to WGS84
* @ param boundingBox bounding box in feature projection
* @ return bounding box in WGS84 */
public BoundingBox boundingBoxToWgs84 ( BoundingBox boundingBox ) { } } | if ( projection == null ) { throw new GeoPackageException ( "Shape Converter projection is null" ) ; } return boundingBox . transform ( toWgs84 ) ; |
public class SlimClockSkin { /** * * * * * * Graphics * * * * * */
@ Override public void updateTime ( final ZonedDateTime TIME ) { } } | if ( dateText . isVisible ( ) ) { dateText . setText ( dateTextFormatter . format ( TIME ) ) ; Helper . adjustTextSize ( dateText , 0.6 * size , size * 0.08 ) ; dateText . relocate ( ( size - dateText . getLayoutBounds ( ) . getWidth ( ) ) * 0.5 , size * 0.22180451 ) ; } if ( dateNumbers . isVisible ( ) ) { dateNumbers . setText ( dateNumberFormatter . format ( TIME ) ) ; Helper . adjustTextSize ( dateNumbers , 0.6 * size , size * 0.08 ) ; dateNumbers . relocate ( ( size - dateNumbers . getLayoutBounds ( ) . getWidth ( ) ) * 0.5 , size * 0.68984962 ) ; } hour . setText ( HOUR_FORMATTER . format ( TIME ) ) ; Helper . adjustTextSize ( hour , 0.4 * size , 0.328 * size ) ; hour . relocate ( 0.136 * size , ( size - hour . getLayoutBounds ( ) . getHeight ( ) ) * 0.5 ) ; minute . setText ( MINUTE_FORMATTER . format ( TIME ) ) ; Helper . adjustTextSize ( minute , 0.4 * size , 0.328 * size ) ; minute . relocate ( 0.544 * size , ( size - minute . getLayoutBounds ( ) . getHeight ( ) ) * 0.5 ) ; if ( secondBackgroundCircle . isVisible ( ) ) { secondArc . setLength ( ( - 6 * TIME . getSecond ( ) ) ) ; if ( clock . isDiscreteSeconds ( ) ) { secondArc . setLength ( ( - 6 * TIME . getSecond ( ) ) ) ; } else { secondArc . setLength ( ( - 6 * TIME . getSecond ( ) - TIME . get ( ChronoField . MILLI_OF_SECOND ) * 0.006 ) ) ; } } |
public class ReaderT { /** * Map the wrapped Future
* < pre >
* { @ code
* FutureT . of ( AnyM . fromStream ( Arrays . asFuture ( 10 ) )
* . map ( t - > t = t + 1 ) ;
* / / FutureT < AnyMSeq < Stream < Future [ 11 ] > > >
* < / pre >
* @ param f Mapping function for the wrapped Future
* @ return FutureT that applies the transform function to the wrapped Future */
public < B > ReaderT < W , T , B > mapFn ( final Function < ? super R , ? extends B > f ) { } } | return new ReaderT < W , T , B > ( run . map ( o -> o . mapFn ( f ) ) ) ; |
public class BuildArtifactsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BuildArtifacts buildArtifacts , ProtocolMarshaller protocolMarshaller ) { } } | if ( buildArtifacts == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( buildArtifacts . getLocation ( ) , LOCATION_BINDING ) ; protocolMarshaller . marshall ( buildArtifacts . getSha256sum ( ) , SHA256SUM_BINDING ) ; protocolMarshaller . marshall ( buildArtifacts . getMd5sum ( ) , MD5SUM_BINDING ) ; protocolMarshaller . marshall ( buildArtifacts . getOverrideArtifactName ( ) , OVERRIDEARTIFACTNAME_BINDING ) ; protocolMarshaller . marshall ( buildArtifacts . getEncryptionDisabled ( ) , ENCRYPTIONDISABLED_BINDING ) ; protocolMarshaller . marshall ( buildArtifacts . getArtifactIdentifier ( ) , ARTIFACTIDENTIFIER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class HttpBuilder { /** * Executes asynchronous GET request on the configured URI ( alias for the ` get ( Class , Closure ) ` method ) , with additional configuration provided by
* the configuration closure . The result will be cast to the specified ` type ` .
* [ source , groovy ]
* def http = HttpBuilder . configure {
* request . uri = ' http : / / localhost : 10101'
* CompletableFuture future = http . getAsync ( String ) {
* request . uri . path = ' / something '
* String result = future . get ( )
* The configuration ` closure ` allows additional configuration for this request based on the { @ link HttpConfig } interface .
* @ param type the type of the response content
* @ param closure the additional configuration closure ( delegated to { @ link HttpConfig } )
* @ return the { @ link CompletableFuture } for the resulting content cast to the specified type */
public < T > CompletableFuture < T > getAsync ( final Class < T > type , @ DelegatesTo ( HttpConfig . class ) final Closure closure ) { } } | return CompletableFuture . supplyAsync ( ( ) -> get ( type , closure ) , getExecutor ( ) ) ; |
public class PropertyWriterImpl { /** * { @ inheritDoc } */
public Content getPropertyDetailsTreeHeader ( ClassDoc classDoc , Content memberDetailsTree ) { } } | memberDetailsTree . addContent ( HtmlConstants . START_OF_PROPERTY_DETAILS ) ; Content propertyDetailsTree = writer . getMemberTreeHeader ( ) ; propertyDetailsTree . addContent ( writer . getMarkerAnchor ( SectionName . PROPERTY_DETAIL ) ) ; Content heading = HtmlTree . HEADING ( HtmlConstants . DETAILS_HEADING , writer . propertyDetailsLabel ) ; propertyDetailsTree . addContent ( heading ) ; return propertyDetailsTree ; |
public class AmazonPinpointEmailClient { /** * Get information about a dedicated IP address , including the name of the dedicated IP pool that it ' s associated
* with , as well information about the automatic warm - up process for the address .
* @ param getDedicatedIpRequest
* A request to obtain more information about a dedicated IP address .
* @ return Result of the GetDedicatedIp operation returned by the service .
* @ throws TooManyRequestsException
* Too many requests have been made to the operation .
* @ throws NotFoundException
* The resource you attempted to access doesn ' t exist .
* @ throws BadRequestException
* The input you provided is invalid .
* @ sample AmazonPinpointEmail . GetDedicatedIp
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / pinpoint - email - 2018-07-26 / GetDedicatedIp " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public GetDedicatedIpResult getDedicatedIp ( GetDedicatedIpRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetDedicatedIp ( request ) ; |
public class SheetRenderer { /** * Converts the JSON data received from the in the request params into our sumitted values map . The map is cleared first .
* @ param jsonData the submitted JSON data
* @ param sheet
* @ param jsonData */
private void decodeSubmittedValues ( final FacesContext context , final Sheet sheet , final String jsonData ) { } } | if ( LangUtils . isValueBlank ( jsonData ) ) { return ; } try { // data comes in as a JSON Object with named properties for the row and columns
// updated this is so that
// multiple updates to the same cell overwrite previous deltas prior to
// submission we don ' t care about
// the property names , just the values , which we ' ll process in turn
final JSONObject obj = new JSONObject ( jsonData ) ; final Iterator < String > keys = obj . keys ( ) ; while ( keys . hasNext ( ) ) { final String key = keys . next ( ) ; // data comes in : [ row , col , oldValue , newValue , rowKey ]
final JSONArray update = obj . getJSONArray ( key ) ; // GitHub # 586 pasted more values than rows
if ( update . isNull ( 4 ) ) { continue ; } final String rowKey = update . getString ( 4 ) ; final int col = sheet . getMappedColumn ( update . getInt ( 1 ) ) ; final String newValue = String . valueOf ( update . get ( 3 ) ) ; sheet . setSubmittedValue ( context , rowKey , col , newValue ) ; } } catch ( final JSONException ex ) { throw new FacesException ( "Failed parsing Ajax JSON message for cell change event:" + ex . getMessage ( ) , ex ) ; } |
public class InternalSARLParser { /** * InternalSARL . g : 10858:1 : entryRuleRichStringLiteralStart returns [ EObject current = null ] : iv _ ruleRichStringLiteralStart = ruleRichStringLiteralStart EOF ; */
public final EObject entryRuleRichStringLiteralStart ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleRichStringLiteralStart = null ; try { // InternalSARL . g : 10858:63 : ( iv _ ruleRichStringLiteralStart = ruleRichStringLiteralStart EOF )
// InternalSARL . g : 10859:2 : iv _ ruleRichStringLiteralStart = ruleRichStringLiteralStart EOF
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getRichStringLiteralStartRule ( ) ) ; } pushFollow ( FOLLOW_1 ) ; iv_ruleRichStringLiteralStart = ruleRichStringLiteralStart ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = iv_ruleRichStringLiteralStart ; } match ( input , EOF , FOLLOW_2 ) ; if ( state . failed ) return current ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class Tile { /** * Sets the description text of the gauge . This description text will usually
* only be visible if it is not empty .
* @ param DESCRIPTION */
public void setDescription ( final String DESCRIPTION ) { } } | if ( null == description ) { _description = DESCRIPTION ; fireTileEvent ( VISIBILITY_EVENT ) ; fireTileEvent ( REDRAW_EVENT ) ; } else { description . set ( DESCRIPTION ) ; } |
public class NavigationAnimationFactory { /** * Create a new zoom in { @ link NavigationAnimation } that zooms in to the provided end view .
* @ param mapPresenter The map onto which you want the zoom in animation to run .
* @ param endView The final view to arrive at when the animation finishes .
* @ return The animation . Just call " run " to have it animate the map . */
public static NavigationAnimation createZoomIn ( MapPresenter mapPresenter , View endView ) { } } | return new NavigationAnimationImpl ( mapPresenter . getViewPort ( ) , mapPresenter . getEventBus ( ) , new LinearTrajectory ( mapPresenter . getViewPort ( ) . getView ( ) , endView ) , getMillis ( mapPresenter ) ) ; |
public class VirtualMediaPanel { /** * Called during our tick when we have adjusted the view location . The { @ link # _ vbounds } will
* already have been updated to reflect our new view coordinates .
* @ param dx the delta scrolled in the x direction ( in pixels ) .
* @ param dy the delta scrolled in the y direction ( in pixels ) . */
protected void viewLocationDidChange ( int dx , int dy ) { } } | // inform our view trackers
for ( int ii = 0 , ll = _trackers . size ( ) ; ii < ll ; ii ++ ) { _trackers . get ( ii ) . viewLocationDidChange ( dx , dy ) ; } // pass the word on to our sprite / anim managers via the meta manager
_metamgr . viewLocationDidChange ( dx , dy ) ; |
public class AbstractViewQuery { /** * Starts an animation on the view .
* < br >
* contributed by : marcosbeirigo
* @ param animId Id of the desired animation .
* @ param listener The listener to recieve notifications from the animation on its events .
* @ return self */
public T animate ( int animId , Animation . AnimationListener listener ) { } } | Animation anim = AnimationUtils . loadAnimation ( context , animId ) ; anim . setAnimationListener ( listener ) ; return animate ( anim ) ; |
public class HelpParser { /** * Output this screen using HTML . */
public void printHtmlOptional ( PrintWriter out , String strTag , String strParams , String strData ) { } } | String strField = ( ( BasePanel ) this . getRecordOwner ( ) ) . getProperty ( "field" ) ; if ( ( strField != null ) && ( strField . length ( ) > 0 ) && ( m_recDetail . getField ( strField ) != null ) ) { String string = m_recDetail . getField ( strField ) . toString ( ) ; if ( strField . equalsIgnoreCase ( "TechnicalInfo" ) ) { string = this . getRecordOwner ( ) . getProperty ( "tech" ) ; // Special case - For Technical Info , Only output if & tech is found
if ( string != null ) string = "yes" ; } if ( ( string != null ) && ( string . length ( ) > 0 ) ) this . parseHtmlData ( out , strData ) ; // If the data is not blank , then process the HTML
// Otherwise , don ' t output the HTML
} |
public class CkyPcfgParser { /** * Process a cell ( binary rules only ) using the Cartesian product of the children ' s rules .
* This follows the description in ( Dunlop et al . , 2010 ) . */
private static final void processCellCartesianProduct ( final CnfGrammar grammar , final Chart chart , final int start , final int end , final ChartCell cell , final Scorer scorer ) { } } | // Apply binary rules .
for ( int mid = start + 1 ; mid <= end - 1 ; mid ++ ) { ChartCell leftCell = chart . getCell ( start , mid ) ; ChartCell rightCell = chart . getCell ( mid , end ) ; // Loop through all possible pairs of left / right non - terminals .
for ( final int leftChildNt : leftCell . getNts ( ) ) { double leftScoreForNt = leftCell . getScore ( leftChildNt ) ; for ( final int rightChildNt : rightCell . getNts ( ) ) { double rightScoreForNt = rightCell . getScore ( rightChildNt ) ; // Lookup the rules with those left / right children .
for ( final Rule r : grammar . getBinaryRulesWithChildren ( leftChildNt , rightChildNt ) ) { double score = scorer . score ( r , start , mid , end ) + leftScoreForNt + rightScoreForNt ; cell . updateCell ( r . getParent ( ) , score , mid , r ) ; } } } } |
public class CommerceAddressPersistenceImpl { /** * Returns the commerce address with the primary key or returns < code > null < / code > if it could not be found .
* @ param primaryKey the primary key of the commerce address
* @ return the commerce address , or < code > null < / code > if a commerce address with the primary key could not be found */
@ Override public CommerceAddress fetchByPrimaryKey ( Serializable primaryKey ) { } } | Serializable serializable = entityCache . getResult ( CommerceAddressModelImpl . ENTITY_CACHE_ENABLED , CommerceAddressImpl . class , primaryKey ) ; if ( serializable == nullModel ) { return null ; } CommerceAddress commerceAddress = ( CommerceAddress ) serializable ; if ( commerceAddress == null ) { Session session = null ; try { session = openSession ( ) ; commerceAddress = ( CommerceAddress ) session . get ( CommerceAddressImpl . class , primaryKey ) ; if ( commerceAddress != null ) { cacheResult ( commerceAddress ) ; } else { entityCache . putResult ( CommerceAddressModelImpl . ENTITY_CACHE_ENABLED , CommerceAddressImpl . class , primaryKey , nullModel ) ; } } catch ( Exception e ) { entityCache . removeResult ( CommerceAddressModelImpl . ENTITY_CACHE_ENABLED , CommerceAddressImpl . class , primaryKey ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } return commerceAddress ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.