signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ColorUtilities { /** * Converts a color string . * @ param rbgString the string in the form " r , g , b , a " as integer values between 0 and 255. * @ return the { @ link Color } . */ public static Color colorFromRbgString ( String rbgString ) { } }
String [ ] split = rbgString . split ( "," ) ; if ( split . length < 3 || split . length > 4 ) { throw new IllegalArgumentException ( "Color string has to be of type r,g,b." ) ; } int r = ( int ) Double . parseDouble ( split [ 0 ] . trim ( ) ) ; int g = ( int ) Double . parseDouble ( split [ 1 ] . trim ( ) ) ; int b = ( int ) Double . parseDouble ( split [ 2 ] . trim ( ) ) ; Color c = null ; if ( split . length == 4 ) { // alpha int a = ( int ) Double . parseDouble ( split [ 3 ] . trim ( ) ) ; c = new Color ( r , g , b , a ) ; } else { c = new Color ( r , g , b ) ; } return c ;
public class TypeHandler { /** * Returns the < code > Object < / code > of type < code > clazz < / code > * with the value of < code > str < / code > . * @ param str the command line value * @ param clazz the type of argument * @ return The instance of < code > clazz < / code > initialised with * the value of < code > str < / code > . * @ throws ParseException if the value creation for the given class failed */ public static Object createValue ( String str , Class < ? > clazz ) throws ParseException { } }
if ( PatternOptionBuilder . STRING_VALUE == clazz ) { return str ; } else if ( PatternOptionBuilder . OBJECT_VALUE == clazz ) { return createObject ( str ) ; } else if ( PatternOptionBuilder . NUMBER_VALUE == clazz ) { return createNumber ( str ) ; } else if ( PatternOptionBuilder . DATE_VALUE == clazz ) { return createDate ( str ) ; } else if ( PatternOptionBuilder . CLASS_VALUE == clazz ) { return createClass ( str ) ; } else if ( PatternOptionBuilder . FILE_VALUE == clazz ) { return createFile ( str ) ; } else if ( PatternOptionBuilder . EXISTING_FILE_VALUE == clazz ) { return createFile ( str ) ; } else if ( PatternOptionBuilder . FILES_VALUE == clazz ) { return createFiles ( str ) ; } else if ( PatternOptionBuilder . URL_VALUE == clazz ) { return createURL ( str ) ; } else { return null ; }
public class SuppressionInfo { /** * Generates the { @ link SuppressionInfo } for a { @ link CompilationUnitTree } . This differs in that * { @ code isGenerated } is determined by inspecting the annotations of the outermost class so that * matchers on { @ link CompilationUnitTree } will also be suppressed . */ public SuppressionInfo forCompilationUnit ( CompilationUnitTree tree , VisitorState state ) { } }
AtomicBoolean generated = new AtomicBoolean ( false ) ; new SimpleTreeVisitor < Void , Void > ( ) { @ Override public Void visitClass ( ClassTree node , Void unused ) { ClassSymbol symbol = ASTHelpers . getSymbol ( node ) ; generated . compareAndSet ( false , symbol != null && isGenerated ( symbol , state ) ) ; return null ; } } . visit ( tree . getTypeDecls ( ) , null ) ; return new SuppressionInfo ( suppressWarningsStrings , customSuppressions , generated . get ( ) ) ;
public class PlayUIServer { /** * Auto - attach StatsStorage if an unknown session ID is passed as URL path parameter in multi - session mode * @ param statsStorageProvider function that returns a StatsStorage containing the given session ID */ public void autoAttachStatsStorageBySessionId ( Function < String , StatsStorage > statsStorageProvider ) { } }
if ( statsStorageProvider != null ) { this . statsStorageLoader = new StatsStorageLoader ( statsStorageProvider ) ; }
public class BaseProcessRecords { /** * Get this record . */ public Record getThisRecord ( String strRecord , String strPackage , String strDBName ) { } }
String strRecordClass = strRecord ; if ( ! strRecordClass . contains ( "." ) ) strRecordClass = strPackage + '.' + strRecordClass ; Record record = Record . makeRecordFromClassName ( strRecordClass , this , false , true ) ; if ( record == null ) return null ; String strMode = this . getProperty ( ExportRecordsToXmlProcess . TRANSFER_MODE ) ; boolean bExport = false ; if ( strMode != null ) if ( strMode . equalsIgnoreCase ( ExportRecordsToXmlProcess . EXPORT ) ) bExport = true ; if ( bExport ) record . setOpenMode ( record . getOpenMode ( ) | DBConstants . OPEN_DONT_CREATE ) ; // if ( this . getProperty ( ExportRecordsToXmlProcess . LOCALE ) ! = null ) // if ( this . getRecord ( FileHdr . FILE _ HDR _ FILE ) . getEditMode ( ) = = DBConstants . EDIT _ CURRENT ) // strDBName = this . getRecord ( FileHdr . FILE _ HDR _ FILE ) . getField ( FileHdr . DATABASE _ NAME ) . toString ( ) + ' _ ' + this . getProperty ( " locale " ) ; if ( strDBName != null ) if ( strPackage != null ) if ( ! strRecordClass . matches ( strPackage ) ) if ( record instanceof DatabaseInfo ) // Always { ( ( DatabaseInfo ) record ) . setDatabaseName ( strDBName ) ; record . setOpenMode ( record . getOpenMode ( ) | DBConstants . OPEN_DONT_CREATE ) ; } record . init ( this ) ; return record ;
public class DateParser { /** * Gets possible component sequences in the given mode * @ param mode the mode * @ param length the length ( only returns sequences of this length ) * @ param dateStyle whether dates are usually entered day first or month first * @ return the list of sequences */ protected static List < Component [ ] > getPossibleSequences ( Mode mode , int length , DateStyle dateStyle ) { } }
List < Component [ ] > sequences = new ArrayList < > ( ) ; Component [ ] [ ] dateSequences = dateStyle . equals ( DateStyle . DAY_FIRST ) ? DATE_SEQUENCES_DAY_FIRST : DATE_SEQUENCES_MONTH_FIRST ; if ( mode == Mode . DATE || mode == Mode . AUTO ) { for ( Component [ ] seq : dateSequences ) { if ( seq . length == length ) { sequences . add ( seq ) ; } } } else if ( mode == Mode . TIME ) { for ( Component [ ] seq : TIME_SEQUENCES ) { if ( seq . length == length ) { sequences . add ( seq ) ; } } } if ( mode == Mode . DATETIME || mode == Mode . AUTO ) { for ( Component [ ] dateSeq : dateSequences ) { for ( Component [ ] timeSeq : TIME_SEQUENCES ) { if ( dateSeq . length + timeSeq . length == length ) { sequences . add ( ArrayUtils . addAll ( dateSeq , timeSeq ) ) ; } } } } return sequences ;
public class DefaultAuthorizationStrategy { /** * Remove a defined FoxHttpAuthorization from the AuthorizationStrategy * @ param foxHttpAuthorizationScope scope in which the authorization is used * @ param foxHttpAuthorization object of the same authorization */ @ Override public void removeAuthorization ( FoxHttpAuthorizationScope foxHttpAuthorizationScope , FoxHttpAuthorization foxHttpAuthorization ) { } }
ArrayList < FoxHttpAuthorization > authorizations = foxHttpAuthorizations . get ( foxHttpAuthorizationScope . toString ( ) ) ; ArrayList < FoxHttpAuthorization > cleandAuthorizations = new ArrayList < > ( ) ; for ( FoxHttpAuthorization authorization : authorizations ) { if ( authorization . getClass ( ) != foxHttpAuthorization . getClass ( ) ) { cleandAuthorizations . add ( authorization ) ; } } foxHttpAuthorizations . put ( foxHttpAuthorizationScope . toString ( ) , cleandAuthorizations ) ;
public class WebJarController { /** * A bundle is removed . * @ param bundle the bundle * @ param bundleEvent the event * @ param webJarLibs the webjars that were embedded in the bundle . */ @ Override public void removedBundle ( Bundle bundle , BundleEvent bundleEvent , List < BundleWebJarLib > webJarLibs ) { } }
removeWebJarLibs ( webJarLibs ) ;
public class MultipartBuilder { /** * Adds an attachment directly by content . * @ param content the content of the attachment * @ param filename the filename of the attachment * @ return this builder */ public MultipartBuilder attachment ( String content , String filename ) { } }
ByteArrayInputStream is = new ByteArrayInputStream ( content . getBytes ( ) ) ; return bodyPart ( new StreamDataBodyPart ( ATTACHMENT_NAME , is , filename ) ) ;
public class NetworkFetcher { /** * Returns null if the animation doesn ' t exist in the cache . */ @ Nullable @ WorkerThread private LottieComposition fetchFromCache ( ) { } }
Pair < FileExtension , InputStream > cacheResult = networkCache . fetch ( ) ; if ( cacheResult == null ) { return null ; } FileExtension extension = cacheResult . first ; InputStream inputStream = cacheResult . second ; LottieResult < LottieComposition > result ; if ( extension == FileExtension . ZIP ) { result = LottieCompositionFactory . fromZipStreamSync ( new ZipInputStream ( inputStream ) , url ) ; } else { result = LottieCompositionFactory . fromJsonInputStreamSync ( inputStream , url ) ; } if ( result . getValue ( ) != null ) { return result . getValue ( ) ; } return null ;
public class WhereUsedPanel { /** * This method is called from within the constructor to initialize the form . * WARNING : Do NOT modify this code . The content of this method is always * regenerated by the Form Editor . */ @ SuppressWarnings ( "unchecked" ) // < editor - fold defaultstate = " collapsed " desc = " Generated Code " > / / GEN - BEGIN : initComponents private void initComponents ( ) { } }
labelTextFieldName = new javax . swing . JLabel ( ) ; checkBoxFindInComments = new javax . swing . JCheckBox ( ) ; labelMindMapName = new javax . swing . JLabel ( ) ; panelScope = new org . netbeans . modules . refactoring . spi . ui . ScopePanel ( WhereUsedPanel . class . getCanonicalName ( ) . replace ( '.' , '-' ) , NbPreferences . forModule ( WhereUsedPanel . class ) , "whereUsed.scope" ) ; labelScopeName = new javax . swing . JLabel ( ) ; java . util . ResourceBundle bundle = java . util . ResourceBundle . getBundle ( "com/igormaznitsa/nbmindmap/i18n/Bundle" ) ; // NOI18N org . openide . awt . Mnemonics . setLocalizedText ( labelTextFieldName , bundle . getString ( "WhereUsedPanel.labelTextFieldName.text" ) ) ; // NOI18N org . openide . awt . Mnemonics . setLocalizedText ( checkBoxFindInComments , bundle . getString ( "WhereUsedPanel.checkBoxFindInComments.text" ) ) ; // NOI18N checkBoxFindInComments . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { checkBoxFindInCommentsActionPerformed ( evt ) ; } } ) ; labelMindMapName . setIcon ( new javax . swing . ImageIcon ( getClass ( ) . getResource ( "/com/igormaznitsa/nbmindmap/icons/logo/logo16.png" ) ) ) ; // NOI18N org . openide . awt . Mnemonics . setLocalizedText ( labelMindMapName , bundle . getString ( "WhereUsedPanel.labelMindMapName.text" ) ) ; // NOI18N org . openide . awt . Mnemonics . setLocalizedText ( labelScopeName , bundle . getString ( "WhereUsedPanel.labelScopeName.text" ) ) ; // NOI18N javax . swing . GroupLayout layout = new javax . swing . GroupLayout ( this ) ; this . setLayout ( layout ) ; layout . setHorizontalGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addContainerGap ( ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addComponent ( labelTextFieldName ) . addPreferredGap ( javax . swing . LayoutStyle . ComponentPlacement . RELATED ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addComponent ( checkBoxFindInComments ) . addGap ( 0 , 0 , Short . MAX_VALUE ) ) . addComponent ( labelMindMapName , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , Short . MAX_VALUE ) ) ) . addGroup ( javax . swing . GroupLayout . Alignment . TRAILING , layout . createSequentialGroup ( ) . addGap ( 0 , 0 , Short . MAX_VALUE ) . addComponent ( labelScopeName ) . addPreferredGap ( javax . swing . LayoutStyle . ComponentPlacement . RELATED ) . addComponent ( panelScope , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) ) ) . addContainerGap ( ) ) ) ; layout . setVerticalGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addContainerGap ( ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . BASELINE ) . addComponent ( labelTextFieldName ) . addComponent ( labelMindMapName ) ) . addPreferredGap ( javax . swing . LayoutStyle . ComponentPlacement . RELATED ) . addComponent ( checkBoxFindInComments ) . addPreferredGap ( javax . swing . LayoutStyle . ComponentPlacement . RELATED ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . CENTER ) . addComponent ( labelScopeName ) . addComponent ( panelScope , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) ) . addContainerGap ( javax . swing . GroupLayout . DEFAULT_SIZE , Short . MAX_VALUE ) ) ) ;
public class ApplicationDescriptorImpl { /** * Adds a new namespace * @ return the current instance of < code > ApplicationDescriptor < / code > */ public ApplicationDescriptor addNamespace ( String name , String value ) { } }
model . attribute ( name , value ) ; return this ;
public class DynamicRepositoryDecoratorRegistryImpl { /** * Decorates a { @ link Repository } if there is a { @ link DecoratorConfiguration } specified for this * repository . */ @ Override public synchronized Repository < Entity > decorate ( Repository < Entity > repository ) { } }
String entityTypeId = repository . getEntityType ( ) . getId ( ) ; if ( ! entityTypeId . equals ( DECORATOR_CONFIGURATION ) && bootstrappingDone ) { DecoratorConfiguration config = dataService . query ( DECORATOR_CONFIGURATION , DecoratorConfiguration . class ) . eq ( ENTITY_TYPE_ID , entityTypeId ) . findOne ( ) ; if ( config != null ) { repository = decorateRepository ( repository , config ) ; } } return repository ;
public class ASTUtils { /** * Return null if specified name annotation is not found . */ public static IAnnotationBinding getAnnotationBinding ( IAnnotationBinding [ ] annotations , String annotationClassName ) { } }
if ( annotations == null ) { return null ; } if ( annotationClassName == null ) { throw new NullPointerException ( ) ; } for ( IAnnotationBinding annotation : annotations ) { String qName = annotation . getAnnotationType ( ) . getBinaryName ( ) ; assert qName != null ; // TODO if multiple annotations for annotationClassName exists if ( qName . equals ( annotationClassName ) ) { return annotation ; } } return null ;
public class DataSiftAccount { /** * List tokens associated with an identity * @ param identity which identity you want to list the tokens of * @ param page page number ( can be 0) * @ param perPage items per page ( can be 0) * @ return List of identities */ public FutureData < TokenList > listTokens ( String identity , int page , int perPage ) { } }
if ( identity == null ) { throw new IllegalArgumentException ( "An identity is required" ) ; } FutureData < TokenList > future = new FutureData < > ( ) ; ParamBuilder b = newParams ( ) ; if ( page > 0 ) { b . put ( "page" , page ) ; } if ( perPage > 0 ) { b . put ( "per_page" , perPage ) ; } URI uri = b . forURL ( config . newAPIEndpointURI ( IDENTITY + "/" + identity + "/token" ) ) ; Request request = config . http ( ) . GET ( uri , new PageReader ( newRequestCallback ( future , new TokenList ( ) , config ) ) ) ; performRequest ( future , request ) ; return future ;
public class WordTree { /** * 找出所有匹配的关键字 * @ param text 被检查的文本 * @ param limit 限制匹配个数 * @ return 匹配的词列表 */ public List < String > matchAll ( String text , int limit ) { } }
return matchAll ( text , limit , false , false ) ;
public class Ec2MachineConfigurator { /** * Looks up volume , by ID or Name tag . * @ param volumeIdOrName the EBS volume ID or Name tag * @ return The volume ID of 1st matching volume found , null if no volume found */ private String lookupVolume ( String volumeIdOrName ) { } }
String ret = null ; if ( ! Utils . isEmptyOrWhitespaces ( volumeIdOrName ) ) { // Lookup by volume ID DescribeVolumesRequest dvs = new DescribeVolumesRequest ( Collections . singletonList ( volumeIdOrName ) ) ; DescribeVolumesResult dvsresult = null ; try { dvsresult = this . ec2Api . describeVolumes ( dvs ) ; } catch ( Exception e ) { dvsresult = null ; } // If not found , lookup by name if ( dvsresult == null || dvsresult . getVolumes ( ) == null || dvsresult . getVolumes ( ) . size ( ) < 1 ) { dvs = new DescribeVolumesRequest ( ) . withFilters ( new Filter ( ) . withName ( "tag:Name" ) . withValues ( volumeIdOrName ) ) ; try { dvsresult = this . ec2Api . describeVolumes ( dvs ) ; } catch ( Exception e ) { dvsresult = null ; } } if ( dvsresult != null && dvsresult . getVolumes ( ) != null && dvsresult . getVolumes ( ) . size ( ) > 0 ) ret = dvsresult . getVolumes ( ) . get ( 0 ) . getVolumeId ( ) ; } return ret ;
public class GeoPackageIOUtils { /** * Get the file name with the extension removed * @ param file * file * @ return file name */ public static String getFileNameWithoutExtension ( File file ) { } }
String name = file . getName ( ) ; int extensionIndex = name . lastIndexOf ( "." ) ; if ( extensionIndex > - 1 ) { name = name . substring ( 0 , extensionIndex ) ; } return name ;
public class OBDImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . OBD__TRIPLETS : getTriplets ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ;
public class CompressedFile { /** * Reads the contents of a file . */ public InputStream read ( ) throws IOException { } }
if ( file . exists ( ) ) try { return Files . newInputStream ( file . toPath ( ) ) ; } catch ( InvalidPathException e ) { throw new IOException ( e ) ; } // check if the compressed file exists if ( gz . exists ( ) ) try { return new GZIPInputStream ( Files . newInputStream ( gz . toPath ( ) ) ) ; } catch ( InvalidPathException e ) { throw new IOException ( e ) ; } // no such file throw new FileNotFoundException ( file . getName ( ) ) ;
public class ZooKeeperMain { /** * this method deletes quota for a node . * @ param zk * the zookeeper client * @ param path * the path to delete quota for * @ param bytes * true if number of bytes needs to be unset * @ param numNodes * true if number of nodes needs to be unset * @ return true if quota deletion is successful * @ throws KeeperException * @ throws IOException * @ throws InterruptedException */ public static boolean delQuota ( ZooKeeper zk , String path , boolean bytes , boolean numNodes ) throws KeeperException , IOException , InterruptedException { } }
String parentPath = Quotas . quotaZookeeper + path ; String quotaPath = Quotas . quotaZookeeper + path + "/" + Quotas . limitNode ; if ( zk . exists ( quotaPath , false ) == null ) { System . out . println ( "Quota does not exist for " + path ) ; return true ; } byte [ ] data = null ; try { data = zk . getData ( quotaPath , false , new Stat ( ) ) ; } catch ( KeeperException . NoNodeException ne ) { System . err . println ( "quota does not exist for " + path ) ; return true ; } StatsTrack strack = new StatsTrack ( new String ( data ) ) ; if ( bytes && ! numNodes ) { strack . setBytes ( - 1L ) ; zk . setData ( quotaPath , strack . toString ( ) . getBytes ( ) , - 1 ) ; } else if ( ! bytes && numNodes ) { strack . setCount ( - 1 ) ; zk . setData ( quotaPath , strack . toString ( ) . getBytes ( ) , - 1 ) ; } else if ( bytes && numNodes ) { // delete till you can find a node with more than // one child List < String > children = zk . getChildren ( parentPath , false ) ; // / delete the direct children first for ( String child : children ) { zk . delete ( parentPath + "/" + child , - 1 ) ; } // cut the tree till their is more than one child trimProcQuotas ( zk , parentPath ) ; } return true ;
public class DocTreeScanner { /** * { @ inheritDoc } This implementation scans the children in left to right order . * @ param node { @ inheritDoc } * @ param p { @ inheritDoc } * @ return the result of scanning */ @ Override public R visitSerialData ( SerialDataTree node , P p ) { } }
return scan ( node . getDescription ( ) , p ) ;
public class DetectDescribeAssociate { /** * Adds a new track given its location and description */ protected PointTrack addNewTrack ( int setIndex , double x , double y , Desc desc ) { } }
PointTrack p = getUnused ( ) ; p . set ( x , y ) ; ( ( Desc ) p . getDescription ( ) ) . setTo ( desc ) ; if ( checkValidSpawn ( setIndex , p ) ) { p . setId = setIndex ; p . featureId = featureID ++ ; sets [ setIndex ] . tracks . add ( p ) ; tracksNew . add ( p ) ; tracksActive . add ( p ) ; tracksAll . add ( p ) ; return p ; } else { unused . add ( p ) ; return null ; }
public class JcrTools { /** * Upload the content at the supplied URL into the repository at the defined path , using the given session . This method will * create a ' nt : file ' node at the supplied path , and any non - existant ancestors with nodes of type ' nt : folder ' . As defined by * the JCR specification , the binary content ( and other properties ) will be placed on a child of the ' nt : file ' node named * ' jcr : content ' with a node type of ' nt : resource ' . * @ param session the JCR session * @ param path the path to the file * @ param contentUrl the URL where the content can be found * @ return the newly created ' nt : file ' node * @ throws RepositoryException if there is a problem uploading the file * @ throws IOException if there is a problem using the stream * @ throws IllegalArgumentException is any of the parameters are null */ public Node uploadFile ( Session session , String path , URL contentUrl ) throws RepositoryException , IOException { } }
isNotNull ( session , "session" ) ; isNotNull ( path , "path" ) ; isNotNull ( contentUrl , "contentUrl" ) ; // Open the URL ' s stream first . . . InputStream stream = contentUrl . openStream ( ) ; return uploadFile ( session , path , stream ) ;
public class EpollSocketChannelConfig { /** * Set the { @ code TCP _ NOTSENT _ LOWAT } option on the socket . See { @ code man 7 tcp } for more details . * @ param tcpNotSentLowAt is a uint32 _ t */ public EpollSocketChannelConfig setTcpNotSentLowAt ( long tcpNotSentLowAt ) { } }
try { ( ( EpollSocketChannel ) channel ) . socket . setTcpNotSentLowAt ( tcpNotSentLowAt ) ; return this ; } catch ( IOException e ) { throw new ChannelException ( e ) ; }
public class ServiceDirectoryImpl { /** * { @ inheritDoc } */ @ Override public DirectoryServiceClient getDirectoryServiceClient ( ) { } }
if ( client == null ) { synchronized ( this ) { if ( isShutdown ) { ServiceDirectoryError error = new ServiceDirectoryError ( ErrorCode . SERVICE_DIRECTORY_IS_SHUTDOWN ) ; throw new ServiceException ( error ) ; } if ( client == null ) { try { String host = ServiceDirectory . getServiceDirectoryConfig ( ) . getString ( DirectoryServiceClient . SD_API_SD_SERVER_FQDN_PROPERTY , DirectoryServiceClient . SD_API_SD_SERVER_FQDN_DEFAULT ) ; int port = ServiceDirectory . getServiceDirectoryConfig ( ) . getInt ( DirectoryServiceClient . SD_API_SD_SERVER_PORT_PROPERTY , DirectoryServiceClient . SD_API_SD_SERVER_PORT_DEFAULT ) ; List < String > ss = new ArrayList < String > ( ) ; ss . add ( host + ":" + port ) ; client = new DirectoryServiceClient ( ss , "admin" , "admin" ) ; } catch ( Exception e ) { // TODO Auto - generated catch block e . printStackTrace ( ) ; } } } } return client ;
public class TransferManager { /** * Schedules a new transfer to download data from Amazon S3 using presigned url * and save it to the specified file . This method is non - blocking and returns immediately * ( i . e . before the data has been fully downloaded ) . * Use the returned { @ link PresignedUrlDownload } object to query the progress of the transfer , * add listeners for progress events , and wait for the download to complete . * Note : The result of the operation doesn ' t support pause and resume functionality . * @ param request The request containing all the parameters for the download . * @ param destFile The file to download the object data to . * @ param downloadContext Additional configuration to control the download behavior * @ return A new { @ link PresignedUrlDownload } object to check the state of the download , * listen for progress notifications , and otherwise manage the download . */ public PresignedUrlDownload download ( final PresignedUrlDownloadRequest request , final File destFile , final PresignedUrlDownloadConfig downloadContext ) { } }
assertParameterNotNull ( request , "A valid PresignedUrlDownloadRequest must be provided to initiate download" ) ; assertParameterNotNull ( destFile , "A valid file must be provided to download into" ) ; assertParameterNotNull ( downloadContext , "A valid PresignedUrlDownloadContext must be provided" ) ; appendSingleObjectUserAgent ( request ) ; String description = "Downloading from the given presigned url: " + request . getPresignedUrl ( ) ; TransferProgress transferProgress = new TransferProgress ( ) ; S3ProgressListenerChain listenerChain = new S3ProgressListenerChain ( new TransferProgressUpdatingListener ( transferProgress ) , request . getGeneralProgressListener ( ) , downloadContext . getS3progressListener ( ) ) ; request . setGeneralProgressListener ( new ProgressListenerChain ( new TransferCompletionFilter ( ) , listenerChain ) ) ; Long startByte = 0L ; Long endByte = null ; long [ ] range = request . getRange ( ) ; if ( range != null && range . length == 2 ) { startByte = range [ 0 ] ; endByte = range [ 1 ] ; } else { // Get content length by making a range GET call final ObjectMetadata objectMetadata = getObjectMetadataUsingRange ( request ) ; if ( objectMetadata != null ) { Long contentLength = TransferManagerUtils . getContentLengthFromContentRange ( objectMetadata ) ; endByte = contentLength != null ? contentLength - 1 : null ; } } final long perRequestDownloadSize = downloadContext . getDownloadSizePerRequest ( ) ; final boolean isDownloadParallel = isDownloadParallel ( request , startByte , endByte , perRequestDownloadSize ) ; final PresignedUrlDownloadImpl download = new PresignedUrlDownloadImpl ( description , transferProgress , listenerChain , request ) ; if ( startByte != null && endByte != null ) { transferProgress . setTotalBytesToTransfer ( endByte - startByte + 1 ) ; } final CountDownLatch latch = new CountDownLatch ( 1 ) ; Future < ? > future = executorService . submit ( new PresignUrlDownloadCallable ( executorService , destFile , latch , download , isDownloadParallel , timedThreadPool , downloadContext . getTimeoutMillis ( ) , s3 , request , perRequestDownloadSize , startByte , endByte , downloadContext . isResumeOnRetry ( ) ) ) ; download . setMonitor ( new DownloadMonitor ( download , future ) ) ; latch . countDown ( ) ; return download ;
public class Datatype_Builder { /** * Sets the value to be returned by { @ link Datatype # getBuilderFactory ( ) } . * @ return this { @ code Builder } object */ public Datatype . Builder setBuilderFactory ( Optional < ? extends BuilderFactory > builderFactory ) { } }
if ( builderFactory . isPresent ( ) ) { return setBuilderFactory ( builderFactory . get ( ) ) ; } else { return clearBuilderFactory ( ) ; }
public class VpnTunnelClient { /** * Retrieves an aggregated list of VPN tunnels . * < p > Sample code : * < pre > < code > * try ( VpnTunnelClient vpnTunnelClient = VpnTunnelClient . create ( ) ) { * ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ; * for ( VpnTunnelsScopedList element : vpnTunnelClient . aggregatedListVpnTunnels ( project ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param project Project ID for this request . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final AggregatedListVpnTunnelsPagedResponse aggregatedListVpnTunnels ( ProjectName project ) { } }
AggregatedListVpnTunnelsHttpRequest request = AggregatedListVpnTunnelsHttpRequest . newBuilder ( ) . setProject ( project == null ? null : project . toString ( ) ) . build ( ) ; return aggregatedListVpnTunnels ( request ) ;
public class ModifyWorkspaceStateRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ModifyWorkspaceStateRequest modifyWorkspaceStateRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( modifyWorkspaceStateRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( modifyWorkspaceStateRequest . getWorkspaceId ( ) , WORKSPACEID_BINDING ) ; protocolMarshaller . marshall ( modifyWorkspaceStateRequest . getWorkspaceState ( ) , WORKSPACESTATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class XMLRoadUtil { /** * Read the roads from the XML description . * @ param xmlNode is the XML node to fill with the container data . * @ param primitive is the container of roads to read . * @ param pathBuilder is the tool to make paths relative . * @ param resources is the tool that permits to gather the resources . * @ throws IOException in case of error . */ public static void readRoadNetwork ( Element xmlNode , RoadNetwork primitive , PathBuilder pathBuilder , XMLResources resources ) throws IOException { } }
final ContainerWrapper w = new ContainerWrapper ( primitive ) ; readGISElementContainer ( xmlNode , w , NODE_ROAD , pathBuilder , resources ) ; URL u ; // Force the primitive to have the pointer to the Shape and dBase files u = w . getElementGeometrySourceURL ( ) ; if ( u != null ) { primitive . setAttribute ( MapElementLayer . ATTR_ELEMENT_GEOMETRY_URL , u ) ; } else { primitive . removeAttribute ( MapElementLayer . ATTR_ELEMENT_GEOMETRY_URL ) ; } u = w . getElementAttributeSourceURL ( ) ; if ( u != null ) { primitive . setAttribute ( MapElementLayer . ATTR_ELEMENT_ATTRIBUTES_URL , u ) ; } else { primitive . removeAttribute ( MapElementLayer . ATTR_ELEMENT_ATTRIBUTES_URL ) ; } final MapMetricProjection projection = w . getElementGeometrySourceProjection ( ) ; if ( projection != null ) { primitive . setAttribute ( MapElementLayer . ATTR_ELEMENT_GEOMETRY_PROJECTION , projection ) ; } else { primitive . removeAttribute ( MapElementLayer . ATTR_ELEMENT_GEOMETRY_PROJECTION ) ; }
public class TimeCategory { /** * Subtract one date from the other . * @ param lhs a Date * @ param rhs another Date * @ return a Duration */ public static TimeDuration minus ( final Date lhs , final Date rhs ) { } }
long milliseconds = lhs . getTime ( ) - rhs . getTime ( ) ; long days = milliseconds / ( 24 * 60 * 60 * 1000 ) ; milliseconds -= days * 24 * 60 * 60 * 1000 ; int hours = ( int ) ( milliseconds / ( 60 * 60 * 1000 ) ) ; milliseconds -= hours * 60 * 60 * 1000 ; int minutes = ( int ) ( milliseconds / ( 60 * 1000 ) ) ; milliseconds -= minutes * 60 * 1000 ; int seconds = ( int ) ( milliseconds / 1000 ) ; milliseconds -= seconds * 1000 ; return new TimeDuration ( ( int ) days , hours , minutes , seconds , ( int ) milliseconds ) ;
public class HomeHandleImpl { /** * Return < code > EJBHome < / code > reference for this HomeHandle . < p > */ public EJBHome getEJBHome ( ) throws RemoteException { } }
// When ivActualVersion is Constant . HOME _ HANDLE _ V1 , ivEjbHome may // be null . So if this happens , we need to find the EJBHome object // by doing a lookup in JNDI . For all other versions , ivEjbHome // should never be null . if ( ivEjbHome == null ) { try { Class homeClass = null ; try { // If we are running on the server side , then the thread // context loader would have been set appropriately by // the container . If running on a client , then check the // thread context class loader first ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; if ( cl != null ) { homeClass = cl . loadClass ( ivHomeInterface ) ; } else { throw new ClassNotFoundException ( ) ; } } catch ( ClassNotFoundException ex ) { // FFDCFilter . processException ( ex , CLASS _ NAME + " . getEJBHome " , " 131 " , this ) ; try { homeClass = Class . forName ( ivHomeInterface ) ; } catch ( ClassNotFoundException e ) { // FFDCFilter . processException ( e , CLASS _ NAME + " . getEJBHome " , // "138 " , this ) ; throw new ClassNotFoundException ( ivHomeInterface ) ; } } InitialContext ctx = null ; try { // Locate the home // 91851 begin if ( this . ivInitialContextProperties == null ) { ctx = new InitialContext ( ) ; } else { try { ctx = new InitialContext ( ivInitialContextProperties ) ; } catch ( NamingException ne ) { // FFDCFilter . processException ( ne , CLASS _ NAME + " . getEJBHome " , // "161 " , this ) ; ctx = new InitialContext ( ) ; } } // 91851 end ivEjbHome = ( EJBHome ) PortableRemoteObject . narrow ( ctx . lookup ( ivJndiName ) , homeClass ) ; } catch ( NoInitialContextException e ) { // FFDCFilter . processException ( e , CLASS _ NAME + " . getEJBHome " , " 172 " , this ) ; java . util . Properties p = new java . util . Properties ( ) ; p . put ( Context . INITIAL_CONTEXT_FACTORY , "com.ibm.websphere.naming.WsnInitialContextFactory" ) ; ctx = new InitialContext ( p ) ; ivEjbHome = ( EJBHome ) PortableRemoteObject . narrow ( ctx . lookup ( ivJndiName ) , homeClass ) ; } } catch ( NamingException e ) { // Problem looking up the home // FFDCFilter . processException ( e , CLASS _ NAME + " . getEJBHome " , " 184 " , this ) ; RemoteException re = new NoSuchObjectException ( "Could not find home in JNDI" ) ; re . detail = e ; throw re ; } catch ( ClassNotFoundException e ) { // We couldn ' t find the home interface ' s class // FFDCFilter . processException ( e , CLASS _ NAME + " . getEJBHome " , " 192 " , this ) ; throw new RemoteException ( "Could not load home interface" , e ) ; } } return ivEjbHome ;
public class MultiViewOps { /** * Extract the fundamental matrices between views 1 + 2 and views 1 + 3 . The returned Fundamental * matrices will have the following properties : x < sub > i < / sub > < sup > T < / sup > * Fi * x < sub > 1 < / sub > = 0 , where i is view 2 or 3. * NOTE : The first camera is assumed to have the camera matrix of P1 = [ I | 0 ] . Thus observations in pixels for * the first camera will not meet the epipolar constraint when applied to the returned fundamental matrices . * @ see TrifocalExtractGeometries * @ param tensor Trifocal tensor . Not modified . * @ param F21 Output : Fundamental matrix for views 1 and 2 . Modified . * @ param F31 Output : Fundamental matrix for views 1 and 3 . Modified . */ public static void extractFundamental ( TrifocalTensor tensor , DMatrixRMaj F21 , DMatrixRMaj F31 ) { } }
TrifocalExtractGeometries e = new TrifocalExtractGeometries ( ) ; e . setTensor ( tensor ) ; e . extractFundmental ( F21 , F31 ) ;
public class PatternBox { /** * Pattern for two different EntityReference have member PhysicalEntity in the same Complex , and * the Complex has transcriptional activity . Complex membership can be through multiple nesting * and / or through homology relations . * @ return the pattern */ public static Pattern inSameComplexHavingTransActivity ( ) { } }
Pattern p = inSameComplex ( ) ; p . add ( peToControl ( ) , "Complex" , "Control" ) ; p . add ( controlToTempReac ( ) , "Control" , "TR" ) ; p . add ( new NOT ( participantER ( ) ) , "TR" , "first ER" ) ; p . add ( new NOT ( participantER ( ) ) , "TR" , "second ER" ) ; return p ;
public class Boxing { /** * Transforms any array into a primitive array . * @ param type target type * @ param src source array * @ param srcPos start position * @ param len length * @ return primitive array */ public static Object unboxAll ( Class < ? > type , Object src , int srcPos , int len ) { } }
switch ( tId ( type ) ) { case I_BOOLEAN : return unboxBooleans ( src , srcPos , len ) ; case I_BYTE : return unboxBytes ( src , srcPos , len ) ; case I_CHARACTER : return unboxCharacters ( src , srcPos , len ) ; case I_DOUBLE : return unboxDoubles ( src , srcPos , len ) ; case I_FLOAT : return unboxFloats ( src , srcPos , len ) ; case I_INTEGER : return unboxIntegers ( src , srcPos , len ) ; case I_LONG : return unboxLongs ( src , srcPos , len ) ; case I_SHORT : return unboxShorts ( src , srcPos , len ) ; } throw new IllegalArgumentException ( "No primitive/box: " + type ) ;
public class GitlabAPI { /** * use project id to get Project JSON */ public String getProjectJson ( Serializable projectId ) throws IOException { } }
String tailUrl = GitlabProject . URL + "/" + sanitizeProjectId ( projectId ) ; return retrieve ( ) . to ( tailUrl , String . class ) ;
public class Engine { /** * Gets the rule block of the given name after iterating the rule blocks . The * cost of this method is O ( n ) , where n is the number of rule blocks in the * engine . For performance , please get the rule blocks by index . * @ param name is the name of the rule block * @ return rule block of the given name * @ throws RuntimeException if there is no block with the given name */ public RuleBlock getRuleBlock ( String name ) { } }
for ( RuleBlock ruleBlock : this . ruleBlocks ) { if ( ruleBlock . getName ( ) . equals ( name ) ) { return ruleBlock ; } } throw new RuntimeException ( String . format ( "[engine error] no rule block by name <%s>" , name ) ) ;
public class RSQLUtility { /** * parses an RSQL valid string into an JPA { @ link Specification } which then * can be used to filter for JPA entities with the given RSQL query . * @ param rsql * the rsql query * @ param fieldNameProvider * the enum class type which implements the * { @ link FieldNameProvider } * @ param virtualPropertyReplacer * holds the logic how the known macros have to be resolved ; may * be < code > null < / code > * @ param database * in use * @ return an specification which can be used with JPA * @ throws RSQLParameterUnsupportedFieldException * if a field in the RSQL string is used but not provided by the * given { @ code fieldNameProvider } * @ throws RSQLParameterSyntaxException * if the RSQL syntax is wrong */ public static < A extends Enum < A > & FieldNameProvider , T > Specification < T > parse ( final String rsql , final Class < A > fieldNameProvider , final VirtualPropertyReplacer virtualPropertyReplacer , final Database database ) { } }
return new RSQLSpecification < > ( rsql . toLowerCase ( ) , fieldNameProvider , virtualPropertyReplacer , database ) ;
public class AbstractAppender { /** * Move provided context to current appender and call { @ link # doAppend ( StringBuilder , Map , Tree , Parser ) } if no recursion has been detected . * @ param buffer * @ param configuration * @ param context */ public final void append ( StringBuilder buffer , Map < String , String > configuration , Tree < Appender > context ) { } }
// Create context if needed Tree < Appender > currentContext = context == null ? new Tree < Appender > ( this ) : context . addLeaf ( this ) ; // Check recursion if ( currentContext . inAncestors ( this ) ) { // For the moment just log a warning , and stop the resolving by appending original chunk buffer . append ( chunk ) ; logger . warning ( format ( "Recursion detected within variable resolving:%n%s" , currentContext . getRoot ( ) ) ) ; } // Process real appending else { doAppend ( buffer , configuration , currentContext ) ; // Dump some info on resolution if this is a root appender if ( currentContext . isRoot ( ) && logger . isLoggable ( FINEST ) ) { logger . finest ( format ( "Resolving variables:%n%s" , currentContext ) ) ; } }
public class ApiOvhDbaastimeseries { /** * Create a key for a project * REST : POST / dbaas / timeseries / { serviceName } / key * @ param serviceName [ required ] Service Name * @ param description [ required ] Description * @ param permissions [ required ] Permissions for this token * @ param tags [ required ] Descriptive tags * @ deprecated */ public OvhKey serviceName_key_POST ( String serviceName , String description , String [ ] permissions , OvhTag [ ] tags ) throws IOException { } }
String qPath = "/dbaas/timeseries/{serviceName}/key" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "description" , description ) ; addBody ( o , "permissions" , permissions ) ; addBody ( o , "tags" , tags ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhKey . class ) ;
public class AnnotationExpander { /** * 複数のアノテーションを展開する 。 * @ param targetAnnos 展開対象のアノテーション * @ return 展開されたアノテーション * @ throws NullPointerException { @ literal targetAnnos = = null . } */ public List < ExpandedAnnotation > expand ( final Annotation [ ] targetAnnos ) { } }
Objects . requireNonNull ( targetAnnos ) ; final List < ExpandedAnnotation > expanedList = new ArrayList < > ( ) ; for ( Annotation targetAnno : targetAnnos ) { expanedList . addAll ( expand ( targetAnno ) ) ; } Collections . sort ( expanedList , comparator ) ; return expanedList ;
public class KeyVaultClientBaseImpl { /** * Gets the specified deleted sas definition . * The Get Deleted SAS Definition operation returns the specified deleted SAS definition along with its attributes . This operation requires the storage / getsas permission . * @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net . * @ param storageAccountName The name of the storage account . * @ param sasDefinitionName The name of the SAS definition . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the DeletedSasDefinitionBundle object */ public Observable < DeletedSasDefinitionBundle > getDeletedSasDefinitionAsync ( String vaultBaseUrl , String storageAccountName , String sasDefinitionName ) { } }
return getDeletedSasDefinitionWithServiceResponseAsync ( vaultBaseUrl , storageAccountName , sasDefinitionName ) . map ( new Func1 < ServiceResponse < DeletedSasDefinitionBundle > , DeletedSasDefinitionBundle > ( ) { @ Override public DeletedSasDefinitionBundle call ( ServiceResponse < DeletedSasDefinitionBundle > response ) { return response . body ( ) ; } } ) ;
public class EntityFunctionResolver { /** * Resolves an { @ link Entity } type to a new resolved { @ link EntityFunction } . * @ param type * Type to resolve . * @ return New ( or cached ) resolved mapped type . */ @ SuppressWarnings ( "unchecked" ) public EntityFunction resolveType ( final Class < ? extends Entity > type ) { } }
// Check already resolved EntityFunction resolvedType = resolved . get ( Objects . requireNonNull ( type ) ) ; if ( resolvedType != null ) { return resolvedType ; } // Log type logger . info ( String . format ( "Resolving type %s" , type ) ) ; // Check not entity if ( Entity . class . equals ( type ) ) { throw new IllegalArgumentException ( "Entity is not a valid Entity subclass" ) ; } // Check is interface if ( ! type . isInterface ( ) ) { throw new IllegalArgumentException ( String . format ( "Type %s is not an interface" , type ) ) ; } // Check type parameters if ( type . getTypeParameters ( ) . length > 0 ) { throw new IllegalArgumentException ( String . format ( "Type %s cannot take type parameters" , type ) ) ; } // Build method map final Map < Method , EntityMethod > methodMap = new HashMap < > ( ) ; final Set < Class < ? extends Entity > > totalDependencies = new HashSet < > ( ) ; for ( final Method m : type . getDeclaredMethods ( ) ) { // Check static if ( Modifier . isStatic ( m . getModifiers ( ) ) ) { // Ignore static methods as not invoked on instance continue ; } // Process functions for ( final EntityMethodFunction methodFunction : functions ) { // Log method logger . fine ( String . format ( "Resolving method %s with function %s" , m , methodFunction . getClass ( ) ) ) ; // Resolve method final EntityMethod em = methodFunction . apply ( m ) ; if ( em != null ) { // Resolved method if ( methodMap . put ( m , em ) != null ) { throw new IllegalArgumentException ( String . format ( "Method %s of type %s had multiple function hits" , m , type ) ) ; } // Add dependencies to be resolved totalDependencies . addAll ( em . getDependencies ( ) ) ; } } // Check method could be resolved if ( ! methodMap . containsKey ( m ) ) { throw new IllegalArgumentException ( String . format ( "Method %s of type %s had no resolver hits" , m , type ) ) ; } } // Created resolved type resolvedType = new EntityFunction ( type , methodMap ) ; resolved . put ( type , resolvedType ) ; // Resolve dependencies totalDependencies . forEach ( this :: resolveType ) ; // Resolve parents for ( final Class < ? > parent : type . getInterfaces ( ) ) { // Ignore if entity if ( Entity . class . equals ( parent ) ) { continue ; } // Check if entity subclass if ( ! Entity . class . isAssignableFrom ( parent ) ) { throw new IllegalArgumentException ( String . format ( "Parent type %s of type %s is not an Entity" , parent , type ) ) ; } // Resolve dependency resolveType ( ( Class < ? extends Entity > ) parent ) ; } return resolvedType ;
public class ColumnDescriptorAdapter { /** * Parse a Bigtable { @ link GcRule } that is in line with * { @ link # buildGarbageCollectionRule ( HColumnDescriptor ) } into the provided * { @ link HColumnDescriptor } . * This method will likely throw IllegalStateException or IllegalArgumentException if the GC Rule * isn ' t similar to { @ link # buildGarbageCollectionRule ( HColumnDescriptor ) } ' s rule . */ private static void convertGarbageCollectionRule ( GcRule gcRule , HColumnDescriptor columnDescriptor ) { } }
// The Bigtable default is to have infinite versions . columnDescriptor . setMaxVersions ( Integer . MAX_VALUE ) ; if ( gcRule == null || gcRule . equals ( GcRule . getDefaultInstance ( ) ) ) { return ; } switch ( gcRule . getRuleCase ( ) ) { case MAX_AGE : columnDescriptor . setTimeToLive ( ( int ) gcRule . getMaxAge ( ) . getSeconds ( ) ) ; return ; case MAX_NUM_VERSIONS : columnDescriptor . setMaxVersions ( gcRule . getMaxNumVersions ( ) ) ; return ; case INTERSECTION : { // minVersions and maxAge are set . processIntersection ( gcRule , columnDescriptor ) ; return ; } case UNION : { // ( minVersion & & maxAge ) | | maxVersions List < GcRule > unionRules = gcRule . getUnion ( ) . getRulesList ( ) ; Preconditions . checkArgument ( unionRules . size ( ) == 2 , "Cannot process rule " + gcRule ) ; if ( hasRule ( unionRules , RuleCase . INTERSECTION ) ) { processIntersection ( getRule ( unionRules , RuleCase . INTERSECTION ) , columnDescriptor ) ; } else { columnDescriptor . setTimeToLive ( ( int ) getRule ( unionRules , RuleCase . MAX_AGE ) . getMaxAge ( ) . getSeconds ( ) ) ; } columnDescriptor . setMaxVersions ( getVersionCount ( unionRules ) ) ; return ; } default : throw new IllegalArgumentException ( "Could not proess gc rules: " + gcRule ) ; }
public class CurrentMetricDataMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CurrentMetricData currentMetricData , ProtocolMarshaller protocolMarshaller ) { } }
if ( currentMetricData == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( currentMetricData . getMetric ( ) , METRIC_BINDING ) ; protocolMarshaller . marshall ( currentMetricData . getValue ( ) , VALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AbstractSarlMojo { /** * Execute another MOJO . * @ param groupId identifier of the MOJO plugin group . * @ param artifactId identifier of the MOJO plugin artifact . * @ param version version of the MOJO plugin version . * @ param goal the goal to run . * @ param configuration the XML code for the configuration . * @ param dependencies the dependencies of the plugin . * @ throws MojoExecutionException when cannot run the MOJO . * @ throws MojoFailureException when the build failed . */ protected void executeMojo ( String groupId , String artifactId , String version , String goal , String configuration , Dependency ... dependencies ) throws MojoExecutionException , MojoFailureException { } }
final Plugin plugin = new Plugin ( ) ; plugin . setArtifactId ( artifactId ) ; plugin . setGroupId ( groupId ) ; plugin . setVersion ( version ) ; plugin . setDependencies ( Arrays . asList ( dependencies ) ) ; getLog ( ) . debug ( MessageFormat . format ( Messages . AbstractSarlMojo_0 , plugin . getId ( ) ) ) ; final PluginDescriptor pluginDescriptor = this . mavenHelper . loadPlugin ( plugin ) ; if ( pluginDescriptor == null ) { throw new MojoExecutionException ( MessageFormat . format ( Messages . AbstractSarlMojo_1 , plugin . getId ( ) ) ) ; } final MojoDescriptor mojoDescriptor = pluginDescriptor . getMojo ( goal ) ; if ( mojoDescriptor == null ) { throw new MojoExecutionException ( MessageFormat . format ( Messages . AbstractSarlMojo_2 , goal ) ) ; } final Xpp3Dom mojoXml ; try { mojoXml = this . mavenHelper . toXpp3Dom ( mojoDescriptor . getMojoConfiguration ( ) ) ; } catch ( PlexusConfigurationException e1 ) { throw new MojoExecutionException ( e1 . getLocalizedMessage ( ) , e1 ) ; } Xpp3Dom configurationXml = this . mavenHelper . toXpp3Dom ( configuration , getLog ( ) ) ; if ( configurationXml != null ) { configurationXml = Xpp3DomUtils . mergeXpp3Dom ( configurationXml , mojoXml ) ; } else { configurationXml = mojoXml ; } getLog ( ) . debug ( MessageFormat . format ( Messages . AbstractSarlMojo_3 , plugin . getId ( ) , configurationXml . toString ( ) ) ) ; final MojoExecution execution = new MojoExecution ( mojoDescriptor , configurationXml ) ; this . mavenHelper . executeMojo ( execution ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link VerticalDatumTypeType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link VerticalDatumTypeType } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "verticalDatumType" ) public JAXBElement < VerticalDatumTypeType > createVerticalDatumType ( VerticalDatumTypeType value ) { } }
return new JAXBElement < VerticalDatumTypeType > ( _VerticalDatumType_QNAME , VerticalDatumTypeType . class , null , value ) ;
public class ServiceManagerAmpWrapper { /** * @ Override * public < T > T run ( ResultFuture < T > future , * long timeout , * TimeUnit unit , * Runnable task ) * return getDelegate ( ) . run ( future , timeout , unit , task ) ; */ @ Override public < T > T run ( long timeout , TimeUnit unit , Consumer < Result < T > > task ) { } }
return delegate ( ) . run ( timeout , unit , task ) ;
public class ListTagOptionsResult { /** * Information about the TagOptions . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setTagOptionDetails ( java . util . Collection ) } or { @ link # withTagOptionDetails ( java . util . Collection ) } if you * want to override the existing values . * @ param tagOptionDetails * Information about the TagOptions . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListTagOptionsResult withTagOptionDetails ( TagOptionDetail ... tagOptionDetails ) { } }
if ( this . tagOptionDetails == null ) { setTagOptionDetails ( new java . util . ArrayList < TagOptionDetail > ( tagOptionDetails . length ) ) ; } for ( TagOptionDetail ele : tagOptionDetails ) { this . tagOptionDetails . add ( ele ) ; } return this ;
public class URLHelper { /** * Get the passed URI as an URL . If the URI is null or cannot be converted to * an URL < code > null < / code > is returned . * @ param aURI * Source URI . May be < code > null < / code > . * @ return < code > null < / code > if the passed URI is null or cannot be converted * to an URL . */ @ Nullable public static URL getAsURL ( @ Nullable final URI aURI ) { } }
if ( aURI != null ) try { return aURI . toURL ( ) ; } catch ( final MalformedURLException ex ) { // fall - through if ( GlobalDebug . isDebugMode ( ) ) if ( LOGGER . isWarnEnabled ( ) ) LOGGER . warn ( "Debug warn: failed to convert '" + aURI + "' to a URL!" ) ; } return null ;
public class ScriptExecUtil { /** * Generate argument array for a script file invocation * @ param filepath remote filepath for the script * @ param scriptargs arguments to the script file * @ param scriptargsarr arguments to the script file as an array * @ param scriptinterpreter interpreter invocation for the file , or null to invoke it directly , can include * $ { scriptfile } * @ param interpreterargsquoted if true , pass the script file and args as a single argument to the interpreter * @ return arg list */ public static ExecArgList createScriptArgList ( final String filepath , final String scriptargs , final String [ ] scriptargsarr , final String scriptinterpreter , final boolean interpreterargsquoted ) { } }
ExecArgList . Builder builder = ExecArgList . builder ( ) ; boolean seenFilepath = false ; if ( null != scriptinterpreter ) { String [ ] burst = OptsUtil . burst ( scriptinterpreter ) ; List < String > args = new ArrayList < String > ( ) ; for ( String arg : burst ) { if ( arg . contains ( "${scriptfile}" ) ) { args . add ( arg . replaceAll ( Pattern . quote ( "${scriptfile}" ) , Matcher . quoteReplacement ( filepath ) ) ) ; seenFilepath = true ; } else { args . add ( arg ) ; } } builder . args ( args , false ) ; } if ( null != scriptinterpreter && interpreterargsquoted ) { ExecArgList . Builder sub = builder . subList ( true ) ; addScriptFileArgList ( seenFilepath ? null : filepath , scriptargs , scriptargsarr , sub , needsQuoting ) ; sub . parent ( ) ; } else { addScriptFileArgList ( seenFilepath ? null : filepath , scriptargs , scriptargsarr , builder , needsQuoting ) ; } return builder . build ( ) ;
public class Strings { /** * Trim white spaces around given string . White space characters are those recognized by * { @ link java . lang . Character # isWhitespace ( char ) } . * @ param string string value to trim . * @ return string with white spaces trimmed or null if given string was null . */ public static String trim ( String string ) { } }
if ( string == null ) { return null ; } int length = string . length ( ) ; int beginIndex = 0 ; for ( ; beginIndex < length ; ++ beginIndex ) { if ( ! Character . isWhitespace ( string . charAt ( beginIndex ) ) ) break ; } int endIndex = length - 1 ; for ( ; endIndex >= 0 ; -- endIndex ) { if ( ! Character . isWhitespace ( string . charAt ( endIndex ) ) ) break ; } return string . substring ( beginIndex , endIndex + 1 ) ;
public class SecretsManager { /** * Store a single Fernet key in a secret . This requires the permission < code > secretsmanager : PutSecretValue < / code > * @ param secretId * the ARN of the secret * @ param clientRequestToken * the secret version identifier * @ param key * the key to store in the secret * @ param stage * the stage with which to tag the version */ public void putSecretValue ( final String secretId , final String clientRequestToken , final Key key , final Stage stage ) { } }
putSecretValue ( secretId , clientRequestToken , singletonList ( key ) , stage ) ;
public class ReschedulingRunnable { /** * Schedule . * @ return the scheduled future */ public ScheduledFuture < ? > schedule ( ) { } }
synchronized ( this . triggerContextMonitor ) { this . scheduledExecutionTime = this . trigger . nextExecutionTime ( this . triggerContext ) ; if ( this . scheduledExecutionTime == null ) { return null ; } long initialDelay = this . scheduledExecutionTime . getTime ( ) - System . currentTimeMillis ( ) ; this . currentFuture = this . executor . schedule ( this , initialDelay , TimeUnit . MILLISECONDS ) ; return this ; }
public class RuleBasedTokenizer { /** * Set as value of the token its normalized counterpart . Normalization is done * following languages and corpora ( Penn TreeBank , Ancora , Tiger , Tutpenn , * etc . ) conventions . * @ param tokens * the tokens * @ param lang * the language */ public static void normalizeTokens ( final List < List < Token > > tokens , final String lang ) { } }
for ( final List < Token > sentence : tokens ) { Normalizer . convertNonCanonicalStrings ( sentence , lang ) ; Normalizer . normalizeQuotes ( sentence , lang ) ; Normalizer . normalizeDoubleQuotes ( sentence , lang ) ; }
public class RendererBuilder { /** * Throws one RendererException if the viewType , layoutInflater or parent are null . */ private void validateAttributesToCreateANewRendererViewHolder ( ) { } }
if ( viewType == null ) { throw new NullContentException ( "RendererBuilder needs a view type to create a RendererViewHolder" ) ; } if ( layoutInflater == null ) { throw new NullLayoutInflaterException ( "RendererBuilder needs a LayoutInflater to create a RendererViewHolder" ) ; } if ( parent == null ) { throw new NullParentException ( "RendererBuilder needs a parent to create a RendererViewHolder" ) ; }
public class SelectorGeneratorBase { /** * used by benchmark harness */ private void genGetAllMethod ( SourceWriter sw , JMethod [ ] methods , TreeLogger treeLogger ) { } }
sw . println ( "public DeferredSelector[] getAllSelectors() {return ds;}" ) ; sw . println ( "private final DeferredSelector[] ds = new DeferredSelector[] {" ) ; sw . indent ( ) ; for ( JMethod m : methods ) { Selector selectorAnnotation = m . getAnnotation ( Selector . class ) ; if ( selectorAnnotation == null ) { continue ; } String selector = selectorAnnotation . value ( ) ; sw . println ( "new DeferredSelector() {" ) ; sw . indent ( ) ; sw . println ( "public String getSelector() { return \"" + selector + "\"; }" ) ; sw . println ( "public NodeList<Element> runSelector(Node ctx) { return " + ( m . getName ( ) + ( m . getParameters ( ) . length == 0 ? "()" : "(ctx)" ) ) + ( "NodeList" . equals ( m . getReturnType ( ) . getSimpleSourceName ( ) ) ? "" : ".get()" ) + ";}" ) ; sw . outdent ( ) ; sw . println ( "}," ) ; } sw . outdent ( ) ; sw . println ( "};" ) ;
public class XDOMBuilder { /** * Add a block to the current block container . * @ param block the block to be added . */ public void addBlock ( Block block ) { } }
try { this . stack . getFirst ( ) . add ( block ) ; } catch ( NoSuchElementException e ) { throw new IllegalStateException ( "All container blocks are closed, too many calls to endBlockList()." ) ; }
public class RoadNetworkLayer { @ Override @ Pure public String getName ( ) { } }
String name = this . roadNetwork . getName ( ) ; if ( name != null && ! "" . equals ( name ) ) { // $ NON - NLS - 1 $ return name ; } name = super . getName ( ) ; if ( name != null && ! "" . equals ( name ) ) { // $ NON - NLS - 1 $ return name ; } return Locale . getString ( "NAME_TEMPLATE" ) ; // $ NON - NLS - 1 $
public class Contract { /** * syntactic sugar */ public SignatoryComponent addSigner ( ) { } }
SignatoryComponent t = new SignatoryComponent ( ) ; if ( this . signer == null ) this . signer = new ArrayList < SignatoryComponent > ( ) ; this . signer . add ( t ) ; return t ;
public class DifferenceMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Difference difference , ProtocolMarshaller protocolMarshaller ) { } }
if ( difference == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( difference . getBeforeBlob ( ) , BEFOREBLOB_BINDING ) ; protocolMarshaller . marshall ( difference . getAfterBlob ( ) , AFTERBLOB_BINDING ) ; protocolMarshaller . marshall ( difference . getChangeType ( ) , CHANGETYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class INChIReader { /** * Reads a ChemFile object from input . * @ return ChemFile with the content read from the input */ private IChemFile readChemFile ( IChemObjectBuilder bldr ) { } }
IChemFile cf = null ; try { parser . setFeature ( "http://xml.org/sax/features/validation" , false ) ; logger . info ( "Deactivated validation" ) ; } catch ( SAXException e ) { logger . warn ( "Cannot deactivate validation." ) ; } INChIHandler handler = new INChIHandler ( bldr ) ; parser . setContentHandler ( handler ) ; try { parser . parse ( new InputSource ( input ) ) ; cf = handler . getChemFile ( ) ; } catch ( IOException e ) { logger . error ( "IOException: " , e . getMessage ( ) ) ; logger . debug ( e ) ; } catch ( SAXException saxe ) { logger . error ( "SAXException: " , saxe . getClass ( ) . getName ( ) ) ; logger . debug ( saxe ) ; } return cf ;
public class CalendarFormatterBase { /** * Format a time zone using a non - location format . */ void formatTimeZone_z ( StringBuilder b , ZonedDateTime d , int width ) { } }
if ( width > 4 ) { return ; } ZoneId zone = d . getZone ( ) ; ZoneRules zoneRules = null ; try { zoneRules = zone . getRules ( ) ; } catch ( ZoneRulesException e ) { // not expected , but catching for safety return ; } boolean daylight = zoneRules . isDaylightSavings ( d . toInstant ( ) ) ; // Select long or short name variants and select the standard or daylight name . Name variants = getTimeZoneName ( zone . getId ( ) , d , width == 4 ) ; String name = variants == null ? null : ( daylight ? variants . daylight ( ) : variants . standard ( ) ) ; switch ( width ) { case 4 : { if ( name != null ) { b . append ( name ) ; } else { // Falls back to ' OOOO ' formatTimeZone_O ( b , d , 4 ) ; } break ; } case 3 : case 2 : case 1 : { if ( name != null ) { b . append ( name ) ; } else { // Falls back to ' O ' formatTimeZone_O ( b , d , 1 ) ; } break ; } }
public class FoxHttpRequestBuilder { /** * Add a FoxHttpPlaceholderEntry to the FoxHttpPlaceholderStrategy * @ param placeholder name of the placeholder ( without escape char ) * @ param value value of the placeholder * @ return FoxHttpClientBuilder ( this ) */ public FoxHttpRequestBuilder addFoxHttpPlaceholderEntry ( String placeholder , String value ) { } }
foxHttpRequest . getFoxHttpClient ( ) . getFoxHttpPlaceholderStrategy ( ) . addPlaceholder ( placeholder , value ) ; return this ;
public class RDFDataset { /** * Adds a triple to the specified graph of this dataset * @ param s * the subject for the triple * @ param p * the predicate for the triple * @ param value * the value of the literal object for the triple * @ param datatype * the datatype of the literal object for the triple ( null values * will default to xsd : string ) * @ param graph * the graph to add this triple to * @ param language * the language of the literal object for the triple ( or null ) */ public void addQuad ( final String s , final String p , final String value , final String datatype , final String language , String graph ) { } }
if ( graph == null ) { graph = "@default" ; } if ( ! containsKey ( graph ) ) { put ( graph , new ArrayList < Quad > ( ) ) ; } ( ( ArrayList < Quad > ) get ( graph ) ) . add ( new Quad ( s , p , value , datatype , language , graph ) ) ;
public class AbstractResources { /** * Create an HttpRequest . * Exceptions : Any exception shall be propagated since it ' s a private method . * @ param uri the URI * @ param method the HttpMethod * @ return the http request * @ throws UnsupportedEncodingException the unsupported encoding exception */ protected HttpRequest createHttpRequest ( URI uri , HttpMethod method ) { } }
HttpRequest request = new HttpRequest ( ) ; request . setUri ( uri ) ; request . setMethod ( method ) ; // Set authorization header request . setHeaders ( createHeaders ( ) ) ; return request ;
public class AESHelper { /** * Decrypts a string encrypted by { @ link # encrypt } method . * @ param c The encrypted HEX string . * @ param key The key . * @ return The decrypted string . */ public static String decrypt ( String c , String key ) { } }
try { SecretKeySpec skeySpec = new SecretKeySpec ( Hex . decodeHex ( key . toCharArray ( ) ) , "AES" ) ; Cipher cipher = Cipher . getInstance ( "AES" ) ; cipher . init ( Cipher . DECRYPT_MODE , skeySpec ) ; byte [ ] decoded = cipher . doFinal ( Hex . decodeHex ( c . toCharArray ( ) ) ) ; return new String ( decoded ) ; } catch ( final Exception e ) { logger . warn ( "Could not decrypt string" , e ) ; return null ; }
public class Validators { /** * Method will return a validator that will accept a blank string . Any other value will be passed on to the supplied validator . * @ param validator Validator to test non blank values with . * @ return validator that will accept a blank string . Any other value will be passed on to the supplied validator . */ public static Validator blankOr ( Validator validator ) { } }
Preconditions . checkNotNull ( validator , "validator cannot be null." ) ; return BlankOrValidator . of ( validator ) ;
public class InnerClasses { /** * Register the given name as an inner class with the given access modifiers . * @ return A { @ link TypeInfo } with the full class name */ public TypeInfo registerInnerClass ( String simpleName , int accessModifiers ) { } }
classNames . claimName ( simpleName ) ; TypeInfo innerClass = outer . innerClass ( simpleName ) ; innerClassesAccessModifiers . put ( innerClass , accessModifiers ) ; return innerClass ;
public class ElemForEach { /** * This after the template ' s children have been composed . */ public void endCompose ( StylesheetRoot sroot ) throws TransformerException { } }
int length = getSortElemCount ( ) ; for ( int i = 0 ; i < length ; i ++ ) { getSortElem ( i ) . endCompose ( sroot ) ; } super . endCompose ( sroot ) ;
public class CellsUtils { /** * Returns a Collection of SparkSQL Row objects from a collection of Stratio Cells * objects * @ param cellsCol Collection of Cells for transforming * @ return Collection of SparkSQL Row created from Cells . */ public static Collection < Row > getRowsFromsCells ( Collection < Cells > cellsCol ) { } }
Collection < Row > result = new ArrayList < > ( ) ; for ( Cells cells : cellsCol ) { result . add ( getRowFromCells ( cells ) ) ; } return result ;
public class Table { /** * / * Add a new heading Cell in the current row . * Adds to the table after this call and before next call to newRow , * newCell or newHeader are added to the cell . * @ return This table for call chaining */ public Table addHeading ( Object o , String attributes ) { } }
addHeading ( o ) ; cell . attribute ( attributes ) ; return this ;
public class Navigator { /** * Prepare the instance subject to being injected for the fragment being navigated to . It ' s an * equivalent way to pass arguments to the next fragment . For example , when next fragment needs * to have a pre set page title name , the controller referenced by the fragment can be prepared * here and set the title in the controller ' s model . Then in the MvcFragment . onViewReady bind * the value of the page title from the controller ' s model to the fragment . * < p > Example : < / p > * To initialize the timer of a TimerFragment which counts down seconds , sets the initial value * of its controller by this with method . * < pre > * class TimerFragment { * @ Inject * TimerController timerController ; * interface TimerController { * void setInitialValue ( long howManySeconds ) ; * navigationManager . navigate ( this ) . with ( TimerController . class , null , new Preparer < TimerController > ( ) { * @ Override * public void prepare ( TimerController instance ) { * long fiveMinutes = 60 * 5; * instance . setInitialValue ( fiveMinutes ) ; * / / Then the value set to the controller will be guaranteed to be retained when * / / TimerFragment is ready to show * } ) . to ( TimerFragment . class . getName ( ) ) ; * < / pre > * @ param type The class type of the instance needs to be prepared * @ param qualifier The qualifier * @ param preparer The preparer in which the injected instance will be prepared * @ return This navigator * @ throws MvcGraphException Raised when the required injectable object cannot be injected */ public < T > Navigator with ( Class < T > type , Annotation qualifier , Preparer < T > preparer ) throws MvcGraphException { } }
T instance ; try { instance = Mvc . graph ( ) . reference ( type , qualifier ) ; } catch ( PokeException e ) { throw new MvcGraphException ( e . getMessage ( ) , e ) ; } if ( preparer != null ) { preparer . prepare ( instance ) ; } if ( pendingReleaseInstances == null ) { pendingReleaseInstances = new ArrayList < > ( ) ; } PendingReleaseInstance pendingReleaseInstance = new PendingReleaseInstance ( ) ; pendingReleaseInstance . instance = instance ; pendingReleaseInstance . type = type ; pendingReleaseInstance . qualifier = qualifier ; pendingReleaseInstances . add ( pendingReleaseInstance ) ; return this ;
public class VisitorState { /** * Gets the current source file . * @ return the source file as a sequence of characters , or null if it is not available */ @ Nullable public CharSequence getSourceCode ( ) { } }
try { return getPath ( ) . getCompilationUnit ( ) . getSourceFile ( ) . getCharContent ( false ) ; } catch ( IOException e ) { return null ; }
public class HtmlTree { /** * Generates a META tag with the http - equiv , content and charset attributes . * @ param httpEquiv http equiv attribute for the META tag * @ param content type of content * @ param charSet character set used * @ return an HtmlTree object for the META tag */ public static HtmlTree META ( String httpEquiv , String content , String charSet ) { } }
HtmlTree htmltree = new HtmlTree ( HtmlTag . META ) ; String contentCharset = content + "; charset=" + charSet ; htmltree . addAttr ( HtmlAttr . HTTP_EQUIV , nullCheck ( httpEquiv ) ) ; htmltree . addAttr ( HtmlAttr . CONTENT , contentCharset ) ; return htmltree ;
public class ActionImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case XtextPackage . ACTION__TYPE : return getType ( ) ; case XtextPackage . ACTION__FEATURE : return getFeature ( ) ; case XtextPackage . ACTION__OPERATOR : return getOperator ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class CmsUpdateBean { /** * Creates the shared folder if possible . < p > * @ throws Exception if something goes wrong */ public void createSharedFolder ( ) throws Exception { } }
String originalSiteRoot = m_cms . getRequestContext ( ) . getSiteRoot ( ) ; CmsProject originalProject = m_cms . getRequestContext ( ) . getCurrentProject ( ) ; try { m_cms . getRequestContext ( ) . setSiteRoot ( "" ) ; m_cms . getRequestContext ( ) . setCurrentProject ( m_cms . createTempfileProject ( ) ) ; if ( ! m_cms . existsResource ( "/shared" ) ) { m_cms . createResource ( "/shared" , OpenCms . getResourceManager ( ) . getResourceType ( "folder" ) ) ; } try { m_cms . lockResourceTemporary ( "/shared" ) ; } catch ( CmsException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } try { m_cms . chacc ( "/shared" , "group" , "Users" , "+v+w+r+i" ) ; } catch ( CmsException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } CmsResource shared = m_cms . readResource ( "/shared" ) ; try { OpenCms . getPublishManager ( ) . publishProject ( m_cms , new CmsHtmlReport ( m_cms . getRequestContext ( ) . getLocale ( ) , m_cms . getRequestContext ( ) . getSiteRoot ( ) ) , shared , false ) ; OpenCms . getPublishManager ( ) . waitWhileRunning ( ) ; } catch ( CmsException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } finally { m_cms . getRequestContext ( ) . setSiteRoot ( originalSiteRoot ) ; m_cms . getRequestContext ( ) . setCurrentProject ( originalProject ) ; }
public class ImportApi { /** * Import users . * Import users in the specified CSV / XLS file . * @ param csvfile The CSV / XLS file to import . ( optional ) * @ param validateBeforeImport Specifies whether the Provisioning API should validate the file before the actual import takes place . ( optional , default to false ) * @ return ApiSuccessResponse * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiSuccessResponse importFile ( File csvfile , Boolean validateBeforeImport ) throws ApiException { } }
ApiResponse < ApiSuccessResponse > resp = importFileWithHttpInfo ( csvfile , validateBeforeImport ) ; return resp . getData ( ) ;
public class PageContext { /** * Provides convenient access to error information . * @ return an ErrorData instance containing information about the * error , as obtained from the request attributes , as per the * Servlet specification . If this is not an error page ( that is , * if the isErrorPage attribute of the page directive is not set * to " true " ) , the information is meaningless . * @ since JSP 2.0 */ public ErrorData getErrorData ( ) { } }
return new ErrorData ( ( Throwable ) getRequest ( ) . getAttribute ( "javax.servlet.error.exception" ) , ( ( Integer ) getRequest ( ) . getAttribute ( "javax.servlet.error.status_code" ) ) . intValue ( ) , ( String ) getRequest ( ) . getAttribute ( "javax.servlet.error.request_uri" ) , ( String ) getRequest ( ) . getAttribute ( "javax.servlet.error.servlet_name" ) ) ;
public class LFltFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */ @ Nonnull public static < R > LFltFunction < R > fltFunctionFrom ( Consumer < LFltFunctionBuilder < R > > buildingFunction ) { } }
LFltFunctionBuilder builder = new LFltFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ;
public class Cpe { /** * Converts the CPE into the CPE 2.2 URI format . * @ return the CPE 2.2 URI format of the CPE * @ throws CpeEncodingException thrown if the CPE is not well formed */ @ Override public String toCpe22Uri ( ) throws CpeEncodingException { } }
StringBuilder sb = new StringBuilder ( "cpe:/" ) ; sb . append ( Convert . wellFormedToCpeUri ( part ) ) . append ( ":" ) ; sb . append ( Convert . wellFormedToCpeUri ( vendor ) ) . append ( ":" ) ; sb . append ( Convert . wellFormedToCpeUri ( product ) ) . append ( ":" ) ; sb . append ( Convert . wellFormedToCpeUri ( version ) ) . append ( ":" ) ; sb . append ( Convert . wellFormedToCpeUri ( update ) ) . append ( ":" ) ; // pack the extra fields from CPE 2.3 into the edition field if present // when outputing to 2.2 format if ( ! ( ( swEdition . isEmpty ( ) || "*" . equals ( swEdition ) ) && ( targetSw . isEmpty ( ) || "*" . equals ( targetSw ) ) && ( targetHw . isEmpty ( ) || "*" . equals ( targetHw ) ) && ( other . isEmpty ( ) || "*" . equals ( other ) ) ) ) { sb . append ( "~" ) . append ( Convert . wellFormedToCpeUri ( edition ) ) . append ( "~" ) . append ( Convert . wellFormedToCpeUri ( swEdition ) ) . append ( "~" ) . append ( Convert . wellFormedToCpeUri ( targetSw ) ) . append ( "~" ) . append ( Convert . wellFormedToCpeUri ( targetHw ) ) . append ( "~" ) . append ( Convert . wellFormedToCpeUri ( other ) ) . append ( ":" ) ; } else { sb . append ( Convert . wellFormedToCpeUri ( edition ) ) . append ( ":" ) ; } sb . append ( Convert . wellFormedToCpeUri ( language ) ) ; return sb . toString ( ) . replaceAll ( "[:]*$" , "" ) ;
public class RegistryService { /** * Push a set of images to a registry * @ param imageConfigs images to push ( but only if they have a build configuration ) * @ param retries how often to retry * @ param registryConfig a global registry configuration * @ param skipTag flag to skip pushing tagged images * @ throws DockerAccessException * @ throws MojoExecutionException */ public void pushImages ( Collection < ImageConfiguration > imageConfigs , int retries , RegistryConfig registryConfig , boolean skipTag ) throws DockerAccessException , MojoExecutionException { } }
for ( ImageConfiguration imageConfig : imageConfigs ) { BuildImageConfiguration buildConfig = imageConfig . getBuildConfiguration ( ) ; String name = imageConfig . getName ( ) ; if ( buildConfig != null ) { String configuredRegistry = EnvUtil . firstRegistryOf ( new ImageName ( imageConfig . getName ( ) ) . getRegistry ( ) , imageConfig . getRegistry ( ) , registryConfig . getRegistry ( ) ) ; AuthConfig authConfig = createAuthConfig ( true , new ImageName ( name ) . getUser ( ) , configuredRegistry , registryConfig ) ; long start = System . currentTimeMillis ( ) ; docker . pushImage ( name , authConfig , configuredRegistry , retries ) ; log . info ( "Pushed %s in %s" , name , EnvUtil . formatDurationTill ( start ) ) ; if ( ! skipTag ) { for ( String tag : imageConfig . getBuildConfiguration ( ) . getTags ( ) ) { if ( tag != null ) { docker . pushImage ( new ImageName ( name , tag ) . getFullName ( ) , authConfig , configuredRegistry , retries ) ; } } } } }
public class BatchStopJobRunRequest { /** * A list of the JobRunIds that should be stopped for that job definition . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setJobRunIds ( java . util . Collection ) } or { @ link # withJobRunIds ( java . util . Collection ) } if you want to * override the existing values . * @ param jobRunIds * A list of the JobRunIds that should be stopped for that job definition . * @ return Returns a reference to this object so that method calls can be chained together . */ public BatchStopJobRunRequest withJobRunIds ( String ... jobRunIds ) { } }
if ( this . jobRunIds == null ) { setJobRunIds ( new java . util . ArrayList < String > ( jobRunIds . length ) ) ; } for ( String ele : jobRunIds ) { this . jobRunIds . add ( ele ) ; } return this ;
public class Socks5LogicHandler { /** * Encodes the proxy authorization request packet . * @ param request the socks proxy request data * @ return the encoded buffer * @ throws UnsupportedEncodingException if request ' s hostname charset * can ' t be converted to ASCII . */ private IoBuffer encodeProxyRequestPacket ( final SocksProxyRequest request ) throws UnsupportedEncodingException { } }
int len = 6 ; InetSocketAddress adr = request . getEndpointAddress ( ) ; byte addressType = 0 ; byte [ ] host = null ; if ( adr != null && ! adr . isUnresolved ( ) ) { if ( adr . getAddress ( ) instanceof Inet6Address ) { len += 16 ; addressType = SocksProxyConstants . IPV6_ADDRESS_TYPE ; } else if ( adr . getAddress ( ) instanceof Inet4Address ) { len += 4 ; addressType = SocksProxyConstants . IPV4_ADDRESS_TYPE ; } } else { host = request . getHost ( ) != null ? request . getHost ( ) . getBytes ( "ASCII" ) : null ; if ( host != null ) { len += 1 + host . length ; addressType = SocksProxyConstants . DOMAIN_NAME_ADDRESS_TYPE ; } else { throw new IllegalArgumentException ( "SocksProxyRequest object " + "has no suitable endpoint information" ) ; } } IoBuffer buf = IoBuffer . allocate ( len ) ; buf . put ( request . getProtocolVersion ( ) ) ; buf . put ( request . getCommandCode ( ) ) ; buf . put ( ( byte ) 0x00 ) ; // Reserved buf . put ( addressType ) ; if ( host == null ) { buf . put ( request . getIpAddress ( ) ) ; } else { buf . put ( ( byte ) host . length ) ; buf . put ( host ) ; } buf . put ( request . getPort ( ) ) ; return buf ;
public class TermFrequencyCounter { /** * 取前N个高频词 * @ param N * @ return */ public Collection < TermFrequency > top ( int N ) { } }
MaxHeap < TermFrequency > heap = new MaxHeap < TermFrequency > ( N , new Comparator < TermFrequency > ( ) { @ Override public int compare ( TermFrequency o1 , TermFrequency o2 ) { return o1 . compareTo ( o2 ) ; } } ) ; heap . addAll ( termFrequencyMap . values ( ) ) ; return heap . toList ( ) ;
public class RebuildWorkspacesRequest { /** * The WorkSpace to rebuild . You can specify a single WorkSpace . * @ return The WorkSpace to rebuild . You can specify a single WorkSpace . */ public java . util . List < RebuildRequest > getRebuildWorkspaceRequests ( ) { } }
if ( rebuildWorkspaceRequests == null ) { rebuildWorkspaceRequests = new com . amazonaws . internal . SdkInternalList < RebuildRequest > ( ) ; } return rebuildWorkspaceRequests ;
public class JBBPUtils { /** * Convert array of JBBP fields into a list . * @ param fields an array of fields , must not be null * @ return a list of JBBP fields */ public static List < JBBPAbstractField > fieldsAsList ( final JBBPAbstractField ... fields ) { } }
final List < JBBPAbstractField > result = new ArrayList < > ( ) ; Collections . addAll ( result , fields ) ; return result ;
public class FieldParser { /** * Gets the parser for the type specified by the given class . Returns null , if no parser for that class * is known . * @ param type The class of the type to get the parser for . * @ return The parser for the given type , or null , if no such parser exists . */ public static < T > Class < FieldParser < T > > getParserForType ( Class < T > type ) { } }
Class < ? extends FieldParser < ? > > parser = PARSERS . get ( type ) ; if ( parser == null ) { return null ; } else { @ SuppressWarnings ( "unchecked" ) Class < FieldParser < T > > typedParser = ( Class < FieldParser < T > > ) parser ; return typedParser ; }
public class Host { /** * Parse the hostname from a " hostname : port " formatted string * @ param hostAndPort * @ return */ public static String parseHostFromHostAndPort ( String hostAndPort ) { } }
return hostAndPort . lastIndexOf ( ':' ) > 0 ? hostAndPort . substring ( 0 , hostAndPort . lastIndexOf ( ':' ) ) : hostAndPort ;
public class PennTokenizer { /** * Tokenizes according to the Penn Treebank conventions . * @ param str the str * @ return the string */ public static String tokenize ( String str ) { } }
str = str . replaceAll ( "``" , " `` " ) ; str = str . replaceAll ( "''" , " '' " ) ; str = str . replaceAll ( "\"" , " \" " ) ; str = str . replaceAll ( "([?!\";#$&])" , " $1 " ) ; str = str . replaceAll ( "\\.\\.\\." , " ... " ) ; str = str . replaceAll ( "([^.])([.])([\\])}>\"']*)\\s*$" , "$1 $2$3 " ) ; str = str . replaceAll ( "([\\[\\](){}<>])" , " $1 " ) ; str = str . replaceAll ( "--" , " -- " ) ; str = str . replaceAll ( "$" , " " ) ; str = str . replaceAll ( "^" , " " ) ; // str = str . replaceAll ( " \ " " , " ' ' " ) ; str = str . replaceAll ( "([^'])' " , "$1 ' " ) ; str = str . replaceAll ( "'([sSmMdD]) " , " '$1 " ) ; str = str . replaceAll ( "'ll " , " 'll " ) ; str = str . replaceAll ( "'re " , " 're " ) ; str = str . replaceAll ( "'ve " , " 've " ) ; str = str . replaceAll ( "n't " , " n't " ) ; str = str . replaceAll ( "'LL " , " 'LL " ) ; str = str . replaceAll ( "'RE " , " 'RE " ) ; str = str . replaceAll ( "'VE " , " 'VE " ) ; str = str . replaceAll ( "N'T " , " N'T " ) ; str = str . replaceAll ( " ([Cc])annot " , " $1an not " ) ; str = str . replaceAll ( " ([Dd])'ye " , " $1' ye " ) ; str = str . replaceAll ( " ([Gg])imme " , " $1im me " ) ; str = str . replaceAll ( " ([Gg])onna " , " $1on na " ) ; str = str . replaceAll ( " ([Gg])otta " , " $1ot ta " ) ; str = str . replaceAll ( " ([Ll])emme " , " $1em me " ) ; str = str . replaceAll ( " ([Mm])ore'n " , " $1ore 'n " ) ; str = str . replaceAll ( " '([Tt])is " , " $1 is " ) ; str = str . replaceAll ( " '([Tt])was " , " $1 was " ) ; str = str . replaceAll ( " ([Ww])anna " , " $1an na " ) ; // " Nicole I . Kidman " gets tokenized as " Nicole I . Kidman " str = str . replaceAll ( " ([A-Z])\\. " , " $1 . " ) ; // written by TuNC from here str = str . replaceAll ( ",([^0-9])" , ", $1" ) ; str = str . replaceAll ( "'([^'])" , "' $1" ) ; str = str . replaceAll ( "([^\\xBB])(\\xBB)" , "$1 $2" ) ; str = str . replaceAll ( "(\\u201C)([^'])" , "$1 $2" ) ; str = str . replaceAll ( "([^'])(\\u201D)" , "$1 $2" ) ; str = str . replaceAll ( "\\,([^0-9])" , "\\, $1" ) ; str = str . replaceAll ( "([^\\s]),([\\s])" , "$1 , $2" ) ; // abc , < blank > - > abc , str = str . replaceAll ( "([^\\s:/0-9])/([^\\s:/0-9])" , "$1 / $2" ) ; // exception : url http : / / . . . , date - time : 12/3/98 str = str . replaceAll ( "([^\\s0-9]+)-" , " $1 -" ) ; // abc - xyz - > abc - xyz ; exception 12-3 ( date - time ) str = str . replaceAll ( "-([^\\s0-9]+)" , "- $1" ) ; str = str . replaceAll ( "([^\\s]):([\\s])" , "$1 : $2" ) ; // abc : < blank > - > abc : str = str . replaceAll ( "([^\\s]):([^0-9]+)" , "$1 : $2" ) ; // abc : xyz - - > abc : xyz ; exception : 12:03 str = str . replaceAll ( "([^0-9]+):([^\\s])" , "$1 : $2" ) ; str = str . replaceAll ( " -([^\\s]+)" , " - $1" ) ; str = str . replaceAll ( "|" , "" ) ; str = str . replaceAll ( "[\u2026\u201C\u201D]" , "" ) ; str = str . replaceAll ( "([^\\p{L}0-9\\.\\,:\\-/])" , " $1 " ) ; // tokenize all unknown characters str = str . replaceAll ( "[ \t]+" , " " ) ; str = str . replaceAll ( "^\\s+" , "" ) ; str = str . replaceAll ( "\\. \\.\\." , " ... " ) ; str = str . trim ( ) ; return str ;
public class IOUtil { /** * Internal copy file method . * @ param srcFile * the validated source file , must not be { @ code null } * @ param destFile * the validated destination file , must not be { @ code null } * @ param preserveFileDate * whether to preserve the file date */ private static void doCopyFile ( final File srcFile , final File destFile , final boolean preserveFileDate ) { } }
if ( destFile . exists ( ) ) { throw new IllegalArgumentException ( "The destination file already existed: " + destFile . getAbsolutePath ( ) ) ; } FileInputStream fis = null ; FileOutputStream fos = null ; FileChannel input = null ; FileChannel output = null ; try { fis = new FileInputStream ( srcFile ) ; fos = new FileOutputStream ( destFile ) ; input = fis . getChannel ( ) ; output = fos . getChannel ( ) ; long size = input . size ( ) ; long pos = 0 ; long count = 0 ; while ( pos < size ) { count = ( ( size - pos ) > FILE_COPY_BUFFER_SIZE ) ? FILE_COPY_BUFFER_SIZE : ( size - pos ) ; pos += output . transferFrom ( input , pos , count ) ; } } catch ( IOException e ) { throw new UncheckedIOException ( e ) ; } finally { close ( output ) ; close ( fos ) ; close ( input ) ; close ( fis ) ; } if ( srcFile . length ( ) != destFile . length ( ) ) { deleteAllIfExists ( destFile ) ; throw new UncheckedIOException ( new IOException ( "Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'" ) ) ; } if ( preserveFileDate ) { destFile . setLastModified ( srcFile . lastModified ( ) ) ; }
public class Downloader { /** * 下载文件 * @ param downloadURL 下载的URL * @ return 是否下载成功 */ @ SuppressWarnings ( "ResultOfMethodCallIgnored" ) public static boolean download ( String downloadURL ) { } }
if ( Checker . isHyperLink ( downloadURL ) && checkDownloadPath ( ) ) { logger . info ( "ready for download url: " + downloadURL + " storage in " + storageFolder ) ; } else { logger . info ( "url or storage path are invalidated, can't download" ) ; return false ; } int byteRead ; String log = "download success from url '" + downloadURL + "' to local '" ; try { String fileName = checkPath ( storageFolder + ValueConsts . SEPARATOR + Formatter . getFileName ( downloadURL ) ) ; String tmp = fileName + ".tmp" ; File file = new File ( tmp ) ; log += file . getAbsolutePath ( ) + "'" ; URL url = new URL ( downloadURL ) ; HttpURLConnection conn = ( HttpURLConnection ) url . openConnection ( ) ; InputStream inStream = NetUtils . getInputStreamOfConnection ( conn ) ; if ( conn . getResponseCode ( ) != ValueConsts . RESPONSE_OK || conn . getContentLength ( ) <= 0 ) { return false ; } FileOutputStream fs = new FileOutputStream ( file ) ; if ( ! file . exists ( ) ) { file . createNewFile ( ) ; } byte [ ] buffer = new byte [ 1024 ] ; while ( ( byteRead = inStream . read ( buffer ) ) != - 1 ) { fs . write ( buffer , 0 , byteRead ) ; } fs . flush ( ) ; inStream . close ( ) ; fs . close ( ) ; file . renameTo ( new File ( fileName ) ) ; logger . info ( log ) ; return true ; } catch ( IOException e ) { log = log . replace ( "success" , "error" ) + ", message: " + e . getMessage ( ) ; logger . error ( log ) ; return false ; }
public class Instagram4j { /** * / * TAGS ENDPOINTS */ @ Override public InstagramSingleObjectResponse < InstagramTags > getTagsCountByName ( String accessToken , String tagName ) throws InstagramError { } }
return instagramEndpoints . getTagsCountByName ( accessToken , tagName ) ;
public class Error { /** * Thrown if the class haven ' t an empty constructor . * @ param aClass class to analyze */ public static void emptyConstructorAbsent ( Class < ? > aClass ) { } }
throw new MalformedBeanException ( MSG . INSTANCE . message ( malformedBeanException1 , aClass . getSimpleName ( ) ) ) ;
public class IsomorphicGraphCounter { /** * Fill in */ public void addInitial ( G g ) { } }
Pair < Integer > orderAndSize = new Pair < Integer > ( g . order ( ) , g . size ( ) ) ; Map < G , Integer > graphs = orderAndSizeToGraphs . get ( orderAndSize ) ; if ( graphs == null ) { graphs = new HashMap < G , Integer > ( ) ; orderAndSizeToGraphs . put ( orderAndSize , graphs ) ; graphs . put ( g , 0 ) ; } else { for ( Map . Entry < G , Integer > e : graphs . entrySet ( ) ) { if ( isoTest . areIsomorphic ( g , e . getKey ( ) ) ) return ; } graphs . put ( g , 0 ) ; }
public class Category { /** * This internal method is used as a callback for when the translation * service or its locale changes . Also applies the translation to all * contained sections . * @ see com . dlsc . formsfx . model . structure . Group : : translate */ public void translate ( TranslationService translationService ) { } }
if ( translationService == null ) { description . setValue ( descriptionKey . getValue ( ) ) ; return ; } if ( ! Strings . isNullOrEmpty ( descriptionKey . get ( ) ) ) { description . setValue ( translationService . translate ( descriptionKey . get ( ) ) ) ; }
public class Right { /** * Supports column level rights */ boolean canSelect ( Table table , boolean [ ] columnCheckList ) { } }
if ( isFull || isFullSelect ) { return true ; } return containsAllColumns ( selectColumnSet , table , columnCheckList ) ;
public class VersionsImpl { /** * Gets the application versions info . * @ param appId The application ID . * @ param listOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the List & lt ; VersionInfo & gt ; object */ public Observable < List < VersionInfo > > listAsync ( UUID appId , ListVersionsOptionalParameter listOptionalParameter ) { } }
return listWithServiceResponseAsync ( appId , listOptionalParameter ) . map ( new Func1 < ServiceResponse < List < VersionInfo > > , List < VersionInfo > > ( ) { @ Override public List < VersionInfo > call ( ServiceResponse < List < VersionInfo > > response ) { return response . body ( ) ; } } ) ;
public class TypeToken { /** * 判断Type是否能确定最终的class , 是则返回true , 存在通配符或者不确定类型则返回false 。 * 例如 : Map & # 60 ; String , String & # 62 ; 返回 ture ; Map & # 60 ; ? extends Serializable , String & # 62 ; 返回false ; * @ param type Type对象 * @ return 是否可反解析 */ public final static boolean isClassType ( final Type type ) { } }
if ( type instanceof Class ) return true ; if ( type instanceof WildcardType ) return false ; if ( type instanceof TypeVariable ) return false ; if ( type instanceof GenericArrayType ) return isClassType ( ( ( GenericArrayType ) type ) . getGenericComponentType ( ) ) ; if ( ! ( type instanceof ParameterizedType ) ) return false ; // 只能是null了 final ParameterizedType ptype = ( ParameterizedType ) type ; if ( ptype . getOwnerType ( ) != null && ! isClassType ( ptype . getOwnerType ( ) ) ) return false ; if ( ! isClassType ( ptype . getRawType ( ) ) ) return false ; for ( Type t : ptype . getActualTypeArguments ( ) ) { if ( ! isClassType ( t ) ) return false ; } return true ;