signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class InstallOptions { /** * Get the value of the given option as a boolean , or the given default
* value if unspecified . If specified , the value is assumed to be
* < code > true < / code > if given as " true " , regardless of case . All other
* values are assumed to be < code > false < / code > . */
public boolean getBooleanValue ( String name , boolean defaultValue ) { } } | String value = getValue ( name ) ; if ( value == null ) { return defaultValue ; } else { return value . equals ( "true" ) ; } |
public class PriorityAwareServiceProvider { /** * Loads and registers services .
* @ param serviceType The service type .
* @ param < T > the concrete type .
* @ return the items found , never { @ code null } . */
private < T > List < T > loadServices ( final Class < T > serviceType ) { } } | List < T > services = new ArrayList < > ( ) ; try { for ( T t : ServiceLoader . load ( serviceType ) ) { services . add ( t ) ; } services . sort ( PriorityAwareServiceProvider :: compareServices ) ; @ SuppressWarnings ( "unchecked" ) final List < T > previousServices = ( List < T > ) servicesLoaded . putIfAbsent ( serviceType , ( List < Object > ) services ) ; return Collections . unmodifiableList ( previousServices != null ? previousServices : services ) ; } catch ( Exception e ) { Logger . getLogger ( PriorityAwareServiceProvider . class . getName ( ) ) . log ( Level . WARNING , "Error loading services of type " + serviceType , e ) ; services . sort ( PriorityAwareServiceProvider :: compareServices ) ; return services ; } |
public class AbstractWComponent { /** * { @ inheritDoc } */
@ Override public Headers getHeaders ( ) { } } | UIContext uic = UIContextHolder . getCurrent ( ) ; return uic == null ? null : uic . getHeaders ( ) ; |
public class StringHelper { /** * Get a concatenated String from all elements of the passed map , separated by
* the specified separator chars .
* @ param cSepOuter
* The separator to use for separating the map entries .
* @ param cSepInner
* The separator to use for separating the key from the value .
* @ param aElements
* The map to convert . May be < code > null < / code > or empty .
* @ param aKeyMapper
* The mapping function to convert from KEYTYPE to String . May not be
* < code > null < / code > .
* @ param aValueMapper
* The mapping function to convert from VALUETYPE to String . May not be
* < code > null < / code > .
* @ return The concatenated string .
* @ param < KEYTYPE >
* Map key type
* @ param < VALUETYPE >
* Map value type
* @ since 8.5.6 */
@ Nonnull public static < KEYTYPE , VALUETYPE > String getImplodedMapped ( final char cSepOuter , final char cSepInner , @ Nullable final Map < ? extends KEYTYPE , ? extends VALUETYPE > aElements , @ Nonnull final Function < ? super KEYTYPE , String > aKeyMapper , @ Nonnull final Function < ? super VALUETYPE , String > aValueMapper ) { } } | return getImplodedMapped ( Character . toString ( cSepOuter ) , Character . toString ( cSepInner ) , aElements , aKeyMapper , aValueMapper ) ; |
public class CmsUpdateDBDropOldIndexes { /** * Gets the constraints for a table . < p >
* @ param dbCon the db connection interface
* @ param tablename the table to get the indexes from
* @ return a list of constraints
* @ throws SQLException if something goes wrong */
private List < String > getConstraints ( CmsSetupDb dbCon , String tablename ) throws SQLException { } } | List < String > constraints = new ArrayList < String > ( ) ; String tableConstraints = readQuery ( QUERY_SHOW_CONSTRAINTS ) ; Map < String , String > replacer = new HashMap < String , String > ( ) ; replacer . put ( REPLACEMENT_TABLENAME , tablename ) ; CmsSetupDBWrapper db = null ; try { db = dbCon . executeSqlStatement ( tableConstraints , replacer ) ; while ( db . getResultSet ( ) . next ( ) ) { String constraint = db . getResultSet ( ) . getString ( FIELD_CONSTRAINT_ORACLE ) ; if ( ! constraints . contains ( constraint ) ) { constraints . add ( constraint ) ; } } } finally { if ( db != null ) { db . close ( ) ; } } return constraints ; |
public class AWSMediaPackageClient { /** * Updates an existing OriginEndpoint .
* @ param updateOriginEndpointRequest
* Configuration parameters used to update an existing OriginEndpoint .
* @ return Result of the UpdateOriginEndpoint operation returned by the service .
* @ throws UnprocessableEntityException
* The parameters sent in the request are not valid .
* @ throws InternalServerErrorException
* An unexpected error occurred .
* @ throws ForbiddenException
* The client is not authorized to access the requested resource .
* @ throws NotFoundException
* The requested resource does not exist .
* @ throws ServiceUnavailableException
* An unexpected error occurred .
* @ throws TooManyRequestsException
* The client has exceeded their resource or throttling limits .
* @ sample AWSMediaPackage . UpdateOriginEndpoint
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / mediapackage - 2017-10-12 / UpdateOriginEndpoint "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateOriginEndpointResult updateOriginEndpoint ( UpdateOriginEndpointRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateOriginEndpoint ( request ) ; |
public class QOrderAsc { /** * { @ inheritDoc } */
@ Override public AbstractQPart prepare ( final AbstractTypeQuery _query , final AbstractQPart _part ) throws EFapsException { } } | getAttribute ( ) . prepare ( _query , this ) ; return this ; |
public class ValueElement { /** * < div color = ' red ' style = " font - size : 24px ; color : red " > < b > < i > < u > JCYPHER < / u > < / i > < / b > < / div >
* < div color = ' red ' style = " font - size : 18px ; color : red " > < i > convert to a string , return a < b > JcString < / b > < / i > < / div >
* < br / > */
public JcString str ( ) { } } | JcString ret = new JcString ( null , this , new FunctionInstance ( FUNCTION . Common . STR , 1 ) ) ; QueryRecorder . recordInvocationConditional ( this , "str" , ret ) ; return ret ; |
public class HspReader { /** * Stream zero or more high - scoring segment pairs from the specified readable .
* @ param readable readable to stream from , must not be null
* @ param listener event based listener callback , must not be null
* @ throws IOException if an I / O error occurs */
public static void stream ( final Readable readable , final HspListener listener ) throws IOException { } } | checkNotNull ( readable ) ; checkNotNull ( listener ) ; HspLineProcessor lineProcessor = new HspLineProcessor ( listener ) ; CharStreams . readLines ( readable , lineProcessor ) ; |
public class DescribeEventTopicsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeEventTopicsRequest describeEventTopicsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeEventTopicsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeEventTopicsRequest . getDirectoryId ( ) , DIRECTORYID_BINDING ) ; protocolMarshaller . marshall ( describeEventTopicsRequest . getTopicNames ( ) , TOPICNAMES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class EncryptRequest { /** * Name - value pair that specifies the encryption context to be used for authenticated encryption . If used here , the
* same value must be supplied to the < code > Decrypt < / code > API or decryption will fail . For more information , see < a
* href = " http : / / docs . aws . amazon . com / kms / latest / developerguide / encryption - context . html " > Encryption Context < / a > .
* @ param encryptionContext
* Name - value pair that specifies the encryption context to be used for authenticated encryption . If used
* here , the same value must be supplied to the < code > Decrypt < / code > API or decryption will fail . For more
* information , see < a
* href = " http : / / docs . aws . amazon . com / kms / latest / developerguide / encryption - context . html " > Encryption
* Context < / a > .
* @ return Returns a reference to this object so that method calls can be chained together . */
public EncryptRequest withEncryptionContext ( java . util . Map < String , String > encryptionContext ) { } } | setEncryptionContext ( encryptionContext ) ; return this ; |
public class ServletHttpRequest { public String getPathTranslated ( ) { } } | if ( _pathInfo == null || _pathInfo . length ( ) == 0 ) return null ; if ( _pathTranslated == null ) { Resource resource = _servletHandler . getHttpContext ( ) . getBaseResource ( ) ; if ( resource == null ) return null ; try { resource = resource . addPath ( _pathInfo ) ; File file = resource . getFile ( ) ; if ( file == null ) return null ; _pathTranslated = file . getAbsolutePath ( ) ; } catch ( Exception e ) { log . debug ( LogSupport . EXCEPTION , e ) ; } } return _pathTranslated ; |
public class AmazonDynamoDBAsyncClient { /** * Adds a new table to your account .
* The table name must be unique among those associated with the AWS
* Account issuing the request , and the AWS Region that receives the
* request ( e . g . < code > us - east - 1 < / code > ) .
* The < code > CreateTable < / code > operation triggers an asynchronous
* workflow to begin creating the table . Amazon DynamoDB immediately
* returns the state of the table ( < code > CREATING < / code > ) until the
* table is in the < code > ACTIVE < / code > state . Once the table is in the
* < code > ACTIVE < / code > state , you can perform data plane operations .
* @ param createTableRequest Container for the necessary parameters to
* execute the CreateTable operation on AmazonDynamoDB .
* @ return A Java Future object containing the response from the
* CreateTable service method , as returned by AmazonDynamoDB .
* @ throws AmazonClientException
* If any internal errors are encountered inside the client while
* attempting to make the request or handle the response . For example
* if a network connection is not available .
* @ throws AmazonServiceException
* If an error response is returned by AmazonDynamoDB indicating
* either a problem with the data in the request , or a server side issue . */
public Future < CreateTableResult > createTableAsync ( final CreateTableRequest createTableRequest ) throws AmazonServiceException , AmazonClientException { } } | return executorService . submit ( new Callable < CreateTableResult > ( ) { public CreateTableResult call ( ) throws Exception { return createTable ( createTableRequest ) ; } } ) ; |
public class LogLevel { /** * Prints the help message .
* @ param message message before standard usage information */
public static void printHelp ( String message ) { } } | System . err . println ( message ) ; HelpFormatter help = new HelpFormatter ( ) ; help . printHelp ( LOG_LEVEL , OPTIONS , true ) ; |
public class DeploymentOverviewMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeploymentOverview deploymentOverview , ProtocolMarshaller protocolMarshaller ) { } } | if ( deploymentOverview == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deploymentOverview . getPending ( ) , PENDING_BINDING ) ; protocolMarshaller . marshall ( deploymentOverview . getInProgress ( ) , INPROGRESS_BINDING ) ; protocolMarshaller . marshall ( deploymentOverview . getSucceeded ( ) , SUCCEEDED_BINDING ) ; protocolMarshaller . marshall ( deploymentOverview . getFailed ( ) , FAILED_BINDING ) ; protocolMarshaller . marshall ( deploymentOverview . getSkipped ( ) , SKIPPED_BINDING ) ; protocolMarshaller . marshall ( deploymentOverview . getReady ( ) , READY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class AbstractDatabaseConfiguration { protected AbstractDatabaseConfiguration setDirectory ( @ NonNull String directory ) { } } | if ( directory == null ) { throw new IllegalArgumentException ( "directory cannot be null." ) ; } if ( readonly ) { throw new IllegalStateException ( "DatabaseConfiguration is readonly mode." ) ; } this . directory = directory ; this . customDir = true ; return this ; |
public class AlertPolicyCache { /** * Returns the cache of external service alert conditions for the given policy , creating one if it doesn ' t exist .
* @ param policyId The id of the policy for the cache of external service alert conditions
* @ return The cache of external service alert conditions for the given policy */
public ExternalServiceAlertConditionCache externalServiceAlertConditions ( long policyId ) { } } | ExternalServiceAlertConditionCache cache = externalServiceConditions . get ( policyId ) ; if ( cache == null ) externalServiceConditions . put ( policyId , cache = new ExternalServiceAlertConditionCache ( policyId ) ) ; return cache ; |
public class PCA { /** * { @ inheritDoc } */
@ Override protected void _fit ( Dataframe trainingData ) { } } | ModelParameters modelParameters = knowledgeBase . getModelParameters ( ) ; int n = trainingData . size ( ) ; int d = trainingData . xColumnSize ( ) ; // convert data into matrix
Map < Object , Integer > featureIds = modelParameters . getFeatureIds ( ) ; DataframeMatrix matrixDataset = DataframeMatrix . newInstance ( trainingData , false , null , featureIds ) ; RealMatrix X = matrixDataset . getX ( ) ; // calculate means and subtract them from data
RealVector meanValues = new OpenMapRealVector ( d ) ; for ( Integer columnId : featureIds . values ( ) ) { double mean = 0.0 ; for ( int row = 0 ; row < n ; row ++ ) { mean += X . getEntry ( row , columnId ) ; } mean /= n ; for ( int row = 0 ; row < n ; row ++ ) { X . addToEntry ( row , columnId , - mean ) ; } meanValues . setEntry ( columnId , mean ) ; } modelParameters . setMean ( meanValues ) ; // dxd matrix
RealMatrix covarianceDD = ( X . transpose ( ) . multiply ( X ) ) . scalarMultiply ( 1.0 / ( n - 1.0 ) ) ; EigenDecomposition decomposition = new EigenDecomposition ( covarianceDD ) ; RealVector eigenValues = new ArrayRealVector ( decomposition . getRealEigenvalues ( ) , false ) ; RealMatrix components = decomposition . getV ( ) ; // Whiten Components W = U * L ^ 0.5 ; To whiten them we multiply with L ^ 0.5.
if ( knowledgeBase . getTrainingParameters ( ) . isWhitened ( ) ) { RealMatrix sqrtEigenValues = new DiagonalMatrix ( d ) ; for ( int i = 0 ; i < d ; i ++ ) { sqrtEigenValues . setEntry ( i , i , FastMath . sqrt ( eigenValues . getEntry ( i ) ) ) ; } components = components . multiply ( sqrtEigenValues ) ; } // the eigenvalues and their components are sorted by descending order no need to resort them
Integer maxDimensions = knowledgeBase . getTrainingParameters ( ) . getMaxDimensions ( ) ; Double variancePercentageThreshold = knowledgeBase . getTrainingParameters ( ) . getVariancePercentageThreshold ( ) ; if ( variancePercentageThreshold != null && variancePercentageThreshold <= 1 ) { double totalVariance = 0.0 ; for ( int i = 0 ; i < d ; i ++ ) { totalVariance += eigenValues . getEntry ( i ) ; } double sum = 0.0 ; int varCounter = 0 ; for ( int i = 0 ; i < d ; i ++ ) { sum += eigenValues . getEntry ( i ) / totalVariance ; varCounter ++ ; if ( sum >= variancePercentageThreshold ) { break ; } } if ( maxDimensions == null || maxDimensions > varCounter ) { maxDimensions = varCounter ; } } if ( maxDimensions != null && maxDimensions < d ) { // keep only the maximum selected eigenvalues
eigenValues = eigenValues . getSubVector ( 0 , maxDimensions ) ; // keep only the maximum selected eigenvectors
components = components . getSubMatrix ( 0 , components . getRowDimension ( ) - 1 , 0 , maxDimensions - 1 ) ; } modelParameters . setEigenValues ( eigenValues ) ; modelParameters . setComponents ( components ) ; |
public class KnowledgeExchangeHandler { /** * Gets an Integer context property .
* @ param exchange the exchange
* @ param message the message
* @ param name the name
* @ return the property */
protected Integer getInteger ( Exchange exchange , Message message , String name ) { } } | Object value = getObject ( exchange , message , name ) ; if ( value instanceof Integer ) { return ( Integer ) value ; } else if ( value instanceof Number ) { return Integer . valueOf ( ( ( Number ) value ) . intValue ( ) ) ; } else if ( value instanceof String ) { return Integer . valueOf ( ( ( String ) value ) . trim ( ) ) ; } return null ; |
public class TargetStreamManager { /** * Handle a new stream ID from a control message
* @ param jsMsg */
private void handleNewStreamID ( ControlMessage cMsg ) throws SIResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "handleNewStreamID" , new Object [ ] { cMsg } ) ; handleNewStreamID ( cMsg , null ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "handleNewStreamID" ) ; |
public class MiniTemplatorParser { /** * Otherwise nothing is done and false is returned . */
private boolean conditionalExclude ( int tPosBegin , int tPosEnd ) { } } | if ( isCondEnabled ( condLevel ) ) { return false ; } excludeTemplateRange ( tPosBegin , tPosEnd ) ; return true ; |
public class SearchPortletController { /** * Create a resourceUrl for < code > AJAX _ RESPONSE _ RESOURCE _ ID < / code > . The resource URL is for the
* ajax typing search results response .
* @ param request render request
* @ param response render response */
private String calculateAutocompleteResourceUrl ( RenderRequest request , RenderResponse response ) { } } | final HttpServletRequest httpRequest = this . portalRequestUtils . getPortletHttpRequest ( request ) ; final IPortalUrlBuilder portalUrlBuilder = this . portalUrlProvider . getPortalUrlBuilderByPortletFName ( httpRequest , "search" , UrlType . RESOURCE ) ; final IPortletUrlBuilder portletUrlBuilder = portalUrlBuilder . getPortletUrlBuilder ( portalUrlBuilder . getTargetPortletWindowId ( ) ) ; portletUrlBuilder . setResourceId ( AJAX_RESPONSE_RESOURCE_ID ) ; return portletUrlBuilder . getPortalUrlBuilder ( ) . getUrlString ( ) ; |
public class NoAuthService { /** * ~ Methods * * * * * */
@ Override public PrincipalUser getUser ( String username , String password ) { } } | requireNotDisposed ( ) ; PrincipalUser result = _userService . findUserByUsername ( username ) ; String isPrivileged = _config . getValue ( Property . IS_PRIVILEGED . getName ( ) , Property . IS_PRIVILEGED . getDefaultValue ( ) ) ; if ( result == null ) { result = new PrincipalUser ( _userService . findAdminUser ( ) , username , username + "@gmail.com" ) ; } DAILY_USERS . put ( username , System . currentTimeMillis ( ) ) ; MONTHLY_USERS . put ( username , System . currentTimeMillis ( ) ) ; _monitorService . updateCounter ( MonitorService . Counter . DAILY_USERS , DAILY_USERS . size ( ) , new HashMap < > ( 0 ) ) ; _monitorService . updateCounter ( MonitorService . Counter . MONTHLY_USERS , MONTHLY_USERS . size ( ) , new HashMap < > ( 0 ) ) ; _monitorService . updateCounter ( MonitorService . Counter . UNIQUE_USERS , _userService . getUniqueUserCount ( ) , new HashMap < String , String > ( 0 ) ) ; try { Method method = PrincipalUser . class . getDeclaredMethod ( "setPrivileged" , boolean . class ) ; method . setAccessible ( true ) ; method . invoke ( result , Boolean . parseBoolean ( isPrivileged ) ) ; } catch ( NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { throw new SystemException ( "Failed to change privileged status." , e ) ; } result = _userService . updateUser ( result ) ; return result ; |
public class AlertMessage { /** * Returns true if the digital signature attached to the message verifies . Don ' t do anything with the alert if it
* doesn ' t verify , because that would allow arbitrary attackers to spam your users . */
public boolean isSignatureValid ( ) { } } | try { return ECKey . verify ( Sha256Hash . hashTwice ( content ) , signature , params . getAlertSigningKey ( ) ) ; } catch ( SignatureDecodeException e ) { return false ; } |
public class CommercePriceEntryLocalServiceBaseImpl { /** * Returns a range of commerce price entries matching the UUID and company .
* @ param uuid the UUID of the commerce price entries
* @ param companyId the primary key of the company
* @ param start the lower bound of the range of commerce price entries
* @ param end the upper bound of the range of commerce price entries ( not inclusive )
* @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > )
* @ return the range of matching commerce price entries , or an empty list if no matches were found */
@ Override public List < CommercePriceEntry > getCommercePriceEntriesByUuidAndCompanyId ( String uuid , long companyId , int start , int end , OrderByComparator < CommercePriceEntry > orderByComparator ) { } } | return commercePriceEntryPersistence . findByUuid_C ( uuid , companyId , start , end , orderByComparator ) ; |
public class ImmatureClass { /** * looks to see the field has a runtime visible annotation , if it does it might
* be autowired or some other mechanism attached that makes them less
* interesting for a toString call .
* @ param f the field to check
* @ return if the field has a runtime visible annotation */
private static boolean fieldHasRuntimeVisibleAnnotation ( Field f ) { } } | AnnotationEntry [ ] annotations = f . getAnnotationEntries ( ) ; if ( annotations != null ) { for ( AnnotationEntry annotation : annotations ) { if ( annotation . isRuntimeVisible ( ) ) { return true ; } } } return false ; |
public class PKCS1_PSS { /** * - - - stuff from the PKCS # 1 - PSS specification - - - - - */
public static boolean emsa_pss_verify ( SignatureParamSpec spec , byte [ ] msg , byte [ ] EM , int emBits ) { } } | int emLen = emBits >> 3 ; if ( ( emBits & 7 ) != 0 ) { emLen ++ ; } byte [ ] mHash = hash ( spec , msg ) ; // System . out . println ( " mHash : " + Utils . bytes2String ( mHash ) ) ;
MessageDigest dig = getMessageDigest ( spec ) ; int hLen = dig . getDigestLength ( ) ; // System . out . println ( " hLen : " + hLen ) ;
int sLen = hLen ; if ( EM [ EM . length - 1 ] != ( byte ) 0xBC ) { // System . out . println ( " no BC at the end " ) ;
return false ; } byte [ ] maskedDB = new byte [ emLen - hLen - 1 ] ; byte [ ] H = new byte [ hLen ] ; System . arraycopy ( EM , 0 , maskedDB , 0 , emLen - hLen - 1 ) ; System . arraycopy ( EM , emLen - hLen - 1 , H , 0 , hLen ) ; // TODO : verify if first X bits of maskedDB are zero
byte [ ] dbMask = mgf1 ( spec , H , emLen - hLen - 1 ) ; byte [ ] DB = xor_os ( maskedDB , dbMask ) ; // set leftmost X bits of DB to zero
int tooMuchBits = ( emLen << 3 ) - emBits ; byte mask = ( byte ) ( 0xFF >>> tooMuchBits ) ; DB [ 0 ] &= mask ; // TODO : another consistency check
byte [ ] salt = new byte [ sLen ] ; System . arraycopy ( DB , DB . length - sLen , salt , 0 , sLen ) ; byte [ ] zeroes = new byte [ 8 ] ; byte [ ] m2 = concat ( concat ( zeroes , mHash ) , salt ) ; byte [ ] H2 = hash ( spec , m2 ) ; return Arrays . equals ( H , H2 ) ; |
public class DbPro { /** * Delete record by id with default primary key .
* < pre >
* Example :
* Db . use ( ) . deleteById ( " user " , 15 ) ;
* < / pre >
* @ param tableName the table name of the table
* @ param idValue the id value of the record
* @ return true if delete succeed otherwise false */
public boolean deleteById ( String tableName , Object idValue ) { } } | return deleteByIds ( tableName , config . dialect . getDefaultPrimaryKey ( ) , idValue ) ; |
public class AppUtil { /** * Starts the camera app in order to capture a picture . If an error occurs while starting the
* camera app , an { @ link ActivityNotFoundException } will be thrown .
* @ param activity
* The activity , the captured picture should be passed to by calling its
* < code > onActivityResult < / code > method , as an instance of the class { @ link Activity } .
* The activity may not be null
* @ param requestCode
* The request code , which should be used to pass the captured picture to the given
* activity , as an { @ link Integer } value
* @ param uri
* The URI of the file , the captured image should be saved to , as an instance of the
* class { @ link Uri } . The URI may not be null */
public static void startCameraApp ( @ NonNull final Activity activity , final int requestCode , @ NonNull final Uri uri ) { } } | Condition . INSTANCE . ensureNotNull ( activity , "The activity may not be null" ) ; Condition . INSTANCE . ensureNotNull ( uri , "The URI may not be null" ) ; Intent intent = new Intent ( MediaStore . ACTION_IMAGE_CAPTURE ) ; intent . putExtra ( MediaStore . EXTRA_OUTPUT , uri ) ; if ( intent . resolveActivity ( activity . getPackageManager ( ) ) == null ) { throw new ActivityNotFoundException ( "Camera app not available" ) ; } activity . startActivityForResult ( intent , requestCode ) ; |
public class MessageResultMarshaller { /** * Marshall the given parameter object . */
public void marshall ( MessageResult messageResult , ProtocolMarshaller protocolMarshaller ) { } } | if ( messageResult == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( messageResult . getDeliveryStatus ( ) , DELIVERYSTATUS_BINDING ) ; protocolMarshaller . marshall ( messageResult . getMessageId ( ) , MESSAGEID_BINDING ) ; protocolMarshaller . marshall ( messageResult . getStatusCode ( ) , STATUSCODE_BINDING ) ; protocolMarshaller . marshall ( messageResult . getStatusMessage ( ) , STATUSMESSAGE_BINDING ) ; protocolMarshaller . marshall ( messageResult . getUpdatedToken ( ) , UPDATEDTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ViewTransitionBuilder { /** * Adds a custom { @ link ViewTransformer } , the builder must be cloned if this method is called .
* @ param viewTransformer
* @ return */
public ViewTransitionBuilder addViewTransformer ( @ NonNull ViewTransformer viewTransformer ) { } } | checkModifiability ( ) ; if ( mCustomTransitionController == null ) { mCustomTransitionController = new CustomTransitionController ( ) ; } mCustomTransitionController . addViewTransformer ( viewTransformer ) ; return self ( ) ; |
public class AtomWriter { /** * < p > Write a list of entities ( feed ) to the XML stream . < / p > < p > < b > Note : < / b > Make sure { @ link
* AtomWriter # startDocument ( ) } has been previously invoked to start the XML stream document , and { @ link
* AtomWriter # endDocument ( ) } is invoked after to end it . < / p >
* @ param entities The list of entities to fill in the XML stream . It can not { @ code null } .
* @ param requestContextURL The ' Context URL ' to write for the feed . It can not { @ code null } .
* @ param meta Additional metadata to write .
* @ throws ODataRenderException In case it is not possible to write to the XML stream . */
public void writeFeed ( List < ? > entities , String requestContextURL , Map < String , Object > meta ) throws ODataRenderException { } } | writeStartFeed ( requestContextURL , meta ) ; writeBodyFeed ( entities ) ; writeEndFeed ( ) ; |
public class AbstractApitraryClient { /** * doGet .
* @ param request
* a { @ link com . apitrary . api . request . Request } object .
* @ param < T >
* a T object .
* @ return a { @ link com . apitrary . api . response . Response } object . */
protected < T > Response < T > doGet ( Request < T > request ) { } } | URI uri = buidURI ( request ) ; Timer timer = Timer . tic ( ) ; TransportResult result = getApiClientTransportFactory ( ) . newTransport ( api ) . doGet ( uri ) ; timer . toc ( ) ; log . trace ( result . getStatusCode ( ) + " " + uri . toString ( ) + " took " + timer . getDifference ( ) + "ms" ) ; Response < T > response = toResponse ( timer , result , request ) ; return response ; |
public class JSONUtils { /** * Check if a field is serializable . Don ' t serialize transient , final , synthetic , or inaccessible fields .
* N . B . Tries to set field to accessible , which will require an " opens " declarations from modules that want to
* allow this introspection .
* @ param field
* the field
* @ param onlySerializePublicFields
* if true , only serialize public fields
* @ return true if the field is serializable */
static boolean fieldIsSerializable ( final Field field , final boolean onlySerializePublicFields ) { } } | final int modifiers = field . getModifiers ( ) ; if ( ( ! onlySerializePublicFields || Modifier . isPublic ( modifiers ) ) && ! Modifier . isTransient ( modifiers ) && ! Modifier . isFinal ( modifiers ) && ( ( modifiers & 0x1000 /* synthetic */
) == 0 ) ) { return JSONUtils . isAccessibleOrMakeAccessible ( field ) ; } return false ; |
public class SwapTablesPlanNode { /** * Flag any issues of incompatibility between the two table operands
* of a swap by appending error details to a feedback buffer . These
* details and possibly others should get attached to a
* PlannerErrorException ' s message by the caller .
* @ param theName the first argument to the table swap
* @ param otherName the second argument to the tble swap
* @ param theTable the catalog Table definition named by theName
* @ param otherTable the catalog Table definition named by otherName
* @ return the current feedback output separator ,
* it will be = = TRUE _ FB _ SEPARATOR
* if the feedback buffer is not empty . */
private void validateTableCompatibility ( String theName , String otherName , Table theTable , Table otherTable , FailureMessage failureMessage ) { } } | if ( theTable . getIsdred ( ) != otherTable . getIsdred ( ) ) { failureMessage . addReason ( "To swap table " + theName + " with table " + otherName + " both tables must be DR enabled or both tables must not be DR enabled." ) ; } if ( theTable . getIsreplicated ( ) != otherTable . getIsreplicated ( ) ) { failureMessage . addReason ( "one table is partitioned and the other is not" ) ; } if ( theTable . getTuplelimit ( ) != otherTable . getTuplelimit ( ) ) { failureMessage . addReason ( "the tables differ in the LIMIT PARTITION ROWS constraint" ) ; } if ( ( theTable . getMaterializer ( ) != null || ! theTable . getMvhandlerinfo ( ) . isEmpty ( ) ) || ( otherTable . getMaterializer ( ) != null || ! otherTable . getMvhandlerinfo ( ) . isEmpty ( ) ) ) { failureMessage . addReason ( "one or both of the tables is actually a view" ) ; } StringBuilder viewNames = new StringBuilder ( ) ; if ( viewsDependOn ( theTable , viewNames ) ) { failureMessage . addReason ( theName + " is referenced in views " + viewNames . toString ( ) ) ; } viewNames . setLength ( 0 ) ; if ( viewsDependOn ( otherTable , viewNames ) ) { failureMessage . addReason ( otherName + " is referenced in views " + viewNames . toString ( ) ) ; } |
public class CreateProjectRequest { /** * A list of the Code objects submitted with the project request . If this parameter is specified , the request must
* also include the toolchain parameter .
* @ param sourceCode
* A list of the Code objects submitted with the project request . If this parameter is specified , the request
* must also include the toolchain parameter . */
public void setSourceCode ( java . util . Collection < Code > sourceCode ) { } } | if ( sourceCode == null ) { this . sourceCode = null ; return ; } this . sourceCode = new java . util . ArrayList < Code > ( sourceCode ) ; |
public class JacksonUtils { /** * Serialize an object to { @ link JsonNode } , with a custom class loader .
* @ param obj
* @ param classLoader
* @ return */
public static JsonNode toJson ( Object obj , ClassLoader classLoader ) { } } | return SerializationUtils . toJson ( obj , classLoader ) ; |
public class ExternalContextAccessSkill { /** * Replies the Behaviors skill as fast as possible .
* @ return the skill */
protected final Behaviors getBehaviorsSkill ( ) { } } | if ( this . skillBufferBehaviors == null || this . skillBufferBehaviors . get ( ) == null ) { this . skillBufferBehaviors = $getSkill ( Behaviors . class ) ; } return $castSkill ( Behaviors . class , this . skillBufferBehaviors ) ; |
public class InputStreamOrByteBufferAdapter { /** * Reads the " modified UTF8 " format defined in the Java classfile spec , optionally replacing ' / ' with ' . ' , and
* optionally removing the prefix " L " and the suffix " ; " .
* @ param strStart
* The start index of the string .
* @ param replaceSlashWithDot
* If true , replace ' / ' with ' . ' .
* @ param stripLSemicolon
* If true , string final ' ; ' character .
* @ return The string .
* @ throws IOException
* If an I / O exception occurs . */
public String readString ( final int strStart , final boolean replaceSlashWithDot , final boolean stripLSemicolon ) throws IOException { } } | final int utfLen = readUnsignedShort ( strStart ) ; final int utfStart = strStart + 2 ; final int bufferUnderrunBytes = Math . max ( 0 , utfStart + utfLen - used ) ; if ( bufferUnderrunBytes > 0 ) { readMore ( bufferUnderrunBytes ) ; } final char [ ] chars = new char [ utfLen ] ; int c , c2 , c3 , c4 ; int byteIdx = 0 ; int charIdx = 0 ; for ( ; byteIdx < utfLen ; byteIdx ++ ) { c = buf [ utfStart + byteIdx ] & 0xff ; if ( c > 127 ) { break ; } chars [ charIdx ++ ] = ( char ) ( replaceSlashWithDot && c == '/' ? '.' : c ) ; } while ( byteIdx < utfLen ) { c = buf [ utfStart + byteIdx ] & 0xff ; switch ( c >> 4 ) { case 0 : case 1 : case 2 : case 3 : case 4 : case 5 : case 6 : case 7 : byteIdx ++ ; chars [ charIdx ++ ] = ( char ) ( replaceSlashWithDot && c == '/' ? '.' : c ) ; break ; case 12 : case 13 : byteIdx += 2 ; if ( byteIdx > utfLen ) { throw new IOException ( "Bad modified UTF8" ) ; } c2 = buf [ utfStart + byteIdx - 1 ] ; if ( ( c2 & 0xc0 ) != 0x80 ) { throw new IOException ( "Bad modified UTF8" ) ; } c4 = ( ( c & 0x1f ) << 6 ) | ( c2 & 0x3f ) ; chars [ charIdx ++ ] = ( char ) ( replaceSlashWithDot && c4 == '/' ? '.' : c4 ) ; break ; case 14 : byteIdx += 3 ; if ( byteIdx > utfLen ) { throw new IOException ( "Bad modified UTF8" ) ; } c2 = buf [ utfStart + byteIdx - 2 ] ; c3 = buf [ utfStart + byteIdx - 1 ] ; if ( ( c2 & 0xc0 ) != 0x80 || ( c3 & 0xc0 ) != 0x80 ) { throw new IOException ( "Bad modified UTF8" ) ; } c4 = ( ( c & 0x0f ) << 12 ) | ( ( c2 & 0x3f ) << 6 ) | ( c3 & 0x3f ) ; chars [ charIdx ++ ] = ( char ) ( replaceSlashWithDot && c4 == '/' ? '.' : c4 ) ; break ; default : throw new IOException ( "Bad modified UTF8" ) ; } } if ( charIdx == utfLen && ! stripLSemicolon ) { return new String ( chars ) ; } else { if ( stripLSemicolon ) { if ( charIdx < 2 || chars [ 0 ] != 'L' || chars [ charIdx - 1 ] != ';' ) { throw new IOException ( "Expected string to start with 'L' and end with ';', got \"" + new String ( chars ) + "\"" ) ; } return new String ( chars , 1 , charIdx - 2 ) ; } else { return new String ( chars , 0 , charIdx ) ; } } |
public class gslbsite { /** * Use this API to unset the properties of gslbsite resources .
* Properties that need to be unset are specified in args array . */
public static base_responses unset ( nitro_service client , String sitename [ ] , String args [ ] ) throws Exception { } } | base_responses result = null ; if ( sitename != null && sitename . length > 0 ) { gslbsite unsetresources [ ] = new gslbsite [ sitename . length ] ; for ( int i = 0 ; i < sitename . length ; i ++ ) { unsetresources [ i ] = new gslbsite ( ) ; unsetresources [ i ] . sitename = sitename [ i ] ; } result = unset_bulk_request ( client , unsetresources , args ) ; } return result ; |
public class JavacParser { /** * Extract the name of a Java source ' s package , or null if not found . This method is only used
* before javac parsing to determine the main type name . */
@ VisibleForTesting static String packageName ( String source ) { } } | try ( StringReader r = new StringReader ( source ) ) { StreamTokenizer tokenizer = new StreamTokenizer ( r ) ; tokenizer . slashSlashComments ( true ) ; tokenizer . slashStarComments ( true ) ; StringBuilder sb = new StringBuilder ( ) ; boolean inName = false ; while ( tokenizer . nextToken ( ) != StreamTokenizer . TT_EOF ) { if ( inName ) { switch ( tokenizer . ttype ) { case ';' : return sb . length ( ) > 0 ? sb . toString ( ) : null ; case '.' : sb . append ( '.' ) ; break ; case StreamTokenizer . TT_WORD : sb . append ( tokenizer . sval ) ; break ; default : inName = false ; // Invalid package statement pattern .
break ; } } else if ( tokenizer . ttype == StreamTokenizer . TT_WORD && tokenizer . sval . equals ( "package" ) ) { inName = true ; } } return null ; // Package statement not found .
} catch ( IOException e ) { throw new AssertionError ( "Exception reading string: " + e ) ; } |
public class ElementService { /** * Drags an element some place else
* @ param draggable
* The element to drag
* @ param x
* Offset
* @ param y
* Offset
* @ throws InterruptedException */
public void dragElementTo ( By draggable , int x , int y ) throws InterruptedException { } } | WebDriver driver = getWebDriver ( ) ; Actions clickAndDrag = new Actions ( getWebDriver ( ) ) ; clickAndDrag . dragAndDropBy ( driver . findElement ( draggable ) , x , y ) ; clickAndDrag . perform ( ) ; |
public class TrelloImpl { /** * / * Others */
@ Override public Card createCard ( String listId , Card card ) { } } | card . setIdList ( listId ) ; try { Card createdCard = postForObject ( createUrl ( CREATE_CARD ) . asString ( ) , card , Card . class ) ; createdCard . setInternalTrello ( this ) ; return createdCard ; } catch ( TrelloBadRequestException e ) { throw decodeException ( card , e ) ; } |
public class RemixSettingsMarshaller { /** * Marshall the given parameter object . */
public void marshall ( RemixSettings remixSettings , ProtocolMarshaller protocolMarshaller ) { } } | if ( remixSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( remixSettings . getChannelMappings ( ) , CHANNELMAPPINGS_BINDING ) ; protocolMarshaller . marshall ( remixSettings . getChannelsIn ( ) , CHANNELSIN_BINDING ) ; protocolMarshaller . marshall ( remixSettings . getChannelsOut ( ) , CHANNELSOUT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class TreeInfo { /** * Map operators to their precedence levels . */
public static int opPrec ( JCTree . Tag op ) { } } | switch ( op ) { case POS : case NEG : case NOT : case COMPL : case PREINC : case PREDEC : return prefixPrec ; case POSTINC : case POSTDEC : case NULLCHK : return postfixPrec ; case ASSIGN : return assignPrec ; case BITOR_ASG : case BITXOR_ASG : case BITAND_ASG : case SL_ASG : case SR_ASG : case USR_ASG : case PLUS_ASG : case MINUS_ASG : case MUL_ASG : case DIV_ASG : case MOD_ASG : return assignopPrec ; case OR : return orPrec ; case AND : return andPrec ; case EQ : case NE : return eqPrec ; case LT : case GT : case LE : case GE : return ordPrec ; case BITOR : return bitorPrec ; case BITXOR : return bitxorPrec ; case BITAND : return bitandPrec ; case SL : case SR : case USR : return shiftPrec ; case PLUS : case MINUS : return addPrec ; case MUL : case DIV : case MOD : return mulPrec ; case TYPETEST : return ordPrec ; default : throw new AssertionError ( ) ; } |
public class LocalQPConsumerKeyGroup { /** * All members of a keyGroup share the same getCursor on the itemStream , which
* uses this method to filter the items . This allows us to see if an item matches
* ANY of the members of the group . */
public boolean filterMatches ( AbstractItem item ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "filterMatches" , item ) ; boolean match = false ; LocalQPConsumerKey matchingMember = null ; // Hopefully we have a general consumer so we don ' t need to parse the message
if ( generalMemberCount > 0 ) { // We have a match but we don ' t care which one out of the general members
// actually takes the message , so if one of the general members is the one
// performing the scan they can take the message .
matchingMember = null ; match = true ; } // Damn , all we ' ve got are members with selectors , we ' ll have to parse the message
else { // If there is just the single member see if they match the message
if ( singleMember != null ) { if ( singleMember . filterMatches ( item ) ) { match = true ; matchingMember = singleMember ; } } // Otherwise we give all the members a chance to match it
else { LocalQPConsumerKey keyMember ; int index ; int size = specificKeyMembers . size ( ) ; for ( index = 0 ; ( index < size ) && ! match ; index ++ ) { keyMember = specificKeyMembers . get ( index ) ; // Drop out if one of the members matches it
if ( keyMember . filterMatches ( item ) ) { match = true ; matchingMember = keyMember ; } } } } // we only want to remember this result if get got here as a result of a consumer
// asking for a message .
boolean onConsumerThread = consumerThreadActive && ( Thread . currentThread ( ) . getId ( ) == consumerThreadID ) ; if ( onConsumerThread ) { currentMatch = match ; currentMatchingMember = matchingMember ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "filterMatches" , new Object [ ] { Boolean . valueOf ( match ) , matchingMember } ) ; return match ; |
public class AmazonApiGatewayClient { /** * Updates an existing < a > Method < / a > resource .
* @ param updateMethodRequest
* Request to update an existing < a > Method < / a > resource .
* @ return Result of the UpdateMethod operation returned by the service .
* @ throws UnauthorizedException
* The request is denied because the caller has insufficient permissions .
* @ throws NotFoundException
* The requested resource is not found . Make sure that the request URI is correct .
* @ throws BadRequestException
* The submitted request is not valid , for example , the input is incomplete or incorrect . See the
* accompanying error message for details .
* @ throws ConflictException
* The request configuration has conflicts . For details , see the accompanying error message .
* @ throws TooManyRequestsException
* The request has reached its throttling limit . Retry after the specified time period .
* @ sample AmazonApiGateway . UpdateMethod */
@ Override public UpdateMethodResult updateMethod ( UpdateMethodRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateMethod ( request ) ; |
public class Tokenizer { /** * Returns a copy of the string , with leading and trailing whitespaces stripped .
* < pre >
* " \ r \ n aaa \ r \ n bbb " = = & gt ; " \ naaa \ n bbb "
* " aaa \ r \ n bbb \ r \ n " = = & gt ; " aaa \ nbbb \ n "
* < / pre >
* @ param textBuf the string builder object
* @ param end the ending index , exclusive .
* @ param trim whether to trim
* @ return the trimmed string */
private static String trimBuffer ( StringBuilder textBuf , int end , boolean trim ) { } } | if ( ! trim ) { return textBuf . substring ( 0 , end ) ; } int start = 0 ; boolean leadingLF = false ; boolean tailingLF = false ; char c ; // leading whitespace
for ( int i = 0 ; i < end ; i ++ ) { c = textBuf . charAt ( i ) ; if ( c == LF || c == CR ) { leadingLF = true ; } else if ( ! Character . isWhitespace ( c ) ) { start = i ; break ; } } if ( leadingLF && start == 0 ) { return String . valueOf ( LF ) ; } // trailing whitespace
for ( int i = end - 1 ; i > start ; i -- ) { c = textBuf . charAt ( i ) ; if ( c == LF || c == CR ) { tailingLF = true ; } else if ( ! Character . isWhitespace ( c ) ) { end = i + 1 ; break ; } } // restore a new line character which is leading whitespace
if ( leadingLF ) { textBuf . setCharAt ( -- start , LF ) ; } // restore a new line character which is tailing whitespace
if ( tailingLF ) { textBuf . setCharAt ( end ++ , LF ) ; } return textBuf . substring ( start , end ) ; |
public class EventNotificationUrl { /** * Get Resource Url for GetEvent
* @ param eventId The unique identifier of the event being retrieved . An event is a notification about a create , read , update , or delete on an order , product , discount or category .
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting to update data using this parameter may cause data loss .
* @ return String Resource Url */
public static MozuUrl getEventUrl ( String eventId , String responseFields ) { } } | UrlFormatter formatter = new UrlFormatter ( "/api/event/pull/{eventId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "eventId" , eventId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . HOME_POD ) ; |
public class NodeWrapper { /** * { @ inheritDoc } */
@ Override public String getURI ( ) { } } | String URI = "" ; switch ( nodeKind ) { case ELEMENT : case ATTRIBUTE : case NAMESPACE : if ( ! "" . equals ( qName . getPrefix ( ) ) ) { URI = qName . getNamespaceURI ( ) ; } break ; default : // Do nothing .
} // Return URI or empty string .
return URI ; |
public class JcrPropertyDefinition { /** * Returns < code > true < / code > if < code > value < / code > can be cast to < code > property . getRequiredType ( ) < / code > per the type
* conversion rules in section 3.6.4 of the JCR 2.0 specification AND < code > value < / code > satisfies the constraints ( if any )
* for the property definition . If the property definition has a required type of { @ link PropertyType # UNDEFINED } , the cast
* will be considered to have succeeded and the value constraints ( if any ) will be interpreted using the semantics for the
* type specified in < code > value . getType ( ) < / code > .
* @ param value the value to be validated
* @ param session the session in which the constraints are to be checked ; may not be null
* @ return < code > true < / code > if the value can be cast to the required type for the property definition ( if it exists ) and
* satisfies the constraints for the property ( if any exist ) .
* @ see PropertyDefinition # getValueConstraints ( )
* @ see # satisfiesConstraints ( Value , JcrSession ) */
boolean canCastToTypeAndSatisfyConstraints ( Value value , JcrSession session ) { } } | try { assert value instanceof JcrValue : "Illegal implementation of Value interface" ; ( ( JcrValue ) value ) . asType ( getRequiredType ( ) ) ; // throws ValueFormatException if there ' s a problem
return satisfiesConstraints ( value , session ) ; } catch ( javax . jcr . ValueFormatException | org . modeshape . jcr . value . ValueFormatException vfe ) { // Cast failed
return false ; } |
public class BigQueryConfiguration { /** * Sets the Bigquery access related fields in the JobConf for input connector .
* @ param config the job configuration .
* @ param projectId the project containing the table to read the intermediate results to .
* @ param datasetId the dataset to write the intermediate results to .
* @ param tableId the table to write the intermediate results to . */
public static void configureBigQueryInput ( Configuration config , String projectId , String datasetId , String tableId ) throws IOException { } } | // Check preconditions .
Preconditions . checkArgument ( ! Strings . isNullOrEmpty ( datasetId ) , "datasetId must not be null or empty." ) ; Preconditions . checkArgument ( ! Strings . isNullOrEmpty ( tableId ) , "tableId must not be null or empty." ) ; // Project is optional , if not set use default project .
if ( ! Strings . isNullOrEmpty ( projectId ) ) { logger . atInfo ( ) . log ( "Using specified project-id '%s' for input" , projectId ) ; config . set ( INPUT_PROJECT_ID_KEY , projectId ) ; // For user - friendliness , we ' ll helpfully backfill the input - specific projectId into the
// " global " projectId for now .
// TODO ( user ) : Maybe don ' t try to be user - friendly here .
if ( Strings . isNullOrEmpty ( config . get ( PROJECT_ID_KEY ) ) ) { logger . atWarning ( ) . log ( "No job-level projectId specified in '%s', using '%s' for it." , PROJECT_ID_KEY , projectId ) ; config . set ( PROJECT_ID_KEY , projectId ) ; } } else { String defaultProjectId = ConfigurationUtil . getMandatoryConfig ( config , PROJECT_ID_KEY ) ; logger . atInfo ( ) . log ( "Using default project-id '%s' since none specified for input." , defaultProjectId ) ; config . set ( INPUT_PROJECT_ID_KEY , defaultProjectId ) ; } config . set ( INPUT_DATASET_ID_KEY , datasetId ) ; config . set ( INPUT_TABLE_ID_KEY , tableId ) ; |
public class FormatFactory { /** * Searches for a format element in the given element . If none is found the XML tree hierarchy
* is searched upwards unto the root . If this is the case the default format object is returned . */
public static NumberFormat getNumberFormat ( final Element element ) { } } | if ( XMLTags . FORMAT . equals ( element . getName ( ) ) ) { return createNumberFormat ( element ) ; } Element child = element . getChild ( XMLTags . FORMAT ) ; if ( child != null ) { return createNumberFormat ( child ) ; } return getNumberFormat ( element . getParentElement ( ) ) ; |
public class ESSyncService { /** * 删除操作dml
* @ param config es配置
* @ param dml dml数据 */
private void delete ( ESSyncConfig config , Dml dml ) { } } | List < Map < String , Object > > dataList = dml . getData ( ) ; if ( dataList == null || dataList . isEmpty ( ) ) { return ; } SchemaItem schemaItem = config . getEsMapping ( ) . getSchemaItem ( ) ; for ( Map < String , Object > data : dataList ) { if ( data == null || data . isEmpty ( ) ) { continue ; } ESMapping mapping = config . getEsMapping ( ) ; // - - - - - 是主表 - - - - -
if ( schemaItem . getMainTable ( ) . getTableName ( ) . equalsIgnoreCase ( dml . getTable ( ) ) ) { if ( mapping . get_id ( ) != null ) { FieldItem idFieldItem = schemaItem . getIdFieldItem ( mapping ) ; // 主键为简单字段
if ( ! idFieldItem . isMethod ( ) && ! idFieldItem . isBinaryOp ( ) ) { Object idVal = esTemplate . getValFromData ( mapping , data , idFieldItem . getFieldName ( ) , idFieldItem . getColumn ( ) . getColumnName ( ) ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Main table delete es index, destination:{}, table: {}, index: {}, id: {}" , config . getDestination ( ) , dml . getTable ( ) , mapping . get_index ( ) , idVal ) ; } esTemplate . delete ( mapping , idVal , null ) ; } else { // - - - - - 主键带函数 , 查询sql获取主键删除 - - - - -
// FIXME 删除时反查sql为空记录 , 无法获获取 id field 值
mainTableDelete ( config , dml , data ) ; } } else { FieldItem pkFieldItem = schemaItem . getIdFieldItem ( mapping ) ; if ( ! pkFieldItem . isMethod ( ) && ! pkFieldItem . isBinaryOp ( ) ) { Map < String , Object > esFieldData = new LinkedHashMap < > ( ) ; Object pkVal = esTemplate . getESDataFromDmlData ( mapping , data , esFieldData ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Main table delete es index, destination:{}, table: {}, index: {}, pk: {}" , config . getDestination ( ) , dml . getTable ( ) , mapping . get_index ( ) , pkVal ) ; } esFieldData . remove ( pkFieldItem . getFieldName ( ) ) ; esFieldData . keySet ( ) . forEach ( key -> esFieldData . put ( key , null ) ) ; esTemplate . delete ( mapping , pkVal , esFieldData ) ; } else { // - - - - - 主键带函数 , 查询sql获取主键删除 - - - - -
mainTableDelete ( config , dml , data ) ; } } } // 从表的操作
for ( TableItem tableItem : schemaItem . getAliasTableItems ( ) . values ( ) ) { if ( tableItem . isMain ( ) ) { continue ; } if ( ! tableItem . getTableName ( ) . equals ( dml . getTable ( ) ) ) { continue ; } // 关联条件出现在主表查询条件是否为简单字段
boolean allFieldsSimple = true ; for ( FieldItem fieldItem : tableItem . getRelationSelectFieldItems ( ) ) { if ( fieldItem . isMethod ( ) || fieldItem . isBinaryOp ( ) ) { allFieldsSimple = false ; break ; } } // 所有查询字段均为简单字段
if ( allFieldsSimple ) { // 不是子查询
if ( ! tableItem . isSubQuery ( ) ) { // - - - - - 关联表简单字段更新为null - - - - -
Map < String , Object > esFieldData = new LinkedHashMap < > ( ) ; for ( FieldItem fieldItem : tableItem . getRelationSelectFieldItems ( ) ) { esFieldData . put ( Util . cleanColumn ( fieldItem . getFieldName ( ) ) , null ) ; } joinTableSimpleFieldOperation ( config , dml , data , tableItem , esFieldData ) ; } else { // - - - - - 关联子表简单字段更新 - - - - -
subTableSimpleFieldOperation ( config , dml , data , null , tableItem ) ; } } else { // - - - - - 关联子表复杂字段更新 执行全sql更新es - - - - -
wholeSqlOperation ( config , dml , data , null , tableItem ) ; } } } |
public class RequestMessage { /** * Parse a string of query parameters into a Map representing the values
* stored using the name as the key .
* @ param data
* @ return Map
* @ throws IllegalArgumentException
* if the string is formatted incorrectly */
private Map < String , String [ ] > parseQueryString ( String data ) { } } | Map < String , String [ ] > map = new Hashtable < String , String [ ] > ( ) ; if ( null == data ) { return map ; } String valArray [ ] = null ; char [ ] chars = data . toCharArray ( ) ; int key_start = 0 ; for ( int i = 0 ; i < chars . length ; i ++ ) { // look for the key name delimiter
if ( '=' == chars [ i ] ) { if ( i == key_start ) { // missing the key name
throw new IllegalArgumentException ( "Missing key name: " + i ) ; } String key = parseName ( chars , key_start , i ) ; int value_start = ++ i ; for ( ; i < chars . length && '&' != chars [ i ] ; i ++ ) { // just keep looping looking for the end or &
} if ( i > value_start ) { // did find at least one char for the value
String value = parseName ( chars , value_start , i ) ; if ( map . containsKey ( key ) ) { String oldVals [ ] = map . get ( key ) ; valArray = new String [ oldVals . length + 1 ] ; System . arraycopy ( oldVals , 0 , valArray , 0 , oldVals . length ) ; valArray [ oldVals . length ] = value ; } else { valArray = new String [ ] { value } ; } map . put ( key , valArray ) ; } key_start = i + 1 ; } } return map ; |
public class JapaneseChronology { /** * Obtains a local date in Japanese calendar system from the
* proleptic - year and day - of - year fields .
* The day - of - year in this factory is expressed relative to the start of the proleptic year .
* The Japanese proleptic year and day - of - year are the same as those in the ISO calendar system .
* They are not reset when the era changes .
* @ param prolepticYear the proleptic - year
* @ param dayOfYear the day - of - year
* @ return the Japanese local date , not null
* @ throws DateTimeException if unable to create the date */
@ Override public JapaneseDate dateYearDay ( int prolepticYear , int dayOfYear ) { } } | LocalDate date = LocalDate . ofYearDay ( prolepticYear , dayOfYear ) ; return date ( prolepticYear , date . getMonthValue ( ) , date . getDayOfMonth ( ) ) ; |
public class CmsEntity { /** * Removes the child entity change handler . < p >
* @ param child the child entity */
private void removeChildChangeHandler ( CmsEntity child ) { } } | HandlerRegistration reg = m_changeHandlerRegistry . remove ( child . getId ( ) ) ; if ( reg != null ) { reg . removeHandler ( ) ; } |
public class DrawerUtils { /** * gets the drawerItem by a defined tag from a drawerItem list
* @ param drawerItems
* @ param tag
* @ return */
public static IDrawerItem getDrawerItem ( List < IDrawerItem > drawerItems , Object tag ) { } } | if ( tag != null ) { for ( IDrawerItem drawerItem : drawerItems ) { if ( tag . equals ( drawerItem . getTag ( ) ) ) { return drawerItem ; } } } return null ; |
public class ProbeAtThrowMethodAdapter { /** * Inject code to fire a probe before any throw instruction . */
@ Override public void visitInsn ( int opcode ) { } } | if ( opcode == ATHROW && ! enabledListeners . isEmpty ( ) ) { String key = createKey ( ) ; ProbeImpl probe = getProbe ( key ) ; long probeId = probe . getIdentifier ( ) ; setProbeInProgress ( true ) ; visitInsn ( DUP ) ; // throwable throwable
visitLdcInsn ( Long . valueOf ( probeId ) ) ; // throwable throwable long1 long2
visitInsn ( DUP2_X1 ) ; // throwable long1 long2 throwable long1 long2
visitInsn ( POP2 ) ; // throwable long1 long2 throwable
if ( isStatic ( ) ) { visitInsn ( ACONST_NULL ) ; // throwable long1 long2 throwable this
} else { visitVarInsn ( ALOAD , 0 ) ; // throwable long1 long2 throwable this
} visitInsn ( SWAP ) ; // throwable long1 long2 this throwable
visitInsn ( ACONST_NULL ) ; // throwable long1 long2 this throwable null
visitInsn ( SWAP ) ; // throwable long1 long2 this null throwable
visitFireProbeInvocation ( ) ; // throwable
setProbeInProgress ( false ) ; setProbeListeners ( probe , enabledListeners ) ; } super . visitInsn ( opcode ) ; |
public class authenticationvserver_auditnslogpolicy_binding { /** * Use this API to fetch authenticationvserver _ auditnslogpolicy _ binding resources of given name . */
public static authenticationvserver_auditnslogpolicy_binding [ ] get ( nitro_service service , String name ) throws Exception { } } | authenticationvserver_auditnslogpolicy_binding obj = new authenticationvserver_auditnslogpolicy_binding ( ) ; obj . set_name ( name ) ; authenticationvserver_auditnslogpolicy_binding response [ ] = ( authenticationvserver_auditnslogpolicy_binding [ ] ) obj . get_resources ( service ) ; return response ; |
public class BadGateway { /** * Returns a static BadGateway instance and set the { @ link # payload } thread local
* with cause specified .
* When calling the instance on { @ link # getMessage ( ) } method , it will return whatever
* stored in the { @ link # payload } thread local
* @ param cause the cause
* @ return a static BadGateway instance as described above */
public static BadGateway of ( Throwable cause ) { } } | if ( _localizedErrorMsg ( ) ) { return of ( cause , defaultMessage ( BAD_GATEWAY ) ) ; } else { touchPayload ( ) . cause ( cause ) ; return _INSTANCE ; } |
public class MessageProcessor { /** * Same as { @ link # createMessage ( ConnectionContext , BasicMessage , Map ) } with < code > null < / code > headers . */
protected Message createMessage ( ConnectionContext context , BasicMessage basicMessage ) throws JMSException { } } | return createMessage ( context , basicMessage , null ) ; |
public class KeyStoreManager { /** * Expands the $ { hostname } with the node ' s hostname .
* @ param subjectDN
* @ param nodeHostName
* @ return String */
public static String expandHostNameVariable ( String subjectDN , String nodeHostName ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "expandHostNameVariable" , new Object [ ] { subjectDN , nodeHostName } ) ; String expandedSubjectDN = subjectDN ; int index1 = subjectDN . indexOf ( "${hostname}" ) ; if ( index1 != - 1 ) { String firstPart = subjectDN . substring ( 0 , index1 ) ; String lastPart = subjectDN . substring ( index1 + "${hostname}" . length ( ) ) ; // String . substring always returns non - null
if ( ! firstPart . equals ( "" ) && ! lastPart . equals ( "" ) ) expandedSubjectDN = firstPart + nodeHostName + lastPart ; else if ( ! firstPart . equals ( "" ) ) expandedSubjectDN = firstPart + nodeHostName ; else if ( ! lastPart . equals ( "" ) ) expandedSubjectDN = nodeHostName + lastPart ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "expandHostNameVariable -> " + expandedSubjectDN ) ; return expandedSubjectDN ; |
public class SegmentClipper { /** * Intersection of two segments */
private boolean intersection ( final long pX0 , final long pY0 , final long pX1 , final long pY1 , final long pX2 , final long pY2 , final long pX3 , final long pY3 ) { } } | return SegmentIntersection . intersection ( pX0 , pY0 , pX1 , pY1 , pX2 , pY2 , pX3 , pY3 , mOptimIntersection ) ; |
public class ConfigParser { /** * Set the config file
* @ param file
* the SeLion Grid config file to use */
public static synchronized ConfigParser setConfigFile ( String file ) { } } | LOGGER . entering ( file ) ; if ( configuration == null ) { configFile = file ; } LOGGER . exiting ( parser . toString ( ) ) ; return parser ; |
public class XMLConfigParser { /** * Resolves resource path specified by & lt ; include file ? location ? & gt ; using the < code > WsLocationAdmin < / code > service .
* The includePath is resolved against the resourcePath if specified . If resourcePath or includePath cannot
* be resolved a null is returned .
* @ param includePath
* @ param basePath
* @ param wsLocationAdmin
* @ return < code > WsResource < / code > if resolved . Null otherwise . */
static WsResource resolveInclude ( String includePath , String basePath , WsLocationAdmin wsLocationAdmin ) { } } | if ( includePath == null ) { return null ; } includePath = includePath . trim ( ) ; if ( includePath . length ( ) == 0 ) { return null ; } if ( basePath == null ) { // no basePath - resolve includePath as is
String normalIncludePath = wsLocationAdmin . resolveString ( includePath ) ; return wsLocationAdmin . resolveResource ( normalIncludePath ) ; } else { String normalIncludePath = wsLocationAdmin . resolveString ( includePath ) ; if ( PathUtils . pathIsAbsolute ( normalIncludePath ) ) { // includePath is absolute - resolve includePath as is
return wsLocationAdmin . resolveResource ( normalIncludePath ) ; } else { // includePath is relative - resolve against basePath
String normalBasePath = wsLocationAdmin . resolveString ( basePath ) ; String normalParentPath = PathUtils . getParent ( normalBasePath ) ; if ( normalParentPath == null ) { return wsLocationAdmin . resolveResource ( normalIncludePath ) ; } else if ( normalParentPath . endsWith ( "/" ) ) { return wsLocationAdmin . resolveResource ( normalParentPath + normalIncludePath ) ; } else { return wsLocationAdmin . resolveResource ( normalParentPath + "/" + normalIncludePath ) ; } } } |
public class StateAssignmentOperation { /** * Determine the subset of { @ link KeyGroupsStateHandle KeyGroupsStateHandles } with correct
* key group index for the given subtask { @ link KeyGroupRange } .
* < p > This is publicly visible to be used in tests . */
public static List < KeyedStateHandle > getKeyedStateHandles ( Collection < ? extends KeyedStateHandle > keyedStateHandles , KeyGroupRange subtaskKeyGroupRange ) { } } | List < KeyedStateHandle > subtaskKeyedStateHandles = new ArrayList < > ( keyedStateHandles . size ( ) ) ; for ( KeyedStateHandle keyedStateHandle : keyedStateHandles ) { KeyedStateHandle intersectedKeyedStateHandle = keyedStateHandle . getIntersection ( subtaskKeyGroupRange ) ; if ( intersectedKeyedStateHandle != null ) { subtaskKeyedStateHandles . add ( intersectedKeyedStateHandle ) ; } } return subtaskKeyedStateHandles ; |
public class ServerChannelBuilder { /** * Removes a permission overwrite for the given entity .
* @ param < T > The type of entity to hold the permission , usually < code > User < / code > or < code > Role < / code >
* @ param permissionable The entity which permission overwrite should be removed .
* @ return The current instance in order to chain call methods . */
public < T extends Permissionable & DiscordEntity > ServerChannelBuilder removePermissionOverwrite ( T permissionable ) { } } | delegate . removePermissionOverwrite ( permissionable ) ; return this ; |
public class BaseMap { /** * Returns the property value specified by ' key ' within this map . */
public Object getProperty ( PropertyKey key ) { } } | // Delegate up to any parent map
if ( _delegateMap != null ) return _delegateMap . getProperty ( key ) ; // If neither found a value , return the default value
return key . getDefaultValue ( ) ; |
public class ProjectionPlanNode { /** * Replace the column names output schema of the child node with the
* output schema column names of this node . We use this when we
* delete an unnecessary projection node . We only need
* to make sure the column names are changed , since we
* will have checked carefully that everything else is the
* same .
* @ param child */
public void replaceChildOutputSchemaNames ( AbstractPlanNode child ) { } } | NodeSchema childSchema = child . getTrueOutputSchema ( false ) ; NodeSchema mySchema = getOutputSchema ( ) ; assert ( childSchema . size ( ) == mySchema . size ( ) ) ; for ( int idx = 0 ; idx < childSchema . size ( ) ; idx += 1 ) { SchemaColumn cCol = childSchema . getColumn ( idx ) ; SchemaColumn myCol = mySchema . getColumn ( idx ) ; assert ( cCol . getValueType ( ) == myCol . getValueType ( ) ) ; assert ( cCol . getExpression ( ) instanceof TupleValueExpression ) ; assert ( myCol . getExpression ( ) instanceof TupleValueExpression ) ; cCol . reset ( myCol . getTableName ( ) , myCol . getTableAlias ( ) , myCol . getColumnName ( ) , myCol . getColumnAlias ( ) ) ; } |
public class X509CertImpl { /** * Gets the DER encoded extension identified by the given
* oid String .
* @ param oid the Object Identifier value for the extension . */
public byte [ ] getExtensionValue ( String oid ) { } } | try { ObjectIdentifier findOID = new ObjectIdentifier ( oid ) ; String extAlias = OIDMap . getName ( findOID ) ; Extension certExt = null ; CertificateExtensions exts = ( CertificateExtensions ) info . get ( CertificateExtensions . NAME ) ; if ( extAlias == null ) { // may be unknown
// get the extensions , search thru ' for this oid
if ( exts == null ) { return null ; } for ( Extension ex : exts . getAllExtensions ( ) ) { ObjectIdentifier inCertOID = ex . getExtensionId ( ) ; if ( inCertOID . equals ( ( Object ) findOID ) ) { certExt = ex ; break ; } } } else { // there ' s sub - class that can handle this extension
try { certExt = ( Extension ) this . get ( extAlias ) ; } catch ( CertificateException e ) { // get ( ) throws an Exception instead of returning null , ignore
} } if ( certExt == null ) { if ( exts != null ) { certExt = exts . getUnparseableExtensions ( ) . get ( oid ) ; } if ( certExt == null ) { return null ; } } byte [ ] extData = certExt . getExtensionValue ( ) ; if ( extData == null ) { return null ; } DerOutputStream out = new DerOutputStream ( ) ; out . putOctetString ( extData ) ; return out . toByteArray ( ) ; } catch ( Exception e ) { return null ; } |
public class FileSearchExtensions { /** * Checks if the given file contains in the parent file .
* @ param fileToSearch
* The parent directory to search .
* @ param pathname
* The file to search .
* @ return ' s true if the file exists in the parent directory otherwise false . */
public static boolean containsFile ( final File fileToSearch , final String pathname ) { } } | final String [ ] allFiles = fileToSearch . list ( ) ; if ( allFiles == null ) { return false ; } final List < String > list = Arrays . asList ( allFiles ) ; return list . contains ( pathname ) ; |
public class AnnotationReader { /** * フィールドに付与されたアノテーションを持つか判定します 。
* @ since 2.0
* @ param field 判定対象のフィールド
* @ param annClass アノテーションのタイプ
* @ return trueの場合 、 アノテーションを持ちます 。 */
public < A extends Annotation > boolean hasAnnotation ( final Field field , final Class < A > annClass ) { } } | return getAnnotation ( field , annClass ) != null ; |
public class RowAVLDiskData { /** * Used when data is read from the disk into the Cache the first time .
* New Nodes are created which are then indexed . */
void setNewNodes ( ) { } } | int index = tTable . getIndexCount ( ) ; nPrimaryNode = new NodeAVLMemoryPointer ( this ) ; NodeAVL n = nPrimaryNode ; for ( int i = 1 ; i < index ; i ++ ) { n . nNext = new NodeAVLMemoryPointer ( this ) ; n = n . nNext ; } |
public class FactoryFiducialCalibration { /** * Detector for a grid of square targets . All squares must be entirely visible inside the image .
* @ see boofcv . alg . fiducial . calib . grid . DetectSquareGridFiducial
* @ param config Configuration for chessboard detector
* @ return Square grid target detector . */
public static CalibrationDetectorSquareGrid squareGrid ( @ Nullable ConfigSquareGrid config , ConfigGridDimen configDimen ) { } } | if ( config == null ) config = new ConfigSquareGrid ( ) ; config . checkValidity ( ) ; return new CalibrationDetectorSquareGrid ( config , configDimen ) ; |
public class ReplicaReader { /** * Helper method to assemble all possible / needed replica get requests .
* The number of configured replicas is also loaded on demand for each request . In the future , this can be
* maybe optimized .
* @ param core the core reference .
* @ param id the id of the document to load from the replicas .
* @ param type the replica mode type .
* @ param bucket the name of the bucket to load it from .
* @ return a list of requests to perform ( both regular and replica get ) . */
private static Observable < BinaryRequest > assembleRequests ( final ClusterFacade core , final String id , final ReplicaMode type , final String bucket ) { } } | if ( type != ReplicaMode . ALL ) { return Observable . just ( ( BinaryRequest ) new ReplicaGetRequest ( id , bucket , ( short ) type . ordinal ( ) ) ) ; } return Observable . defer ( new Func0 < Observable < GetClusterConfigResponse > > ( ) { @ Override public Observable < GetClusterConfigResponse > call ( ) { return core . send ( new GetClusterConfigRequest ( ) ) ; } } ) . map ( new Func1 < GetClusterConfigResponse , Integer > ( ) { @ Override public Integer call ( GetClusterConfigResponse response ) { CouchbaseBucketConfig conf = ( CouchbaseBucketConfig ) response . config ( ) . bucketConfig ( bucket ) ; return conf . numberOfReplicas ( ) ; } } ) . flatMap ( new Func1 < Integer , Observable < BinaryRequest > > ( ) { @ Override public Observable < BinaryRequest > call ( Integer max ) { List < BinaryRequest > requests = new ArrayList < BinaryRequest > ( ) ; requests . add ( new GetRequest ( id , bucket ) ) ; for ( int i = 0 ; i < max ; i ++ ) { requests . add ( new ReplicaGetRequest ( id , bucket , ( short ) ( i + 1 ) ) ) ; } return Observable . from ( requests ) ; } } ) ; |
public class Months { /** * Obtains an instance of < code > Months < / code > that may be cached .
* < code > Months < / code > is immutable , so instances can be cached and shared .
* This factory method provides access to shared instances .
* @ param months the number of months to obtain an instance for
* @ return the instance of Months */
public static Months months ( int months ) { } } | switch ( months ) { case 0 : return ZERO ; case 1 : return ONE ; case 2 : return TWO ; case 3 : return THREE ; case 4 : return FOUR ; case 5 : return FIVE ; case 6 : return SIX ; case 7 : return SEVEN ; case 8 : return EIGHT ; case 9 : return NINE ; case 10 : return TEN ; case 11 : return ELEVEN ; case 12 : return TWELVE ; case Integer . MAX_VALUE : return MAX_VALUE ; case Integer . MIN_VALUE : return MIN_VALUE ; default : return new Months ( months ) ; } |
public class EnumFacingUtils { /** * Rotates facing { @ code count } times .
* @ param facing the facing
* @ param count the count
* @ return the enum facing */
public static EnumFacing rotateFacing ( EnumFacing facing , int count ) { } } | if ( facing == null ) return null ; while ( count -- > 0 ) facing = facing . rotateAround ( EnumFacing . Axis . Y ) ; return facing ; |
public class FormSpec { /** * Parses an encoded form specification and initializes all required fields . The encoded
* description must be in lower case .
* @ param encodedDescription the FormSpec in an encoded format
* @ throws NullPointerException if { @ code encodedDescription } is { @ code null }
* @ throws IllegalArgumentException if { @ code encodedDescription } is empty , whitespace , has no
* size , or is otherwise invalid */
private void parseAndInitValues ( String encodedDescription ) { } } | checkNotBlank ( encodedDescription , "The encoded form specification must not be null, empty or whitespace." ) ; String [ ] token = TOKEN_SEPARATOR_PATTERN . split ( encodedDescription ) ; checkArgument ( token . length > 0 , "The form spec must not be empty." ) ; int nextIndex = 0 ; String next = token [ nextIndex ++ ] ; // Check if the first token is an orientation .
DefaultAlignment alignment = DefaultAlignment . valueOf ( next , isHorizontal ( ) ) ; if ( alignment != null ) { setDefaultAlignment ( alignment ) ; checkArgument ( token . length > 1 , "The form spec must provide a size." ) ; next = token [ nextIndex ++ ] ; } setSize ( parseSize ( next ) ) ; if ( nextIndex < token . length ) { setResizeWeight ( parseResizeWeight ( token [ nextIndex ] ) ) ; } |
public class DiagnosticsInner { /** * Get Site Analyses .
* Get Site Analyses .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param siteName Site Name
* @ param diagnosticCategory Diagnostic Category
* @ 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 < List < AnalysisDefinitionInner > > listSiteAnalysesAsync ( final String resourceGroupName , final String siteName , final String diagnosticCategory , final ListOperationCallback < AnalysisDefinitionInner > serviceCallback ) { } } | return AzureServiceFuture . fromPageResponse ( listSiteAnalysesSinglePageAsync ( resourceGroupName , siteName , diagnosticCategory ) , new Func1 < String , Observable < ServiceResponse < Page < AnalysisDefinitionInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < AnalysisDefinitionInner > > > call ( String nextPageLink ) { return listSiteAnalysesNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ; |
public class Cache2kBuilder { /** * A set of listeners . Listeners added in this collection will be
* executed in a asynchronous mode .
* @ throws IllegalArgumentException if an identical listener is already added .
* @ param listener The listener to add */
public final Cache2kBuilder < K , V > addAsyncListener ( CacheEntryOperationListener < K , V > listener ) { } } | config ( ) . getAsyncListeners ( ) . add ( wrapCustomizationInstance ( listener ) ) ; return this ; |
public class RegularUtils { /** * < p > 正则提取匹配到的内容 , 默认提取索引为0 < / p >
* < p > 例如 : < / p >
* author : Crab2Died
* date : 2017年06月02日 15:49:51
* @ param pattern 匹配目标内容
* @ param reg 正则表达式
* @ return 提取内容集合 */
public static String match ( String pattern , String reg ) { } } | String match = null ; List < String > matches = match ( pattern , reg , 0 ) ; if ( null != matches && matches . size ( ) > 0 ) { match = matches . get ( 0 ) ; } return match ; |
public class WrapLayout { /** * Returns the minimum dimensions needed to layout the < i > visible < / i >
* components contained in the specified target container .
* @ param target the component which needs to be laid out
* @ return the minimum dimensions to lay out the
* subcomponents of the specified container */
@ Override public Dimension minimumLayoutSize ( Container target ) { } } | Dimension minimum = layoutSize ( target , false ) ; minimum . width -= ( getHgap ( ) + 1 ) ; return minimum ; |
public class BaseApplet { /** * A utility method to get an Input stream from a filename or URL string .
* @ param strFilename The filename or url to open as an Input Stream .
* @ return The imput stream ( or null if there was an error ) . */
public InputStream getInputStream ( String strFilename ) { } } | InputStream streamIn = null ; if ( ( strFilename != null ) && ( strFilename . length ( ) > 0 ) ) { try { URL url = null ; if ( strFilename . indexOf ( ':' ) == - 1 ) if ( this . getApplication ( ) != null ) url = this . getApplication ( ) . getResourceURL ( strFilename , this ) ; if ( url != null ) streamIn = url . openStream ( ) ; } catch ( Exception ex ) { streamIn = null ; } } if ( streamIn == null ) streamIn = Util . getInputStream ( strFilename , this . getApplication ( ) ) ; return streamIn ; |
public class CmsSiteManagerImpl { /** * Checks if the given path is that of a shared folder . < p >
* @ param name a path prefix
* @ return true if the given prefix represents a shared folder */
public boolean isSharedFolder ( String name ) { } } | return ( m_sharedFolder != null ) && m_sharedFolder . equals ( CmsStringUtil . joinPaths ( "/" , name , "/" ) ) ; |
public class CmsEditProjectDialog { /** * Sets the user Group name . < p >
* @ param userGroup the user Group name to set */
public void setUserGroup ( String userGroup ) { } } | CmsGroup group = checkGroup ( userGroup ) ; if ( group != null ) { m_project . setGroupId ( group . getId ( ) ) ; } |
public class PtrFrameLayout { /** * If at the top and not in loading , reset */
private boolean tryToNotifyReset ( ) { } } | if ( ( mStatus == PTR_STATUS_COMPLETE || mStatus == PTR_STATUS_PREPARE ) && mPtrIndicator . isInStartPosition ( ) ) { if ( mPtrUIHandlerHolder . hasHandler ( ) ) { mPtrUIHandlerHolder . onUIReset ( this ) ; if ( DEBUG ) { PtrCLog . i ( LOG_TAG , "PtrUIHandler: onUIReset" ) ; } } mStatus = PTR_STATUS_INIT ; clearFlag ( ) ; return true ; } return false ; |
public class ColorXyz { /** * Convert a 3 - channel { @ link Planar } image from RGB into XYZ . RGB is assumed
* to have a range from 0:255
* NOTE : Input and output image can be the same instance .
* @ param rgb ( Input ) RGB encoded image
* @ param xyz ( Output ) XYZ encoded image */
public static < T extends ImageGray < T > > void rgbToXyz ( Planar < T > rgb , Planar < GrayF32 > xyz ) { } } | xyz . reshape ( rgb . width , rgb . height , 3 ) ; if ( rgb . getBandType ( ) == GrayU8 . class ) { if ( BoofConcurrency . USE_CONCURRENT ) { ImplColorXyz_MT . rgbToXyz_U8 ( ( Planar < GrayU8 > ) rgb , xyz ) ; } else { ImplColorXyz . rgbToXyz_U8 ( ( Planar < GrayU8 > ) rgb , xyz ) ; } } else if ( rgb . getBandType ( ) == GrayF32 . class ) { if ( BoofConcurrency . USE_CONCURRENT ) { ImplColorXyz_MT . rgbToXyz_F32 ( ( Planar < GrayF32 > ) rgb , xyz ) ; } else { ImplColorXyz . rgbToXyz_F32 ( ( Planar < GrayF32 > ) rgb , xyz ) ; } } else { throw new IllegalArgumentException ( "Unsupported band type " + rgb . getBandType ( ) . getSimpleName ( ) ) ; } |
public class AbstractAliasDestinationHandler { /** * Is a real target destination corrupt ? */
@ Override public boolean isCorruptOrIndoubt ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "isCorruptOrIndoubt" ) ; boolean isCorruptOrIndoubt = _targetDestinationHandler . isCorruptOrIndoubt ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "isCorruptOrIndoubt" , Boolean . valueOf ( isCorruptOrIndoubt ) ) ; return isCorruptOrIndoubt ; |
public class AbstractMaterialDialogBuilder { /** * Initializes the builder .
* @ param themeResourceId
* The resource id of the theme , which should be used by the dialog , as an { @ link
* Integer } value or 0 , if the default theme should be used */
private void initialize ( @ StyleRes final int themeResourceId ) { } } | int themeId = themeResourceId ; if ( themeId == 0 ) { TypedValue typedValue = new TypedValue ( ) ; getContext ( ) . getTheme ( ) . resolveAttribute ( R . attr . materialDialogTheme , typedValue , true ) ; themeId = typedValue . resourceId ; themeId = themeId != 0 ? themeId : R . style . MaterialDialog_Light ; } setContext ( new ContextThemeWrapper ( getContext ( ) , themeId ) ) ; this . themeResourceId = themeId ; obtainStyledAttributes ( themeId ) ; |
public class ApiOvhLicensedirectadmin { /** * Confirm termination of your service
* REST : POST / license / directadmin / { serviceName } / confirmTermination
* @ param futureUse What next after your termination request
* @ param reason Reason of your termination request
* @ param commentary Commentary about your termination request
* @ param token [ required ] The termination token sent by mail to the admin contact
* @ param serviceName [ required ] The name of your DirectAdmin license */
public String serviceName_confirmTermination_POST ( String serviceName , String commentary , OvhTerminationFutureUseEnum futureUse , OvhTerminationReasonEnum reason , String token ) throws IOException { } } | String qPath = "/license/directadmin/{serviceName}/confirmTermination" ; StringBuilder sb = path ( qPath , serviceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "commentary" , commentary ) ; addBody ( o , "futureUse" , futureUse ) ; addBody ( o , "reason" , reason ) ; addBody ( o , "token" , token ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , String . class ) ; |
public class MBeanServerExecutorLocal { /** * Handle a single request
* @ param pRequestHandler the handler which can deal with this request
* @ param pJmxReq the request to execute
* @ return the return value
* @ throws MBeanException
* @ throws ReflectionException
* @ throws AttributeNotFoundException
* @ throws InstanceNotFoundException */
public < R extends JmxRequest > Object handleRequest ( JsonRequestHandler < R > pRequestHandler , R pJmxReq ) throws MBeanException , ReflectionException , AttributeNotFoundException , InstanceNotFoundException , NotChangedException { } } | AttributeNotFoundException attrException = null ; InstanceNotFoundException objNotFoundException = null ; for ( MBeanServerConnection conn : getMBeanServers ( ) ) { try { return pRequestHandler . handleRequest ( conn , pJmxReq ) ; } catch ( InstanceNotFoundException exp ) { // Remember exceptions for later use
objNotFoundException = exp ; } catch ( AttributeNotFoundException exp ) { attrException = exp ; } catch ( IOException exp ) { throw new IllegalStateException ( "I/O Error while dispatching" , exp ) ; } } if ( attrException != null ) { throw attrException ; } // Must be there , otherwise we would not have left the loop
throw objNotFoundException ; |
public class FontFidelityImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . FONT_FIDELITY__STP_FNT_EX : setStpFntEx ( STP_FNT_EX_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class ExecutionResult { /** * Returns a copy of the ExecutionResult with the { @ code result } value , and completed and success set to true . */
public ExecutionResult withResult ( Object result ) { } } | return new ExecutionResult ( result , null , nonResult , waitNanos , true , true , successAll ) ; |
public class Compatibility { /** * If the className argument needs to be mapped to a new event handler class ,
* returns the new class name ; otherwise returns the unmodified argument . */
public static String getEventHandler ( String className ) throws IOException { } } | if ( getEventHandlers ( ) != null ) { String newHandler = getEventHandlers ( ) . get ( className ) ; if ( newHandler != null ) return newHandler ; } return className ; |
public class ServletHandler { protected void handleTrace ( HttpServletRequest request , HttpServletResponse response ) throws IOException { } } | response . setHeader ( HttpFields . __ContentType , HttpFields . __MessageHttp ) ; OutputStream out = response . getOutputStream ( ) ; ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer ( ) ; writer . write ( request . toString ( ) ) ; writer . flush ( ) ; response . setIntHeader ( HttpFields . __ContentLength , writer . size ( ) ) ; writer . writeTo ( out ) ; out . flush ( ) ; |
public class CmsJlanThreadManager { /** * Starts the JLAN server in a new thread . < p > */
public synchronized void start ( ) { } } | String path = OpenCms . getSystemInfo ( ) . getAbsoluteRfsPathRelativeToWebInf ( "config/jlanConfig.xml" ) ; File configFile = new File ( path ) ; if ( configFile . exists ( ) ) { if ( m_thread == null ) { m_thread = new JlanThread ( path ) ; m_thread . start ( ) ; } } else { String message = "Not starting JLAN server because no config file was found at " + path ; System . out . println ( message ) ; LOG . warn ( message ) ; } |
public class UniversalDateAndTimeStampImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . UNIVERSAL_DATE_AND_TIME_STAMP__RESERVED : return getReserved ( ) ; case AfplibPackage . UNIVERSAL_DATE_AND_TIME_STAMP__YEAR_AD : return getYearAD ( ) ; case AfplibPackage . UNIVERSAL_DATE_AND_TIME_STAMP__MONTH : return getMonth ( ) ; case AfplibPackage . UNIVERSAL_DATE_AND_TIME_STAMP__DAY : return getDay ( ) ; case AfplibPackage . UNIVERSAL_DATE_AND_TIME_STAMP__HOUR : return getHour ( ) ; case AfplibPackage . UNIVERSAL_DATE_AND_TIME_STAMP__MINUTE : return getMinute ( ) ; case AfplibPackage . UNIVERSAL_DATE_AND_TIME_STAMP__SECOND : return getSecond ( ) ; case AfplibPackage . UNIVERSAL_DATE_AND_TIME_STAMP__TIME_ZONE : return getTimeZone ( ) ; case AfplibPackage . UNIVERSAL_DATE_AND_TIME_STAMP__UTC_DIFF_H : return getUTCDiffH ( ) ; case AfplibPackage . UNIVERSAL_DATE_AND_TIME_STAMP__UTC_DIFF_M : return getUTCDiffM ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class OracleDdlParser { /** * { @ inheritDoc }
* @ see org . modeshape . sequencer . ddl . StandardDdlParser # parseNextCreateTableOption ( org . modeshape . sequencer . ddl . DdlTokenStream ,
* org . modeshape . sequencer . ddl . node . AstNode ) */
@ Override protected void parseNextCreateTableOption ( final DdlTokenStream tokens , final AstNode tableNode ) throws ParsingException { } } | final String tableProperty = tokens . consume ( ) ; boolean processed = false ; // if token is a number add it to previous option
if ( tableProperty . matches ( "\\b\\d+\\b" ) ) { final List < AstNode > options = tableNode . getChildren ( TYPE_STATEMENT_OPTION ) ; if ( ! options . isEmpty ( ) ) { final AstNode option = options . get ( options . size ( ) - 1 ) ; final String currValue = ( String ) option . getProperty ( VALUE ) ; option . setProperty ( VALUE , currValue + SPACE + tableProperty ) ; processed = true ; } } if ( ! processed ) { final AstNode tableOption = nodeFactory ( ) . node ( "option" , tableNode , TYPE_STATEMENT_OPTION ) ; tableOption . setProperty ( VALUE , tableProperty ) ; } |
public class NumberConverter { /** * Creates a Number for the { @ code source } and { @ code destinationType } . */
Number numberFor ( String source , Class < ? > destinationType ) { } } | String sourceString = source . trim ( ) ; if ( sourceString . length ( ) == 0 ) return null ; try { if ( destinationType . equals ( Byte . class ) ) return Byte . valueOf ( source ) ; if ( destinationType . equals ( Short . class ) ) return Short . valueOf ( source ) ; if ( destinationType . equals ( Integer . class ) ) return Integer . valueOf ( source ) ; if ( destinationType . equals ( Long . class ) ) return Long . valueOf ( source ) ; if ( destinationType . equals ( Float . class ) ) return Float . valueOf ( source ) ; if ( destinationType . equals ( Double . class ) ) return Double . valueOf ( source ) ; if ( destinationType . equals ( BigDecimal . class ) ) return new BigDecimal ( source ) ; if ( destinationType . equals ( BigInteger . class ) ) return new BigInteger ( source ) ; } catch ( Exception e ) { throw new Errors ( ) . errorMapping ( source , destinationType , e ) . toMappingException ( ) ; } throw new Errors ( ) . errorMapping ( source , destinationType ) . toMappingException ( ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.