signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class InternetPrintWriter { /** * Creates a new InternetPrintWriter for given charset encoding . * @ param outputStream the wrapped output stream . * @ param charset the charset . * @ return a new InternetPrintWriter . */ public static InternetPrintWriter createForEncoding ( OutputStream outputStream , boolean autoFlush , Charset charset ) { } }
return new InternetPrintWriter ( new OutputStreamWriter ( outputStream , charset ) , autoFlush ) ;
public class ScriptBytecodeAdapter { public static Object invokeNewN ( Class senderClass , Class receiver , Object arguments ) throws Throwable { } }
try { return InvokerHelper . invokeConstructorOf ( receiver , arguments ) ; } catch ( GroovyRuntimeException gre ) { throw unwrap ( gre ) ; }
public class IotHubResourcesInner { /** * Get all the IoT hubs in a resource group . * Get all the IoT hubs in a resource group . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; IotHubDescriptionInner & gt ; object */ public Observable < Page < IotHubDescriptionInner > > listByResourceGroupNextAsync ( final String nextPageLink ) { } }
return listByResourceGroupNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < IotHubDescriptionInner > > , Page < IotHubDescriptionInner > > ( ) { @ Override public Page < IotHubDescriptionInner > call ( ServiceResponse < Page < IotHubDescriptionInner > > response ) { return response . body ( ) ; } } ) ;
public class InternalJavaScriptResourceRenderer { /** * This methods generates the HTML code of the current b : internalJavaScriptResource . * @ param context the FacesContext . * @ param component the current b : internalJavaScriptResource . * @ throws IOException thrown if something goes wrong when writing the HTML code . */ @ Override public void encodeBegin ( FacesContext context , UIComponent component ) throws IOException { } }
if ( ! component . isRendered ( ) ) { return ; } InternalJavaScriptResource internalJavaScriptResource = ( InternalJavaScriptResource ) component ; ResponseWriter rw = context . getResponseWriter ( ) ; rw . startElement ( "script" , internalJavaScriptResource ) ; rw . writeAttribute ( "src" , internalJavaScriptResource . getUrl ( ) , null ) ; rw . endElement ( "script" ) ;
public class CmsSearchManager { /** * Returns a document type config . < p > * @ param name the name of the document type config * @ return the document type config . */ public CmsSearchDocumentType getDocumentTypeConfig ( String name ) { } }
// this is really used only for the search manager GUI , // so performance is not an issue and no lookup map is generated for ( int i = 0 ; i < m_documentTypeConfigs . size ( ) ; i ++ ) { CmsSearchDocumentType type = m_documentTypeConfigs . get ( i ) ; if ( type . getName ( ) . equals ( name ) ) { return type ; } } return null ;
public class UiCompat { /** * Returns a themed color integer associated with a particular resource ID . * If the resource holds a complex { @ link ColorStateList } , then the default * color from the set is returned . * @ param resources Resources * @ param id The desired resource identifier , as generated by the aapt * tool . This integer encodes the package , type , and resource * entry . The value 0 is an invalid identifier . * @ return A single color value in the form 0xAARRGGBB . */ public static int getColor ( Resources resources , int id ) { } }
if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . M ) { return resources . getColor ( id , null ) ; } else { return resources . getColor ( id ) ; }
public class AssetFiltersInner { /** * Create or update an Asset Filter . * Creates or updates an Asset Filter associated with the specified Asset . * @ param resourceGroupName The name of the resource group within the Azure subscription . * @ param accountName The Media Services account name . * @ param assetName The Asset name . * @ param filterName The Asset Filter name * @ param parameters The request parameters * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ApiErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the AssetFilterInner object if successful . */ public AssetFilterInner createOrUpdate ( String resourceGroupName , String accountName , String assetName , String filterName , AssetFilterInner parameters ) { } }
return createOrUpdateWithServiceResponseAsync ( resourceGroupName , accountName , assetName , filterName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ;
public class PhotosetsInterface { /** * Convenience method . * Calls getPhotos ( ) with Extras . MIN _ EXTRAS and Flickr . PRIVACY _ LEVEL _ NO _ FILTER . * This method does not require authentication . * @ see com . flickr4java . flickr . photos . Extras * @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ NO _ FILTER * @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ PUBLIC * @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ FRIENDS * @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ FRIENDS _ FAMILY * @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ FAMILY * @ see com . flickr4java . flickr . Flickr # PRIVACY _ LEVEL _ FRIENDS * @ param photosetId * The photoset ID * @ param perPage * The number of photos per page * @ param page * The page offset * @ return PhotoList The Collection of Photo objects * @ throws FlickrException */ public PhotoList < Photo > getPhotos ( String photosetId , int perPage , int page ) throws FlickrException { } }
return getPhotos ( photosetId , Extras . MIN_EXTRAS , Flickr . PRIVACY_LEVEL_NO_FILTER , perPage , page ) ;
public class ProcessEngineConfigurationImpl { /** * id generator / / / / / */ protected void initIdGenerator ( ) { } }
if ( idGenerator == null ) { CommandExecutor idGeneratorCommandExecutor = null ; if ( idGeneratorDataSource != null ) { ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneProcessEngineConfiguration ( ) ; processEngineConfiguration . setDataSource ( idGeneratorDataSource ) ; processEngineConfiguration . setDatabaseSchemaUpdate ( DB_SCHEMA_UPDATE_FALSE ) ; processEngineConfiguration . init ( ) ; idGeneratorCommandExecutor = processEngineConfiguration . getCommandExecutorTxRequiresNew ( ) ; } else if ( idGeneratorDataSourceJndiName != null ) { ProcessEngineConfigurationImpl processEngineConfiguration = new StandaloneProcessEngineConfiguration ( ) ; processEngineConfiguration . setDataSourceJndiName ( idGeneratorDataSourceJndiName ) ; processEngineConfiguration . setDatabaseSchemaUpdate ( DB_SCHEMA_UPDATE_FALSE ) ; processEngineConfiguration . init ( ) ; idGeneratorCommandExecutor = processEngineConfiguration . getCommandExecutorTxRequiresNew ( ) ; } else { idGeneratorCommandExecutor = commandExecutorTxRequiresNew ; } DbIdGenerator dbIdGenerator = new DbIdGenerator ( ) ; dbIdGenerator . setIdBlockSize ( idBlockSize ) ; dbIdGenerator . setCommandExecutor ( idGeneratorCommandExecutor ) ; idGenerator = dbIdGenerator ; }
public class Text { /** * Compares two chars . * @ param c1 the first char * @ param c2 the second char * @ return true if first and second chars are different . */ private boolean differentChars ( char c1 , char c2 ) { } }
if ( 65 <= c1 && c1 < 97 ) { c1 += 32 ; } if ( 65 <= c2 && c2 < 97 ) { c2 += 32 ; } return c1 != c2 ;
public class UserBinding { /** * Create a UserBindingFetcher to execute fetch . * @ param pathServiceSid The SID of the Service to fetch the resource from * @ param pathUserSid The SID of the User for the binding * @ param pathSid The unique string that identifies the resource * @ return UserBindingFetcher capable of executing the fetch */ public static UserBindingFetcher fetcher ( final String pathServiceSid , final String pathUserSid , final String pathSid ) { } }
return new UserBindingFetcher ( pathServiceSid , pathUserSid , pathSid ) ;
public class ConcurrentLinkedHashMap { /** * / * - - - - - Concurrent Map Support - - - - - */ public void clear ( ) { } }
// The alternative is to iterate through the keys and call # remove ( ) , // which // adds unnecessary contention on the eviction lock and buffers . evictionLock . lock ( ) ; try { Node node ; while ( ( node = evictionDeque . poll ( ) ) != null ) { data . remove ( node . key , node ) ; node . makeDead ( ) ; } // Drain the buffers and run only the write tasks for ( int i = 0 ; i < buffers . length ; i ++ ) { Queue < Task > buffer = buffers [ i ] ; int removed = 0 ; Task task ; while ( ( task = buffer . poll ( ) ) != null ) { if ( task . isWrite ( ) ) { task . run ( ) ; } removed ++ ; } bufferLengths . addAndGet ( i , - removed ) ; } } finally { evictionLock . unlock ( ) ; }
public class ContainerReadIndex { /** * Gets a reference to the existing StreamSegmentRead index for the given StreamSegment Id . Creates a new one if * necessary . * @ param streamSegmentId The Id of the StreamSegment whose ReadIndex to get . */ private StreamSegmentReadIndex getOrCreateIndex ( long streamSegmentId ) throws StreamSegmentNotExistsException { } }
StreamSegmentReadIndex index ; synchronized ( this . lock ) { // Try to see if we have the index already in memory . index = getIndex ( streamSegmentId ) ; if ( index == null ) { // We don ' t have it , create one . SegmentMetadata segmentMetadata = this . metadata . getStreamSegmentMetadata ( streamSegmentId ) ; Exceptions . checkArgument ( segmentMetadata != null , "streamSegmentId" , "StreamSegmentId %s does not exist in the metadata." , streamSegmentId ) ; if ( segmentMetadata . isDeleted ( ) ) { throw new StreamSegmentNotExistsException ( segmentMetadata . getName ( ) ) ; } index = new StreamSegmentReadIndex ( this . config , segmentMetadata , this . cache , this . storage , this . executor , isRecoveryMode ( ) ) ; this . cacheManager . register ( index ) ; this . readIndices . put ( streamSegmentId , index ) ; } } return index ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcMemberType ( ) { } }
if ( ifcMemberTypeEClass == null ) { ifcMemberTypeEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 321 ) ; } return ifcMemberTypeEClass ;
public class ImageViewHelper { /** * Helper method to calculate drawing matrix . Based on ImageView source code . */ static void applyScaleType ( ImageView . ScaleType type , int dwidth , int dheight , int vwidth , int vheight , Matrix imageMatrix , Matrix outMatrix ) { } }
if ( ImageView . ScaleType . CENTER == type ) { // Center bitmap in view , no scaling . outMatrix . setTranslate ( ( vwidth - dwidth ) * 0.5f , ( vheight - dheight ) * 0.5f ) ; } else if ( ImageView . ScaleType . CENTER_CROP == type ) { float scale ; float dx = 0 ; float dy = 0 ; if ( dwidth * vheight > vwidth * dheight ) { scale = ( float ) vheight / ( float ) dheight ; dx = ( vwidth - dwidth * scale ) * 0.5f ; } else { scale = ( float ) vwidth / ( float ) dwidth ; dy = ( vheight - dheight * scale ) * 0.5f ; } outMatrix . setScale ( scale , scale ) ; outMatrix . postTranslate ( dx , dy ) ; } else if ( ImageView . ScaleType . CENTER_INSIDE == type ) { float scale ; float dx ; float dy ; if ( dwidth <= vwidth && dheight <= vheight ) { scale = 1.0f ; } else { scale = Math . min ( ( float ) vwidth / ( float ) dwidth , ( float ) vheight / ( float ) dheight ) ; } dx = ( vwidth - dwidth * scale ) * 0.5f ; dy = ( vheight - dheight * scale ) * 0.5f ; outMatrix . setScale ( scale , scale ) ; outMatrix . postTranslate ( dx , dy ) ; } else { Matrix . ScaleToFit scaleToFit = scaleTypeToScaleToFit ( type ) ; if ( scaleToFit == null ) { outMatrix . set ( imageMatrix ) ; } else { // Generate the required transform . tmpSrc . set ( 0 , 0 , dwidth , dheight ) ; tmpDst . set ( 0 , 0 , vwidth , vheight ) ; outMatrix . setRectToRect ( tmpSrc , tmpDst , scaleToFit ) ; } }
public class DiagnosticsInner { /** * Get Detector . * Get Detector . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws DefaultErrorResponseException 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 ; DetectorDefinitionInner & gt ; object if successful . */ public PagedList < DetectorDefinitionInner > getSiteDetectorSlotNext ( final String nextPageLink ) { } }
ServiceResponse < Page < DetectorDefinitionInner > > response = getSiteDetectorSlotNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < DetectorDefinitionInner > ( response . body ( ) ) { @ Override public Page < DetectorDefinitionInner > nextPage ( String nextPageLink ) { return getSiteDetectorSlotNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ;
public class TypeImplementationGenerator { /** * Prints the list of static variable and / or enum constant accessor methods . */ protected void printStaticAccessors ( ) { } }
if ( ! options . staticAccessorMethods ( ) ) { return ; } for ( VariableDeclarationFragment fragment : getStaticFields ( ) ) { if ( ! ( ( FieldDeclaration ) fragment . getParent ( ) ) . hasPrivateDeclaration ( ) ) { VariableElement varElement = fragment . getVariableElement ( ) ; TypeMirror type = varElement . asType ( ) ; boolean isVolatile = ElementUtil . isVolatile ( varElement ) ; boolean isPrimitive = type . getKind ( ) . isPrimitive ( ) ; String accessorName = nameTable . getStaticAccessorName ( varElement ) ; String varName = nameTable . getVariableQualifiedName ( varElement ) ; String objcType = nameTable . getObjCType ( type ) ; String typeSuffix = isPrimitive ? NameTable . capitalize ( TypeUtil . getName ( type ) ) : "Id" ; TypeElement declaringClass = ElementUtil . getDeclaringClass ( varElement ) ; String baseName = nameTable . getVariableBaseName ( varElement ) ; ExecutableElement getter = ElementUtil . findGetterMethod ( baseName , type , declaringClass , /* isStatic = */ true ) ; if ( getter == null ) { if ( isVolatile ) { printf ( "\n+ (%s)%s {\n return JreLoadVolatile%s(&%s);\n}\n" , objcType , accessorName , typeSuffix , varName ) ; } else { printf ( "\n+ (%s)%s {\n return %s;\n}\n" , objcType , accessorName , varName ) ; } } ExecutableElement setter = ElementUtil . findSetterMethod ( baseName , type , declaringClass , /* isStatic = */ true ) ; if ( setter == null && ! ElementUtil . isFinal ( varElement ) ) { String setterFunc = isVolatile ? ( isPrimitive ? "JreAssignVolatile" + typeSuffix : "JreVolatileStrongAssign" ) : ( isPrimitive | options . useARC ( ) ? null : "JreStrongAssign" ) ; if ( setterFunc == null ) { printf ( "\n+ (void)set%s:(%s)value {\n %s = value;\n}\n" , NameTable . capitalize ( accessorName ) , objcType , varName ) ; } else { printf ( "\n+ (void)set%s:(%s)value {\n %s(&%s, value);\n}\n" , NameTable . capitalize ( accessorName ) , objcType , setterFunc , varName ) ; } } } } if ( typeNode instanceof EnumDeclaration ) { for ( EnumConstantDeclaration constant : ( ( EnumDeclaration ) typeNode ) . getEnumConstants ( ) ) { VariableElement varElement = constant . getVariableElement ( ) ; printf ( "\n+ (%s *)%s {\n return %s;\n}\n" , typeName , nameTable . getStaticAccessorName ( varElement ) , nameTable . getVariableQualifiedName ( varElement ) ) ; } }
public class AsyncAssembly { /** * Pauses the file upload . This is a blocking function that would try to wait till the assembly file uploads * have actually been paused if possible . * @ throws LocalOperationException if the method is called while no upload is going on . */ public void pauseUpload ( ) throws LocalOperationException { } }
if ( state == State . UPLOADING ) { setState ( State . PAUSED ) ; executor . hardStop ( ) ; } else { throw new LocalOperationException ( "Attempt to pause upload while assembly is not uploading" ) ; }
public class BundleDetailsMarshaller { /** * Marshall the given parameter object . */ public void marshall ( BundleDetails bundleDetails , ProtocolMarshaller protocolMarshaller ) { } }
if ( bundleDetails == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( bundleDetails . getBundleId ( ) , BUNDLEID_BINDING ) ; protocolMarshaller . marshall ( bundleDetails . getTitle ( ) , TITLE_BINDING ) ; protocolMarshaller . marshall ( bundleDetails . getVersion ( ) , VERSION_BINDING ) ; protocolMarshaller . marshall ( bundleDetails . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( bundleDetails . getIconUrl ( ) , ICONURL_BINDING ) ; protocolMarshaller . marshall ( bundleDetails . getAvailablePlatforms ( ) , AVAILABLEPLATFORMS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ArrayHelper { /** * Get a 1:1 copy of the passed array . Nested elements are not deep - copied - * the references are re - used ! * @ param aArray * The array to be copied . * @ return < code > null < / code > if the passed array is < code > null < / code > - a non - * < code > null < / code > copy otherwise . */ @ Nullable @ ReturnsMutableCopy public static float [ ] getCopy ( @ Nullable final float ... aArray ) { } }
return aArray == null ? null : getCopy ( aArray , 0 , aArray . length ) ;
public class Range { /** * only valid if this . and ( operand ) is not empty ! */ public void remove ( Range operand , List < Range > result ) { } }
// a piece left of operand // | - - this - - | // | - - op - - | if ( first < operand . first ) { result . add ( new Range ( first , ( char ) ( operand . first - 1 ) ) ) ; } // a piece right of operand // | - - this - - | // | - - op - - | if ( operand . last < last ) { result . add ( new Range ( ( char ) ( operand . last + 1 ) , last ) ) ; } // result is not changes this is completly covered by operand
public class CrawlerPack { /** * 取得遠端格式為 JSON 的資料 * @ param uri required Apache Common VFS supported file systems and response JSON format content . * @ return org . jsoup . nodes . Document */ public org . jsoup . nodes . Document getFromJson ( String uri ) { } }
// 取回資料 , 並轉化為XML格式 String json = getFromRemote ( uri ) ; // 將 json 轉化為 xml String xml = jsonToXml ( json ) ; // 轉化為 Jsoup 物件 return xmlToJsoupDoc ( xml ) ;
public class CmsImportVersion10 { /** * Imports a new user from the current xml data . < p > */ public void importUser ( ) { } }
// create a new user id String userName = m_orgUnit . getName ( ) + m_userName ; try { if ( m_throwable != null ) { m_user = null ; getReport ( ) . println ( m_throwable ) ; CmsMessageContainer message = Messages . get ( ) . container ( Messages . ERR_IMPORTEXPORT_ERROR_IMPORTING_USER_1 , userName ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( message . key ( ) , m_throwable ) ; } m_throwable = null ; return ; } getReport ( ) . print ( Messages . get ( ) . container ( Messages . RPT_IMPORT_USER_0 ) , I_CmsReport . FORMAT_NOTE ) ; getReport ( ) . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_ARGUMENT_1 , userName ) ) ; getReport ( ) . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_DOTS_0 ) ) ; try { getCms ( ) . readUser ( userName ) ; // user exists already getReport ( ) . println ( Messages . get ( ) . container ( Messages . RPT_NOT_CREATED_0 ) , I_CmsReport . FORMAT_OK ) ; m_user = null ; return ; } catch ( @ SuppressWarnings ( "unused" ) CmsDbEntryNotFoundException e ) { // user does not exist } CmsParameterConfiguration config = OpenCms . getPasswordHandler ( ) . getConfiguration ( ) ; if ( ( config != null ) && config . containsKey ( I_CmsPasswordHandler . CONVERT_DIGEST_ENCODING ) ) { if ( config . getBoolean ( I_CmsPasswordHandler . CONVERT_DIGEST_ENCODING , false ) ) { m_userPassword = convertDigestEncoding ( m_userPassword ) ; } } m_user = getCms ( ) . importUser ( new CmsUUID ( ) . toString ( ) , userName , m_userPassword , m_userFirstname , m_userLastname , m_userEmail , m_userFlags , m_userDateCreated , m_userInfos ) ; getReport ( ) . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_OK_0 ) , I_CmsReport . FORMAT_OK ) ; } catch ( Throwable e ) { m_user = null ; getReport ( ) . println ( e ) ; CmsMessageContainer message = Messages . get ( ) . container ( Messages . ERR_IMPORTEXPORT_ERROR_IMPORTING_USER_1 , userName ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( message . key ( ) , e ) ; } } finally { m_userName = null ; m_userPassword = null ; m_userFirstname = null ; m_userLastname = null ; m_userEmail = null ; m_userFlags = 0 ; m_userDateCreated = 0 ; m_userInfos = null ; }
public class BundleDelegatingPageMounter { /** * < p > stop . < / p > */ public void stop ( ) { } }
Collection < List < DefaultPageMounter > > values ; synchronized ( mountPointRegistrations ) { values = new ArrayList < List < DefaultPageMounter > > ( mountPointRegistrations . values ( ) ) ; mountPointRegistrations . clear ( ) ; } for ( List < DefaultPageMounter > bundleMounters : values ) { for ( DefaultPageMounter pageMounter : bundleMounters ) { pageMounter . dispose ( ) ; } }
public class Files { /** * Replace extension on given file path and return resulting path . Is legal for new extension parameter to start with * dot extension separator , but is not mandatory . * @ param path file path to replace extension , * @ param newExtension newly extension , with optional dot separator prefix . * @ return newly created file path . * @ throws IllegalArgumentException if path or new extension parameter is null . */ public static String replaceExtension ( String path , String newExtension ) throws IllegalArgumentException { } }
Params . notNull ( path , "Path" ) ; Params . notNull ( newExtension , "New extension" ) ; if ( newExtension . charAt ( 0 ) == '.' ) { newExtension = newExtension . substring ( 1 ) ; } int extensionDotIndex = path . lastIndexOf ( '.' ) + 1 ; if ( extensionDotIndex == 0 ) { extensionDotIndex = path . length ( ) ; } StringBuilder sb = new StringBuilder ( path . length ( ) ) ; sb . append ( path . substring ( 0 , extensionDotIndex ) ) ; sb . append ( newExtension ) ; return sb . toString ( ) ;
public class ImgUtil { /** * 给图片添加文字水印 * @ param imageFile 源图像文件 * @ param destFile 目标图像文件 * @ param pressText 水印文字 * @ param color 水印的字体颜色 * @ param font { @ link Font } 字体相关信息 , 如果默认则为 { @ code null } * @ param x 修正值 。 默认在中间 , 偏移量相对于中间偏移 * @ param y 修正值 。 默认在中间 , 偏移量相对于中间偏移 * @ param alpha 透明度 : alpha 必须是范围 [ 0.0 , 1.0 ] 之内 ( 包含边界值 ) 的一个浮点数字 */ public static void pressText ( File imageFile , File destFile , String pressText , Color color , Font font , int x , int y , float alpha ) { } }
pressText ( read ( imageFile ) , destFile , pressText , color , font , x , y , alpha ) ;
public class TiledRasterLayerService { /** * Paint raster layer . * @ param tileServiceState state ( as this is a singleton ) * @ param boundsCrs crs for bounds * @ param bounds bounds for which tiles are needed * @ param scale scale for rendering * @ return list of raster tiles * @ throws GeomajasException oops * @ since 1.8.0 */ @ Api public List < RasterTile > paint ( TiledRasterLayerServiceState tileServiceState , CoordinateReferenceSystem boundsCrs , Envelope bounds , double scale ) throws GeomajasException { } }
try { CrsTransform layerToMap = geoService . getCrsTransform ( tileServiceState . getCrs ( ) , boundsCrs ) ; CrsTransform mapToLayer = geoService . getCrsTransform ( boundsCrs , tileServiceState . getCrs ( ) ) ; bounds = clipBounds ( tileServiceState , bounds ) ; if ( bounds . isNull ( ) ) { return new ArrayList < RasterTile > ( ) ; } // find the center of the map in map coordinates ( positive y - axis ) Coordinate boundsCenter = new Coordinate ( ( bounds . getMinX ( ) + bounds . getMaxX ( ) ) / 2 , ( bounds . getMinY ( ) + bounds . getMaxY ( ) ) / 2 ) ; // find zoomlevel // scale in pix / m should just above the given scale so we have at least one // screen pixel per google pixel ! ( otherwise text unreadable ) int zoomLevel = getBestZoomLevelForScaleInPixPerMeter ( tileServiceState , mapToLayer , boundsCenter , scale ) ; log . debug ( "zoomLevel={}" , zoomLevel ) ; // find the google indices for the center // google indices determine the row and column of the 256x256 image // in the big google square for the given zoom zoomLevel // the resulting indices are floating point values as the center // is not coincident with an image corner ! ! ! ! Coordinate indicesCenter ; indicesCenter = getTileIndicesFromMap ( mapToLayer , boundsCenter , zoomLevel ) ; // Calculate the width in map units of the image that contains the // center Coordinate indicesUpperLeft = new Coordinate ( Math . floor ( indicesCenter . x ) , Math . floor ( indicesCenter . y ) ) ; Coordinate indicesLowerRight = new Coordinate ( indicesUpperLeft . x + 1 , indicesUpperLeft . y + 1 ) ; Coordinate mapUpperLeft = getMapFromTileIndices ( layerToMap , indicesUpperLeft , zoomLevel ) ; Coordinate mapLowerRight = getMapFromTileIndices ( layerToMap , indicesLowerRight , zoomLevel ) ; double width = Math . abs ( mapLowerRight . x - mapUpperLeft . x ) ; if ( 0 == width ) { width = 1.0 ; } double height = Math . abs ( mapLowerRight . y - mapUpperLeft . y ) ; if ( 0 == height ) { height = 1.0 ; } // Calculate the position and indices of the center image corner // in map space double xCenter = boundsCenter . x - ( indicesCenter . x - indicesUpperLeft . x ) * width ; double yCenter = boundsCenter . y + ( indicesCenter . y - indicesUpperLeft . y ) * height ; int iCenter = ( int ) indicesUpperLeft . x ; int jCenter = ( int ) indicesUpperLeft . y ; // Calculate the position and indices of the upper left image corner // that just falls off the screen double xMin = xCenter ; int iMin = iCenter ; while ( xMin > bounds . getMinX ( ) && iMin > 0 ) { xMin -= width ; iMin -- ; } double yMax = yCenter ; int jMin = jCenter ; while ( yMax < bounds . getMaxY ( ) && jMin > 0 ) { yMax += height ; jMin -- ; } // Calculate the indices of the lower right corner // that just falls off the screen int levelMax = POWERS_OF_TWO [ zoomLevel ] - 1 ; double xMax = xCenter ; int iMax = iCenter ; while ( xMax < bounds . getMaxX ( ) && iMax <= levelMax ) { xMax += width ; iMax ++ ; } double yMin = yCenter ; int jMax = jCenter ; while ( yMin > bounds . getMinY ( ) && jMax <= levelMax ) { yMin -= height ; jMax ++ ; } Coordinate upperLeft = new Coordinate ( xMin , yMax ) ; // calculate the images List < RasterTile > result = new ArrayList < RasterTile > ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "bounds =" + bounds ) ; log . debug ( "tilebounds " + xMin + ", " + xMax + ", " + yMin + ", " + yMax ) ; log . debug ( "indices " + iMin + ", " + iMax + ", " + jMin + ", " + jMax ) ; } int xScreenUpperLeft = ( int ) Math . round ( upperLeft . x * scale ) ; int yScreenUpperLeft = ( int ) Math . round ( upperLeft . y * scale ) ; int screenWidth = ( int ) Math . round ( scale * width ) ; int screenHeight = ( int ) Math . round ( scale * height ) ; for ( int i = iMin ; i < iMax ; i ++ ) { for ( int j = jMin ; j < jMax ; j ++ ) { // Using screen coordinates : int x = xScreenUpperLeft + ( i - iMin ) * screenWidth ; int y = yScreenUpperLeft - ( j - jMin ) * screenHeight ; RasterTile image = new RasterTile ( new Bbox ( x , - y , screenWidth , screenHeight ) , tileServiceState . getId ( ) + "." + zoomLevel + "." + i + "," + j ) ; image . setCode ( new TileCode ( zoomLevel , i , j ) ) ; String url = tileServiceState . getUrlSelectionStrategy ( ) . next ( ) ; url = url . replace ( "${level}" , Integer . toString ( zoomLevel ) ) ; url = url . replace ( "${x}" , Integer . toString ( i ) ) ; url = url . replace ( "${y}" , Integer . toString ( j ) ) ; image . setUrl ( url ) ; log . debug ( "adding image {}" , image ) ; result . add ( image ) ; } } return result ; } catch ( TransformException e ) { throw new GeomajasException ( e , ExceptionCode . RENDER_TRANSFORMATION_FAILED ) ; }
public class ArchiveExtractor { /** * Open and extract data from Tar pattern files */ private boolean unTar ( String fileName , String innerDir , String archiveFile ) { } }
boolean success = true ; TarUnArchiver unArchiver = new TarUnArchiver ( ) ; try { File destDir = new File ( innerDir ) ; if ( ! destDir . exists ( ) ) { destDir . mkdirs ( ) ; } if ( fileName . endsWith ( TAR_GZ_SUFFIX ) || fileName . endsWith ( TGZ_SUFFIX ) ) { unArchiver = new TarGZipUnArchiver ( ) ; } else if ( fileName . endsWith ( TAR_BZ2_SUFFIX ) ) { unArchiver = new TarBZip2UnArchiver ( ) ; } else if ( fileName . endsWith ( XZ_SUFFIX ) ) { String destFileUrl = destDir . getCanonicalPath ( ) + Constants . BACK_SLASH + XZ_UN_ARCHIVER_FILE_NAME ; success = unXz ( new File ( archiveFile ) , destFileUrl ) ; archiveFile = destFileUrl ; } if ( success ) { unArchiver . enableLogging ( new ConsoleLogger ( ConsoleLogger . LEVEL_DISABLED , UN_ARCHIVER_LOGGER ) ) ; unArchiver . setSourceFile ( new File ( archiveFile ) ) ; unArchiver . setDestDirectory ( destDir ) ; unArchiver . extract ( ) ; } } catch ( Exception e ) { success = false ; logger . warn ( "Error extracting file {}: {}" , fileName , e . getMessage ( ) ) ; } return success ;
public class Solo { /** * Scroll the specified AbsListView to the specified line . * @ param absListView the { @ link AbsListView } to scroll * @ param line the line to scroll to */ public void scrollListToLine ( AbsListView absListView , int line ) { } }
if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "scrollListToLine(" + absListView + ", " + line + ")" ) ; } scroller . scrollListToLine ( absListView , line ) ;
public class LoggedInUserStorage { /** * Set the base directory to be used . * @ param sBaseDirectory * The new base directory . May not be < code > null < / code > but maybe * empty . */ public static void setBaseDirectory ( @ Nonnull final String sBaseDirectory ) { } }
ValueEnforcer . notNull ( sBaseDirectory , "BaseDirectory" ) ; s_aRWLock . writeLocked ( ( ) -> { s_sBaseDirectory = sBaseDirectory ; } ) ;
public class SessionNotificationCtx { /** * Used to write the state of the SessionNotificationCtx instance to disk , * when we are persisting the state of the ClusterManager * @ param jsonGenerator The JsonGenerator instance being used to write JSON * to disk * @ throws IOException */ public void write ( JsonGenerator jsonGenerator ) throws IOException { } }
jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeStringField ( "handle" , handle ) ; jsonGenerator . writeStringField ( "host" , host ) ; jsonGenerator . writeNumberField ( "port" , port ) ; jsonGenerator . writeNumberField ( "numPendingCalls" , pendingCalls . size ( ) ) ; jsonGenerator . writeFieldName ( "pendingCalls" ) ; jsonGenerator . writeStartArray ( ) ; for ( TBase call : pendingCalls ) { jsonGenerator . writeStartObject ( ) ; // TBase is an abstract class . While reading back , we want to know // what kind of object we actually wrote . Jackson does provide two methods // to do it automatically , but one of them adds types at a lot of places // where we don ' t need it , and hence our parsing would be required to be // changed . The other required adding an annotation to the TBase class , // which we can ' t do , since it is auto - generated by Thrift . String callType = call . getClass ( ) . getName ( ) ; jsonGenerator . writeStringField ( "callType" , callType ) ; jsonGenerator . writeObjectField ( "call" , call ) ; jsonGenerator . writeEndObject ( ) ; } jsonGenerator . writeEndArray ( ) ; jsonGenerator . writeEndObject ( ) ;
public class AbstractDependencyFilterMojo { /** * Return artifact filters configured for this MOJO . * @ param additionalFilters optional additional filters to apply * @ return the filters */ protected final FilterArtifacts getFilters ( ArtifactsFilter ... additionalFilters ) { } }
FilterArtifacts filters = new FilterArtifacts ( ) ; for ( ArtifactsFilter additionalFilter : additionalFilters ) { filters . addFilter ( additionalFilter ) ; } filters . addFilter ( new MatchingGroupIdFilter ( cleanFilterConfig ( this . excludeGroupIds ) ) ) ; if ( this . includes != null && ! this . includes . isEmpty ( ) ) { filters . addFilter ( new IncludeFilter ( this . includes ) ) ; } if ( this . excludes != null && ! this . excludes . isEmpty ( ) ) { filters . addFilter ( new ExcludeFilter ( this . excludes ) ) ; } return filters ;
public class ThreadPoolManager { /** * 获取有效的线程池 */ public static ExecutorService getValidExecutor ( ) { } }
ExecutorService executorToUse ; if ( EXECUTOR . isTerminating ( ) || EXECUTOR . isShutdown ( ) || EXECUTOR . isTerminated ( ) ) { executorToUse = Executors . newSingleThreadExecutor ( ) ; LOG . info ( "由于线程池" + ThreadPoolManager . class . getSimpleName ( ) + "不可用,因此使用临时线程提交此任务" ) ; } else { executorToUse = EXECUTOR ; } return executorToUse ;
public class ImmutableMatrixFactory { /** * Returns an immutable vector with the same values as the argument . * @ param source the vector containing the data for the new immutable vector * @ return an immutable vector containing the same elements as { @ code source } * @ throws NullPointerException if { @ code source } is { @ code null } */ public static ImmutableVector3 copy ( Vector3 source ) { } }
if ( source instanceof ImmutableVector3 ) return ( ImmutableVector3 ) source ; return createVector ( source . getX ( ) , source . getY ( ) , source . getZ ( ) ) ;
public class CompilationUnit { /** * Returns an iterator on the unit ' s SourceUnits . */ public Iterator < SourceUnit > iterator ( ) { } }
return new Iterator < SourceUnit > ( ) { Iterator < String > nameIterator = names . iterator ( ) ; public boolean hasNext ( ) { return nameIterator . hasNext ( ) ; } public SourceUnit next ( ) { String name = nameIterator . next ( ) ; return sources . get ( name ) ; } public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ;
public class ElementMatchers { /** * Matches an { @ link AnnotationSource } to declare any annotation * that matches the given matcher . Note that this matcher does not match inherited annotations that only exist * for types . Use { @ link net . bytebuddy . matcher . ElementMatchers # inheritsAnnotation ( net . bytebuddy . matcher . ElementMatcher ) } * for matching inherited annotations . * @ param matcher A matcher to apply on any declared annotation of the matched annotated element . * @ param < T > The type of the matched object . * @ return A matcher that validates that an annotated element is annotated with an annotation that matches * the given { @ code matcher } . */ public static < T extends AnnotationSource > ElementMatcher . Junction < T > declaresAnnotation ( ElementMatcher < ? super AnnotationDescription > matcher ) { } }
return new DeclaringAnnotationMatcher < T > ( new CollectionItemMatcher < AnnotationDescription > ( matcher ) ) ;
public class Matrix4d { /** * Set < code > this < / code > matrix to < code > T * R * S < / code > , where < code > T < / code > is a translation by the given < code > ( tx , ty , tz ) < / code > , * < code > R < / code > is a rotation transformation specified by the quaternion < code > ( qx , qy , qz , qw ) < / code > , and < code > S < / code > is a scaling transformation * which scales the three axes x , y and z by < code > ( sx , sy , sz ) < / code > . * When transforming a vector by the resulting matrix the scaling transformation will be applied first , then the rotation and * at last the translation . * When used with a right - handed coordinate system , the produced rotation will rotate a vector * counter - clockwise around the rotation axis , when viewing along the negative axis direction towards the origin . * When used with a left - handed coordinate system , the rotation is clockwise . * This method is equivalent to calling : < code > translation ( tx , ty , tz ) . rotate ( quat ) . scale ( sx , sy , sz ) < / code > * @ see # translation ( double , double , double ) * @ see # rotate ( Quaterniondc ) * @ see # scale ( double , double , double ) * @ param tx * the number of units by which to translate the x - component * @ param ty * the number of units by which to translate the y - component * @ param tz * the number of units by which to translate the z - component * @ param qx * the x - coordinate of the vector part of the quaternion * @ param qy * the y - coordinate of the vector part of the quaternion * @ param qz * the z - coordinate of the vector part of the quaternion * @ param qw * the scalar part of the quaternion * @ param sx * the scaling factor for the x - axis * @ param sy * the scaling factor for the y - axis * @ param sz * the scaling factor for the z - axis * @ return this */ public Matrix4d translationRotateScale ( double tx , double ty , double tz , double qx , double qy , double qz , double qw , double sx , double sy , double sz ) { } }
double dqx = qx + qx , dqy = qy + qy , dqz = qz + qz ; double q00 = dqx * qx ; double q11 = dqy * qy ; double q22 = dqz * qz ; double q01 = dqx * qy ; double q02 = dqx * qz ; double q03 = dqx * qw ; double q12 = dqy * qz ; double q13 = dqy * qw ; double q23 = dqz * qw ; m00 = sx - ( q11 + q22 ) * sx ; m01 = ( q01 + q23 ) * sx ; m02 = ( q02 - q13 ) * sx ; m03 = 0.0 ; m10 = ( q01 - q23 ) * sy ; m11 = sy - ( q22 + q00 ) * sy ; m12 = ( q12 + q03 ) * sy ; m13 = 0.0 ; m20 = ( q02 + q13 ) * sz ; m21 = ( q12 - q03 ) * sz ; m22 = sz - ( q11 + q00 ) * sz ; m23 = 0.0 ; m30 = tx ; m31 = ty ; m32 = tz ; m33 = 1.0 ; boolean one = Math . abs ( sx ) == 1.0 && Math . abs ( sy ) == 1.0 && Math . abs ( sz ) == 1.0 ; properties = PROPERTY_AFFINE | ( one ? PROPERTY_ORTHONORMAL : 0 ) ; return this ;
public class CSSExpression { /** * Shortcut method to add a string value that is automatically quoted inside * @ param nIndex * The index where the member should be added . Must be & ge ; 0. * @ param sValue * The value to be quoted and than added . May not be < code > null < / code > . * @ return this */ @ Nonnull public CSSExpression addString ( @ Nonnegative final int nIndex , @ Nonnull final String sValue ) { } }
return addTermSimple ( nIndex , getQuotedStringValue ( sValue ) ) ;
public class Surface { /** * Draws a tile at the specified location : { @ code x , y } . */ public Surface draw ( Tile tile , float x , float y ) { } }
return draw ( tile , x , y , tile . width ( ) , tile . height ( ) ) ;
public class CommerceRegionPersistenceImpl { /** * Returns an ordered range of all the commerce regions where commerceCountryId = & # 63 ; and active = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceRegionModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param commerceCountryId the commerce country ID * @ param active the active * @ param start the lower bound of the range of commerce regions * @ param end the upper bound of the range of commerce regions ( not inclusive ) * @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > ) * @ return the ordered range of matching commerce regions */ @ Override public List < CommerceRegion > findByC_A ( long commerceCountryId , boolean active , int start , int end , OrderByComparator < CommerceRegion > orderByComparator ) { } }
return findByC_A ( commerceCountryId , active , start , end , orderByComparator , true ) ;
public class SimpleProfiler { /** * Stop the timer identified by the given key . After stopping a timer , the time passed from its * { @ link # start ( String ) initialization } will be added to the cumulated time of the specific timer . * @ param name * The name of the timer to be stopped . */ public static void stop ( String name ) { } }
Long start = PENDING . remove ( name ) ; if ( start == null ) { return ; } long duration = System . currentTimeMillis ( ) - start ; Counter sum = CUMULATED . computeIfAbsent ( name , k -> new Counter ( k , "ms" ) ) ; sum . increment ( duration ) ;
public class AdditionalAnswers { /** * Creates an answer from a functional interface - allows for a strongly typed answer to be created * ideally in Java 8 * @ param answer interface to the answer - which is expected to return something * @ param < T > return type * @ param < A > input parameter type 1 * @ param < B > input parameter type 2 * @ param < C > input parameter type 3 * @ param < D > input parameter type 4 * @ param < E > input parameter type 5 * @ return the answer object to use * @ since 2.1.0 */ @ Incubating public static < T , A , B , C , D , E > Answer < T > answer ( Answer5 < T , A , B , C , D , E > answer ) { } }
return toAnswer ( answer ) ;
public class DispatcherServlet { /** * Iglu request attributes will be copied to the servlet request . * @ param dispatch * @ param parameters * @ return * @ throws ServletException */ public boolean dispatch ( String dispatch , String [ ] parameters ) // throws IOException { } }
String dispatchURL = dispatch ; HttpServletRequest servletRequest = httpRequest . get ( ) ; HttpServletResponse servletResponse = httpResponse . get ( ) ; // set content type , because otherwise the response // may be interpreted as text / plain servletResponse . setContentType ( "text/html; charset=UTF-8" ) ; try { // pass set attributes as new servlet parameters ( a hack to get rid of ) Request request = requestRegistry . getCurrentRequest ( ) ; if ( request != null ) { for ( Object name : request . getAttributeMap ( ) . keySet ( ) ) { Object o = request . getAttributeMap ( ) . get ( name ) ; servletRequest . setAttribute ( name . toString ( ) , o ) ; } } // servlet - include , servlet - forward , service - invocation switch ( this . dispatchMode ) { case FORWARD : { ServletSupport . forward ( dispatchURL , servletRequest , servletResponse ) ; } default : // INCLUDE { ServletSupport . include ( dispatchURL , servletRequest , servletResponse ) ; } } } catch ( ServletException e ) { throw new ResourceException ( "failed to dispatch servlet request to " + dispatchURL , e ) ; } catch ( IOException e ) { throw new ResourceException ( "failed to dispatch servlet request to " + dispatchURL , e ) ; } return true ;
public class NfsFileBase { /** * ( non - Javadoc ) * @ see com . emc . ecs . nfsclient . nfs . NfsFile # mkdir ( com . emc . ecs . nfsclient . nfs . * NfsSetAttributes ) */ public NfsMkdirResponse mkdir ( NfsSetAttributes attributes ) throws IOException { } }
NfsMkdirResponse response = getNfs ( ) . wrapped_sendMkdir ( makeMkdirRequest ( attributes ) ) ; setFileHandle ( response . getFileHandle ( ) ) ; return response ;
public class TSDB { /** * Attempts to find the UID matching a given name * @ param type The type of UID * @ param name The name to search for * @ throws IllegalArgumentException if the type is not valid * @ throws NoSuchUniqueName if the name was not found * @ since 2.0 */ public byte [ ] getUID ( final UniqueIdType type , final String name ) { } }
try { return getUIDAsync ( type , name ) . join ( ) ; } catch ( NoSuchUniqueName e ) { throw e ; } catch ( IllegalArgumentException e ) { throw e ; } catch ( Exception e ) { LOG . error ( "Unexpected exception" , e ) ; throw new RuntimeException ( e ) ; }
public class ParameterEditManager { /** * This method does the actual work of adding a newly created parameter edit and adding it to * the parameter edits set . */ private static void addParmEditDirective ( String targetID , String name , String value , IPerson person , Document plf , Element parmSet ) throws PortalException { } }
String ID = null ; try { ID = getDLS ( ) . getNextStructDirectiveId ( person ) ; } catch ( Exception e ) { throw new PortalException ( "Exception encountered while " + "generating new parameter edit node " + "Id for userId=" + person . getID ( ) , e ) ; } Element parm = plf . createElement ( Constants . ELM_PARM_EDIT ) ; parm . setAttribute ( Constants . ATT_TYPE , Constants . ELM_PARM_EDIT ) ; parm . setAttribute ( Constants . ATT_ID , ID ) ; parm . setIdAttribute ( Constants . ATT_ID , true ) ; parm . setAttributeNS ( Constants . NS_URI , Constants . ATT_TARGET , targetID ) ; parm . setAttribute ( Constants . ATT_NAME , name ) ; parm . setAttribute ( Constants . ATT_USER_VALUE , value ) ; parmSet . appendChild ( parm ) ;
public class GlobalEnablementBuilder { /** * cachedAlternativeMap is accessed from a single thread only and the result is safely propagated . Therefore , there is no need to synchronize access to * cachedAlternativeMap . */ private Map < Class < ? > , Integer > getGlobalAlternativeMap ( ) { } }
if ( cachedAlternativeMap == null || dirty ) { Map < Class < ? > , Integer > map = new HashMap < Class < ? > , Integer > ( ) ; for ( Item item : alternatives ) { map . put ( item . getJavaClass ( ) , item . getPriority ( ) ) ; } cachedAlternativeMap = ImmutableMap . copyOf ( map ) ; } return cachedAlternativeMap ;
public class Workbench { /** * Returns a workbench entry for the given address , possibly creating one . The entry may or may not be on the { @ link Workbench } * currently . * @ param address an IP address in byte - array form . * @ return a workbench entry for { @ code address } ( possibly a new one ) . */ public WorkbenchEntry getWorkbenchEntry ( final byte [ ] address ) { } }
WorkbenchEntry workbenchEntry ; synchronized ( address2WorkbenchEntry ) { workbenchEntry = address2WorkbenchEntry . get ( address ) ; if ( workbenchEntry == null ) address2WorkbenchEntry . add ( workbenchEntry = new WorkbenchEntry ( address , broken ) ) ; } return workbenchEntry ;
public class Schema { /** * A copy of the list of { @ link ColumnType } * for this schema * @ return the list of column types in order based * on column index for this schema */ public List < ColumnType > getColumnTypes ( ) { } }
List < ColumnType > list = new ArrayList < > ( columnMetaData . size ( ) ) ; for ( ColumnMetaData md : columnMetaData ) list . add ( md . getColumnType ( ) ) ; return list ;
public class SystemInputJson { /** * Returns the JSON object that represents the given value definition . */ private static JsonStructure toJson ( VarValueDef value ) { } }
JsonObjectBuilder builder = Json . createObjectBuilder ( ) ; if ( value . getType ( ) . equals ( FAILURE ) ) { builder . add ( FAILURE_KEY , true ) ; } else if ( value . getType ( ) . equals ( ONCE ) ) { builder . add ( ONCE_KEY , true ) ; } addAnnotations ( builder , value ) ; ConditionJson . toJson ( value ) . ifPresent ( json -> builder . add ( WHEN_KEY , json ) ) ; addProperties ( builder , value ) ; return builder . build ( ) ;
public class RallyRestApi { /** * Delete the specified object . * @ param request the { @ link DeleteRequest } specifying the object to be deleted . * @ return the resulting { @ link DeleteResponse } * @ throws IOException if an error occurs during the deletion . */ public DeleteResponse delete ( DeleteRequest request ) throws IOException { } }
return new DeleteResponse ( client . doDelete ( request . toUrl ( ) ) ) ;
public class ToStream { /** * Serializes the DOM node . Throws an exception only if an I / O * exception occured while serializing . * @ param node Node to serialize . * @ throws IOException An I / O exception occured while serializing */ public void serialize ( Node node ) throws IOException { } }
try { TreeWalker walker = new TreeWalker ( this ) ; walker . traverse ( node ) ; } catch ( org . xml . sax . SAXException se ) { throw new WrappedRuntimeException ( se ) ; }
public class HelloWorldApplication { /** * Initialization routine that is invoked by TeaServlet after invoking the * default constructor to allow the application to configure itself . The * supplied configuration may be used to get access to the TeaServlet * environment as well as to get access to the configuraton properties * provided in the application configuration defined in the TeaServlet * configuration file ( ie : the & lt ; init & gt ; block of the application ) . * @ param config The application configuration and TeaServlet environment * @ throws ServletException if a critical error occurs during initialization * that should stop TeaServlet from continuing */ @ Override public void init ( ApplicationConfig config ) throws ServletException { } }
// get the configuration properties and get the " greeting " configuration // if not provided , it will default to " Hello " String greeting = config . getProperties ( ) . getString ( "greeting" , "Hello" ) ; // create the singleton / stateless instance this . context = new HelloWorldContext ( greeting ) ;
public class CmsDriverManager { /** * Reads the publish report assigned to a publish job . < p > * @ param dbc the current database context * @ param publishHistoryId the history id identifying the publish job * @ return the content of the assigned publish report * @ throws CmsException if something goes wrong */ public byte [ ] readPublishReportContents ( CmsDbContext dbc , CmsUUID publishHistoryId ) throws CmsException { } }
return getProjectDriver ( dbc ) . readPublishReportContents ( dbc , publishHistoryId ) ;
public class Modal { /** * Close all modals . */ private void closeAll ( ) { } }
getModalPanel ( ) . removeAll ( ) ; components . clear ( ) ; depths . clear ( ) ; listeners . clear ( ) ; restoreRootPane ( ) ;
public class MemberMatcher { /** * Returns the default constructor in { @ code declaringClass } * @ param declaringClass * The declaringClass of the class where the constructor is * located . * @ return A { @ code java . lang . reflect . Constructor } . * @ throws ConstructorNotFoundException * If no default constructor was found in { @ code declaringClass } */ @ SuppressWarnings ( "unchecked" ) public static < T > Constructor < T > defaultConstructorIn ( Class < T > declaringClass ) { } }
return ( Constructor < T > ) WhiteboxImpl . findDefaultConstructorOrThrowException ( declaringClass ) ;
public class Quaternion { /** * Replies the rotation axis - angle represented by this quaternion . * @ return the rotation axis - angle . */ @ Pure public final Vector3f getAxis ( ) { } }
double mag = this . x * this . x + this . y * this . y + this . z * this . z ; if ( mag > EPS ) { mag = Math . sqrt ( mag ) ; double invMag = 1f / mag ; return new Vector3f ( this . x * invMag , this . y * invMag , this . z * invMag ) ; } return new Vector3f ( 0f , 0f , 1f ) ;
public class Period { /** * Constructs a Period representing a duration * less than count units extending into the past . * @ param count the number of units . must be non - negative * @ param unit the unit * @ return the new Period */ public static Period lessThan ( float count , TimeUnit unit ) { } }
checkCount ( count ) ; return new Period ( ETimeLimit . LT , false , count , unit ) ;
public class PropertyCharacteristics { /** * Sets the class of list elements when the property value is actually a list of elements . < br > * The only usage of this method which makes sense is , when property value is actually a list of enum constants . * In this case the element type ( enum class name ) has to be set explicitly . * In all other cases the class name of list elements is implicitly defined by the list element type ( { @ link ListPropertyElementType } ) . < br > * For enum classes , permitted values are automatically set to the enums ' values . * @ param listElementClass Type ( class ) of list elements */ public void setListElementClass ( Class < ? > listElementClass ) { } }
this . listElementClass = listElementClass ; if ( listElementClass . isEnum ( ) ) { setPermittedValues ( Arrays . asList ( listElementClass . getEnumConstants ( ) ) ) ; }
public class JMXContext { /** * Get the { @ link GarbageCollectorMXBean } with the given name . If no garbage * collector exists for the given name , then < code > null < / code > is returned . * @ param name The name of the garbage collector to retrieve * @ return The associated garbage collector or < code > null < / code > * @ see # getGarbageCollectorMXBeans ( ) */ public GarbageCollectorMXBean getGarbageCollectorMXBean ( String name ) { } }
for ( GarbageCollectorMXBean bean : getGarbageCollectorMXBeans ( ) ) { if ( bean . getName ( ) . equals ( name ) ) { return bean ; } } return null ;
public class ContainerBase { /** * ( non - Javadoc ) * @ see org . jboss . shrinkwrap . api . container . ResourceContainer # addResource ( java . lang . String , * org . jboss . shrinkwrap . api . Path , java . lang . ClassLoader ) */ @ Override public T addAsResource ( String resourceName , ArchivePath target , ClassLoader classLoader ) throws IllegalArgumentException { } }
Validate . notNull ( resourceName , "ResourceName should be specified" ) ; Validate . notNull ( target , "Target should be specified" ) ; Validate . notNull ( classLoader , "ClassLoader should be specified" ) ; return addAsResource ( new ClassLoaderAsset ( resourceName , classLoader ) , target ) ;
public class ns_detail_vlan { /** * Use this API to fetch filtered set of ns _ detail _ vlan resources . * filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */ public static ns_detail_vlan [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
ns_detail_vlan obj = new ns_detail_vlan ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; ns_detail_vlan [ ] response = ( ns_detail_vlan [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class CSSWriter { /** * Write the CSS content to the passed writer . No specific charset is used . * @ param aCSS * The CSS to write . May not be < code > null < / code > . * @ param aWriter * The write to write the text to . May not be < code > null < / code > . Is * automatically closed after the writing ! * @ throws IOException * In case writing fails . * @ throws IllegalStateException * In case some elements cannot be written in the version supplied in * the constructor . * @ see # getCSSAsString ( ICSSWriteable ) */ public void writeCSS ( @ Nonnull final ICSSWriteable aCSS , @ Nonnull @ WillClose final Writer aWriter ) throws IOException { } }
ValueEnforcer . notNull ( aCSS , "CSS" ) ; ValueEnforcer . notNull ( aWriter , "Writer" ) ; try { aWriter . write ( aCSS . getAsCSSString ( m_aSettings ) ) ; } finally { StreamHelper . close ( aWriter ) ; }
public class StartAutomationExecutionRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( StartAutomationExecutionRequest startAutomationExecutionRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( startAutomationExecutionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( startAutomationExecutionRequest . getDocumentName ( ) , DOCUMENTNAME_BINDING ) ; protocolMarshaller . marshall ( startAutomationExecutionRequest . getDocumentVersion ( ) , DOCUMENTVERSION_BINDING ) ; protocolMarshaller . marshall ( startAutomationExecutionRequest . getParameters ( ) , PARAMETERS_BINDING ) ; protocolMarshaller . marshall ( startAutomationExecutionRequest . getClientToken ( ) , CLIENTTOKEN_BINDING ) ; protocolMarshaller . marshall ( startAutomationExecutionRequest . getMode ( ) , MODE_BINDING ) ; protocolMarshaller . marshall ( startAutomationExecutionRequest . getTargetParameterName ( ) , TARGETPARAMETERNAME_BINDING ) ; protocolMarshaller . marshall ( startAutomationExecutionRequest . getTargets ( ) , TARGETS_BINDING ) ; protocolMarshaller . marshall ( startAutomationExecutionRequest . getTargetMaps ( ) , TARGETMAPS_BINDING ) ; protocolMarshaller . marshall ( startAutomationExecutionRequest . getMaxConcurrency ( ) , MAXCONCURRENCY_BINDING ) ; protocolMarshaller . marshall ( startAutomationExecutionRequest . getMaxErrors ( ) , MAXERRORS_BINDING ) ; protocolMarshaller . marshall ( startAutomationExecutionRequest . getTargetLocations ( ) , TARGETLOCATIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Card { /** * Converts an unchecked String value to a { @ link FundingType } or { @ code null } . * @ param possibleFundingType a String that might match a { @ link FundingType } or be empty * @ return { @ code null } if the input is blank , else the appropriate { @ link FundingType } */ @ Nullable @ FundingType public static String asFundingType ( @ Nullable String possibleFundingType ) { } }
if ( possibleFundingType == null || TextUtils . isEmpty ( possibleFundingType . trim ( ) ) ) { return null ; } if ( Card . FUNDING_CREDIT . equalsIgnoreCase ( possibleFundingType ) ) { return Card . FUNDING_CREDIT ; } else if ( Card . FUNDING_DEBIT . equalsIgnoreCase ( possibleFundingType ) ) { return Card . FUNDING_DEBIT ; } else if ( Card . FUNDING_PREPAID . equalsIgnoreCase ( possibleFundingType ) ) { return Card . FUNDING_PREPAID ; } else { return Card . FUNDING_UNKNOWN ; }
public class SeaGlassLookAndFeel { /** * Used by the renderers . For the most part the renderers are implemented as * Labels , which is problematic in so far as they are never selected . To * accomodate this SeaGlassLabelUI checks if the current UI matches that of * < code > selectedUI < / code > ( which this methods sets ) , if it does , then a * state as set by this method is set in the field { @ code selectedUIState } . * This provides a way for labels to have a state other than selected . * @ param uix a UI delegate . * @ param selected is the component selected ? * @ param focused is the component focused ? * @ param enabled is the component enabled ? * @ param rollover is the component ' s rollover state enabled ? */ public static void setSelectedUI ( ComponentUI uix , boolean selected , boolean focused , boolean enabled , boolean rollover ) { } }
selectedUI = uix ; selectedUIState = 0 ; if ( selected ) { selectedUIState = SynthConstants . SELECTED ; if ( focused ) { selectedUIState |= SynthConstants . FOCUSED ; } } else if ( rollover && enabled ) { selectedUIState |= SynthConstants . MOUSE_OVER | SynthConstants . ENABLED ; if ( focused ) { selectedUIState |= SynthConstants . FOCUSED ; } } else { if ( enabled ) { selectedUIState |= SynthConstants . ENABLED ; selectedUIState = SynthConstants . FOCUSED ; } else { selectedUIState |= SynthConstants . DISABLED ; } }
public class Vertex { /** * 创建一个时间实例 * @ param realWord 时间对应的真实字串 * @ return 时间顶点 */ public static Vertex newTimeInstance ( String realWord ) { } }
return new Vertex ( Predefine . TAG_TIME , realWord , new CoreDictionary . Attribute ( Nature . t , 1000 ) ) ;
public class GusNotifier { /** * Get HttpClient with proper proxy and timeout settings . * @ param config The system configuration . Cannot be null . * @ return HttpClient */ public HttpClient getHttpClient ( SystemConfiguration config ) { } }
HttpClient httpclient = new HttpClient ( theConnectionManager ) ; // Wait for 2 seconds to get a connection from pool httpclient . getParams ( ) . setParameter ( "http.connection-manager.timeout" , 2000L ) ; String host = config . getValue ( Property . GUS_PROXY_HOST . getName ( ) , Property . GUS_PROXY_HOST . getDefaultValue ( ) ) ; if ( host != null && host . length ( ) > 0 ) { httpclient . getHostConfiguration ( ) . setProxy ( host , Integer . parseInt ( config . getValue ( Property . GUS_PROXY_PORT . getName ( ) , Property . GUS_PROXY_PORT . getDefaultValue ( ) ) ) ) ; } return httpclient ;
public class SoapUtils { /** * A method to copy namespaces declarations . * @ param source * the source message containing the namespaces to be copied on * the target message . * @ param target * the target message . * @ author Simone Gianfranceschi */ public static void addNSdeclarations ( Element source , Element target ) throws Exception { } }
NamedNodeMap sourceAttributes = source . getAttributes ( ) ; Attr attribute ; String attributeName ; for ( int i = 0 ; i <= sourceAttributes . getLength ( ) - 1 ; i ++ ) { attribute = ( Attr ) sourceAttributes . item ( i ) ; attributeName = attribute . getName ( ) ; if ( attributeName . startsWith ( "xmlns" ) && ! attributeName . startsWith ( "xmlns:soap-env" ) ) { // System . out . println ( " XMLNS : " + // attributeName + " : " + attribute . getValue ( ) ) ; target . setAttribute ( attributeName , attribute . getValue ( ) ) ; } }
public class ResourceLocks { /** * deletes unused LockedObjects and resets the counter . works recursively * starting at the given LockedObject * @ param transaction * @ param lo * LockedObject * @ param temporary * Clean temporary or real locks * @ return if cleaned */ private boolean cleanLockedObjects ( ITransaction transaction , LockedObject lo , boolean temporary ) { } }
if ( lo . _children == null ) { if ( lo . _owner == null ) { if ( temporary ) { lo . removeTempLockedObject ( ) ; } else { lo . removeLockedObject ( ) ; } return true ; } else { return false ; } } else { boolean canDelete = true ; int limit = lo . _children . length ; for ( int i = 0 ; i < limit ; i ++ ) { if ( ! cleanLockedObjects ( transaction , lo . _children [ i ] , temporary ) ) { canDelete = false ; } else { // because the deleting shifts the array i -- ; limit -- ; } } if ( canDelete ) { if ( lo . _owner == null ) { if ( temporary ) { lo . removeTempLockedObject ( ) ; } else { lo . removeLockedObject ( ) ; } return true ; } else { return false ; } } else { return false ; } }
public class TagTrackingCacheEventListener { /** * If the element has a TaggedCacheKey record the tag associations */ protected void putElement ( Ehcache cache , Element element ) { } }
final Set < CacheEntryTag > tags = this . getTags ( element ) ; // Check if the key is tagged if ( tags != null && ! tags . isEmpty ( ) ) { final String cacheName = cache . getName ( ) ; final Object key = element . getObjectKey ( ) ; final LoadingCache < CacheEntryTag , Set < Object > > cacheKeys = taggedCacheKeys . getUnchecked ( cacheName ) ; logger . debug ( "Tracking {} tags in cache {} for key {}" , tags . size ( ) , cacheName , key ) ; // Add all the tags to the tracking map for ( final CacheEntryTag tag : tags ) { // Record that this tag type is stored in this cache final String tagType = tag . getTagType ( ) ; final Set < Ehcache > caches = taggedCaches . getUnchecked ( tagType ) ; caches . add ( cache ) ; // Record the tag - > key association final Set < Object > taggedKeys = cacheKeys . getUnchecked ( tag ) ; taggedKeys . add ( key ) ; } }
public class BasePanel { /** * Find the sub - screen that uses this grid query and set for selection . * When you select a new record here , you read the same record in the SelectQuery . * ( Override to do something ) . * @ param selectTable The record which is synced on record change . * @ param bUpdateOnSelect Do I update the current record if a selection occurs . * @ return True if successful . */ public boolean setSelectQuery ( Rec selectTable , boolean bUpdateOnSelect ) { } }
// If this screen can ' t accept a select BaseTable , find the one that can for ( Enumeration < ScreenField > e = m_SFieldList . elements ( ) ; e . hasMoreElements ( ) ; ) { // This should only be called for Imaged GridScreens ( Child windows would be deleted by now if Component ) ScreenField sField = e . nextElement ( ) ; if ( sField . setSelectQuery ( selectTable , bUpdateOnSelect ) ) return true ; } return false ;
public class DatabaseTaskStore { /** * { @ inheritDoc } */ @ Override public List < PartitionRecord > find ( PartitionRecord expected ) throws Exception { } }
StringBuilder select = new StringBuilder ( 172 ) . append ( "SELECT p.EXECUTOR,p.HOSTNAME,p.ID,p.LSERVER,p.USERDIR FROM Partition p" ) ; if ( expected != null ) { select . append ( " WHERE" ) ; if ( expected . hasExecutor ( ) ) select . append ( " p.EXECUTOR=:x AND" ) ; if ( expected . hasHostName ( ) ) select . append ( " p.HOSTNAME=:h AND" ) ; if ( expected . hasId ( ) ) select . append ( " p.ID=:i AND" ) ; if ( expected . hasLibertyServer ( ) ) select . append ( " p.LSERVER=:l AND" ) ; if ( expected . hasUserDir ( ) ) select . append ( " p.USERDIR=:u AND" ) ; int length = select . length ( ) ; select . delete ( length - ( select . charAt ( length - 1 ) == 'E' ? 6 : 3 ) , length ) ; } select . append ( " ORDER BY p.ID ASC" ) ; final boolean trace = TraceComponent . isAnyTracingEnabled ( ) ; if ( trace && tc . isEntryEnabled ( ) ) Tr . entry ( this , tc , "find" , expected , select ) ; List < PartitionRecord > records = new ArrayList < PartitionRecord > ( ) ; EntityManager em = getPersistenceServiceUnit ( ) . createEntityManager ( ) ; try { TypedQuery < Object [ ] > query = em . createQuery ( select . toString ( ) , Object [ ] . class ) ; if ( expected != null ) { if ( expected . hasExecutor ( ) ) query . setParameter ( "x" , expected . getExecutor ( ) ) ; if ( expected . hasHostName ( ) ) query . setParameter ( "h" , expected . getHostName ( ) ) ; if ( expected . hasId ( ) ) query . setParameter ( "i" , expected . getId ( ) ) ; if ( expected . hasLibertyServer ( ) ) query . setParameter ( "l" , expected . getLibertyServer ( ) ) ; if ( expected . hasUserDir ( ) ) query . setParameter ( "u" , expected . getUserDir ( ) ) ; } List < Object [ ] > results = query . getResultList ( ) ; for ( Object [ ] result : results ) { PartitionRecord record = new PartitionRecord ( true ) ; record . setExecutor ( ( String ) result [ 0 ] ) ; record . setHostName ( ( String ) result [ 1 ] ) ; record . setId ( ( Long ) result [ 2 ] ) ; record . setLibertyServer ( ( String ) result [ 3 ] ) ; record . setUserDir ( ( String ) result [ 4 ] ) ; records . add ( record ) ; } } finally { em . close ( ) ; } if ( trace && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "find" , records . size ( ) < 20 ? records : records . size ( ) ) ; return records ;
public class Utility { /** * 将句子转换为 ( 单词 , 词性 , NER标签 ) 三元组 * @ param sentence * @ param tagSet * @ return */ public static List < String [ ] > convertSentenceToNER ( Sentence sentence , NERTagSet tagSet ) { } }
List < String [ ] > collector = new LinkedList < String [ ] > ( ) ; Set < String > nerLabels = tagSet . nerLabels ; for ( IWord word : sentence . wordList ) { if ( word instanceof CompoundWord ) { List < Word > wordList = ( ( CompoundWord ) word ) . innerList ; Word [ ] words = wordList . toArray ( new Word [ 0 ] ) ; if ( nerLabels . contains ( word . getLabel ( ) ) ) { collector . add ( new String [ ] { words [ 0 ] . value , words [ 0 ] . label , tagSet . B_TAG_PREFIX + word . getLabel ( ) } ) ; for ( int i = 1 ; i < words . length - 1 ; i ++ ) { collector . add ( new String [ ] { words [ i ] . value , words [ i ] . label , tagSet . M_TAG_PREFIX + word . getLabel ( ) } ) ; } collector . add ( new String [ ] { words [ words . length - 1 ] . value , words [ words . length - 1 ] . label , tagSet . E_TAG_PREFIX + word . getLabel ( ) } ) ; } else { for ( Word w : words ) { collector . add ( new String [ ] { w . value , w . label , tagSet . O_TAG } ) ; } } } else { if ( nerLabels . contains ( word . getLabel ( ) ) ) { // 单个实体 collector . add ( new String [ ] { word . getValue ( ) , word . getLabel ( ) , tagSet . S_TAG } ) ; } else { collector . add ( new String [ ] { word . getValue ( ) , word . getLabel ( ) , tagSet . O_TAG } ) ; } } } return collector ;
public class BooleanUtil { /** * 对Boolean数组取异或 * < pre > * BooleanUtil . xor ( true , true ) = false * BooleanUtil . xor ( false , false ) = false * BooleanUtil . xor ( true , false ) = true * BooleanUtil . xor ( true , true ) = false * BooleanUtil . xor ( false , false ) = false * BooleanUtil . xor ( true , false ) = true * < / pre > * @ param array { @ code boolean } 数组 * @ return 如果异或计算为true返回 { @ code true } */ public static boolean xor ( boolean ... array ) { } }
if ( ArrayUtil . isEmpty ( array ) ) { throw new IllegalArgumentException ( "The Array must not be empty" ) ; } boolean result = false ; for ( final boolean element : array ) { result ^= element ; } return result ;
public class FieldConverter { /** * Set up the default control for this field . * @ param itsLocation Location of this component on screen ( ie . , GridBagConstraint ) . * @ param targetScreen Where to place this component ( ie . , Parent screen or GridBagLayout ) . * @ param iDisplayFieldDesc Display the label ? ( optional ) . * @ return Return the component or ScreenField that is created for this field . */ public ScreenComponent setupDefaultView ( ScreenLoc itsLocation , ComponentParent targetScreen , Convert converter , int iDisplayFieldDesc , Map < String , Object > properties ) // Add this view to the list { } }
ScreenComponent sField = null ; BaseField field = ( BaseField ) this . getField ( ) ; if ( field != null ) { sField = field . setupDefaultView ( itsLocation , targetScreen , converter , iDisplayFieldDesc , properties ) ; if ( sField != null ) if ( sField . getConverter ( ) == null ) sField . setConverter ( this ) ; } else sField = BaseField . createScreenComponent ( ScreenModel . EDIT_TEXT , itsLocation , targetScreen , converter , iDisplayFieldDesc , properties ) ; return sField ;
public class SystemProperties { /** * Gets a { @ code boolean } system property value . * @ param key the property key to retrieve . * @ param defaultValue the default value to return in case the property is not defined . * @ return the property value or the submitted default value if the property is not defined . */ public static boolean booleanValue ( String key , boolean defaultValue ) { } }
String value = System . getProperty ( key ) ; boolean booleanValue = defaultValue ; if ( value != null ) { booleanValue = Boolean . parseBoolean ( value ) ; } return booleanValue ;
public class DayOpeningHours { /** * Verifies if the string can be converted into an instance of this class . * @ param dayOpeningHours * String to test . * @ return { @ literal true } if the string is valid , else { @ literal false } . */ public static boolean isValid ( @ Nullable final String dayOpeningHours ) { } }
if ( dayOpeningHours == null ) { return true ; } final int p = dayOpeningHours . indexOf ( ' ' ) ; if ( p < 0 ) { return false ; } final String dayOfTheWeekStr = dayOpeningHours . substring ( 0 , p ) ; final String hourRangesStr = dayOpeningHours . substring ( p + 1 ) ; return DayOfTheWeek . isValid ( dayOfTheWeekStr ) && HourRanges . isValid ( hourRangesStr ) ;
public class DefaultTicketGrantingTicketFactory { /** * Produce ticket . * @ param < T > the type parameter * @ param authentication the authentication * @ param tgtId the tgt id * @ param clazz the clazz * @ return the ticket . */ protected < T extends TicketGrantingTicket > T produceTicket ( final Authentication authentication , final String tgtId , final Class < T > clazz ) { } }
val result = new TicketGrantingTicketImpl ( tgtId , authentication , this . ticketGrantingTicketExpirationPolicy ) ; if ( ! clazz . isAssignableFrom ( result . getClass ( ) ) ) { throw new ClassCastException ( "Result [" + result + " is of type " + result . getClass ( ) + " when we were expecting " + clazz ) ; } return ( T ) result ;
public class CmsGalleryService { /** * Gets the sitemap tree open state . < p > * @ param treeToken the tree token to use * @ return the sitemap tree open state */ CmsTreeOpenState getSitemapTreeState ( String treeToken ) { } }
return ( CmsTreeOpenState ) ( getRequest ( ) . getSession ( ) . getAttribute ( getTreeOpenStateAttributeName ( I_CmsGalleryProviderConstants . TREE_SITEMAP , treeToken ) ) ) ;
public class ChainingIterator { /** * Moves the cursor a relative number of rows . * Movement can go in forward ( positive ) or reverse ( negative ) . * Calling relative does not " wrap " meaning if you move before first or * after last you get positioned at the first or last row . * Calling relative ( 0 ) does not change the cursor position . * Note : Calling the method relative ( 1 ) is different from calling * the method next ( ) because is makes sense to call next ( ) when * there is no current row , for example , when the cursor is * positioned before the first row or after the last row of * the result set . */ public boolean relative ( int row ) throws PersistenceBrokerException { } }
if ( row == 0 ) { return true ; } boolean movedToRelative = false ; boolean retval = false ; setNextIterator ( ) ; if ( row > 0 ) { // special case checking for the iterator we ' re currently in // ( since it isn ' t positioned on the boundary potentially ) if ( row > ( m_activeIterator . size ( ) - m_currentCursorPosition ) ) { // the relative position lies over the border of the // current iterator . // starting position counter should be set to whatever we have left in // active iterator . int positionCounter = m_activeIterator . size ( ) - m_currentCursorPosition ; for ( int i = m_activeIteratorIndex + 1 ; ( ( i < m_rsIterators . size ( ) ) && ! movedToRelative ) ; i ++ ) { m_activeIteratorIndex = i ; m_currentCursorPosition = 0 ; m_activeIterator = ( OJBIterator ) m_rsIterators . get ( m_activeIteratorIndex ) ; if ( ! ( ( row - positionCounter ) > m_activeIterator . size ( ) ) ) { // the relative position requested is within this iterator . m_currentCursorPosition = row - positionCounter ; retval = m_activeIterator . relative ( m_currentCursorPosition ) ; movedToRelative = true ; } } } else { // the relative position lays within the current iterator . retval = m_activeIterator . relative ( row ) ; movedToRelative = true ; } } return retval ;
public class V1InstanceCreator { /** * Create a new iteration with a name , begin date , and end date . * @ param name The name of the iteration . * @ param schedule The schedule this iteration belongs to . * @ param beginDate The begin date or start date of this iteration . * @ param endDate The end date of this iteration . * @ param attributes additional attributes for the Iteration . * @ return A newly minted Iteration that exists in the VersionOne system . */ public Iteration iteration ( String name , Schedule schedule , DateTime beginDate , DateTime endDate , Map < String , Object > attributes ) { } }
Iteration iteration = new Iteration ( instance ) ; iteration . setName ( name ) ; iteration . setSchedule ( schedule ) ; iteration . setBeginDate ( beginDate ) ; iteration . setEndDate ( endDate ) ; addAttributes ( iteration , attributes ) ; iteration . save ( ) ; return iteration ;
public class EngineeringObjectEnhancer { /** * Updates all models which are referenced by the given engineering object . */ private List < AdvancedModelWrapper > updateReferencedModelsByEO ( EngineeringObjectModelWrapper model ) { } }
List < AdvancedModelWrapper > updates = new ArrayList < AdvancedModelWrapper > ( ) ; for ( Field field : model . getForeignKeyFields ( ) ) { try { AdvancedModelWrapper result = performMerge ( model , loadReferencedModel ( model , field ) ) ; if ( result != null ) { updates . add ( result ) ; } } catch ( EDBException e ) { LOGGER . debug ( "Skipped referenced model for field {}, since it does not exist." , field , e ) ; } } return updates ;
public class Rectangle { /** * Indicates whether some type of border is set . * @ return a boolean */ public boolean hasBorders ( ) { } }
switch ( border ) { case UNDEFINED : case NO_BORDER : return false ; default : return borderWidth > 0 || borderWidthLeft > 0 || borderWidthRight > 0 || borderWidthTop > 0 || borderWidthBottom > 0 ; }
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getObjectOriginIdentifier ( ) { } }
if ( objectOriginIdentifierEClass == null ) { objectOriginIdentifierEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 514 ) ; } return objectOriginIdentifierEClass ;
public class RelationFactory { private SimpleRelation buildSimpleManyToOneOneToVirtualOne ( Entity entity , final Attribute fromAttribute , Entity targetEntity , Attribute targetAttribute ) { } }
Namer targetNamer = relationUtil . getManyToOneNamer ( fromAttribute , targetEntity . getModel ( ) ) ; Namer inverseNamer = relationUtil . getOneToManyNamer ( fromAttribute . getColumnConfig ( ) , entity . getModel ( ) ) ; SimpleRelation m2o = new SimpleManyToOne ( inverseNamer , targetNamer , fromAttribute , entity , targetEntity , targetAttribute ) { @ Override protected AbstractRelation buildInverse ( ) { AbstractRelation o2vo = new SimpleOneToVirtualOne ( getTo ( ) , getFrom ( ) , getToAttribute ( ) , getToEntity ( ) , getFromEntity ( ) , getFromAttribute ( ) ) ; OneToManyConfig o2voConfig = fromAttribute . getColumnConfig ( ) . getOneToManyConfig ( ) ; setLabelSingular ( o2voConfig , o2vo ) ; configureActions ( o2vo , cfg ( ) . getDefaultOneToManyConfig ( ) , o2voConfig ) ; return o2vo ; } } ; ManyToOneConfig m2oConfig = fromAttribute . getColumnConfig ( ) . getManyToOneConfig ( ) ; setLabelSingular ( m2oConfig , m2o ) ; configureActions ( m2o , cfg ( ) . getDefaultManyToOneConfig ( ) , m2oConfig ) ; return m2o ;
public class GenericFilter { /** * < p > Returns the names of the filter ' s initialization parameters * as an < code > Enumeration < / code > of < code > String < / code > objects , * or an empty < code > Enumeration < / code > if the filter has no * initialization parameters . See { @ link * FilterConfig # getInitParameterNames } . < / p > * < p > This method is supplied for convenience . It gets the * parameter names from the filter ' s < code > FilterConfig < / code > object . * @ return Enumeration an enumeration of < code > String < / code > * objects containing the names of * the filter ' s initialization parameters * @ since Servlet 4.0 */ @ Override public Enumeration < String > getInitParameterNames ( ) { } }
FilterConfig fc = getFilterConfig ( ) ; if ( fc == null ) { throw new IllegalStateException ( lStrings . getString ( "err.filter_config_not_initialized" ) ) ; } return fc . getInitParameterNames ( ) ;
public class RecurlyClient { /** * Preview an update to a particular { @ link Subscription } by it ' s UUID * Returns information about a single subscription . * @ param uuid UUID of the subscription to preview an update for * @ return Subscription the updated subscription preview */ public Subscription updateSubscriptionPreview ( final String uuid , final SubscriptionUpdate subscriptionUpdate ) { } }
return doPOST ( Subscriptions . SUBSCRIPTIONS_RESOURCE + "/" + uuid + "/preview" , subscriptionUpdate , Subscription . class ) ;
public class Request { /** * Makes http GET request . * @ param url url to makes request to * @ param params data to add to params field * @ return { @ link okhttp3 . Response } * @ throws RequestException * @ throws LocalOperationException */ okhttp3 . Response get ( String url , Map < String , Object > params ) throws RequestException , LocalOperationException { } }
String fullUrl = getFullUrl ( url ) ; okhttp3 . Request request = new okhttp3 . Request . Builder ( ) . url ( addUrlParams ( fullUrl , toPayload ( params ) ) ) . addHeader ( "Transloadit-Client" , version ) . build ( ) ; try { return httpClient . newCall ( request ) . execute ( ) ; } catch ( IOException e ) { throw new RequestException ( e ) ; }
public class LocaleData { /** * Returns the current CLDR version */ public static VersionInfo getCLDRVersion ( ) { } }
// fetching this data should be idempotent . if ( gCLDRVersion == null ) { // from ZoneMeta . java UResourceBundle supplementalDataBundle = UResourceBundle . getBundleInstance ( ICUData . ICU_BASE_NAME , "supplementalData" , ICUResourceBundle . ICU_DATA_CLASS_LOADER ) ; UResourceBundle cldrVersionBundle = supplementalDataBundle . get ( "cldrVersion" ) ; gCLDRVersion = VersionInfo . getInstance ( cldrVersionBundle . getString ( ) ) ; } return gCLDRVersion ;
public class DistanceFromLine { /** * There are some situations where processing everything as a list can speed things up a lot . * This is not one of them . */ @ Override public void computeDistance ( List < Point2D > obs , double [ ] distance ) { } }
for ( int i = 0 ; i < obs . size ( ) ; i ++ ) { distance [ i ] = computeDistance ( obs . get ( i ) ) ; }
public class HTODDynacache { /** * delTemplateEntry ( ) * This removes the specified entry for the specified template from the disk . */ public int delTemplateEntry ( String template , Object entry ) { } }
int returnCode = NO_EXCEPTION ; if ( ! this . disableTemplatesSupport ) { if ( delayOffload ) { Result result = auxTemplateDependencyTable . removeEntry ( template , entry ) ; returnCode = result . returnCode ; if ( ! result . bExist && returnCode != DISK_EXCEPTION ) { returnCode = delValueSetEntry ( TEMPLATE_ID_DATA , template , entry ) ; } } else { returnCode = delValueSetEntry ( TEMPLATE_ID_DATA , template , entry ) ; } } return returnCode ;
public class CmsDecorationObject { /** * Replaces the macros in the given message . < p > * @ param msg the message in which the macros are replaced * @ param contentLocale the locale of the content that is currently decorated * @ return the message with the macros replaced */ private String replaceMacros ( String msg , String contentLocale ) { } }
CmsMacroResolver resolver = CmsMacroResolver . newInstance ( ) ; resolver . addMacro ( MACRO_DECORATION , m_decoration ) ; resolver . addMacro ( MACRO_DECORATIONKEY , m_decorationKey ) ; if ( m_locale != null ) { resolver . addMacro ( MACRO_LOCALE , m_locale . toString ( ) ) ; if ( ! contentLocale . equals ( m_locale . toString ( ) ) ) { resolver . addMacro ( MACRO_LANGUAGE , "lang=\"" + m_locale . toString ( ) + "\"" ) ; } } return resolver . resolveMacros ( msg ) ;
public class Rule { /** * Sets the rule parameters */ public Rule setParams ( List < RuleParam > params ) { } }
this . params . clear ( ) ; for ( RuleParam param : params ) { param . setRule ( this ) ; this . params . add ( param ) ; } return this ;
public class JmsServiceFacade { /** * Returns true if environment is client container . * This has to be only used by JMS 20 module ( so it is safe . . as no chance of NPE . . i . e bundleContext is always initialized properly ) */ public static boolean isClientContainer ( ) { } }
String processType = AccessController . doPrivileged ( new PrivilegedAction < String > ( ) { @ Override public String run ( ) { return bundleContext . getProperty ( WsLocationConstants . LOC_PROCESS_TYPE ) ; } } ) ; return Boolean . valueOf ( WsLocationConstants . LOC_PROCESS_TYPE_CLIENT . equals ( processType ) ) ;
public class BulkRebuildIndexCommand { /** * - - - - - private methods - - - - - */ private void rebuildNodeIndex ( final String entityType ) { } }
final NodeFactory nodeFactory = new NodeFactory ( SecurityContext . getSuperUserInstance ( ) ) ; final DatabaseService graphDb = ( DatabaseService ) arguments . get ( "graphDb" ) ; Iterator < AbstractNode > nodeIterator = null ; nodeIterator = Iterables . map ( nodeFactory , graphDb . getNodesByTypeProperty ( entityType ) ) . iterator ( ) ; if ( entityType == null ) { info ( "Node type not set or no entity class found. Starting (re-)indexing all nodes" ) ; } else { info ( "Starting (re-)indexing all nodes of type {}" , entityType ) ; } long count = bulkGraphOperation ( securityContext , nodeIterator , 1000 , "RebuildNodeIndex" , new BulkGraphOperation < AbstractNode > ( ) { @ Override public boolean handleGraphObject ( SecurityContext securityContext , AbstractNode node ) { node . addToIndex ( ) ; return true ; } @ Override public void handleThrowable ( SecurityContext securityContext , Throwable t , AbstractNode node ) { logger . warn ( "Unable to index node {}: {}" , new Object [ ] { node , t . getMessage ( ) } ) ; } @ Override public void handleTransactionFailure ( SecurityContext securityContext , Throwable t ) { logger . warn ( "Unable to index node: {}" , t . getMessage ( ) ) ; } } ) ; info ( "Done with (re-)indexing {} nodes" , count ) ;
public class ParameterUtil { /** * Similar to { @ link # requireDateParameter } but returns a SQL date . */ public static java . sql . Date requireSQLDateParameter ( HttpServletRequest req , String name , String invalidDataMessage ) throws DataValidationException { } }
return new java . sql . Date ( requireDateParameter ( req , name , invalidDataMessage ) . getTime ( ) ) ;
public class Ix { /** * Combines the next element from each source Iterable via a zipper function . * If one of the source Iterables is sorter the sequence terminates eagerly . * The result ' s iterator ( ) doesn ' t support remove ( ) . * @ param < T1 > the first source ' s element type * @ param < T2 > the second source ' s element type * @ param < T3 > the third source ' s element type * @ param < R > the result value type * @ param source1 the first source Iterable * @ param source2 the second source Iterable * @ param source3 the third source Iterable * @ param zipper the function that takes one from each source , not null * @ return the new Ix instance * @ throws NullPointerException if any of the sources or zipper is null * @ since 1.0 */ public static < T1 , T2 , T3 , R > Ix < R > zip ( Iterable < T1 > source1 , Iterable < T2 > source2 , Iterable < T3 > source3 , IxFunction3 < ? super T1 , ? super T2 , ? super T3 , ? extends R > zipper ) { } }
return new IxZip3 < T1 , T2 , T3 , R > ( nullCheck ( source1 , "source1 is null" ) , nullCheck ( source2 , "source2 is null" ) , nullCheck ( source3 , "source3 is null" ) , nullCheck ( zipper , "zipper is null" ) ) ;
public class DemoMMCIFReader { /** * An example demonstrating how to directly use the mmCif file parsing classes . This could potentially be used * to use the parser to populate a data - structure that is different from the biojava - structure data model . */ public void loadFromDirectAccess ( ) { } }
String pdbId = "1A4W" ; StructureProvider pdbreader = new MMCIFFileReader ( ) ; try { Structure s = pdbreader . getStructureById ( pdbId ) ; System . out . println ( "Getting chain H of 1A4W" ) ; List < Chain > hs = s . getNonPolyChainsByPDB ( "H" ) ; Chain h = hs . get ( 0 ) ; List < Group > ligands = h . getAtomGroups ( ) ; System . out . println ( "These ligands have been found in chain " + h . getName ( ) ) ; for ( Group l : ligands ) { System . out . println ( l ) ; } System . out . println ( "Accessing QWE directly: " ) ; Group qwe = s . getNonPolyChainsByPDB ( "H" ) . get ( 2 ) . getGroupByPDB ( new ResidueNumber ( "H" , 373 , null ) ) ; System . out . println ( qwe . getChemComp ( ) ) ; System . out . println ( h . getSeqResSequence ( ) ) ; System . out . println ( h . getAtomSequence ( ) ) ; System . out . println ( h . getAtomGroups ( GroupType . HETATM ) ) ; System . out . println ( "Entities: " + s . getEntityInfos ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; }
public class MapComposedElement { /** * Invert the order of points coordinates of this element and reorder the groupIndex too . * < p > NOTE : invert each parts with { @ link MapComposedElement # invertPointsIn ( int ) } * does ' nt produce the same result as { @ link MapComposedElement # invert ( ) } * < p > This method invert points coordinates AND start index of parts to * keep the logical order of points * this method is reversible * < p > { @ code this . invert ( ) = = this . invert ( ) . invert ( ) } * @ return the inverted element */ public MapComposedElement invert ( ) { } }
if ( this . pointCoordinates == null ) { throw new IndexOutOfBoundsException ( ) ; } double [ ] tmp = new double [ this . pointCoordinates . length ] ; for ( int i = 0 ; i < this . pointCoordinates . length ; i += 2 ) { tmp [ i ] = this . pointCoordinates [ this . pointCoordinates . length - 1 - ( i + 1 ) ] ; tmp [ i + 1 ] = this . pointCoordinates [ this . pointCoordinates . length - 1 - i ] ; } System . arraycopy ( tmp , 0 , this . pointCoordinates , 0 , this . pointCoordinates . length ) ; if ( this . partIndexes != null ) { int [ ] tmpint = new int [ this . partIndexes . length ] ; // part 0 not inside the index array for ( int i = 0 ; i < this . partIndexes . length ; ++ i ) { tmpint [ this . partIndexes . length - 1 - i ] = this . pointCoordinates . length - this . partIndexes [ i ] ; } System . arraycopy ( tmpint , 0 , this . partIndexes , 0 , this . partIndexes . length ) ; tmpint = null ; } tmp = null ; return this ;