signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class DubiousMapCollection { /** * parses all the parameters of a called method and removes any of the parameters that are maps currently being looked at for this detector */
private void processMethodCall ( ) { } } | int numParams = SignatureUtils . getNumParameters ( getSigConstantOperand ( ) ) ; int depth = stack . getStackDepth ( ) ; for ( int i = 0 ; i < numParams ; i ++ ) { if ( depth > i ) { OpcodeStack . Item item = stack . getStackItem ( i ) ; XField xf = item . getXField ( ) ; if ( xf != null ) { removeField ( item ) ; } } else { return ; } } |
public class ClusteringFeature { /** * Calculates the k - means costs of the ClusteringFeature too a center .
* @ param center
* the center too calculate the costs
* @ return the costs */
public double calcKMeansCosts ( double [ ] center ) { } } | assert ( this . sumPoints . length == center . length ) ; return this . sumSquaredLength - 2 * Metric . dotProduct ( this . sumPoints , center ) + this . numPoints * Metric . dotProduct ( center ) ; |
public class ProfileOption { /** * Sets the profile version or version range . Do not set ( use this method ) if the latest version should be
* discovered and used )
* @ param version artifact version / version range ( cannot be empty )
* @ return itself , for fluent api usage
* @ throws IllegalArgumentException - If version is empty */
public ProfileOption version ( final String version ) { } } | if ( version != null ) { validateNotEmpty ( version , true , "Version" ) ; } m_version = version ; return this ; |
public class WebSiteManagementClientImpl { /** * Gets the source controls available for Azure websites .
* Gets the source controls available for Azure websites .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; SourceControlInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < SourceControlInner > > > listSourceControlsSinglePageAsync ( ) { } } | if ( this . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.apiVersion() is required and cannot be null." ) ; } return service . listSourceControls ( this . apiVersion ( ) , this . acceptLanguage ( ) , this . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < SourceControlInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SourceControlInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < SourceControlInner > > result = listSourceControlsDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < SourceControlInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class TypeMappings { /** * Get the output unique group ID mapping for the UserRegistry .
* @ param inputVirtualRealm Virtual realm to find the mappings .
* @ return The output unique group ID property .
* @ pre inputVirtualRealm ! = null
* @ pre inputVirtualRealm ! = " "
* @ post $ return ! = " "
* @ post $ return ! = null */
public String getOutputUniqueGroupId ( String inputVirtualRealm ) { } } | // initialize the return value
String returnValue = getOutputMapping ( inputVirtualRealm , Service . CONFIG_DO_UNIQUE_GROUP_ID_MAPPING , OUTPUT_UNIQUE_GROUP_ID_DEFAULT ) ; return returnValue ; |
public class MainFrame { /** * GEN - LAST : event _ menuAboutActionPerformed */
private void menuOpenProjectActionPerformed ( java . awt . event . ActionEvent evt ) { } } | // GEN - FIRST : event _ menuOpenProjectActionPerformed
final JFileChooser fileChooser = new JFileChooser ( ) ; fileChooser . setFileView ( new FileView ( ) { private Icon KNOWLEDGE_FOLDER_ICO = null ; private Icon OTHER_FOLDER_ICO = null ; @ Override public Icon getIcon ( final File f ) { final Icon result ; if ( f . isDirectory ( ) ) { final File knowledge = new File ( f , Context . KNOWLEDGE_FOLDER ) ; if ( knowledge . isDirectory ( ) ) { if ( KNOWLEDGE_FOLDER_ICO == null ) { Icon superIcon = super . getIcon ( f ) ; if ( superIcon == null || superIcon instanceof ImageIcon ) { superIcon = superIcon == null ? UIManager . getIcon ( "FileView.directoryIcon" ) : superIcon ; KNOWLEDGE_FOLDER_ICO = new ImageIcon ( UiUtils . makeBadgedRightBottom ( UiUtils . iconToImage ( fileChooser , superIcon ) , Icons . MMDBADGE . getIcon ( ) . getImage ( ) ) ) ; result = KNOWLEDGE_FOLDER_ICO ; } else { result = superIcon ; } } else { result = KNOWLEDGE_FOLDER_ICO ; } } else { if ( OTHER_FOLDER_ICO == null ) { Icon superIcon = super . getIcon ( f ) ; if ( superIcon == null || superIcon instanceof ImageIcon ) { OTHER_FOLDER_ICO = superIcon == null ? UIManager . getIcon ( "FileView.directoryIcon" ) : superIcon ; result = OTHER_FOLDER_ICO ; } else { result = superIcon ; } } else { result = OTHER_FOLDER_ICO ; } } return result ; } else if ( f . isFile ( ) && f . getName ( ) . toLowerCase ( Locale . ENGLISH ) . endsWith ( ".mmd" ) ) { // NOI18N
return Icons . DOCUMENT . getIcon ( ) ; } else { return super . getIcon ( f ) ; } } } ) ; fileChooser . setFileSelectionMode ( JFileChooser . DIRECTORIES_ONLY ) ; fileChooser . setMultiSelectionEnabled ( false ) ; fileChooser . setDialogTitle ( "Open project folder" ) ; if ( fileChooser . showOpenDialog ( Main . getApplicationFrame ( ) ) == JFileChooser . APPROVE_OPTION ) { final File choosenFile = fileChooser . getSelectedFile ( ) ; if ( ! focusInTree ( choosenFile ) ) { openProject ( fileChooser . getSelectedFile ( ) , false ) ; } } |
public class AWSAppSyncClient { /** * Lists the data sources for a given API .
* @ param listDataSourcesRequest
* @ return Result of the ListDataSources operation returned by the service .
* @ throws BadRequestException
* The request is not well formed . For example , a value is invalid or a required field is missing . Check the
* field values , and then try again .
* @ throws NotFoundException
* The resource specified in the request was not found . Check the resource , and then try again .
* @ throws UnauthorizedException
* You are not authorized to perform this operation .
* @ throws InternalFailureException
* An internal AWS AppSync error occurred . Try your request again .
* @ sample AWSAppSync . ListDataSources
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / appsync - 2017-07-25 / ListDataSources " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListDataSourcesResult listDataSources ( ListDataSourcesRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListDataSources ( request ) ; |
public class S16 { /** * Compress an integer array using Simple16
* @ param in
* array to compress
* @ param currentPos
* where to start reading
* @ param inlength
* how many integers to read
* @ param out
* output array
* @ param tmpoutpos
* location in the output array
* @ return the number of 32 - bit words written ( in compressed form ) */
public static int compress ( final int [ ] in , int currentPos , int inlength , final int out [ ] , final int tmpoutpos ) { } } | int outpos = tmpoutpos ; final int finalin = currentPos + inlength ; while ( currentPos < finalin ) { int inoffset = compressblock ( out , outpos ++ , in , currentPos , inlength ) ; if ( inoffset == - 1 ) throw new RuntimeException ( "Too big a number" ) ; currentPos += inoffset ; inlength -= inoffset ; } return outpos - tmpoutpos ; |
public class PropertiesReader { /** * Reads an integer property .
* @ param property The property name .
* @ return The property value .
* @ throws ConfigurationException if the property is not present */
public int getInteger ( String property ) { } } | return getProperty ( property , value -> { try { return Integer . valueOf ( value ) ; } catch ( NumberFormatException e ) { throw new ConfigurationException ( "malformed property value: " + property + " must be an integer" ) ; } } ) ; |
public class BootstrapDiscoveryBuilder { /** * Sets the bootstrap nodes .
* @ param nodes the bootstrap nodes
* @ return the location provider builder */
public BootstrapDiscoveryBuilder withNodes ( Address ... nodes ) { } } | return withNodes ( Stream . of ( nodes ) . map ( address -> Node . builder ( ) . withAddress ( address ) . build ( ) ) . collect ( Collectors . toSet ( ) ) ) ; |
public class MapRFileSystem { /** * Retrieves the CLDB locations for the given MapR cluster name .
* @ param authority
* the name of the MapR cluster
* @ return a list of CLDB locations
* @ throws IOException
* thrown if the CLDB locations for the given MapR cluster name
* cannot be determined */
private static String [ ] getCLDBLocations ( String authority ) throws IOException { } } | // Determine the MapR home
String maprHome = System . getenv ( MAPR_HOME_ENV ) ; if ( maprHome == null ) { maprHome = DEFAULT_MAPR_HOME ; } final File maprClusterConf = new File ( maprHome , MAPR_CLUSTER_CONF_FILE ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( String . format ( "Trying to retrieve MapR cluster configuration from %s" , maprClusterConf ) ) ; } if ( ! maprClusterConf . exists ( ) ) { throw new IOException ( "Could not find CLDB configuration '" + maprClusterConf . getAbsolutePath ( ) + "', assuming MapR home is '" + maprHome + "'." ) ; } // Read the cluster configuration file , format is specified at
// http : / / doc . mapr . com / display / MapR / mapr - clusters . conf
try ( BufferedReader br = new BufferedReader ( new FileReader ( maprClusterConf ) ) ) { String line ; while ( ( line = br . readLine ( ) ) != null ) { // Normalize the string
line = line . trim ( ) ; line = line . replace ( '\t' , ' ' ) ; final String [ ] fields = line . split ( " " ) ; if ( fields . length < 1 ) { continue ; } final String clusterName = fields [ 0 ] ; if ( ! clusterName . equals ( authority ) ) { continue ; } final List < String > cldbLocations = new ArrayList < > ( ) ; for ( int i = 1 ; i < fields . length ; ++ i ) { // Make sure this is not a key - value pair MapR recently
// introduced in the file format along with their security
// features .
if ( ! fields [ i ] . isEmpty ( ) && ! fields [ i ] . contains ( "=" ) ) { cldbLocations . add ( fields [ i ] ) ; } } if ( cldbLocations . isEmpty ( ) ) { throw new IOException ( String . format ( "%s contains entry for cluster %s but no CLDB locations." , maprClusterConf , authority ) ) ; } return cldbLocations . toArray ( new String [ cldbLocations . size ( ) ] ) ; } } throw new IOException ( String . format ( "Unable to find CLDB locations for cluster %s" , authority ) ) ; |
public class GitlabAPI { /** * Delete a deploy key for a project
* @ param targetProjectId The id of the Gitlab project
* @ param targetKeyId The id of the Gitlab ssh key
* @ throws IOException on gitlab api call error */
public void deleteDeployKey ( Integer targetProjectId , Integer targetKeyId ) throws IOException { } } | String tailUrl = GitlabProject . URL + "/" + targetProjectId + GitlabSSHKey . DEPLOY_KEYS_URL + "/" + targetKeyId ; retrieve ( ) . method ( DELETE ) . to ( tailUrl , Void . class ) ; |
public class JsonValidationContext { /** * Adds the specified state objects to this validation context . Each state object will be
* identified by its concrete class ( retrieved with < tt > getClass < / tt > ) and can be retrieved with
* { @ link # getState ( java . lang . Class ) } .
* @ param states the state objects to register
* @ return this context
* @ throws IllegalArgumentException if a state is already registered for a class of one of the
* specified states ( or there are duplicates ) */
public JsonValidationContext addStates ( Object ... states ) throws IllegalArgumentException { } } | for ( Object state : states ) { addState ( state , state . getClass ( ) ) ; } return this ; |
public class LCCore { /** * Because some systems may need to use the main thread for specific action ( like Cocoa ) ,
* we keep the current thread aside , and continue on a new thread .
* @ param toContinue the Runnable to run on a new Thread to continue the application startup */
public static void keepMainThread ( Runnable toContinue ) { } } | mainThread = Thread . currentThread ( ) ; Thread thread = new Thread ( toContinue , "LC Core - Main" ) ; thread . start ( ) ; mainThreadLoop ( ) ; |
public class ListResourceRecordSetsResult { /** * Information about multiple resource record sets .
* @ param resourceRecordSets
* Information about multiple resource record sets . */
public void setResourceRecordSets ( java . util . Collection < ResourceRecordSet > resourceRecordSets ) { } } | if ( resourceRecordSets == null ) { this . resourceRecordSets = null ; return ; } this . resourceRecordSets = new com . amazonaws . internal . SdkInternalList < ResourceRecordSet > ( resourceRecordSets ) ; |
public class ReplicatedTree { /** * Returns all children of a given node .
* @ param fqn The fully qualified name of the node
* @ return A list of child names ( as Strings ) */
public List < String > getChildren ( String fqn ) { } } | final Node n = findNode ( fqn ) ; if ( n == null ) return null ; final Set < String > names = n . getChildrenNames ( ) ; return new ArrayList < String > ( names ) ; |
public class DiagnosticImpl { /** * { @ inheritDoc } */
@ Override public String getDescription ( ) { } } | // We need to change references to input fields to their label or accessible text .
Object [ ] modifiedArgs = new Object [ args . length ] ; for ( int i = 0 ; i < args . length ; i ++ ) { if ( args [ i ] instanceof Input ) { Input input = ( Input ) args [ i ] ; String text = null ; UIContextHolder . pushContext ( uic ) ; try { if ( input . getLabel ( ) != null ) { text = input . getLabel ( ) . getText ( ) ; // Some apps use colons at the end of labels . We trim these off automatically
if ( ! Util . empty ( text ) && text . charAt ( text . length ( ) - 1 ) == ':' ) { text = text . substring ( 0 , text . length ( ) - 1 ) ; } } if ( text == null ) { text = input . getAccessibleText ( ) ; } if ( text == null ) { text = input . getToolTip ( ) ; } } finally { UIContextHolder . popContext ( ) ; } modifiedArgs [ i ] = text == null ? "" : text ; } else { modifiedArgs [ i ] = args [ i ] ; } } return I18nUtilities . format ( null , message , modifiedArgs ) ; |
public class DateUtils { /** * < p > Gets a date ceiling , leaving the field specified as the most
* significant field . < / p >
* < p > For example , if you had the date - time of 28 Mar 2002
* 13:45:01.231 , if you passed with HOUR , it would return 28 Mar
* 2002 14:00:00.000 . If this was passed with MONTH , it would
* return 1 Apr 2002 0:00:00.000 . < / p >
* @ param date the date to work with , either { @ code Date } or { @ code Calendar } , not null
* @ param field the field from { @ code Calendar } or < code > SEMI _ MONTH < / code >
* @ return the different ceil date , not null
* @ throws IllegalArgumentException if the date is < code > null < / code >
* @ throws ClassCastException if the object type is not a { @ code Date } or { @ code Calendar }
* @ throws ArithmeticException if the year is over 280 million
* @ since 2.5 */
public static Date ceiling ( final Object date , final int field ) { } } | if ( date == null ) { throw new IllegalArgumentException ( "The date must not be null" ) ; } if ( date instanceof Date ) { return ceiling ( ( Date ) date , field ) ; } else if ( date instanceof Calendar ) { return ceiling ( ( Calendar ) date , field ) . getTime ( ) ; } else { throw new ClassCastException ( "Could not find ceiling of for type: " + date . getClass ( ) ) ; } |
public class ns_ssl_certkey_policy { /** * < pre >
* Use this operation to set the polling frequency of the NetScaler SSL certificates .
* < / pre > */
public static ns_ssl_certkey_policy update ( nitro_service client , ns_ssl_certkey_policy resource ) throws Exception { } } | resource . validate ( "modify" ) ; return ( ( ns_ssl_certkey_policy [ ] ) resource . update_resource ( client ) ) [ 0 ] ; |
public class RepresentationModel { /** * Adds all given { @ link Link } s to the resource .
* @ param links must not be { @ literal null } . */
@ SuppressWarnings ( "unchecked" ) public T add ( Link ... links ) { } } | Assert . notNull ( links , "Given links must not be null!" ) ; add ( Arrays . asList ( links ) ) ; return ( T ) this ; |
public class Utils { /** * 获取excel列表头
* @ param titleRow excel行
* @ param clz 类型
* @ return ExcelHeader集合
* @ throws Excel4JException 异常 */
public static Map < Integer , ExcelHeader > getHeaderMap ( Row titleRow , Class < ? > clz ) throws Excel4JException { } } | List < ExcelHeader > headers = getHeaderList ( clz ) ; Map < Integer , ExcelHeader > maps = new HashMap < > ( ) ; for ( Cell c : titleRow ) { String title = c . getStringCellValue ( ) ; for ( ExcelHeader eh : headers ) { if ( eh . getTitle ( ) . equals ( title . trim ( ) ) ) { maps . put ( c . getColumnIndex ( ) , eh ) ; break ; } } } return maps ; |
public class AVLGroupTree { /** * Update values associated with a node , readjusting the tree if necessary . */
@ SuppressWarnings ( "WeakerAccess" ) public void update ( int node , double centroid , int count , List < Double > data , boolean forceInPlace ) { } } | if ( centroid == centroids [ node ] || forceInPlace ) { // we prefer to update in place so repeated values don ' t shuffle around and for merging
centroids [ node ] = centroid ; counts [ node ] = count ; if ( datas != null ) { datas [ node ] = data ; } } else { // have to do full scale update
this . centroid = centroid ; this . count = count ; this . data = data ; tree . update ( node ) ; } |
public class ContractsApi { /** * Get corporation contracts Returns contracts available to a corporation ,
* only if the corporation is issuer , acceptor or assignee . Only returns
* contracts no older than 30 days , or if the status is
* \ & quot ; in _ progress \ & quot ; . - - - This route is cached for up to 300 seconds
* @ param corporationId
* An EVE corporation ID ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param page
* Which page of results to return ( optional , default to 1)
* @ param token
* Access token to use if unable to set a header ( optional )
* @ return ApiResponse & lt ; List & lt ; CorporationContractsResponse & gt ; & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public ApiResponse < List < CorporationContractsResponse > > getCorporationsCorporationIdContractsWithHttpInfo ( Integer corporationId , String datasource , String ifNoneMatch , Integer page , String token ) throws ApiException { } } | com . squareup . okhttp . Call call = getCorporationsCorporationIdContractsValidateBeforeCall ( corporationId , datasource , ifNoneMatch , page , token , null ) ; Type localVarReturnType = new TypeToken < List < CorporationContractsResponse > > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class nsacl6 { /** * Use this API to disable nsacl6 resources of given names . */
public static base_responses disable ( nitro_service client , String acl6name [ ] ) throws Exception { } } | base_responses result = null ; if ( acl6name != null && acl6name . length > 0 ) { nsacl6 disableresources [ ] = new nsacl6 [ acl6name . length ] ; for ( int i = 0 ; i < acl6name . length ; i ++ ) { disableresources [ i ] = new nsacl6 ( ) ; disableresources [ i ] . acl6name = acl6name [ i ] ; } result = perform_operation_bulk_request ( client , disableresources , "disable" ) ; } return result ; |
public class ApiOvhStore { /** * Create a ' marketplace ' contact for current nic
* REST : POST / store / contact
* @ param title [ required ] Title
* @ param firstname [ required ] First name
* @ param lastname [ required ] Last name
* @ param email [ required ] Email address
* @ param street [ required ] Street address
* @ param country [ required ] Country
* @ param zip [ required ] Zipcode
* @ param province [ required ] Province name
* @ param city [ required ] City
* @ param phone [ required ] Phone number
* API beta */
public OvhContact contact_POST ( String city , String country , String email , String firstname , String lastname , String phone , String province , String street , String title , String zip ) throws IOException { } } | String qPath = "/store/contact" ; StringBuilder sb = path ( qPath ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "city" , city ) ; addBody ( o , "country" , country ) ; addBody ( o , "email" , email ) ; addBody ( o , "firstname" , firstname ) ; addBody ( o , "lastname" , lastname ) ; addBody ( o , "phone" , phone ) ; addBody ( o , "province" , province ) ; addBody ( o , "street" , street ) ; addBody ( o , "title" , title ) ; addBody ( o , "zip" , zip ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhContact . class ) ; |
public class SerializationObjectPool { /** * Returns a serialization object back into the pool .
* @ param object an instance previously allocated with { @ link # getSerializationObject ( ) } . */
public void returnSerializationObject ( SerializationObject object ) { } } | synchronized ( ivListOfObjects ) { if ( ivListOfObjects . size ( ) < MAXIMUM_NUM_OF_OBJECTS ) { ivListOfObjects . add ( object ) ; } } |
public class JsonOutput { /** * Writes a JSON double .
* This outputs the values of NaN , and Infinity as strings .
* @ param value the value
* @ throws IOException if an error occurs */
void writeDouble ( double value ) throws IOException { } } | if ( Double . isNaN ( value ) || Double . isInfinite ( value ) ) { output . append ( '"' ) . append ( Double . toString ( value ) ) . append ( '"' ) ; } else { output . append ( Double . toString ( value ) ) ; } |
public class BiMapJsonDeserializer { /** * @ param keyDeserializer { @ link KeyDeserializer } used to deserialize the keys .
* @ param valueDeserializer { @ link JsonDeserializer } used to deserialize the values .
* @ param < K > Type of the keys inside the { @ link BiMap }
* @ param < V > Type of the values inside the { @ link BiMap }
* @ return a new instance of { @ link BiMapJsonDeserializer } */
public static < K , V > BiMapJsonDeserializer < K , V > newInstance ( KeyDeserializer < K > keyDeserializer , JsonDeserializer < V > valueDeserializer ) { } } | return new BiMapJsonDeserializer < K , V > ( keyDeserializer , valueDeserializer ) ; |
public class FeaturesInner { /** * Registers the preview feature for the subscription .
* @ param resourceProviderNamespace The namespace of the resource provider .
* @ param featureName The name of the feature to register .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < FeatureResultInner > registerAsync ( String resourceProviderNamespace , String featureName , final ServiceCallback < FeatureResultInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( registerWithServiceResponseAsync ( resourceProviderNamespace , featureName ) , serviceCallback ) ; |
public class AmazonDaxClient { /** * Returns a list of parameter group descriptions . If a parameter group name is specified , the list will contain
* only the descriptions for that group .
* @ param describeParameterGroupsRequest
* @ return Result of the DescribeParameterGroups operation returned by the service .
* @ throws ParameterGroupNotFoundException
* The specified parameter group does not exist .
* @ throws ServiceLinkedRoleNotFoundException
* @ throws InvalidParameterValueException
* The value for a parameter is invalid .
* @ throws InvalidParameterCombinationException
* Two or more incompatible parameters were specified .
* @ sample AmazonDax . DescribeParameterGroups
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / dax - 2017-04-19 / DescribeParameterGroups " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public DescribeParameterGroupsResult describeParameterGroups ( DescribeParameterGroupsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeDescribeParameterGroups ( request ) ; |
public class ManagedObject { /** * Get the serialized bytes representing this ManagedObject ,
* these will be given to the logger and potentially to the ObjectStore .
* @ return ObjectManagerByteArrayOutputStream containing the serialized bytes currently
* representing this ManagedObject .
* @ throws ObjectManagerException */
protected ObjectManagerByteArrayOutputStream getSerializedBytes ( ) throws ObjectManagerException { } } | final String methodName = "getSerializedBytes" ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , methodName ) ; // The serialized image of the ManagedObject that will become the commited version .
// The objectStore and log keep their own reference to the bytes so any change must replace
// this buffer with another one and not update it in place .
// These bytes are the ones written to the log , before the transaction outcome is known .
ObjectManagerByteArrayOutputStream byteArrayOutputStream ; long estimatedLength ; try { if ( this instanceof SimplifiedSerialization ) { estimatedLength = estimatedLength ( ) ; byteArrayOutputStream = owningToken . objectStore . getObjectManagerState ( ) . getbyteArrayOutputStreamFromPool ( ( int ) estimatedLength ) ; java . io . DataOutputStream dataOutputStream = new java . io . DataOutputStream ( byteArrayOutputStream ) ; int signature = getSignature ( ) ; dataOutputStream . writeInt ( signature ) ; if ( signature == SimplifiedSerialization . signature_Generic ) { dataOutputStream . writeUTF ( getClass ( ) . getName ( ) ) ; } // if ( signature = = SimplifiedSerialization . signature _ Generic ) .
( ( SimplifiedSerialization ) this ) . writeObject ( dataOutputStream ) ; } else { estimatedLength = 1024 ; byteArrayOutputStream = owningToken . objectStore . getObjectManagerState ( ) . getbyteArrayOutputStreamFromPool ( ( int ) estimatedLength ) ; byteArrayOutputStream . writeInt ( SimplifiedSerialization . signature_DefaultSerialization ) ; java . io . ObjectOutputStream objectOutputStream = new java . io . ObjectOutputStream ( byteArrayOutputStream ) ; objectOutputStream . writeObject ( this ) ; objectOutputStream . close ( ) ; } } catch ( java . io . IOException exception ) { // No FFDC Code Needed .
ObjectManager . ffdc . processException ( this , cclass , methodName , exception , "1:619:1.34" ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , exception ) ; throw new PermanentIOException ( this , exception ) ; } // catch .
reserveSpaceInStore ( byteArrayOutputStream ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , methodName , new Object [ ] { byteArrayOutputStream , new Long ( updateSequence ) , new Integer ( byteArrayOutputStream . size ( ) ) , new Long ( estimatedLength ) } ) ; return byteArrayOutputStream ; |
public class SuggestTree { /** * Returns the weight of the specified suggestion in this tree , or - 1 if the
* tree does not contain the suggestion .
* @ throws NullPointerException if the specified suggestion is { @ code null } */
public int weightOf ( String suggestion ) { } } | Node n = getNode ( suggestion ) ; return ( n != null ) ? n . weight : - 1 ; |
public class ClasspathJSGenerator { /** * ( non - Javadoc )
* @ see
* net . jawr . web . resource . handler . reader . ResourceBrowser # getFilePath ( java .
* lang . String ) */
@ Override public String getFilePath ( String resourcePath ) { } } | return helper . getFilePath ( resolver . getResourcePath ( resourcePath ) ) ; |
public class PrettyPrint { /** * About as clumsy and random as a blaster . . . */
public static String UUID ( long lo , long hi ) { } } | long lo0 = ( lo >> 32 ) & 0xFFFFFFFFL ; long lo1 = ( lo >> 16 ) & 0xFFFFL ; long lo2 = ( lo >> 0 ) & 0xFFFFL ; long hi0 = ( hi >> 48 ) & 0xFFFFL ; long hi1 = ( hi >> 0 ) & 0xFFFFFFFFFFFFL ; return String . format ( "%08X-%04X-%04X-%04X-%012X" , lo0 , lo1 , lo2 , hi0 , hi1 ) ; |
public class AbstractIoBuffer { /** * { @ inheritDoc } */
@ Override public final IoBuffer putDouble ( int index , double value ) { } } | autoExpand ( index , 8 ) ; buf ( ) . putDouble ( index , value ) ; return this ; |
public class FileHelper { /** * Transform an existing file into the target class .
* @ param < T >
* @ param securityContext
* @ param uuid
* @ param fileType
* @ return transformed file
* @ throws FrameworkException
* @ throws IOException */
public static < T extends File > T transformFile ( final SecurityContext securityContext , final String uuid , final Class < T > fileType ) throws FrameworkException , IOException { } } | AbstractFile existingFile = getFileByUuid ( securityContext , uuid ) ; if ( existingFile != null ) { existingFile . unlockSystemPropertiesOnce ( ) ; existingFile . setProperties ( securityContext , new PropertyMap ( AbstractNode . type , fileType == null ? File . class . getSimpleName ( ) : fileType . getSimpleName ( ) ) ) ; existingFile = getFileByUuid ( securityContext , uuid ) ; return ( T ) ( fileType != null ? fileType . cast ( existingFile ) : ( File ) existingFile ) ; } return null ; |
public class PushNotificationPayload { /** * Create a custom alert ( if none exist ) and add a title - loc - key parameter .
* @ param titleLocKey
* @ throws JSONException */
public void addCustomAlertTitleLocKey ( String titleLocKey ) throws JSONException { } } | Object value = titleLocKey != null ? titleLocKey : new JSONNull ( ) ; put ( "title-loc-key" , titleLocKey , getOrAddCustomAlert ( ) , false ) ; |
public class AbstractCreator { /** * Initialize the code builder to create a mapper .
* @ param instance the class to call
* @ return the code builder to create the mapper */
private CodeBlock . Builder initMethodCallCode ( MapperInstance instance ) { } } | CodeBlock . Builder builder = CodeBlock . builder ( ) ; if ( null == instance . getInstanceCreationMethod ( ) . isConstructor ( ) ) { builder . add ( "$T.$L" , rawName ( instance . getMapperType ( ) ) , instance . getInstanceCreationMethod ( ) . getName ( ) ) ; } else { builder . add ( "new $T" , typeName ( instance . getMapperType ( ) ) ) ; } return builder ; |
public class VTimeZone { /** * Check if the DOW rule specified by month , weekInMonth and dayOfWeek is equivalent
* to the DateTimerule . */
private static boolean isEquivalentDateRule ( int month , int weekInMonth , int dayOfWeek , DateTimeRule dtrule ) { } } | if ( month != dtrule . getRuleMonth ( ) || dayOfWeek != dtrule . getRuleDayOfWeek ( ) ) { return false ; } if ( dtrule . getTimeRuleType ( ) != DateTimeRule . WALL_TIME ) { // Do not try to do more intelligent comparison for now .
return false ; } if ( dtrule . getDateRuleType ( ) == DateTimeRule . DOW && dtrule . getRuleWeekInMonth ( ) == weekInMonth ) { return true ; } int ruleDOM = dtrule . getRuleDayOfMonth ( ) ; if ( dtrule . getDateRuleType ( ) == DateTimeRule . DOW_GEQ_DOM ) { if ( ruleDOM % 7 == 1 && ( ruleDOM + 6 ) / 7 == weekInMonth ) { return true ; } if ( month != Calendar . FEBRUARY && ( MONTHLENGTH [ month ] - ruleDOM ) % 7 == 6 && weekInMonth == - 1 * ( ( MONTHLENGTH [ month ] - ruleDOM + 1 ) / 7 ) ) { return true ; } } if ( dtrule . getDateRuleType ( ) == DateTimeRule . DOW_LEQ_DOM ) { if ( ruleDOM % 7 == 0 && ruleDOM / 7 == weekInMonth ) { return true ; } if ( month != Calendar . FEBRUARY && ( MONTHLENGTH [ month ] - ruleDOM ) % 7 == 0 && weekInMonth == - 1 * ( ( MONTHLENGTH [ month ] - ruleDOM ) / 7 + 1 ) ) { return true ; } } return false ; |
import java . util . List ; import javafx . util . Pair ; class ValidateMatching { /** * Function to verify if two lists of tuples are identical .
* Examples :
* validate _ matching ( [ ( 10 , 4 ) , ( 2 , 5 ) ] , [ ( 10 , 4 ) , ( 2 , 5 ) ] ) - > True
* validate _ matching ( [ ( 1 , 2 ) , ( 3 , 7 ) ] , [ ( 12 , 14 ) , ( 12 , 45 ) ] ) - > False
* validate _ matching ( [ ( 2 , 14 ) , ( 12 , 25 ) ] , [ ( 2 , 14 ) , ( 12 , 25 ) ] ) - > True */
public static Boolean validateMatching ( List < Pair < Integer , Integer > > pairList1 , List < Pair < Integer , Integer > > pairList2 ) { } } | boolean result = pairList1 . equals ( pairList2 ) ; return result ; |
public class DatabaseHashMap { /** * PK56991 we are checking if the session table in DB2 is marked as Volatile .
* We are skipping the same check on iSeries and zOS as VOLATILE is only
* compatiable and improve DB2 performance on Linux , Unix and Windows
* platforms ( LUW ) as information provided by Mark Anderson (
* DB2 chief architect on iSeries )
* @ param con
* @ return */
private boolean isTableMarkedVolatile ( Connection con ) { } } | if ( com . ibm . websphere . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . entering ( methodClassName , methodNames [ IS_TABLE_MARKED_VOLATILE ] ) ; } boolean isMarkedVolatile = false ; String tblName = tableName , qualifierName = null , sqlQuery = null ; PreparedStatement ps = null ; ResultSet rs = null ; tblName = tblName . toUpperCase ( ) ; if ( _smc . isUsingCustomSchemaName ( ) ) { // PM27191
qualifierName = qualifierNameWhenCustomSchemaIsSet ; } else if ( dbid != null ) { qualifierName = dbid . toUpperCase ( ) ; } sqlQuery = "select 1 from syscat.tables " + "where TabName = '" + tblName + "' and Volatile = 'C' " ; if ( qualifierName != null ) sqlQuery += " and tabschema = '" + qualifierName + "'" ; sqlQuery += " for read only" ; if ( com . ibm . websphere . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . FINE , methodClassName , methodNames [ CREATE_TABLE ] , "Sql: " + sqlQuery ) ; } try { ps = con . prepareStatement ( sqlQuery ) ; rs = ps . executeQuery ( ) ; if ( rs . next ( ) ) { isMarkedVolatile = true ; } } catch ( Throwable th ) { LoggingUtil . SESSION_LOGGER_WAS . logp ( Level . SEVERE , methodClassName , methodNames [ CREATE_TABLE ] , "CommonMessage.exception" , th ) ; } finally { if ( rs != null ) { closeResultSet ( rs ) ; } if ( ps != null ) { closeStatement ( ps ) ; } } if ( com . ibm . websphere . ras . TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_WAS . isLoggable ( Level . FINE ) ) { LoggingUtil . SESSION_LOGGER_WAS . exiting ( methodClassName , methodNames [ IS_TABLE_MARKED_VOLATILE ] , isMarkedVolatile ) ; } return isMarkedVolatile ; |
public class SingularValueDecomposition { /** * Effective numerical matrix rank
* @ return Number of non - negligible singular values . */
public int rank ( ) { } } | final double eps = 0x1p-52 , tol = ( m > n ? m : n ) * s [ 0 ] * eps ; int r = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] > tol ) { r ++ ; } } return r ; |
public class AuthenticationApi { /** * Perform authorization
* Perform authorization based on the code grant type & amp ; mdash ; either Authorization Code Grant or Implicit Grant . For more information , see [ Authorization Endpoint ] ( https : / / tools . ietf . org / html / rfc6749 # section - 3.1 ) . * * Note : * * For the optional * * scope * * parameter , the Authentication API supports only the & # x60 ; * & # x60 ; value .
* @ param clientId The ID of the application or service that is registered as the client . You & # 39 ; ll need to get this value from your PureEngage Cloud representative . ( required )
* @ param redirectUri The URI that you want users to be redirected to after entering valid credentials during an Implicit or Authorization Code grant . The Authentication API includes this as part of the URI it returns in the & # 39 ; Location & # 39 ; header . ( required )
* @ param responseType The response type to let the Authentication API know which grant flow you & # 39 ; re using . Possible values are & # x60 ; code & # x60 ; for Authorization Code Grant or & # x60 ; token & # x60 ; for Implicit Grant . For more information about this parameter , see [ Response Type ] ( https : / / tools . ietf . org / html / rfc6749 # section - 3.1.1 ) . ( required )
* @ param authorization Basic authorization . For example : & # 39 ; Authorization : Basic Y3 . . . MQ & # x3D ; & # x3D ; & # 39 ; ( optional )
* @ param hideTenant Hide the * * tenant * * field in the UI for Authorization Code Grant . ( optional , default to false )
* @ param scope The scope of the access request . The Authentication API supports only the & # x60 ; * & # x60 ; value . ( optional )
* @ return ApiResponse & lt ; Void & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < Void > authorizeWithHttpInfo ( String clientId , String redirectUri , String responseType , String authorization , Boolean hideTenant , String scope ) throws ApiException { } } | com . squareup . okhttp . Call call = authorizeValidateBeforeCall ( clientId , redirectUri , responseType , authorization , hideTenant , scope , null , null ) ; return apiClient . execute ( call ) ; |
public class NumericShaper { /** * Converts the digits in the text that occur between start and
* start + count , using the provided context .
* Context is ignored if the shaper is not a contextual shaper .
* @ param text an array of characters
* @ param start the index into < code > text < / code > to start
* converting
* @ param count the number of characters in < code > text < / code >
* to convert
* @ param context the context to which to convert the
* characters , such as < code > NumericShaper . EUROPEAN < / code >
* @ throws IndexOutOfBoundsException if start or start + count is
* out of bounds
* @ throws NullPointerException if text is null
* @ throws IllegalArgumentException if this is a contextual shaper
* and the specified < code > context < / code > is not a single valid
* range . */
public void shape ( char [ ] text , int start , int count , int context ) { } } | checkParams ( text , start , count ) ; if ( isContextual ( ) ) { int ctxKey = getKeyFromMask ( context ) ; if ( rangeSet == null ) { shapeContextually ( text , start , count , ctxKey ) ; } else { shapeContextually ( text , start , count , Range . values ( ) [ ctxKey ] ) ; } } else { shapeNonContextually ( text , start , count ) ; } |
public class MPBase { /** * Fills a hashmap with the rest method and the path to call the api . It validates that no other method / path is filled in the hash
* @ param hashAnnotation a HashMap object that will contain the method and path
* @ param method a String with the method
* @ param path a String with the path
* @ param payloadType a PayloadType enum
* @ param retries int with the retries for the api request
* @ param connectionTimeout int with the connection timeout for the api request expressed in milliseconds
* @ param socketTimeout int with the socket timeout for the api request expressed in milliseconds
* @ return the HashMap object that is received by param
* @ throws MPException */
private static HashMap < String , Object > fillHashAnnotations ( HashMap < String , Object > hashAnnotation , HttpMethod method , String path , PayloadType payloadType , int retries , int connectionTimeout , int socketTimeout ) throws MPException { } } | if ( hashAnnotation . containsKey ( "method" ) ) { throw new MPException ( "Multiple rest methods found" ) ; } hashAnnotation . put ( "method" , method ) ; hashAnnotation . put ( "path" , path ) ; hashAnnotation . put ( "payloadType" , payloadType ) ; hashAnnotation . put ( "retries" , retries ) ; hashAnnotation . put ( "connectionTimeout" , connectionTimeout ) ; hashAnnotation . put ( "socketTimeout" , socketTimeout ) ; return hashAnnotation ; |
public class BuiltinAuthorizationService { /** * { @ inheritDoc } */
@ Override public boolean isEveryoneGranted ( String resourceName , Collection < String > requiredRoles ) { } } | validateInput ( resourceName , requiredRoles ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Determining if Everyone is authorized to access resource " + resourceName + ". Specified required roles are " + requiredRoles + "." ) ; } if ( requiredRoles . isEmpty ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , "Everyone is granted access to resource " + resourceName + " as there are no required roles." ) ; } return true ; } Collection < String > roles = getRolesForSpecialSubject ( resourceName , AuthorizationTableService . EVERYONE ) ; AccessDecisionService accessDecisionService = accessDecisionServiceRef . getService ( ) ; boolean granted = accessDecisionService . isGranted ( resourceName , requiredRoles , roles , null ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { if ( granted ) { Tr . event ( tc , "Everyone is granted access to resource " + resourceName + "." ) ; } else { Tr . event ( tc , "Everyone is NOT granted access to resource " + resourceName + "." ) ; } } return granted ; |
public class TypeVariableName { /** * Returns type variable equivalent to { @ code type } . */
public static TypeVariableName get ( java . lang . reflect . TypeVariable < ? > type ) { } } | return get ( type , new LinkedHashMap < > ( ) ) ; |
public class EventMetadataUtils { /** * Append values for the given key from all { @ link TaskState } s
* @ param sb a { @ link StringBuffer } to hold the output
* @ param key the key of the values to retrieve */
private static void appendTaskStateValues ( List < TaskState > taskStates , StringBuffer sb , String key ) { } } | // Add task failure messages in a group followed by task failure exceptions
for ( TaskState taskState : taskStates ) { if ( taskState . contains ( key ) ) { if ( sb . length ( ) != 0 ) { sb . append ( "," ) ; } sb . append ( taskState . getProp ( key ) ) ; } } |
public class PageFlowUtils { /** * Destroys the stack of { @ link PageFlowController } s that have invoked nested page flows .
* @ deprecated Use { @ link PageFlowStack # destroy } instead .
* @ param request the current HttpServletRequest . */
public static void destroyPageFlowStack ( HttpServletRequest request ) { } } | ServletContext servletContext = InternalUtils . getServletContext ( request ) ; PageFlowStack . get ( request , servletContext ) . destroy ( request ) ; |
public class GlResourceBuilder { /** * Return this gl resource builder configured with an plus operator ( ' < code > + < / code > ' character ) . The
* plus operator combines two ore more haplotypes into a genotype .
* @ return this gl resource builder configured with an plus operator ( ' < code > + < / code > ' character )
* @ throws GlClientException if an error occurs */
public GlResourceBuilder plus ( ) throws GlClientException { } } | alleles . clear ( ) ; alleleLists . clear ( ) ; haplotypes . add ( haplotype ) ; genotype = client . createGenotype ( haplotypes ) ; return this ; |
public class NavigationView { /** * Subscribes the { @ link InstructionView } and { @ link SummaryBottomSheet } to the { @ link NavigationViewModel } .
* Then , creates an instance of { @ link NavigationViewSubscriber } , which takes a presenter .
* The subscriber then subscribes to the view models , setting up the appropriate presenter / listener
* method calls based on the { @ link android . arch . lifecycle . LiveData } updates . */
private void subscribeViewModels ( ) { } } | instructionView . subscribe ( navigationViewModel ) ; summaryBottomSheet . subscribe ( navigationViewModel ) ; NavigationViewSubscriber subscriber = new NavigationViewSubscriber ( navigationPresenter ) ; subscriber . subscribe ( ( ( LifecycleOwner ) getContext ( ) ) , navigationViewModel ) ; isSubscribed = true ; |
public class StandardRequestMapper { /** * Locates the piece of mapping definition that fits the command ,
* being a mvc form , and hands the result exceptionHandler to the form for processing
* The command is a string that consists of maximum three words , separated by dots . The first
* word specifies a mapping definition , the second word specifies a form and the third one
* a particular event . If no form is specified , the RequestMapper will look for the form " index " .
* If normal processing somehow does not lead to a dispatch , the request exceptionHandler is handed
* to the error handling form of a mapping specification
* @ param frh the object that knows how to carry out tasks , evaluate results and perform dispatches
* @ return true if the processing lead to a response
* @ throws ConfigurationException in case no dispatch has been reached */
public boolean processRequest ( String [ ] processArray , Properties requestProperties , RequestDispatcher frh ) throws ConfigurationException { } } | String [ ] subProcessArray ; String mappingName ; if ( processArray . length == 0 ) { mappingName = this . defaultMappingName ; subProcessArray = new String [ 0 ] ; } else { mappingName = processArray [ 0 ] ; subProcessArray = new String [ processArray . length - 1 ] ; System . arraycopy ( processArray , 1 , subProcessArray , 0 , subProcessArray . length ) ; } Mapping mapping = mappingMap . get ( mappingName ) ; if ( mapping == null ) { System . out . println ( new LogEntry ( "can not find mapping '" + mappingName + "': turning to default mapping '" + defaultMappingName + "'" ) ) ; mapping = mappingMap . get ( defaultMappingName ) ; if ( mapping == null || ! mapping . isLoaded ( ) ) { throw new ConfigurationException ( "can not find mapping '" + mappingName + "',\n" + "default mapping specification '" + defaultMappingName + "' " + ( mapping == null ? " absent" : " not loaded" ) + ";\nadd a default mapping to avoid uncontrolled responses" ) ; } } if ( ! mapping . isLoaded ( ) ) { throw new ConfigurationException ( "mapping '" + mappingName + "' not loaded" ) ; } Process process = mapping . getRootProcess ( ) ; boolean hasResponded = false ; try { hasResponded = process . processRequest ( subProcessArray , requestProperties , frh ) ; } catch ( Throwable t ) { if ( t instanceof RuntimeException ) { throw ( RuntimeException ) t ; } throw new ConfigurationException ( "process not completed due to insufficient error handling" , t ) ; } return hasResponded ; |
public class CmsObject { /** * Reads a resource from the VFS ,
* using the specified resource filter . < p >
* A resource may be of type < code > { @ link CmsFile } < / code > or
* < code > { @ link CmsFolder } < / code > . In case of
* a file , the resource will not contain the binary file content . Since reading
* the binary content is a cost - expensive database operation , it ' s recommended
* to work with resources if possible , and only read the file content when absolutely
* required . To " upgrade " a resource to a file ,
* use < code > { @ link # readFile ( CmsResource ) } < / code > . < p >
* The specified filter controls what kind of resources should be " found "
* during the read operation . This will depend on the application . For example ,
* using < code > { @ link CmsResourceFilter # DEFAULT } < / code > will only return currently
* " valid " resources , while using < code > { @ link CmsResourceFilter # IGNORE _ EXPIRATION } < / code >
* will ignore the date release / date expired information of the resource . < p >
* @ param resourcename the name of the resource to read ( full current site relative path )
* @ param filter the resource filter to use while reading
* @ return the resource that was read
* @ throws CmsException if the resource could not be read for any reason
* @ see # readFile ( String , CmsResourceFilter )
* @ see # readFolder ( String , CmsResourceFilter ) */
public CmsResource readResource ( String resourcename , CmsResourceFilter filter ) throws CmsException { } } | return m_securityManager . readResource ( m_context , addSiteRoot ( resourcename ) , filter ) ; |
public class DefaultTree { /** * 向 TreeSource 增加新的节点 。
* @ param < ID >
* 数据标识
* @ param < DATA >
* 数据
* @ param source
* 节点构造源
* @ param node
* 父节点 */
private static < ID , DATA > void generateSubNode ( final TreeSource < ID , DATA > source , final DefaultTree < ID , DATA > node ) { } } | List < ID > items = source . listChildrenId ( node . getId ( ) ) ; if ( items == null || items . isEmpty ( ) ) { return ; } for ( ID id : items ) { DATA item = source . getItem ( id ) ; node . appendChildNode ( id , item ) ; } for ( DefaultTree < ID , DATA > subNode : new ArrayList < > ( node . getChildNodes ( ) . values ( ) ) ) { generateSubNode ( source , subNode ) ; } |
public class JsonSerDe { /** * Also , throws IOException when Binary is detected . */
private static void buildJSONString ( StringBuilder sb , Object o , ObjectInspector oi ) throws IOException { } } | switch ( oi . getCategory ( ) ) { case PRIMITIVE : { PrimitiveObjectInspector poi = ( PrimitiveObjectInspector ) oi ; if ( o == null ) { sb . append ( "null" ) ; } else { switch ( poi . getPrimitiveCategory ( ) ) { case BOOLEAN : { boolean b = ( ( BooleanObjectInspector ) poi ) . get ( o ) ; sb . append ( b ? "true" : "false" ) ; break ; } case BYTE : { sb . append ( ( ( ByteObjectInspector ) poi ) . get ( o ) ) ; break ; } case SHORT : { sb . append ( ( ( ShortObjectInspector ) poi ) . get ( o ) ) ; break ; } case INT : { sb . append ( ( ( IntObjectInspector ) poi ) . get ( o ) ) ; break ; } case LONG : { sb . append ( ( ( LongObjectInspector ) poi ) . get ( o ) ) ; break ; } case FLOAT : { sb . append ( ( ( FloatObjectInspector ) poi ) . get ( o ) ) ; break ; } case DOUBLE : { sb . append ( ( ( DoubleObjectInspector ) poi ) . get ( o ) ) ; break ; } case STRING : { String s = SerDeUtils . escapeString ( ( ( StringObjectInspector ) poi ) . getPrimitiveJavaObject ( o ) ) ; appendWithQuotes ( sb , s ) ; break ; } case BINARY : { throw new IOException ( "JsonSerDe does not support BINARY type" ) ; } case DATE : Date d = ( ( DateObjectInspector ) poi ) . getPrimitiveJavaObject ( o ) ; appendWithQuotes ( sb , d . toString ( ) ) ; break ; case TIMESTAMP : { Timestamp t = ( ( TimestampObjectInspector ) poi ) . getPrimitiveJavaObject ( o ) ; appendWithQuotes ( sb , t . toString ( ) ) ; break ; } case DECIMAL : sb . append ( ( ( HiveDecimalObjectInspector ) poi ) . getPrimitiveJavaObject ( o ) ) ; break ; case VARCHAR : { String s = SerDeUtils . escapeString ( ( ( HiveVarcharObjectInspector ) poi ) . getPrimitiveJavaObject ( o ) . toString ( ) ) ; appendWithQuotes ( sb , s ) ; break ; } case CHAR : { // this should use HiveChar . getPaddedValue ( ) but it ' s protected ; currently ( v0.13)
// HiveChar . toString ( ) returns getPaddedValue ( )
String s = SerDeUtils . escapeString ( ( ( HiveCharObjectInspector ) poi ) . getPrimitiveJavaObject ( o ) . toString ( ) ) ; appendWithQuotes ( sb , s ) ; break ; } default : throw new RuntimeException ( "Unknown primitive type: " + poi . getPrimitiveCategory ( ) ) ; } } break ; } case LIST : { ListObjectInspector loi = ( ListObjectInspector ) oi ; ObjectInspector listElementObjectInspector = loi . getListElementObjectInspector ( ) ; List < ? > olist = loi . getList ( o ) ; if ( olist == null ) { sb . append ( "null" ) ; } else { sb . append ( SerDeUtils . LBRACKET ) ; for ( int i = 0 ; i < olist . size ( ) ; i ++ ) { if ( i > 0 ) { sb . append ( SerDeUtils . COMMA ) ; } buildJSONString ( sb , olist . get ( i ) , listElementObjectInspector ) ; } sb . append ( SerDeUtils . RBRACKET ) ; } break ; } case MAP : { MapObjectInspector moi = ( MapObjectInspector ) oi ; ObjectInspector mapKeyObjectInspector = moi . getMapKeyObjectInspector ( ) ; ObjectInspector mapValueObjectInspector = moi . getMapValueObjectInspector ( ) ; Map < ? , ? > omap = moi . getMap ( o ) ; if ( omap == null ) { sb . append ( "null" ) ; } else { sb . append ( SerDeUtils . LBRACE ) ; boolean first = true ; for ( Object entry : omap . entrySet ( ) ) { if ( first ) { first = false ; } else { sb . append ( SerDeUtils . COMMA ) ; } Map . Entry < ? , ? > e = ( Map . Entry < ? , ? > ) entry ; StringBuilder keyBuilder = new StringBuilder ( ) ; buildJSONString ( keyBuilder , e . getKey ( ) , mapKeyObjectInspector ) ; String keyString = keyBuilder . toString ( ) . trim ( ) ; if ( ( ! keyString . isEmpty ( ) ) && ( keyString . charAt ( 0 ) != SerDeUtils . QUOTE ) ) { appendWithQuotes ( sb , keyString ) ; } else { sb . append ( keyString ) ; } sb . append ( SerDeUtils . COLON ) ; buildJSONString ( sb , e . getValue ( ) , mapValueObjectInspector ) ; } sb . append ( SerDeUtils . RBRACE ) ; } break ; } case STRUCT : { StructObjectInspector soi = ( StructObjectInspector ) oi ; List < ? extends StructField > structFields = soi . getAllStructFieldRefs ( ) ; if ( o == null ) { sb . append ( "null" ) ; } else { sb . append ( SerDeUtils . LBRACE ) ; for ( int i = 0 ; i < structFields . size ( ) ; i ++ ) { if ( i > 0 ) { sb . append ( SerDeUtils . COMMA ) ; } appendWithQuotes ( sb , structFields . get ( i ) . getFieldName ( ) ) ; sb . append ( SerDeUtils . COLON ) ; buildJSONString ( sb , soi . getStructFieldData ( o , structFields . get ( i ) ) , structFields . get ( i ) . getFieldObjectInspector ( ) ) ; } sb . append ( SerDeUtils . RBRACE ) ; } break ; } case UNION : { UnionObjectInspector uoi = ( UnionObjectInspector ) oi ; if ( o == null ) { sb . append ( "null" ) ; } else { sb . append ( SerDeUtils . LBRACE ) ; sb . append ( uoi . getTag ( o ) ) ; sb . append ( SerDeUtils . COLON ) ; buildJSONString ( sb , uoi . getField ( o ) , uoi . getObjectInspectors ( ) . get ( uoi . getTag ( o ) ) ) ; sb . append ( SerDeUtils . RBRACE ) ; } break ; } default : throw new RuntimeException ( "Unknown type in ObjectInspector!" ) ; } |
public class AssignPointIDTouchFilter { /** * Assign touch point IDs , for protocol A multitouch drivers that do not
* assign IDs themselves . */
@ Override public boolean filter ( TouchState state ) { } } | if ( oldState . getPointCount ( ) == 0 ) { for ( int i = 0 ; i < state . getPointCount ( ) ; i ++ ) { state . getPoint ( i ) . id = acquireID ( ) ; } } else if ( state . getPointCount ( ) >= oldState . getPointCount ( ) ) { // For each existing touch point , find the closest pending touch
// point .
// mappedIndices contains 0 for every unmapped pending touch point
// index and 1 for every pending touch point index that has
// already been mapped to an existing touch point .
if ( mappedIndices . length < state . getPointCount ( ) ) { mappedIndices = new int [ state . getPointCount ( ) ] ; } else { Arrays . fill ( mappedIndices , 0 ) ; } int mappedIndexCount = 0 ; for ( int i = 0 ; i < oldState . getPointCount ( ) ; i ++ ) { TouchState . Point oldPoint = oldState . getPoint ( i ) ; int x = oldPoint . x ; int y = oldPoint . y ; int closestDistanceSquared = Integer . MAX_VALUE ; int mappedIndex = - 1 ; for ( int j = 0 ; j < state . getPointCount ( ) ; j ++ ) { if ( mappedIndices [ j ] == 0 ) { TouchState . Point newPoint = state . getPoint ( j ) ; int distanceX = x - newPoint . x ; int distanceY = y - newPoint . y ; int distanceSquared = distanceX * distanceX + distanceY * distanceY ; if ( distanceSquared < closestDistanceSquared ) { mappedIndex = j ; closestDistanceSquared = distanceSquared ; } } } assert ( mappedIndex >= 0 ) ; state . getPoint ( mappedIndex ) . id = oldPoint . id ; mappedIndexCount ++ ; mappedIndices [ mappedIndex ] = 1 ; } if ( mappedIndexCount < state . getPointCount ( ) ) { for ( int i = 0 ; i < state . getPointCount ( ) ; i ++ ) { if ( mappedIndices [ i ] == 0 ) { state . getPoint ( i ) . id = acquireID ( ) ; } } } } else { // There are more existing touch points than pending touch points .
// For each pending touch point , find the closest existing touch
// point .
// mappedIndices contains 0 for every unmapped pre - existing touch
// index and 1 for every pre - existing touch index that has already
// been mapped to a pending touch point
if ( mappedIndices . length < oldState . getPointCount ( ) ) { mappedIndices = new int [ oldState . getPointCount ( ) ] ; } else { Arrays . fill ( mappedIndices , 0 ) ; } int mappedIndexCount = 0 ; for ( int i = 0 ; i < state . getPointCount ( ) && mappedIndexCount < oldState . getPointCount ( ) ; i ++ ) { TouchState . Point newPoint = state . getPoint ( i ) ; int x = newPoint . x ; int y = newPoint . y ; int j ; int closestDistanceSquared = Integer . MAX_VALUE ; int mappedIndex = - 1 ; for ( j = 0 ; j < oldState . getPointCount ( ) ; j ++ ) { if ( mappedIndices [ j ] == 0 ) { TouchState . Point oldPoint = oldState . getPoint ( j ) ; int distanceX = x - oldPoint . x ; int distanceY = y - oldPoint . y ; int distanceSquared = distanceX * distanceX + distanceY * distanceY ; if ( distanceSquared < closestDistanceSquared ) { mappedIndex = j ; closestDistanceSquared = distanceSquared ; } } } assert ( mappedIndex >= 0 ) ; state . getPoint ( i ) . id = oldState . getPoint ( mappedIndex ) . id ; mappedIndexCount ++ ; mappedIndices [ mappedIndex ] = 1 ; } } // Release unused IDs . This can only be done after we have finished
// assigning all new IDs .
for ( int i = 0 ; i < oldState . getPointCount ( ) ; i ++ ) { int id = oldState . getPoint ( i ) . id ; TouchState . Point p = state . getPointForID ( id ) ; if ( p == null ) { releaseID ( id ) ; } } state . copyTo ( oldState ) ; return false ; |
public class MPJwtBadMPConfigAsEnvVars { /** * The server will be started with all mp - config properties set to bad values in environment variables .
* The server . xml has a valid mp _ jwt config specified .
* The config settings should come from server . xml .
* The test should run successfully .
* @ throws Exception */
@ Test public void MPJwtBadMPConfigAsEnvVars_GoodMpJwtConfigSpecifiedInServerXml ( ) throws Exception { } } | resourceServer . reconfigureServerUsingExpandedConfiguration ( _testName , "rs_server_AltConfigNotInApp_goodServerXmlConfig.xml" ) ; standardTestFlow ( resourceServer , MpJwtFatConstants . NO_MP_CONFIG_IN_APP_ROOT_CONTEXT , MpJwtFatConstants . NO_MP_CONFIG_IN_APP_APP , MpJwtFatConstants . MPJWT_APP_CLASS_NO_MP_CONFIG_IN_APP ) ; |
public class ReflectionUtils { /** * Invokes the specified method without throwing any checked exceptions .
* This is only valid for methods that are not declared to throw any checked
* exceptions . Any unchecked exceptions thrown by the specified method will be
* re - thrown ( in their original form , not wrapped in an InvocationTargetException
* as would be the case for a normal reflective invocation ) .
* @ param method The method to invoke . Both the method and its class must have
* been declared public and non - abstract , otherwise they will be inaccessible .
* @ param target The object on which to invoke the method .
* @ param arguments The method arguments .
* @ param < T > The return type of the method . The compiler can usually infer the
* correct type .
* @ return The result of invoking the method , or null if the method is void . */
public static < T > T invokeUnchecked ( Method method , Object target , Object ... arguments ) { } } | try { @ SuppressWarnings ( "unchecked" ) T result = ( T ) method . invoke ( target , arguments ) ; return result ; } catch ( IllegalAccessException ex ) { // This cannot happen if the method is public .
throw new IllegalArgumentException ( "Method " + method . getName ( ) + " is not publicly accessible." , ex ) ; } catch ( InvocationTargetException ex ) { // If the method is not declared to throw any checked exceptions ,
// the worst that can happen is a RuntimeException or an Error ( we can ,
// and should , re - throw both ) .
if ( ex . getCause ( ) instanceof Error ) { throw ( Error ) ex . getCause ( ) ; } else { throw ( RuntimeException ) ex . getCause ( ) ; } } |
public class EncodingContext { /** * Encode the given integer array into Base64 format .
* @ param input The array of integers to encode
* @ return The Base64 encoded data
* @ throws IOException if an error occurs encoding the array stream
* @ see # decodeIntArray ( String ) */
public String encodeIntArray ( int [ ] input ) throws IOException { } } | ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; DataOutputStream dos = new DataOutputStream ( bos ) ; int length = input . length ; dos . writeInt ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { dos . writeInt ( input [ i ] ) ; } return new String ( Base64 . encodeBase64URLSafe ( bos . toByteArray ( ) ) ) ; |
public class FairScheduler { /** * Is a job being starved for fair share for the given task type ?
* This is defined as being below half its fair share * and * having a
* positive deficit . */
boolean isStarvedForFairShare ( JobInfo info , TaskType type ) { } } | int desiredFairShare = ( int ) Math . floor ( Math . min ( ( fairTasks ( info , type ) + 1 ) / 2 , runnableTasks ( info , type ) ) ) ; return ( runningTasks ( info , type ) < desiredFairShare ) ; |
public class UpgradeManagerNamenode { /** * Start distributed upgrade .
* Instantiates distributed upgrade objects .
* @ return true if distributed upgrade is required or false otherwise
* @ throws IOException */
public synchronized boolean startUpgrade ( ) throws IOException { } } | if ( ! upgradeState ) { initializeUpgrade ( ) ; if ( ! upgradeState ) return false ; // write new upgrade state into disk
namesystem . getFSImage ( ) . storage . writeAll ( ) ; } assert currentUpgrades != null : "currentUpgrades is null" ; this . broadcastCommand = currentUpgrades . first ( ) . startUpgrade ( ) ; NameNode . LOG . info ( "\n Distributed upgrade for NameNode version " + getUpgradeVersion ( ) + " to current LV " + FSConstants . LAYOUT_VERSION + " is started." ) ; return true ; |
public class KllFloatsSketch { /** * thousands of trials */
public static int getKFromEpsilon ( final double epsilon , final boolean pmf ) { } } | // Ensure that eps is > = than the lowest possible eps given MAX _ K and pmf = false .
final double eps = max ( epsilon , 4.7634E-5 ) ; final double kdbl = pmf ? exp ( log ( 2.446 / eps ) / 0.9433 ) : exp ( log ( 2.296 / eps ) / 0.9723 ) ; final double krnd = round ( kdbl ) ; final double del = abs ( krnd - kdbl ) ; final int k = ( int ) ( ( del < 1E-6 ) ? krnd : ceil ( kdbl ) ) ; return max ( MIN_K , min ( MAX_K , k ) ) ; |
public class InternalArrayIterate { /** * Implemented to avoid megamorphic call on castProcedure . */
private static < T > void batchReject ( T [ ] array , int start , int end , FastListRejectProcedure < T > castProcedure ) { } } | for ( int i = start ; i < end ; i ++ ) { castProcedure . value ( array [ i ] ) ; } |
public class TableExtractor { /** * Get the table row headings based on the cell information
* @ param tc
* the object of the table candidate */
public void getRowHeadingBasedOnCells ( TableCandidate tc ) { } } | String rowHeadingThisTable = "" ; int footnoteLineIndex = tc . getFootnoteBeginRow ( ) ; String [ ] [ ] cells = tc . getCells ( ) ; // if ( cells [ 0 ] [ 0 ] . length ( ) = = 0 ) {
for ( int j = 0 ; j < footnoteLineIndex ; j ++ ) { if ( cells [ j ] [ 0 ] . length ( ) > 0 ) rowHeadingThisTable = rowHeadingThisTable + cells [ j ] [ 0 ] + "; " ; } rowHeadingThisTable = tc . replaceAllSpecialChracters ( rowHeadingThisTable ) ; tc . setHeadingRows ( rowHeadingThisTable ) ; |
public class ManagementResource { /** * / * ( non - Javadoc )
* @ see net . roboconf . dm . internal . rest . client . exceptions . server . IApplicationWs
* # deleteApplication ( java . lang . String ) */
@ Override public Response deleteApplication ( String applicationName ) { } } | this . logger . fine ( "Request: delete application " + applicationName + "." ) ; Response result = Response . ok ( ) . build ( ) ; try { ManagedApplication ma = this . manager . applicationMngr ( ) . findManagedApplicationByName ( applicationName ) ; if ( ma == null ) result = handleError ( Status . NOT_FOUND , new RestError ( REST_INEXISTING , application ( applicationName ) ) , lang ( this . manager ) ) . build ( ) ; else this . manager . applicationMngr ( ) . deleteApplication ( ma ) ; } catch ( UnauthorizedActionException | IOException e ) { result = handleError ( Status . FORBIDDEN , new RestError ( REST_DELETION_ERROR , e , application ( applicationName ) ) , lang ( this . manager ) ) . build ( ) ; } return result ; |
public class GroovyInterpretterConfig { /** * Get default compiler configuration for { @ link GroovyShell } . */
public CompilerConfiguration getCompilerConfiguration ( ) { } } | CompilerConfiguration cc = new CompilerConfiguration ( ) ; ImportCustomizer imports = new ImportCustomizer ( ) ; for ( String starImport : STAR_IMPORTS ) { imports . addStarImports ( starImport ) ; } for ( String staticStar : STATIC_IMPORTS ) { imports . addStaticStars ( staticStar ) ; } cc . addCompilationCustomizers ( imports ) ; return cc ; |
public class Channel { /** * Send a transaction proposal .
* @ param transactionProposalRequest The transaction proposal to be sent to all the required peers needed for endorsing .
* @ return responses from peers .
* @ throws InvalidArgumentException
* @ throws ProposalException */
public Collection < ProposalResponse > sendTransactionProposal ( TransactionProposalRequest transactionProposalRequest ) throws ProposalException , InvalidArgumentException { } } | return sendProposal ( transactionProposalRequest , getEndorsingPeers ( ) ) ; |
public class ResourceUtil { /** * Convert a resource path to an absolute file path .
* @ param resourcePath The resource - relative path to resolve .
* @ return The absolute path to this resource . */
public static String getPathForResource ( final String resourcePath ) { } } | URL path = ResourceUtil . class . getResource ( resourcePath ) ; if ( path == null ) { path = ResourceUtil . class . getResource ( "/" ) ; File tmpFile = new File ( path . getPath ( ) , resourcePath ) ; return tmpFile . getPath ( ) ; } return path . getPath ( ) ; |
public class WDTimerImpl { /** * Open custom Watchdog
* @ param file
* @ throws IOException */
public void open ( String file ) throws IOException { } } | filename = file ; if ( fd > 0 ) { throw new IOException ( "File " + filename + " already open." ) ; } fd = WDT . open ( file ) ; if ( fd < 0 ) { throw new IOException ( "Cannot open file handle for " + filename + " got " + fd + " back." ) ; } |
public class XsdAsm { /** * This method is the entry point for the class creation process .
* It receives all the { @ link XsdAbstractElement } objects and creates the necessary infrastructure for the
* generated fluent interface , the required interfaces , visitor and all the classes based on the elements received .
* @ param elements The elements which will serve as base to the generated classes .
* @ param apiName The resulting fluent interface name . */
public void generateClassFromElements ( Stream < XsdElement > elements , String apiName ) { } } | createGeneratedFilesDirectory ( apiName ) ; createSupportingInfrastructure ( apiName ) ; List < XsdElement > elementList = elements . collect ( Collectors . toList ( ) ) ; interfaceGenerator . addCreatedElements ( elementList ) ; elementList . forEach ( element -> generateClassFromElement ( element , apiName ) ) ; interfaceGenerator . generateInterfaces ( createdAttributes , apiName ) ; List < XsdAttribute > attributes = new ArrayList < > ( ) ; createdAttributes . keySet ( ) . forEach ( attribute -> attributes . addAll ( createdAttributes . get ( attribute ) ) ) ; generateAttributes ( attributes , apiName ) ; generateVisitors ( interfaceGenerator . getExtraElementsForVisitor ( ) , attributes , apiName ) ; |
public class Popups { /** * Creates a new popup with the specified style name and contents and shows it near the
* specified target widget . Returns the newly created popup . */
public static PopupPanel newPopup ( String styleName , Widget contents , Position pos , Widget target ) { } } | PopupPanel panel = newPopup ( styleName , contents ) ; show ( panel , pos , target ) ; return panel ; |
public class JFXAlert { /** * this method ensure not null value for current animation */
private JFXAlertAnimation getCurrentAnimation ( ) { } } | JFXAlertAnimation usedAnimation = getAnimation ( ) ; usedAnimation = usedAnimation == null ? JFXAlertAnimation . NO_ANIMATION : usedAnimation ; return usedAnimation ; |
public class EmailAddressValidator { /** * Checks if a value is a valid e - mail address according to a complex regular
* expression . Additionally an MX record lookup is performed to see whether
* this host provides SMTP services .
* @ param sEmail
* The value validation is being performed on . A < code > null < / code >
* value is considered invalid .
* @ return < code > true < / code > if the email address is valid , < code > false < / code >
* otherwise . */
public static boolean isValidWithMXCheck ( @ Nullable final String sEmail ) { } } | // First check without MX
if ( ! EmailAddressHelper . isValid ( sEmail ) ) return false ; final String sUnifiedEmail = EmailAddressHelper . getUnifiedEmailAddress ( sEmail ) ; // MX record checking
final int i = sUnifiedEmail . indexOf ( '@' ) ; final String sHostName = sUnifiedEmail . substring ( i + 1 ) ; return _hasMXRecord ( sHostName ) ; |
public class FileRepositoryCollectionFactory { /** * Add a FileRepositorySource so it can be used by the ' createFileRepositySource ' factory method */
public void addFileRepositoryCollectionClass ( Class < ? extends FileRepositoryCollection > clazz , Set < String > fileExtensions ) { } } | for ( String extension : fileExtensions ) { fileRepositoryCollections . put ( extension . toLowerCase ( ) , clazz ) ; } |
public class ContainerDeployController { /** * Undeploy all deployments marked as managed , and all manually deployed .
* @ throws Exception */
public void undeployManaged ( @ Observes UnDeployManagedDeployments event ) throws Exception { } } | forEachDeployedDeployment ( new Operation < Container , Deployment > ( ) { @ Inject private Event < DeploymentEvent > event ; @ Override public void perform ( Container container , Deployment deployment ) throws Exception { if ( container . getState ( ) . equals ( Container . State . STARTED ) && deployment . isDeployed ( ) ) { event . fire ( new UnDeployDeployment ( container , deployment ) ) ; } } } ) ; |
public class BinaryString { /** * TODO upper / lower is slow ? . . */
private SegmentAndOffset firstSegmentAndOffset ( int segSize ) { } } | int segIndex = offset / segSize ; return new SegmentAndOffset ( segIndex , offset % segSize ) ; |
public class AVIMConversationsQuery { /** * 增加查询条件 , 当conversation的属性中对应的字段满足小于条件时即可返回
* @ param key
* @ param value
* @ return */
public AVIMConversationsQuery whereLessThan ( String key , Object value ) { } } | conditions . whereLessThan ( key , value ) ; return this ; |
public class DroolsValidator { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public boolean validatePriorityType ( BigInteger priorityType , DiagnosticChain diagnostics , Map < Object , Object > context ) { } } | boolean result = validatePriorityType_Min ( priorityType , diagnostics , context ) ; return result ; |
public class AbstractSlidingAverage { /** * Returns average by calculating cell by cell
* @ return */
@ Override public double average ( ) { } } | readLock . lock ( ) ; try { double s = 0 ; PrimitiveIterator . OfInt it = modIterator ( ) ; while ( it . hasNext ( ) ) { s += ring [ it . nextInt ( ) ] ; } return s / ( count ( ) ) ; } finally { readLock . unlock ( ) ; } |
public class SibRaXaResource { /** * Checks if the transaction was rolled back or not . If for some reason
* we could not obtain the transaction state then we return true indicating
* a rollback .
* @ return true if the transaction was rolled back */
boolean isTransactionRolledBack ( ) { } } | final String methodName = "isTransactionRolledBack" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName ) ; } // Default to true indicating a rollback
boolean isRolledBack = true ; Boolean rolledBack = null ; if ( _lastXidUsed != null ) { // Get hold of the state of the last transaction used by this xa resource
// instance .
synchronized ( _transactionStates ) { rolledBack = ( Boolean ) _transactionStates . remove ( _lastXidUsed ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { StringBuffer sb = new StringBuffer ( "After removing the xid " ) ; sb . append ( _lastXidUsed ) ; sb . append ( " the hashtable of transactionStates now contains " ) ; sb . append ( _transactionStates . size ( ) ) ; sb . append ( " entries" ) ; SibTr . debug ( this , TRACE , sb . toString ( ) ) ; } } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isDebugEnabled ( ) ) { SibTr . debug ( this , TRACE , "WARNING! No last Xid set" ) ; } } if ( rolledBack != null ) { isRolledBack = rolledBack . booleanValue ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName , Boolean . valueOf ( isRolledBack ) ) ; } return isRolledBack ; |
public class Actions { /** * Converts an { @ link Action1 } to a function that calls the action and returns a specified value .
* @ param action the { @ link Action1 } to convert
* @ param result the value to return from the function call
* @ return a { @ link Func1 } that calls { @ code action } and returns { @ code result } */
public static < T1 , R > Func1 < T1 , R > toFunc ( final Action1 < T1 > action , final R result ) { } } | return new Func1 < T1 , R > ( ) { @ Override public R call ( T1 t1 ) { action . call ( t1 ) ; return result ; } } ; |
public class ZookeeperHealthAutoConfiguration { /** * If there is an active curator , if the zookeeper health endpoint is enabled and if a
* health indicator hasn ' t already been added by a user add one .
* @ param curator The curator connection to zookeeper to use
* @ return An instance of { @ link ZookeeperHealthIndicator } to add to actuator health
* report */
@ Bean @ ConditionalOnMissingBean ( ZookeeperHealthIndicator . class ) @ ConditionalOnBean ( CuratorFramework . class ) @ ConditionalOnEnabledHealthIndicator ( "zookeeper" ) public ZookeeperHealthIndicator zookeeperHealthIndicator ( CuratorFramework curator ) { } } | return new ZookeeperHealthIndicator ( curator ) ; |
public class SnorocketReasoner { /** * Ideally we ' d return some kind of normal form axioms here . However , in
* the presence of GCIs this is not well defined ( as far as I know -
* Michael ) .
* Instead , we will return stated form axioms for Sufficient conditions
* ( i . e . for INamedConcept on the RHS ) , and SNOMED CT DNF - based axioms for
* Necessary conditions . The former is just a filter over the stated axioms ,
* the latter requires looking at the Taxonomy and inferred relationships .
* Note that there will be < i > virtual < / i > INamedConcepts that need to be
* skipped / expanded and redundant IExistentials that need to be filtered .
* @ return */
public Collection < Axiom > getInferredAxioms ( ) { } } | final Collection < Axiom > inferred = new HashSet < > ( ) ; if ( ! isClassified ) classify ( ) ; if ( ! no . isTaxonomyComputed ( ) ) { log . info ( "Building taxonomy" ) ; no . buildTaxonomy ( ) ; } final Map < String , Node > taxonomy = no . getTaxonomy ( ) ; final IConceptMap < Context > contextIndex = no . getContextIndex ( ) ; final IntIterator itr = contextIndex . keyIterator ( ) ; while ( itr . hasNext ( ) ) { final int key = itr . next ( ) ; final String id = factory . lookupConceptId ( key ) . toString ( ) ; if ( factory . isVirtualConcept ( key ) || NamedConcept . BOTTOM . equals ( id ) ) { continue ; } Concept rhs = getNecessary ( contextIndex , taxonomy , key ) ; final Concept lhs = new NamedConcept ( id ) ; if ( ! lhs . equals ( rhs ) && ! rhs . equals ( NamedConcept . TOP_CONCEPT ) ) { // skip trivial axioms
inferred . add ( new ConceptInclusion ( lhs , rhs ) ) ; } } return inferred ; |
public class OrOperator { /** * ( non - Javadoc )
* @ see net . timewalker . ffmq4 . common . message . selector . expression . SelectorNode # evaluate ( javax . jms . Message ) */
@ Override public Object evaluate ( Message message ) throws JMSException { } } | Boolean leftOperandValue = leftOperand . evaluateBoolean ( message ) ; if ( leftOperandValue == null ) { Boolean rightOperandValue = rightOperand . evaluateBoolean ( message ) ; if ( rightOperandValue == null || ! rightOperandValue . booleanValue ( ) ) return null ; return Boolean . TRUE ; } else { if ( leftOperandValue . booleanValue ( ) ) return Boolean . TRUE ; return rightOperand . evaluateBoolean ( message ) ; } |
public class MySQLQueryFactory { /** * Create a INSERT IGNORE INTO clause
* @ param entity table to insert to
* @ return insert clause */
public SQLInsertClause insertIgnore ( RelationalPath < ? > entity ) { } } | SQLInsertClause insert = insert ( entity ) ; insert . addFlag ( Position . START_OVERRIDE , "insert ignore into " ) ; return insert ; |
public class SurefireMojoInterceptor { /** * Checks that surefire configuration allows integration with
* Ekstazi . At the moment , we check that forking is enabled . */
private static void checkSurefireConfiguration ( Object mojo ) throws Exception { } } | String forkCount = null ; try { forkCount = invokeAndGetString ( GET_FORK_COUNT , mojo ) ; } catch ( NoSuchMethodException ex ) { // Nothing : earlier versions ( before 2.14 ) of surefire did
// not have forkCount .
} String forkMode = null ; try { forkMode = getStringField ( FORK_MODE_FIELD , mojo ) ; } catch ( NoSuchMethodException ex ) { // Nothing : earlier versions ( before 2.1 ) of surefire did
// not have forkMode .
} if ( ( forkCount != null && forkCount . equals ( "0" ) ) || ( forkMode != null && ( forkMode . equals ( "never" ) || forkMode . equals ( "none" ) ) ) ) { throwMojoExecutionException ( mojo , "Fork has to be enabled when running tests with Ekstazi; check forkMode and forkCount parameters." , null ) ; } |
public class QueueListenerImpl { /** * Returns true when the execution is a branch with the new branch mechanism
* It will return true for executions of parallel , multi - instance , sub - flows and non blocking */
private boolean isBranch ( Execution execution ) { } } | return execution != null && ! StringUtils . isEmpty ( execution . getSystemContext ( ) . getBranchId ( ) ) ; |
public class ResourceType { /** * Returns < code > true < / code > if the resource type or any of the resource ' s super type ( s ) equals the given resource
* type .
* This implementation is equal to { @ link ResourceResolver # isResourceType ( Resource , String ) } - but in earlier sling
* version the comparison check did not take potentieal mixtures of relative and absolute resource types into account .
* This method respects this .
* @ param resource The resource to check
* @ param resourceType The resource type to check this resource against .
* @ return < code > true < / code > if the resource type or any of the resource ' s super type ( s ) equals the given resource
* type . < code > false < / code > is also returned if < code > resource < / code > or < code > resourceType < / code > are
* < code > null < / code > . */
public static boolean is ( @ Nullable Resource resource , @ Nullable String resourceType ) { } } | if ( resource == null || resourceType == null ) { return false ; } ResourceResolver resolver = resource . getResourceResolver ( ) ; // Check if the resource is of the given type . This method first checks the
// resource type of the resource , then its super resource type and continues
// to go up the resource super type hierarchy .
boolean result = false ; if ( ResourceType . equals ( resourceType , resource . getResourceType ( ) ) ) { result = true ; } else { Set < String > superTypesChecked = new HashSet < > ( ) ; String superType = resolver . getParentResourceType ( resource ) ; while ( ! result && superType != null ) { if ( ResourceType . equals ( resourceType , superType ) ) { result = true ; } else { superTypesChecked . add ( superType ) ; superType = resolver . getParentResourceType ( superType ) ; if ( superType != null && superTypesChecked . contains ( superType ) ) { throw new SlingException ( "Cyclic dependency for resourceSuperType hierarchy detected on resource " + resource . getPath ( ) , null ) ; } } } } return result ; |
public class CommandOption { /** * Sets command option setting key to be output when set
* if not set short command option name is used instead
* @ param name of setting key
* @ return command option */
public CommandOption < T > setting ( String name ) { } } | Assert . notNullOrEmptyTrimmed ( name , "Missing setting name" ) ; name = StringUtils . trim ( name ) ; String compare = StringUtils . sanitizeWhitespace ( name ) ; Assert . isTrue ( name . equals ( compare ) , "Setting name can not contain whitespace characters!" ) ; setting = name ; return this ; |
public class TwitterImpl { /** * " command = FINALIZE & media _ id = 601413451156586496" */
private UploadedMedia uploadMediaChunkedFinalize ( long mediaId ) throws TwitterException { } } | int tries = 0 ; int maxTries = 20 ; int lastProgressPercent = 0 ; int currentProgressPercent = 0 ; UploadedMedia uploadedMedia = uploadMediaChunkedFinalize0 ( mediaId ) ; while ( tries < maxTries ) { if ( lastProgressPercent == currentProgressPercent ) { tries ++ ; } lastProgressPercent = currentProgressPercent ; String state = uploadedMedia . getProcessingState ( ) ; if ( state . equals ( "failed" ) ) { throw new TwitterException ( "Failed to finalize the chuncked upload." ) ; } if ( state . equals ( "pending" ) || state . equals ( "in_progress" ) ) { currentProgressPercent = uploadedMedia . getProgressPercent ( ) ; int waitSec = Math . max ( uploadedMedia . getProcessingCheckAfterSecs ( ) , 1 ) ; logger . debug ( "Chunked finalize, wait for:" + waitSec + " sec" ) ; try { Thread . sleep ( waitSec * 1000 ) ; } catch ( InterruptedException e ) { throw new TwitterException ( "Failed to finalize the chuncked upload." , e ) ; } } if ( state . equals ( "succeeded" ) ) { return uploadedMedia ; } uploadedMedia = uploadMediaChunkedStatus ( mediaId ) ; } throw new TwitterException ( "Failed to finalize the chuncked upload, progress has stopped, tried " + tries + 1 + " times." ) ; |
public class AuthorizedValuesRule { /** * ( non - Javadoc )
* @ see javax . validation . ConstraintValidator # initialize ( java . lang . annotation . Annotation ) */
@ Override public void initialize ( AuthorizedValues annotation ) { } } | // Si l ' annotation est nulle : on sort
if ( annotation == null ) return ; // Obtention de la liste
String [ ] annotationValues = annotation . values ( ) ; // Si la liste de l ' annotation est vide : on sort
if ( annotationValues == null || annotationValues . length == 0 ) return ; // On affecte la liste de valeurs
values = annotationValues ; // On affecte l ' état de prise en compte de la casse
caseSensitive = annotation . caseSensitive ( ) ; |
public class AbstractHosts { /** * 获取hosts文件路径 .
* @ return hosts文件路径 */
protected String getHostsPath ( ) { } } | String path ; if ( System . getProperty ( "os.name" ) . startsWith ( "Windows" ) ) { path = "c:/windows/System32/drivers/etc/hosts" ; } else { path = "/etc/hosts" ; } return path ; |
public class HttpResourceHandler { /** * Helper method to split a string by a given character , with empty parts omitted . */
private static Iterable < String > splitAndOmitEmpty ( final String str , final char splitChar ) { } } | return new Iterable < String > ( ) { @ Override public Iterator < String > iterator ( ) { return new Iterator < String > ( ) { int startIdx = 0 ; String next = null ; @ Override public boolean hasNext ( ) { while ( next == null && startIdx < str . length ( ) ) { int idx = str . indexOf ( splitChar , startIdx ) ; if ( idx == startIdx ) { // Omit empty string
startIdx ++ ; continue ; } if ( idx >= 0 ) { // Found the next part
next = str . substring ( startIdx , idx ) ; startIdx = idx ; } else { // The last part
if ( startIdx < str . length ( ) ) { next = str . substring ( startIdx ) ; startIdx = str . length ( ) ; } break ; } } return next != null ; } @ Override public String next ( ) { if ( hasNext ( ) ) { String next = this . next ; this . next = null ; return next ; } throw new NoSuchElementException ( "No more element" ) ; } @ Override public void remove ( ) { throw new UnsupportedOperationException ( "Remove not supported" ) ; } } ; } } ; |
public class UnscaledDecimal128Arithmetic { /** * Instead of throwing overflow exception , this function returns :
* 0 when there was no overflow
* + 1 when there was overflow
* - 1 when there was underflow */
public static long addWithOverflow ( Slice left , Slice right , Slice result ) { } } | boolean leftNegative = isNegative ( left ) ; boolean rightNegative = isNegative ( right ) ; long overflow = 0 ; if ( leftNegative == rightNegative ) { // either both negative or both positive
overflow = addUnsignedReturnOverflow ( left , right , result , leftNegative ) ; if ( leftNegative ) { overflow = - overflow ; } } else { int compare = compareAbsolute ( left , right ) ; if ( compare > 0 ) { subtractUnsigned ( left , right , result , leftNegative ) ; } else if ( compare < 0 ) { subtractUnsigned ( right , left , result , ! leftNegative ) ; } else { setToZero ( result ) ; } } return overflow ; |
public class ThresholdImageOps { /** * Applies a global threshold across the whole image . If ' down ' is true , then pixels with values < =
* to ' threshold ' are set to 1 and the others set to 0 . If ' down ' is false , then pixels with values >
* to ' threshold ' are set to 1 and the others set to 0.
* @ param input Input image . Not modified .
* @ param output ( Optional ) Binary output image . If null a new image will be declared . Modified .
* @ param threshold threshold value .
* @ param down If true then the inequality < = is used , otherwise if false then & gt ; is used .
* @ return Output image . */
public static GrayU8 threshold ( GrayS16 input , GrayU8 output , int threshold , boolean down ) { } } | output = InputSanityCheck . checkDeclare ( input , output , GrayU8 . class ) ; if ( BoofConcurrency . USE_CONCURRENT ) { ImplThresholdImageOps_MT . threshold ( input , output , threshold , down ) ; } else { ImplThresholdImageOps . threshold ( input , output , threshold , down ) ; } return output ; |
public class MultiMapLayer { /** * Fire the event that indicates a layer was moved up .
* @ param layer is the moved layer .
* @ param newIndex is the new index of the layer . */
protected void fireLayerMovedUpEvent ( MapLayer layer , int newIndex ) { } } | fireLayerHierarchyChangedEvent ( new MapLayerHierarchyEvent ( this , layer , Type . MOVE_CHILD_UP , newIndex , layer . isTemporaryLayer ( ) ) ) ; |
public class MongoDBClient { /** * ( non - Javadoc )
* @ see com . impetus . kundera . client . Client # getColumnsById ( java . lang . String ,
* java . lang . String , java . lang . String , java . lang . String , java . lang . Object ,
* java . lang . Class ) */
@ Override public < E > List < E > getColumnsById ( String schemaName , String joinTableName , String joinColumnName , String inverseJoinColumnName , Object parentId , Class columnJavaType ) { } } | List < E > foreignKeys = new ArrayList < E > ( ) ; DBCollection dbCollection = mongoDb . getCollection ( joinTableName ) ; BasicDBObject query = new BasicDBObject ( ) ; query . put ( joinColumnName , MongoDBUtils . populateValue ( parentId , parentId . getClass ( ) ) ) ; KunderaCoreUtils . printQuery ( "Find by Id:" + query , showQuery ) ; DBCursor cursor = dbCollection . find ( query ) ; DBObject fetchedDocument = null ; while ( cursor . hasNext ( ) ) { fetchedDocument = cursor . next ( ) ; Object foreignKey = fetchedDocument . get ( inverseJoinColumnName ) ; foreignKey = MongoDBUtils . getTranslatedObject ( foreignKey , foreignKey . getClass ( ) , columnJavaType ) ; foreignKeys . add ( ( E ) foreignKey ) ; } return foreignKeys ; |
public class DefineStyleActivity { /** * Preview image , to album . */
private void previewAlbum ( int position ) { } } | if ( mAlbumFiles == null || mAlbumFiles . size ( ) == 0 ) { Toast . makeText ( this , R . string . no_selected , Toast . LENGTH_LONG ) . show ( ) ; } else { Album . galleryAlbum ( this ) . checkable ( true ) . checkedList ( mAlbumFiles ) . currentPosition ( position ) . widget ( Widget . newLightBuilder ( this ) . toolBarColor ( Color . WHITE ) . statusBarColor ( Color . WHITE ) . mediaItemCheckSelector ( Color . GREEN , Color . RED ) . bucketItemCheckSelector ( Color . GREEN , Color . RED ) . buttonStyle ( Widget . ButtonStyle . newLightBuilder ( this ) . setButtonSelector ( Color . WHITE , Color . GRAY ) . build ( ) ) . build ( ) ) . onResult ( new Action < ArrayList < AlbumFile > > ( ) { @ Override public void onAction ( @ NonNull ArrayList < AlbumFile > result ) { mAlbumFiles = result ; mAdapter . notifyDataSetChanged ( mAlbumFiles ) ; mTvMessage . setVisibility ( result . size ( ) > 0 ? View . VISIBLE : View . GONE ) ; } } ) . start ( ) ; } |
public class ServiceTools { /** * Return JsonUnmarshaller instance if annotation JsonUnmarshaller is present
* @ param annotations
* @ return
* @ throws org . ocelotds . marshalling . exceptions . JsonMarshallerException */
public IJsonMarshaller getJsonMarshaller ( Annotation [ ] annotations ) throws JsonMarshallerException { } } | if ( annotations != null ) { for ( Annotation annotation : annotations ) { if ( JsonUnmarshaller . class . isAssignableFrom ( annotation . annotationType ( ) ) ) { return getJsonMarshallerFromAnnotation ( ( JsonUnmarshaller ) annotation ) ; } } } return null ; |
public class CustomFunctions { /** * コレクションの値を結合する 。
* @ param collection 結合対象のコレクション
* @ param delimiter 区切り文字
* @ param printer コレクションの要素の値のフォーマッタ
* @ return 結合した文字列を返す 。 結合の対象のコレクションがnulの場合 、 空文字を返す 。
* @ throws NullPointerException { @ literal printer is null . } */
@ SuppressWarnings ( { } } | "rawtypes" , "unchecked" } ) public static String join ( final Collection < ? > collection , final String delimiter , final TextPrinter printer ) { Objects . requireNonNull ( printer ) ; if ( collection == null || collection . isEmpty ( ) ) { return "" ; } String value = collection . stream ( ) . map ( v -> printer . print ( v ) ) . collect ( Collectors . joining ( defaultString ( delimiter ) ) ) ; return value ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.