signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ConfigViewImpl { /** * Supply explicit properties object for introspection and outrespection .
* @ param properties The properties .
* @ return This view . */
public ConfigViewImpl withProperties ( Properties properties ) { } } | if ( properties != null ) { this . properties = properties ; this . strategy . withProperties ( properties ) ; } return this ; |
public class Client { /** * Creates a Privilege
* @ param name
* The name of this privilege .
* @ param version
* The version for the privilege schema . Set to 2018-05-18.
* @ param statements
* A list of Statement objects or HashMap < String , Object >
* @ return Created Privilege
* @ throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
* @ throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
* @ throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
* @ see < a target = " _ blank " href = " https : / / developers . onelogin . com / api - docs / 1 / privileges / create - privilege " > Create Privilege documentation < / a > */
public Privilege createPrivilege ( String name , String version , List < ? > statements ) throws OAuthSystemException , OAuthProblemException , URISyntaxException { } } | cleanError ( ) ; prepareToken ( ) ; OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient ( ) ; OAuthClient oAuthClient = new OAuthClient ( httpClient ) ; URIBuilder url = new URIBuilder ( settings . getURL ( Constants . CREATE_PRIVILEGE_URL ) ) ; OAuthClientRequest bearerRequest = new OAuthBearerClientRequest ( url . toString ( ) ) . buildHeaderMessage ( ) ; Map < String , String > headers = getAuthorizedHeader ( ) ; bearerRequest . setHeaders ( headers ) ; List < HashMap < String , Object > > statementData = new ArrayList < HashMap < String , Object > > ( ) ; if ( ! statements . isEmpty ( ) ) { if ( statements . get ( 0 ) instanceof Statement ) { List < Statement > data = ( List < Statement > ) statements ; HashMap < String , Object > dataObj ; for ( Statement statement : data ) { dataObj = new HashMap < String , Object > ( ) ; dataObj . put ( "Effect" , statement . effect ) ; dataObj . put ( "Action" , statement . actions ) ; dataObj . put ( "Scope" , statement . scopes ) ; statementData . add ( dataObj ) ; } } else if ( statements . get ( 0 ) instanceof HashMap ) { List < HashMap < String , Object > > data = ( List < HashMap < String , Object > > ) statements ; for ( HashMap < String , Object > statement : data ) { statementData . add ( statement ) ; } } } Map < String , Object > privilegeData = new HashMap < String , Object > ( ) ; privilegeData . put ( "Version" , version ) ; privilegeData . put ( "Statement" , statementData ) ; Map < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( "name" , name ) ; params . put ( "privilege" , privilegeData ) ; String body = JSONUtils . buildJSON ( params ) ; bearerRequest . setBody ( body ) ; Privilege privilege = null ; OneloginOAuth2JSONResourceResponse oAuth2Response = oAuthClient . resource ( bearerRequest , OAuth . HttpMethod . POST , OneloginOAuth2JSONResourceResponse . class ) ; if ( oAuth2Response . getResponseCode ( ) == 201 ) { String id = ( String ) oAuth2Response . getFromContent ( "id" ) ; if ( id != null && ! id . isEmpty ( ) ) { privilege = new Privilege ( id , name , version , statements ) ; } } else { error = oAuth2Response . getError ( ) ; errorDescription = oAuth2Response . getErrorDescription ( ) ; } return privilege ; |
public class ToolbarRadioAction { @ Override public void setSelected ( boolean selected ) { } } | if ( selected ) { ( ( ToolbarModalAction ) toolbarAction ) . onSelect ( null ) ; } else { ( ( ToolbarModalAction ) toolbarAction ) . onDeselect ( null ) ; } |
public class RequiredParameters { /** * Build a help text for the defined parameters .
* < p > The format of the help text will be :
* Required Parameters :
* \ t - : shortName : , - - : name : \ t : helpText : \ t default : : defaultValue : \ t choices : : choices : \ n
* @ return a formatted help String . */
public String getHelp ( ) { } } | StringBuilder sb = new StringBuilder ( data . size ( ) * HELP_TEXT_LENGTH_PER_PARAM ) ; sb . append ( "Required Parameters:" ) ; sb . append ( HELP_TEXT_LINE_DELIMITER ) ; for ( Option o : data . values ( ) ) { sb . append ( this . helpText ( o ) ) ; } sb . append ( HELP_TEXT_LINE_DELIMITER ) ; return sb . toString ( ) ; |
public class EhCacheWrapper { /** * ( non - Javadoc )
* @ see javax . persistence . Cache # contains ( java . lang . Class , java . lang . Object ) */
@ Override public boolean contains ( Class arg0 , Object arg1 ) { } } | if ( isAlive ( ) ) { return ( ehcache . get ( arg1 ) != null ) ; } return false ; |
public class AggregationFromAnnotationsParser { /** * General purpose function matching is done through FunctionRegistry . */
@ VisibleForTesting public static ParametricAggregation parseFunctionDefinitionWithTypesConstraint ( Class < ? > clazz , TypeSignature returnType , List < TypeSignature > argumentTypes ) { } } | requireNonNull ( returnType , "returnType is null" ) ; requireNonNull ( argumentTypes , "argumentTypes is null" ) ; for ( ParametricAggregation aggregation : parseFunctionDefinitions ( clazz ) ) { if ( aggregation . getSignature ( ) . getReturnType ( ) . equals ( returnType ) && aggregation . getSignature ( ) . getArgumentTypes ( ) . equals ( argumentTypes ) ) { return aggregation ; } } throw new IllegalArgumentException ( String . format ( "No method with return type %s and arguments %s" , returnType , argumentTypes ) ) ; |
public class ArtifactManagingServiceImpl { /** * ( non - Javadoc )
* @ see org . exoplatform . services . jcr . ext . maven . ArtifactManagingService # importArtifacts
* ( org . exoplatform . services . jcr . ext . common . SessionProvider , java . io . InputStream ) */
public void importArtifacts ( SessionProvider sp , InputStream in ) throws RepositoryException , FileNotFoundException { } } | LOG . info ( "Extract repository to temporary folder" ) ; String path = System . getProperty ( "java.io.tmpdir" ) + File . separator + "maven2" ; File temporaryFolder = new File ( getUniqueFilename ( path ) ) ; if ( ! temporaryFolder . mkdir ( ) ) { throw new FileNotFoundException ( "Cannot create temporary folder" ) ; } ZipEntry entry ; ZipInputStream zipIn = new ZipInputStream ( new BufferedInputStream ( in ) ) ; try { while ( ( entry = zipIn . getNextEntry ( ) ) != null ) { if ( ! ( entry . isDirectory ( ) && new File ( temporaryFolder + File . separator + entry . getName ( ) ) . mkdir ( ) ) ) { int count ; byte data [ ] = new byte [ BUFFER ] ; File file = new File ( temporaryFolder + File . separator + entry . getName ( ) ) ; FileUtils . touch ( file ) ; FileOutputStream fos = new FileOutputStream ( file ) ; BufferedOutputStream dest = new BufferedOutputStream ( fos , BUFFER ) ; while ( ( count = zipIn . read ( data , 0 , BUFFER ) ) != - 1 ) { dest . write ( data , 0 , count ) ; } dest . flush ( ) ; dest . close ( ) ; } } } catch ( IOException e ) { LOG . error ( "Cannot get zip entry from stream" , e ) ; } finally { IOUtils . closeQuietly ( zipIn ) ; IOUtils . closeQuietly ( in ) ; } // main part - copy to JCR from temp folder
// use uploading artifacts from local folder .
importArtifacts ( sp , temporaryFolder ) ; try { FileUtils . deleteDirectory ( temporaryFolder ) ; } catch ( IOException e ) { LOG . error ( "Cannot remove temporary folder" , e ) ; } |
public class XPathQueryBuilder { /** * Unescapes single or double quotes depending on how < code > literal < / code >
* is enclosed and strips enclosing quotes .
* Examples : < br >
* < code > " foo " " bar " < / code > - & gt ; < code > foo " bar < / code > < br >
* < code > ' foo ' ' bar ' < / code > - & gt ; < code > foo ' bar < / code > < br >
* but : < br >
* < code > ' foo " " bar ' < / code > - & gt ; < code > foo " " bar < / code >
* @ param literal the string literal to unescape
* @ return the unescaped and stripped literal . */
private String unescapeQuotes ( String literal ) { } } | String value = literal . substring ( 1 , literal . length ( ) - 1 ) ; if ( value . length ( ) == 0 ) { // empty string
return value ; } if ( literal . charAt ( 0 ) == '"' ) { value = value . replaceAll ( "\"\"" , "\"" ) ; } else { value = value . replaceAll ( "''" , "'" ) ; } return value ; |
public class BaseLevel3 { /** * ? trsm solves one of the following matrix equations :
* op ( a ) * x = alpha * b or x * op ( a ) = alpha * b ,
* where x and b are m - by - n general matrices , and a is triangular ;
* op ( a ) must be an m - by - m matrix , if side = ' L ' or ' l '
* op ( a ) must be an n - by - n matrix , if side = ' R ' or ' r ' .
* For the definition of op ( a ) , see Matrix Arguments .
* The routine overwrites x on b .
* @ param Order
* @ param Side
* @ param Uplo
* @ param TransA
* @ param Diag
* @ param alpha
* @ param A
* @ param B */
@ Override public void trsm ( char Order , char Side , char Uplo , char TransA , char Diag , double alpha , INDArray A , INDArray B ) { } } | if ( Nd4j . getExecutioner ( ) . getProfilingMode ( ) == OpExecutioner . ProfilingMode . ALL ) OpProfiler . getInstance ( ) . processBlasCall ( false , A , B ) ; // FIXME : int cast
if ( A . data ( ) . dataType ( ) == DataType . DOUBLE ) { DefaultOpExecutioner . validateDataType ( DataType . DOUBLE , A , B ) ; dtrsm ( Order , Side , Uplo , TransA , Diag , ( int ) A . rows ( ) , ( int ) A . columns ( ) , alpha , A , ( int ) A . size ( 0 ) , B , ( int ) B . size ( 0 ) ) ; } else { DefaultOpExecutioner . validateDataType ( DataType . FLOAT , A , B ) ; strsm ( Order , Side , Uplo , TransA , Diag , ( int ) A . rows ( ) , ( int ) A . columns ( ) , ( float ) alpha , A , ( int ) A . size ( 0 ) , B , ( int ) B . size ( 0 ) ) ; } OpExecutionerUtil . checkForAny ( B ) ; |
public class TelegramBot { /** * This allows you to edit the text of a message you have already sent previously
* @ param oldMessage The Message object that represents the message you want to edit
* @ param text The new text you want to display
* @ param parseMode The ParseMode that should be used with this new text
* @ param disableWebPagePreview Whether any URLs should be displayed with a preview of their content
* @ param inlineReplyMarkup Any InlineReplyMarkup object you want to edit into the message
* @ return A new Message object representing the edited message */
public Message editMessageText ( Message oldMessage , String text , ParseMode parseMode , boolean disableWebPagePreview , InlineReplyMarkup inlineReplyMarkup ) { } } | return this . editMessageText ( oldMessage . getChat ( ) . getId ( ) , oldMessage . getMessageId ( ) , text , parseMode , disableWebPagePreview , inlineReplyMarkup ) ; |
public class ThriftInvertedIndexHandler { /** * / * ( non - Javadoc )
* @ see com . impetus . client . cassandra . index . InvertedIndexHandlerBase # getSuperColumnForRow ( org . apache . cassandra . thrift . ConsistencyLevel , java . lang . String , java . lang . String , byte [ ] , java . lang . String ) */
@ Override protected SuperColumn getSuperColumnForRow ( ConsistencyLevel consistencyLevel , String columnFamilyName , String rowKey , byte [ ] superColumnName , String persistenceUnit ) { } } | ColumnPath cp = new ColumnPath ( columnFamilyName ) ; cp . setSuper_column ( superColumnName ) ; ColumnOrSuperColumn cosc = null ; Connection conn = thriftClient . getConnection ( ) ; try { cosc = conn . getClient ( ) . get ( ByteBuffer . wrap ( rowKey . getBytes ( ) ) , cp , consistencyLevel ) ; } catch ( InvalidRequestException e ) { log . error ( "Unable to search from inverted index, Caused by: ." , e ) ; throw new IndexingException ( e ) ; } catch ( NotFoundException e ) { log . warn ( "Not found any record in inverted index table." ) ; } catch ( UnavailableException e ) { log . error ( "Unable to search from inverted index, Caused by: ." , e ) ; throw new IndexingException ( e ) ; } catch ( TimedOutException e ) { log . error ( "Unable to search from inverted index, Caused by: ." , e ) ; throw new IndexingException ( e ) ; } catch ( TException e ) { log . error ( "Unable to search from inverted index, Caused by: ." , e ) ; throw new IndexingException ( e ) ; } finally { thriftClient . releaseConnection ( conn ) ; } SuperColumn thriftSuperColumn = ThriftDataResultHelper . transformThriftResult ( cosc , ColumnFamilyType . SUPER_COLUMN , null ) ; return thriftSuperColumn ; |
public class Plane4f { /** * Set this pane to be coplanar with all the three specified points .
* @ param p1x is a point on the plane
* @ param p1y is a point on the plane
* @ param p1z is a point on the plane
* @ param p2x is a point on the plane
* @ param p2y is a point on the plane
* @ param p2z is a point on the plane
* @ param p3x is a point on the plane
* @ param p3y is a point on the plane
* @ param p3z is a point on the plane */
@ Override public void set ( double p1x , double p1y , double p1z , double p2x , double p2y , double p2z , double p3x , double p3y , double p3z ) { } } | Vector3f v = new Vector3f ( ) ; FunctionalVector3D . crossProduct ( p2x - p1x , p2y - p1y , p2z - p1z , p3x - p1x , p3y - p1y , p3z - p1z , v ) ; this . a = v . getX ( ) ; this . b = v . getY ( ) ; this . c = v . getZ ( ) ; this . d = - ( this . a * p1x + this . b * p1y + this . c * p1z ) ; normalize ( ) ; |
public class RoutingServlet { /** * Performs custom processing when a route was not matched .
* Detects 404s , also useful for handling special cases like 405 errors if we detect the route would match for a
* different HTTP method .
* @ return { @ code true } if the response handler should be invoked , { @ code false } otherwise */
protected boolean handleUnmatchedRoute ( HttpServletRequest httpServletRequest , HttpServletResponse httpServletResponse , HttpMethod httpMethod , String requestPath ) { } } | // If this resource matches a different method [ s ] , error out specially
List < HttpMethod > otherHttpMethods = new ArrayList < > ( HttpMethod . values ( ) . length ) ; for ( HttpMethod otherHttpMethod : HttpMethod . values ( ) ) if ( httpMethod != otherHttpMethod && routeMatcher . match ( otherHttpMethod , requestPath ) . isPresent ( ) ) otherHttpMethods . add ( otherHttpMethod ) ; // Handle OPTIONS specially by indicating we don ' t want to invoke the response handler
// Otherwise , throw an exception indicating a 405
if ( otherHttpMethods . size ( ) > 0 ) { // Always write the Allow header
httpServletResponse . setHeader ( "Allow" , otherHttpMethods . stream ( ) . map ( method -> method . name ( ) ) . collect ( joining ( ", " ) ) ) ; if ( httpMethod == HttpMethod . OPTIONS ) return false ; throw new MethodNotAllowedException ( format ( "%s is not supported for this resource. Supported method%s %s" , httpMethod , ( otherHttpMethods . size ( ) == 1 ? " is" : "s are" ) , otherHttpMethods . stream ( ) . map ( method -> method . name ( ) ) . collect ( joining ( ", " ) ) ) ) ; } // No matching route , and no possible alternatives ? It ' s a 404
throw new NotFoundException ( format ( "No route was found for %s %s" , httpMethod . name ( ) , requestPath ) ) ; |
public class FactoryThresholdBinary { /** * Applies a local Otsu threshold
* @ see ThresholdLocalOtsu
* @ param regionWidth About how wide and tall you wish a block to be in pixels .
* @ param scale Scale factor adjust for threshold . 1.0 means no change .
* @ param down Should it threshold up or down .
* @ param tuning Tuning parameter . 0 = standard Otsu . Greater than 0 will penalize zero texture .
* @ param inputType Type of input image
* @ return Filter to binary */
public static < T extends ImageGray < T > > InputToBinary < T > localOtsu ( ConfigLength regionWidth , double scale , boolean down , boolean otsu2 , double tuning , Class < T > inputType ) { } } | if ( BOverrideFactoryThresholdBinary . localOtsu != null ) return BOverrideFactoryThresholdBinary . localOtsu . handle ( otsu2 , regionWidth , tuning , scale , down , inputType ) ; ThresholdLocalOtsu otsu ; if ( BoofConcurrency . USE_CONCURRENT ) { otsu = new ThresholdLocalOtsu_MT ( otsu2 , regionWidth , tuning , scale , down ) ; } else { otsu = new ThresholdLocalOtsu ( otsu2 , regionWidth , tuning , scale , down ) ; } return new InputToBinarySwitch < > ( otsu , inputType ) ; |
public class RuleBasedTimeZone { /** * { @ inheritDoc } */
@ Override public TimeZoneTransition getNextTransition ( long base , boolean inclusive ) { } } | complete ( ) ; if ( historicTransitions == null ) { return null ; } boolean isFinal = false ; TimeZoneTransition result ; TimeZoneTransition tzt = historicTransitions . get ( 0 ) ; long tt = tzt . getTime ( ) ; if ( tt > base || ( inclusive && tt == base ) ) { result = tzt ; } else { int idx = historicTransitions . size ( ) - 1 ; tzt = historicTransitions . get ( idx ) ; tt = tzt . getTime ( ) ; if ( inclusive && tt == base ) { result = tzt ; } else if ( tt <= base ) { if ( finalRules != null ) { // Find a transion time with finalRules
Date start0 = finalRules [ 0 ] . getNextStart ( base , finalRules [ 1 ] . getRawOffset ( ) , finalRules [ 1 ] . getDSTSavings ( ) , inclusive ) ; Date start1 = finalRules [ 1 ] . getNextStart ( base , finalRules [ 0 ] . getRawOffset ( ) , finalRules [ 0 ] . getDSTSavings ( ) , inclusive ) ; if ( start1 . after ( start0 ) ) { tzt = new TimeZoneTransition ( start0 . getTime ( ) , finalRules [ 1 ] , finalRules [ 0 ] ) ; } else { tzt = new TimeZoneTransition ( start1 . getTime ( ) , finalRules [ 0 ] , finalRules [ 1 ] ) ; } result = tzt ; isFinal = true ; } else { return null ; } } else { // Find a transition within the historic transitions
idx -- ; TimeZoneTransition prev = tzt ; while ( idx > 0 ) { tzt = historicTransitions . get ( idx ) ; tt = tzt . getTime ( ) ; if ( tt < base || ( ! inclusive && tt == base ) ) { break ; } idx -- ; prev = tzt ; } result = prev ; } } // For now , this implementation ignore transitions with only zone name changes .
TimeZoneRule from = result . getFrom ( ) ; TimeZoneRule to = result . getTo ( ) ; if ( from . getRawOffset ( ) == to . getRawOffset ( ) && from . getDSTSavings ( ) == to . getDSTSavings ( ) ) { // No offset changes . Try next one if not final
if ( isFinal ) { return null ; } else { result = getNextTransition ( result . getTime ( ) , false /* always exclusive */
) ; } } return result ; |
public class AbstractJaxRsResourceProvider { /** * Read the current state of the resource
* @ param id the id of the resource to read
* @ return the response
* @ see < a href = " https : / / www . hl7 . org / fhir / http . html # read " > https : / / www . hl7 . org / fhir / http . html # read < / a > */
@ GET @ Path ( "/{id}" ) public Response find ( @ PathParam ( "id" ) final String id ) throws IOException { } } | return execute ( getResourceRequest ( RequestTypeEnum . GET , RestOperationTypeEnum . READ ) . id ( id ) ) ; |
public class JOGLTypeConversions { /** * Convert blend functions from GL constants .
* @ param type The GL constant .
* @ return The value . */
public static JCGLBlendFunction blendFunctionFromGL ( final int type ) { } } | switch ( type ) { case GL2ES2 . GL_CONSTANT_ALPHA : return JCGLBlendFunction . BLEND_CONSTANT_ALPHA ; case GL2ES2 . GL_CONSTANT_COLOR : return JCGLBlendFunction . BLEND_CONSTANT_COLOR ; case GL . GL_DST_ALPHA : return JCGLBlendFunction . BLEND_DESTINATION_ALPHA ; case GL . GL_DST_COLOR : return JCGLBlendFunction . BLEND_DESTINATION_COLOR ; case GL . GL_ONE : return JCGLBlendFunction . BLEND_ONE ; case GL2ES2 . GL_ONE_MINUS_CONSTANT_ALPHA : return JCGLBlendFunction . BLEND_ONE_MINUS_CONSTANT_ALPHA ; case GL2ES2 . GL_ONE_MINUS_CONSTANT_COLOR : return JCGLBlendFunction . BLEND_ONE_MINUS_CONSTANT_COLOR ; case GL . GL_ONE_MINUS_DST_ALPHA : return JCGLBlendFunction . BLEND_ONE_MINUS_DESTINATION_ALPHA ; case GL . GL_ONE_MINUS_DST_COLOR : return JCGLBlendFunction . BLEND_ONE_MINUS_DESTINATION_COLOR ; case GL . GL_ONE_MINUS_SRC_ALPHA : return JCGLBlendFunction . BLEND_ONE_MINUS_SOURCE_ALPHA ; case GL . GL_ONE_MINUS_SRC_COLOR : return JCGLBlendFunction . BLEND_ONE_MINUS_SOURCE_COLOR ; case GL . GL_SRC_ALPHA : return JCGLBlendFunction . BLEND_SOURCE_ALPHA ; case GL . GL_SRC_COLOR : return JCGLBlendFunction . BLEND_SOURCE_COLOR ; case GL . GL_SRC_ALPHA_SATURATE : return JCGLBlendFunction . BLEND_SOURCE_ALPHA_SATURATE ; case GL . GL_ZERO : return JCGLBlendFunction . BLEND_ZERO ; default : throw new UnreachableCodeException ( ) ; } |
public class CrafterXStreamMarshaller { /** * Returns true if the specified class :
* < ol >
* < li > < / li >
* < li > Is NOT the same , a subclass or subinterface of one of the unsupported classes . < / li >
* < li > Is the the same , a subclass or subinterface of one of the supported classes . < / li >
* < / ol >
* Also returns true if there aren ' t any unsupported or supported classes . */
@ Override @ SuppressWarnings ( "unchecked" ) public boolean supports ( Class clazz ) { } } | if ( ArrayUtils . isNotEmpty ( unsupportedClasses ) ) { for ( Class unsupportedClass : unsupportedClasses ) { if ( unsupportedClass . isAssignableFrom ( clazz ) ) { return false ; } } } return super . supports ( clazz ) ; |
public class ConfigurationPropertySources { /** * Return { @ link Iterable } containing a single new { @ link ConfigurationPropertySource }
* adapted from the given Spring { @ link PropertySource } .
* @ param source the Spring property source to adapt
* @ return an { @ link Iterable } containing a single newly adapted
* { @ link SpringConfigurationPropertySource } */
public static Iterable < ConfigurationPropertySource > from ( PropertySource < ? > source ) { } } | return Collections . singleton ( SpringConfigurationPropertySource . from ( source ) ) ; |
public class MetricServiceClient { /** * Lists metric descriptors that match a filter . This method does not require a Stackdriver
* account .
* < p > Sample code :
* < pre > < code >
* try ( MetricServiceClient metricServiceClient = MetricServiceClient . create ( ) ) {
* ProjectName name = ProjectName . of ( " [ PROJECT ] " ) ;
* for ( MetricDescriptor element : metricServiceClient . listMetricDescriptors ( name . toString ( ) ) . iterateAll ( ) ) {
* / / doThingsWith ( element ) ;
* < / code > < / pre >
* @ param name The project on which to execute the request . The format is
* ` " projects / { project _ id _ or _ number } " ` .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final ListMetricDescriptorsPagedResponse listMetricDescriptors ( String name ) { } } | ListMetricDescriptorsRequest request = ListMetricDescriptorsRequest . newBuilder ( ) . setName ( name ) . build ( ) ; return listMetricDescriptors ( request ) ; |
public class FormatTag { /** * Returns the locale based on the country and language .
* @ return the locale */
public Locale getLocale ( ) throws JspException { } } | Locale loc = null ; if ( _language != null || _country != null ) { // language is required
if ( _language == null ) { String s = Bundle . getString ( "Tags_LocaleRequiresLanguage" , new Object [ ] { _country } ) ; registerTagError ( s , null ) ; return super . getUserLocale ( ) ; } if ( _country == null ) loc = new Locale ( _language ) ; else loc = new Locale ( _language , _country ) ; } else loc = super . getUserLocale ( ) ; return loc ; |
public class NumberBoundaryStage { /** * Method canParse .
* @ param threshold String
* @ return boolean */
@ Override public boolean canParse ( final String threshold ) { } } | if ( threshold == null || threshold . isEmpty ( ) ) { return false ; } switch ( threshold . charAt ( 0 ) ) { case '+' : case '-' : return ! ( threshold . startsWith ( "-inf" ) || threshold . startsWith ( "+inf" ) ) ; default : return Character . isDigit ( threshold . charAt ( 0 ) ) ; } |
public class HttpRequester { /** * Gets response as string .
* @ param uri the uri
* @ param header the header
* @ return the response as string */
public static String getResponseAsString ( URI uri , Header header ) { } } | return getResponseAsString ( uri . toString ( ) , header ) ; |
public class Criteria { /** * NOT IN Criteria with SubQuery
* @ param attribute The field name to be used
* @ param subQuery The subQuery */
public void addNotIn ( String attribute , Query subQuery ) { } } | // PAW
// addSelectionCriteria ( ValueCriteria . buildNotInCriteria ( attribute , subQuery , getAlias ( ) ) ) ;
addSelectionCriteria ( ValueCriteria . buildNotInCriteria ( attribute , subQuery , getUserAlias ( attribute ) ) ) ; |
public class HTTaxinvoiceServiceImp { /** * ( non - Javadoc )
* @ see com . popbill . api . HTTaxinvoiceService # deleteDeptUser ( java . lang . String ) */
public Response deleteDeptUser ( String corpNum ) throws PopbillException { } } | if ( corpNum == null || corpNum . isEmpty ( ) ) throw new PopbillException ( - 99999999 , "연동회원 사업자번호(corpNum)가 입력되지 않았습니다." ) ; return httppost ( "/HomeTax/Taxinvoice/DeptUser" , corpNum , null , null , "DELETE" , Response . class ) ; |
public class AbstractCubicSpline { /** * Updates points
* @ param points */
private void update ( double ... points ) { } } | checkInput ( points ) ; if ( ! closed ) { this . injection = checkInjection ( points , 0 ) ; } double [ ] cp = createControlPoints ( points ) ; init ( cp ) ; |
public class JBossASClient { /** * Convienence method that allows you to create request that reads a single attribute
* value to a resource .
* @ param runtime if < code > true < / code > , the attribute is a runtime attribute
* @ param attributeName the name of the attribute whose value is to be read
* @ param address identifies the resource
* @ return the request */
public static ModelNode createReadAttributeRequest ( boolean runtime , String attributeName , Address address ) { } } | final ModelNode op = createRequest ( READ_ATTRIBUTE , address ) ; op . get ( "include-runtime" ) . set ( runtime ) ; op . get ( NAME ) . set ( attributeName ) ; return op ; |
public class MathUtil { /** * Determine if the requested { @ code index } and { @ code length } will fit within { @ code capacity } .
* @ param index The starting index .
* @ param length The length which will be utilized ( starting from { @ code index } ) .
* @ param capacity The capacity that { @ code index + length } is allowed to be within .
* @ return { @ code true } if the requested { @ code index } and { @ code length } will fit within { @ code capacity } .
* { @ code false } if this would result in an index out of bounds exception . */
public static boolean isOutOfBounds ( int index , int length , int capacity ) { } } | return ( index | length | ( index + length ) | ( capacity - ( index + length ) ) ) < 0 ; |
public class CodedInputStream { /** * Read an embedded message field value from the stream . */
public void readMessage ( final MessageLite . Builder builder , final ExtensionRegistryLite extensionRegistry ) throws IOException { } } | final int length = readRawVarint32 ( ) ; if ( recursionDepth >= recursionLimit ) { throw InvalidProtocolBufferException . recursionLimitExceeded ( ) ; } final int oldLimit = pushLimit ( length ) ; ++ recursionDepth ; builder . mergeFrom ( this , extensionRegistry ) ; checkLastTagWas ( 0 ) ; -- recursionDepth ; popLimit ( oldLimit ) ; |
public class AwesomeTextView { /** * Sets the text to display a MaterialIcon , replacing whatever text is already present .
* Used to set the text to display a MaterialIcon Icon .
* @ param iconCode the fontawesome icon code e . g . " md _ share " */
public void setMaterialIcon ( @ FontAwesome . Icon CharSequence iconCode ) { } } | setBootstrapText ( new BootstrapText . Builder ( getContext ( ) , isInEditMode ( ) ) . addMaterialIcon ( iconCode ) . build ( ) ) ; |
public class AwsSecurityFindingFilters { /** * The canonical AWS partition name to which the region is assigned .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setResourcePartition ( java . util . Collection ) } or { @ link # withResourcePartition ( java . util . Collection ) } if
* you want to override the existing values .
* @ param resourcePartition
* The canonical AWS partition name to which the region is assigned .
* @ return Returns a reference to this object so that method calls can be chained together . */
public AwsSecurityFindingFilters withResourcePartition ( StringFilter ... resourcePartition ) { } } | if ( this . resourcePartition == null ) { setResourcePartition ( new java . util . ArrayList < StringFilter > ( resourcePartition . length ) ) ; } for ( StringFilter ele : resourcePartition ) { this . resourcePartition . add ( ele ) ; } return this ; |
public class SQLUtils { /** * Method returning the host surrounded by square brackets if ' dbServer ' is IPv6 format .
* Otherwise the returned string will be the same .
* @ return */
public static String getIPv4OrIPv6WithSquareBracketsHost ( String dbServer ) { } } | final Address address = new Address ( dbServer ) ; return address . getURIIPV6Literal ( ) ; |
public class Cards { /** * 获取卡券背景颜色列表
* @ return */
public List < Color > listColors ( ) { } } | String url = WxEndpoint . get ( "url.card.colors.get" ) ; logger . debug ( "list colors." ) ; String response = wxClient . get ( url ) ; ColorWrapper colorWrapper = JsonMapper . defaultMapper ( ) . fromJson ( response , ColorWrapper . class ) ; return colorWrapper . getColors ( ) ; |
public class LinkedList { /** * Inserts the object into a new element after the provided element .
* @ param previous Element which will be before the new one
* @ param object The object which goes into the new element
* @ return The new element */
public Element < T > insertAfter ( Element < T > previous , T object ) { } } | Element < T > e = requestNew ( ) ; e . object = object ; e . previous = previous ; e . next = previous . next ; if ( e . next != null ) { e . next . previous = e ; } else { last = e ; } previous . next = e ; size ++ ; return e ; |
public class ParsedColInfo { /** * Construct a ParsedColInfo from Volt XML . */
static public ParsedColInfo fromOrderByXml ( AbstractParsedStmt parsedStmt , VoltXMLElement orderByXml ) { } } | // A generic adjuster that just calls finalizeValueTypes
ExpressionAdjuster adjuster = new ExpressionAdjuster ( ) { @ Override public AbstractExpression adjust ( AbstractExpression expr ) { ExpressionUtil . finalizeValueTypes ( expr ) ; return expr ; } } ; return fromOrderByXml ( parsedStmt , orderByXml , adjuster ) ; |
public class ArrayUtil { /** * Sum double [ ] .
* @ param a the a
* @ param b the b
* @ return the double [ ] */
@ javax . annotation . Nonnull public static double [ ] sum ( @ javax . annotation . Nonnull final double [ ] a , final double b ) { } } | return com . simiacryptus . util . ArrayUtil . op ( a , ( x ) -> x + b ) ; |
public class Sneaky { /** * Wrap a { @ link CheckedToDoubleFunction } in a { @ link ToDoubleFunction } .
* Example :
* < code > < pre >
* map . computeIfAbsent ( " key " , Unchecked . toDoubleFunction ( k - > {
* if ( k . length ( ) > 10)
* throw new Exception ( " Only short strings allowed " ) ;
* return 42.0;
* < / pre > < / code > */
public static < T > ToDoubleFunction < T > toDoubleFunction ( CheckedToDoubleFunction < T > function ) { } } | return Unchecked . toDoubleFunction ( function , Unchecked . RETHROW_ALL ) ; |
public class InternalXtextParser { /** * InternalXtext . g : 1758:1 : entryRuleDisjunction returns [ EObject current = null ] : iv _ ruleDisjunction = ruleDisjunction EOF ; */
public final EObject entryRuleDisjunction ( ) throws RecognitionException { } } | EObject current = null ; EObject iv_ruleDisjunction = null ; try { // InternalXtext . g : 1758:52 : ( iv _ ruleDisjunction = ruleDisjunction EOF )
// InternalXtext . g : 1759:2 : iv _ ruleDisjunction = ruleDisjunction EOF
{ newCompositeNode ( grammarAccess . getDisjunctionRule ( ) ) ; pushFollow ( FollowSets000 . FOLLOW_1 ) ; iv_ruleDisjunction = ruleDisjunction ( ) ; state . _fsp -- ; current = iv_ruleDisjunction ; match ( input , EOF , FollowSets000 . FOLLOW_2 ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class RepositoryModule { /** * Allows to load executor only if required jars are in classpath .
* For example , no need for graph dependencies if only object db is used .
* @ param executorBinder executor binder class
* @ see ru . vyarus . guice . persist . orient . support . repository . ObjectExecutorBinder as example */
protected void loadOptionalExecutor ( final String executorBinder ) { } } | try { final Method bindExecutor = RepositoryModule . class . getDeclaredMethod ( "bindExecutor" , Class . class ) ; bindExecutor . setAccessible ( true ) ; try { Class . forName ( executorBinder ) . getConstructor ( RepositoryModule . class , Method . class ) . newInstance ( this , bindExecutor ) ; } finally { bindExecutor . setAccessible ( false ) ; } } catch ( Exception ignore ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Failed to process executor loader " + executorBinder , ignore ) ; } } |
public class SwaggerMethodParser { /** * Get whether or not the provided response status code is one of the expected status codes for
* this Swagger method .
* @ param responseStatusCode the status code that was returned in the HTTP response
* @ param additionalAllowedStatusCodes an additional set of allowed status codes that will be
* merged with the existing set of allowed status codes for
* this query
* @ return whether or not the provided response status code is one of the expected status codes
* for this Swagger method */
public boolean isExpectedResponseStatusCode ( int responseStatusCode , int [ ] additionalAllowedStatusCodes ) { } } | boolean result ; if ( expectedStatusCodes == null ) { result = ( responseStatusCode < 400 ) ; } else { result = contains ( expectedStatusCodes , responseStatusCode ) || contains ( additionalAllowedStatusCodes , responseStatusCode ) ; } return result ; |
public class ZipFileWalker { /** * Run the ZipFileWalker using the given OutputHandler
* @ param outputHandler For every file that is found in the
* Zip - file , the method found ( ) in the { @ link OutputHandler }
* is invoked .
* @ return true if processing was stopped because of a found file ,
* false if no file was found or the { @ link OutputHandler } did
* not return true on the call to found ( ) .
* @ throws IOException Thrown if an error occurs while handling the
* Zip - file or while handling the call to found ( ) . */
public boolean walk ( OutputHandler outputHandler ) throws IOException { } } | try ( ZipFile zipFile = new ZipFile ( zip ) ) { // walk all entries and look for matches
Enumeration < ? extends ZipEntry > entries = zipFile . entries ( ) ; while ( entries . hasMoreElements ( ) ) { ZipEntry entry = entries . nextElement ( ) ; // first check if the file matches the name , if a name - pattern is given
File file = new File ( zip , entry . getName ( ) ) ; if ( outputHandler . found ( file , zipFile . getInputStream ( entry ) ) ) { return true ; } // look for name or content inside zip - files as well , do it recursively to also
// look at content of nested zip - files
if ( ZipUtils . isZip ( entry . getName ( ) ) ) { if ( walkRecursive ( file , zipFile . getInputStream ( entry ) , outputHandler ) ) { return true ; } } } return false ; } |
public class Calendar { /** * Removes the entries returned by the iterator from the calendar . This is basically just a convenience
* method as the actual work of removing an entry from a calendar is done inside { @ link Entry # setCalendar ( Calendar ) } .
* @ param entries the entries to remove */
public final void removeEntries ( Iterator < Entry < ? > > entries ) { } } | if ( entries != null ) { while ( entries . hasNext ( ) ) { removeEntry ( entries . next ( ) ) ; } } |
public class DescribeCertificatesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DescribeCertificatesRequest describeCertificatesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( describeCertificatesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeCertificatesRequest . getFilters ( ) , FILTERS_BINDING ) ; protocolMarshaller . marshall ( describeCertificatesRequest . getMaxRecords ( ) , MAXRECORDS_BINDING ) ; protocolMarshaller . marshall ( describeCertificatesRequest . getMarker ( ) , MARKER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class StreamCopier { /** * Execute the copy of bytes from the input to the output stream . If maxBytes is specified , limits the number of
* bytes copied to maxBytes .
* Note : this method should only be called once . Further calls will throw a { @ link IllegalStateException } .
* @ return Number of bytes copied . */
public synchronized long copy ( ) throws IOException { } } | if ( this . copied ) { throw new IllegalStateException ( String . format ( "%s already copied." , StreamCopier . class . getName ( ) ) ) ; } this . copied = true ; try { long numBytes = 0 ; long totalBytes = 0 ; final ByteBuffer buffer = ByteBuffer . allocateDirect ( this . bufferSize ) ; // Only keep copying if we ' ve read less than maxBytes ( if maxBytes exists )
while ( ( this . maxBytes == null || this . maxBytes > totalBytes ) && ( numBytes = fillBufferFromInputChannel ( buffer ) ) != - 1 ) { totalBytes += numBytes ; // flip the buffer to be written
buffer . flip ( ) ; // If we ' ve read more than maxBytes , discard enough bytes to only write maxBytes .
if ( this . maxBytes != null && totalBytes > this . maxBytes ) { buffer . limit ( buffer . limit ( ) - ( int ) ( totalBytes - this . maxBytes ) ) ; totalBytes = this . maxBytes ; } this . outputChannel . write ( buffer ) ; // Clear if empty
buffer . compact ( ) ; if ( this . copySpeedMeter != null ) { this . copySpeedMeter . mark ( numBytes ) ; } } // Done writing , now flip to read again
buffer . flip ( ) ; // check that buffer is fully written .
while ( buffer . hasRemaining ( ) ) { this . outputChannel . write ( buffer ) ; } return totalBytes ; } finally { if ( this . closeChannelsOnComplete ) { this . inputChannel . close ( ) ; this . outputChannel . close ( ) ; } } |
public class SSLChannelProvider { /** * Access the event service .
* @ return EventEngine - null if not found */
public static EventEngine getEventService ( ) { } } | SSLChannelProvider p = instance . get ( ) ; if ( p != null ) return p . eventService ; throw new IllegalStateException ( "Requested service is null: no active component instance" ) ; |
public class AmazonCloudDirectoryClient { /** * Upgrades a published schema under a new minor version revision using the current contents of
* < code > DevelopmentSchemaArn < / code > .
* @ param upgradePublishedSchemaRequest
* @ return Result of the UpgradePublishedSchema operation returned by the service .
* @ throws InternalServiceException
* Indicates a problem that must be resolved by Amazon Web Services . This might be a transient error in
* which case you can retry your request until it succeeds . Otherwise , go to the < a
* href = " http : / / status . aws . amazon . com / " > AWS Service Health Dashboard < / a > site to see if there are any
* operational issues with the service .
* @ throws InvalidArnException
* Indicates that the provided ARN value is not valid .
* @ throws RetryableConflictException
* Occurs when a conflict with a previous successful write is detected . For example , if a write operation
* occurs on an object and then an attempt is made to read the object using “ SERIALIZABLE ” consistency , this
* exception may result . This generally occurs when the previous write did not have time to propagate to the
* host serving the current request . A retry ( with appropriate backoff logic ) is the recommended response to
* this exception .
* @ throws ValidationException
* Indicates that your request is malformed in some manner . See the exception message .
* @ throws IncompatibleSchemaException
* Indicates a failure occurred while performing a check for backward compatibility between the specified
* schema and the schema that is currently applied to the directory .
* @ throws AccessDeniedException
* Access denied . Check your permissions .
* @ throws ResourceNotFoundException
* The specified resource could not be found .
* @ throws InvalidAttachmentException
* Indicates that an attempt to make an attachment was invalid . For example , attaching two nodes with a link
* type that is not applicable to the nodes or attempting to apply a schema to a directory a second time .
* @ throws LimitExceededException
* Indicates that limits are exceeded . See < a
* href = " https : / / docs . aws . amazon . com / clouddirectory / latest / developerguide / limits . html " > Limits < / a > for more
* information .
* @ sample AmazonCloudDirectory . UpgradePublishedSchema
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / clouddirectory - 2017-01-11 / UpgradePublishedSchema "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpgradePublishedSchemaResult upgradePublishedSchema ( UpgradePublishedSchemaRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpgradePublishedSchema ( request ) ; |
public class FastSet { /** * { @ inheritDoc } */
@ Override public int last ( ) { } } | if ( isEmpty ( ) ) { throw new NoSuchElementException ( ) ; } return multiplyByWordSize ( firstEmptyWord - 1 ) + ( WORD_SIZE - Integer . numberOfLeadingZeros ( words [ firstEmptyWord - 1 ] ) ) - 1 ; |
public class FormatUtil { /** * Formats the string array d with the specified separator .
* @ param d the string array to be formatted
* @ param sep separator between the single values of the array , e . g . ' , '
* @ return a String representing the string array d */
public static String format ( String [ ] d , String sep ) { } } | if ( d == null ) { return "null" ; } if ( d . length == 0 ) { return "" ; } if ( d . length == 1 ) { return d [ 0 ] ; } int len = sep . length ( ) * ( d . length - 1 ) ; for ( String s : d ) { len += s . length ( ) ; } StringBuilder buffer = new StringBuilder ( len ) . append ( d [ 0 ] ) ; for ( int i = 1 ; i < d . length ; i ++ ) { buffer . append ( sep ) . append ( d [ i ] ) ; } return buffer . toString ( ) ; |
public class OjbTagsHandler { /** * Processes the template for all table definitions in the torque model .
* @ param template The template
* @ param attributes The attributes of the tag
* @ exception XDocletException if an error occurs
* @ doc . tag type = " block " */
public void forAllTables ( String template , Properties attributes ) throws XDocletException { } } | for ( Iterator it = _torqueModel . getTables ( ) ; it . hasNext ( ) ; ) { _curTableDef = ( TableDef ) it . next ( ) ; generate ( template ) ; } _curTableDef = null ; |
public class Maybes { /** * Get an Iterator for the value ( if any ) in the provided Maybe
* @ param pub Maybe to get Iterator for
* @ return Iterator over Maybe value */
public static < T > Iterator < T > iterator ( Maybe < T > pub ) { } } | return pub . toFlowable ( ) . blockingIterable ( ) . iterator ( ) ; |
public class CmsDisplayTypeSelectWidget { /** * Replaces the select items with the given items . < p >
* @ param items the select items */
private void replaceItems ( Map < String , String > items ) { } } | String oldValue = m_selectBox . getFormValueAsString ( ) ; // set value and option to the combo box .
m_selectBox . setItems ( items ) ; if ( items . containsKey ( oldValue ) ) { m_selectBox . setFormValueAsString ( oldValue ) ; } |
public class EvaluationUtils { /** * Calculate the precision from true positive and false positive counts
* @ param tpCount True positive count
* @ param fpCount False positive count
* @ param edgeCase Edge case value use to avoid 0/0
* @ return Precision */
public static double precision ( long tpCount , long fpCount , double edgeCase ) { } } | // Edge case
if ( tpCount == 0 && fpCount == 0 ) { return edgeCase ; } return tpCount / ( double ) ( tpCount + fpCount ) ; |
public class EnvironmentsInner { /** * Stops an environment by stopping all resources inside the environment This operation can take a while to complete .
* @ param resourceGroupName The name of the resource group .
* @ param labAccountName The name of the lab Account .
* @ param labName The name of the lab .
* @ param environmentSettingName The name of the environment Setting .
* @ param environmentName The name of the environment .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceResponse } object if successful . */
public Observable < Void > beginStopAsync ( String resourceGroupName , String labAccountName , String labName , String environmentSettingName , String environmentName ) { } } | return beginStopWithServiceResponseAsync ( resourceGroupName , labAccountName , labName , environmentSettingName , environmentName ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ; |
public class CmsSerialDateUtil { /** * Parses int value and returns the provided default if the value can ' t be parsed .
* @ param value the int to parse .
* @ param defaultValue the default value .
* @ return the parsed int , or the default value if parsing fails . */
public static int toIntWithDefault ( String value , int defaultValue ) { } } | int result = defaultValue ; try { result = Integer . parseInt ( value ) ; } catch ( @ SuppressWarnings ( "unused" ) Exception e ) { // Do nothing , return default .
} return result ; |
public class SenseData { /** * Returns the proper response code for the given error type and sense data format .
* @ param errorType a sense data error type
* @ param senseDataFormat a sense data format
* @ return the proper response code */
public static final int getReponseCodeFor ( final ErrorType errorType , final SenseDataFormat senseDataFormat ) { } } | if ( senseDataFormat == SenseDataFormat . FIXED ) { if ( errorType == ErrorType . CURRENT ) return 0x70 ; else // errorType = = DEFERRED
return 0x71 ; } else { // senseDataFormat = = DESCRIPTOR
if ( errorType == ErrorType . CURRENT ) return 0x72 ; else // errorType = = DEFERRED
return 0x73 ; } /* * Response codes 0x74 to 0x7E are reserved . Response code 0x7f is vendor specific . */ |
public class XMLConfigWebFactory { /** * reloads the Config Object
* @ param cs
* @ param force
* @ throws SAXException
* @ throws ClassNotFoundException
* @ throws PageException
* @ throws IOException
* @ throws TagLibException
* @ throws FunctionLibException
* @ throws BundleException
* @ throws NoSuchAlgorithmException */
public static void reloadInstance ( CFMLEngine engine , ConfigServerImpl cs , ConfigWebImpl cw , boolean force ) throws SAXException , ClassException , PageException , IOException , TagLibException , FunctionLibException , BundleException { } } | Resource configFile = cw . getConfigFile ( ) ; Resource configDir = cw . getConfigDir ( ) ; int iDoNew = doNew ( engine , configDir , false ) . updateType ; boolean doNew = iDoNew != NEW_NONE ; if ( configFile == null ) return ; if ( second ( cw . getLoadTime ( ) ) > second ( configFile . lastModified ( ) ) && ! force ) return ; Document doc = loadDocument ( configFile ) ; createContextFiles ( configDir , null , doNew ) ; cw . reset ( ) ; load ( cs , cw , doc , true , doNew ) ; createContextFilesPost ( configDir , cw , null , false , doNew ) ; ( ( CFMLEngineImpl ) ConfigWebUtil . getEngine ( cw ) ) . onStart ( cw , true ) ; |
public class DBPropertiesUpdate { /** * Insert a new Bundle into the Database .
* @ return ID of the new Bundle */
private Instance insertNewBundle ( ) { } } | Instance ret = null ; try { final Insert insert = new Insert ( DBPropertiesUpdate . TYPE_PROPERTIES_BUNDLE ) ; insert . add ( "Name" , this . bundlename ) ; insert . add ( "UUID" , this . bundeluuid ) ; insert . add ( "Sequence" , this . bundlesequence ) ; insert . add ( "CacheOnStart" , this . cacheOnStart ) ; insert . executeWithoutAccessCheck ( ) ; ret = insert . getInstance ( ) ; insert . close ( ) ; } catch ( final EFapsException e ) { DBPropertiesUpdate . LOG . error ( "insertNewBundle()" , e ) ; } return ret ; |
public class ElementMatchers { /** * Matches a { @ link TypeDescription } that is an interface . Annotation types are also considered interface types .
* @ param < T > The type of the matched object .
* @ return A matcher for an interface .
* @ see ElementMatchers # isAnnotation ( ) */
public static < T extends TypeDescription > ElementMatcher . Junction < T > isInterface ( ) { } } | return new ModifierMatcher < T > ( ModifierMatcher . Mode . INTERFACE ) ; |
public class Matrix4f { /** * Apply a mirror / reflection transformation to this matrix that reflects about the given plane
* specified via the equation < code > x * a + y * b + z * c + d = 0 < / code > .
* The vector < code > ( a , b , c ) < / code > must be a unit vector .
* If < code > M < / code > is < code > this < / code > matrix and < code > R < / code > the reflection matrix ,
* then the new matrix will be < code > M * R < / code > . So when transforming a
* vector < code > v < / code > with the new matrix by using < code > M * R * v < / code > , the
* reflection will be applied first !
* Reference : < a href = " https : / / msdn . microsoft . com / en - us / library / windows / desktop / bb281733 ( v = vs . 85 ) . aspx " > msdn . microsoft . com < / a >
* @ param a
* the x factor in the plane equation
* @ param b
* the y factor in the plane equation
* @ param c
* the z factor in the plane equation
* @ param d
* the constant in the plane equation
* @ return a matrix holding the result */
public Matrix4f reflect ( float a , float b , float c , float d ) { } } | return reflect ( a , b , c , d , thisOrNew ( ) ) ; |
public class AkkaInvocationHandler { /** * Create the RpcInvocation message for the given RPC .
* @ param methodName of the RPC
* @ param parameterTypes of the RPC
* @ param args of the RPC
* @ return RpcInvocation message which encapsulates the RPC details
* @ throws IOException if we cannot serialize the RPC invocation parameters */
protected RpcInvocation createRpcInvocationMessage ( final String methodName , final Class < ? > [ ] parameterTypes , final Object [ ] args ) throws IOException { } } | final RpcInvocation rpcInvocation ; if ( isLocal ) { rpcInvocation = new LocalRpcInvocation ( methodName , parameterTypes , args ) ; } else { try { RemoteRpcInvocation remoteRpcInvocation = new RemoteRpcInvocation ( methodName , parameterTypes , args ) ; if ( remoteRpcInvocation . getSize ( ) > maximumFramesize ) { throw new IOException ( "The rpc invocation size exceeds the maximum akka framesize." ) ; } else { rpcInvocation = remoteRpcInvocation ; } } catch ( IOException e ) { LOG . warn ( "Could not create remote rpc invocation message. Failing rpc invocation because..." , e ) ; throw e ; } } return rpcInvocation ; |
public class Proposal { /** * Sets the buyerRfp value for this Proposal .
* @ param buyerRfp * The buyer RFP associated with this { @ code Proposal } , which
* is optional . This field will be null
* if the proposal is not initiated from RFP .
* < span class = " constraint Applicable " > This attribute
* is applicable when : < ul > < li > using programmatic guaranteed , not using
* sales management . < / li > < li > using preferred deals , not using sales management . < / li > < / ul > < / span > */
public void setBuyerRfp ( com . google . api . ads . admanager . axis . v201805 . BuyerRfp buyerRfp ) { } } | this . buyerRfp = buyerRfp ; |
public class DefaultClusterManager { /** * Finds a node in the cluster . */
private void doFind ( final Message < JsonObject > message ) { } } | String type = message . body ( ) . getString ( "type" ) ; if ( type != null ) { switch ( type ) { case "group" : doFindGroup ( message ) ; break ; case "node" : doFindNode ( message ) ; break ; case "network" : doFindNetwork ( message ) ; break ; default : message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "Invalid type specified." ) ) ; break ; } } else { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No type specified." ) ) ; } |
public class WebContainer { /** * 112102 - added method below to fill the cipher to bit size table */
protected void loadCipherToBit ( ) { } } | boolean keySizeFromCipherMap = Boolean . valueOf ( WebContainer . getWebContainerProperties ( ) . getProperty ( "com.ibm.ws.webcontainer.keysizefromciphermap" , "true" ) ) . booleanValue ( ) ; // 721610
if ( keySizeFromCipherMap ) { this . getKeySizefromCipherMap ( "toLoad" ) ; // this will load the Map with values
} else { Properties cipherToBitProps = new Properties ( ) ; // load the ssl cipher suite bit sizes property file
try { String fileName = System . getProperty ( "server.root" ) + File . separator + "properties" + File . separator + "sslbitsizes.properties" ; cipherToBitProps . load ( new FileInputStream ( fileName ) ) ; } catch ( Exception ex ) { logger . logp ( Level . SEVERE , CLASS_NAME , "loadCipherToBit" , "failed.to.load.sslbitsizes.properties " , ex ) ; /* 283348.1 */
com . ibm . wsspi . webcontainer . util . FFDCWrapper . processException ( ex , CLASS_NAME + ".loadCipherToBit" , "825" , this ) ; } // put the properties into a hash map for unsynch . reference
_cipherToBit . putAll ( cipherToBitProps ) ; } |
public class ELText { /** * Factory method for creating a validated ELText instance . When an Expression is hit , it will use the
* ExpressionFactory to create a ValueExpression instance , resolving any functions at that time . < p / > Variables and
* properties will not be evaluated .
* @ param fact
* ExpressionFactory to use
* @ param ctx
* ELContext to validate against
* @ param in
* String to parse
* @ return ELText that can be re - applied later
* @ throws javax . el . ELException */
public static ELText parse ( ExpressionFactory fact , ELContext ctx , String in ) throws ELException { } } | char [ ] ca = in . toCharArray ( ) ; int i = 0 ; char c = 0 ; int len = ca . length ; int end = len - 1 ; boolean esc = false ; int vlen = 0 ; StringBuffer buff = new StringBuffer ( 128 ) ; List < ELText > text = new ArrayList < ELText > ( ) ; ELText t = null ; ValueExpression ve = null ; while ( i < len ) { c = ca [ i ] ; if ( '\\' == c ) { esc = ! esc ; if ( esc && i < end && ( ca [ i + 1 ] == '$' || ca [ i + 1 ] == '#' ) ) { i ++ ; continue ; } } else if ( ! esc && ( '$' == c || '#' == c ) ) { if ( i < end ) { if ( '{' == ca [ i + 1 ] ) { if ( buff . length ( ) > 0 ) { text . add ( new ELText ( buff . toString ( ) ) ) ; buff . setLength ( 0 ) ; } vlen = findVarLength ( ca , i ) ; if ( ctx != null && fact != null ) { ve = fact . createValueExpression ( ctx , new String ( ca , i , vlen ) , String . class ) ; t = new ELCacheableTextVariable ( ve ) ; } else { t = new ELCacheableTextVariable ( new LiteralValueExpression ( new String ( ca , i , vlen ) ) ) ; } text . add ( t ) ; i += vlen ; continue ; } } } esc = false ; buff . append ( c ) ; i ++ ; } if ( buff . length ( ) > 0 ) { text . add ( new ELText ( new String ( buff . toString ( ) ) ) ) ; buff . setLength ( 0 ) ; } if ( text . size ( ) == 0 ) { return null ; } else if ( text . size ( ) == 1 ) { return ( ELText ) text . get ( 0 ) ; } else { ELText [ ] ta = ( ELText [ ] ) text . toArray ( new ELText [ text . size ( ) ] ) ; return new ELTextComposite ( ta ) ; } |
public class Allure { /** * Adds label to current test or step ( or fixture ) if any . Takes no effect
* if no test run at the moment .
* @ param name the name of label .
* @ param value the value of label . */
public static void label ( final String name , final String value ) { } } | final Label label = new Label ( ) . setName ( name ) . setValue ( value ) ; getLifecycle ( ) . updateTestCase ( testResult -> testResult . getLabels ( ) . add ( label ) ) ; |
public class CalendarMonth { /** * / * [ deutsch ]
* < p > Kombiniert diese Instanz mit dem angegebenen Tag zu einem Kalenderdatum . < / p >
* @ param dayOfMonth day of month in range 1-28/29/30/31
* @ return calendar date
* @ throws IllegalArgumentException if the day - of - month is out of range */
public PlainDate atDayOfMonth ( int dayOfMonth ) { } } | if ( dayOfMonth == 1 ) { return this . start . getTemporal ( ) ; } return this . start . getTemporal ( ) . with ( PlainDate . DAY_OF_MONTH , dayOfMonth ) ; |
public class Configurations { /** * Merge a set of Configurations .
* @ param configurations the configuration to be merged
* @ return the merged configuration .
* @ throws org . apache . reef . tang . exceptions . BindException if the merge fails . */
public static Configuration merge ( final Configuration ... configurations ) { } } | return Tang . Factory . getTang ( ) . newConfigurationBuilder ( configurations ) . build ( ) ; |
public class MBeanInfoData { /** * Add an exception which occurred during extraction of an { @ link MBeanInfo } for
* a certain { @ link ObjectName } to this map .
* @ param pName MBean name for which the error occurred
* @ param pExp exception occurred
* @ throws IllegalStateException if this method decides to rethrow the exception */
public void handleException ( ObjectName pName , InstanceNotFoundException pExp ) throws InstanceNotFoundException { } } | // This happen happens for JBoss 7.1 in some cases ( i . e . ResourceAdapterModule )
if ( pathStack . size ( ) == 0 ) { addException ( pName , pExp ) ; } else { throw new InstanceNotFoundException ( "InstanceNotFoundException for MBean " + pName + " (" + pExp . getMessage ( ) + ")" ) ; } |
public class MimeType { /** * Get extension of file , without fragment id */
private static String getExtension ( String fileName ) { } } | // play it safe and get rid of any fragment id
// that might be there
int length = fileName . length ( ) ; int newEnd = fileName . lastIndexOf ( '#' ) ; if ( newEnd == - 1 ) { newEnd = length ; } int i = fileName . lastIndexOf ( '.' , newEnd ) ; if ( i != - 1 ) { return fileName . substring ( i + 1 , newEnd ) ; } else { // no extension , no content type
return null ; } |
public class DescriptorImporterBase { /** * { @ inheritDoc }
* @ see org . jboss . shrinkwrap . descriptor . api . DescriptorImporter # fromFile ( java . io . File ) */
@ Override public T fromFile ( final File file ) throws IllegalArgumentException , DescriptorImportException { } } | // Precondition checks
if ( file == null ) { throw new IllegalArgumentException ( "File not specified" ) ; } // Delegate
try { return this . fromStream ( new FileInputStream ( file ) ) ; } catch ( final FileNotFoundException e ) { throw new IllegalArgumentException ( "Specified file does not exist or is a directory: " + file . getAbsolutePath ( ) ) ; } |
public class HttpResponse { /** * 创建CompletionHandler实例
* @ return CompletionHandler */
public CompletionHandler createAsyncHandler ( ) { } } | return Utility . createAsyncHandler ( ( v , a ) -> { finish ( v ) ; } , ( t , a ) -> { context . getLogger ( ) . log ( Level . WARNING , "Servlet occur, force to close channel. request = " + request + ", result is CompletionHandler" , ( Throwable ) t ) ; finish ( 500 , null ) ; } ) ; |
public class WidgetUtils { /** * Moderated version of Color . brighter ( )
* @ param color
* @ return */
@ SuppressWarnings ( "checkstyle:LocalVariableName" ) public static Color slightlyBrighter ( final Color color ) { } } | int r = color . getRed ( ) ; int g = color . getGreen ( ) ; int b = color . getBlue ( ) ; /* * From 2D group : 1 . black . brighter ( ) should return grey 2 . applying brighter to blue will always return blue ,
* brighter 3 . non pure color ( non zero rgb ) will eventually return white */
final int i = ( int ) ( 1.0 / ( 1.0 - COLOR_SCALE_FACTOR ) ) ; if ( r == 0 && g == 0 && b == 0 ) { return new Color ( i , i , i ) ; } if ( r > 0 && r < i ) { r = i ; } if ( g > 0 && g < i ) { g = i ; } if ( b > 0 && b < i ) { b = i ; } return new Color ( Math . min ( ( int ) ( r / COLOR_SCALE_FACTOR ) , 255 ) , Math . min ( ( int ) ( g / COLOR_SCALE_FACTOR ) , 255 ) , Math . min ( ( int ) ( b / COLOR_SCALE_FACTOR ) , 255 ) ) ; |
public class EditText { /** * Gets the radius of the shadow layer .
* @ return the radius of the shadow layer . If 0 , the shadow layer is not visible
* @ see # setShadowLayer ( float , float , float , int )
* @ attr ref android . R . styleable # TextView _ shadowRadius */
@ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) public float getShadowRadius ( ) { } } | if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN ) return mInputView . getShadowRadius ( ) ; return 0 ; |
public class Gauge { /** * Defines the shape that will be used to visualize the medium tickmark .
* Values are LINE , DOT , TRAPEZOID , BOX and PILL
* @ param TYPE */
public void setMediumTickMarkType ( final TickMarkType TYPE ) { } } | if ( null == mediumTickMarkType ) { _mediumTickMarkType = null == TYPE ? TickMarkType . LINE : TYPE ; fireUpdateEvent ( REDRAW_EVENT ) ; } else { mediumTickMarkType . set ( TYPE ) ; } |
public class Record { /** * Parse a block of text into records .
* @ param text text to be parsed
* @ param start start index
* @ param valueStart value start index
* @ param valueStop value end index
* @ param dictStart dictionary start index
* @ param dictStop dictionary end index */
private void parse ( String text , int start , int valueStart , int valueStop , int dictStart , int dictStop ) { } } | m_field = text . substring ( start , valueStart ) ; if ( valueStop - valueStart <= 1 ) { m_value = null ; } else { m_value = text . substring ( valueStart + 1 , valueStop ) ; } if ( dictStop - dictStart > 1 ) { for ( int s = getNextOpeningParenthesisPosition ( text , dictStart ) ; s >= 0 && s < dictStop ; ) { int e = getClosingParenthesisPosition ( text , s ) ; m_records . add ( new Record ( text , s , e ) ) ; s = getNextOpeningParenthesisPosition ( text , e ) ; } } |
public class AWSGlueClient { /** * Retrieves a specified function definition from the Data Catalog .
* @ param getUserDefinedFunctionRequest
* @ return Result of the GetUserDefinedFunction operation returned by the service .
* @ throws EntityNotFoundException
* A specified entity does not exist
* @ throws InvalidInputException
* The input provided was not valid .
* @ throws InternalServiceException
* An internal service error occurred .
* @ throws OperationTimeoutException
* The operation timed out .
* @ throws GlueEncryptionException
* An encryption operation failed .
* @ sample AWSGlue . GetUserDefinedFunction
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / glue - 2017-03-31 / GetUserDefinedFunction " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public GetUserDefinedFunctionResult getUserDefinedFunction ( GetUserDefinedFunctionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetUserDefinedFunction ( request ) ; |
public class BaseMoskitoUIAction { /** * Returns a previously set info message or null if no message has been set .
* @ return */
protected String getInfoMessage ( ) { } } | try { return ( String ) APICallContext . getCallContext ( ) . getCurrentSession ( ) . getAttribute ( "infoMessage" ) ; } catch ( Exception any ) { return null ; } |
public class P2sVpnServerConfigurationsInner { /** * Retrieves the details of a P2SVpnServerConfiguration .
* @ param resourceGroupName The resource group name of the P2SVpnServerConfiguration .
* @ param virtualWanName The name of the VirtualWan .
* @ param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the P2SVpnServerConfigurationInner object */
public Observable < P2SVpnServerConfigurationInner > getAsync ( String resourceGroupName , String virtualWanName , String p2SVpnServerConfigurationName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , virtualWanName , p2SVpnServerConfigurationName ) . map ( new Func1 < ServiceResponse < P2SVpnServerConfigurationInner > , P2SVpnServerConfigurationInner > ( ) { @ Override public P2SVpnServerConfigurationInner call ( ServiceResponse < P2SVpnServerConfigurationInner > response ) { return response . body ( ) ; } } ) ; |
public class CompositeBinaryStore { /** * Move a BinaryKey to a named store
* @ param key Binary key to transfer from the source store to the destination store
* @ param destination a hint for discovering the destination repository
* @ throws BinaryStoreException if anything unexpected fails */
public void moveValue ( BinaryKey key , String destination ) throws BinaryStoreException { } } | moveValue ( key , null , destination ) ; |
public class RestTemplateBuilder { /** * Sets the read timeout on the underlying { @ link ClientHttpRequestFactory } .
* @ param readTimeout the read timeout
* @ return a new builder instance .
* @ since 2.1.0 */
public RestTemplateBuilder setReadTimeout ( Duration readTimeout ) { } } | return new RestTemplateBuilder ( this . detectRequestFactory , this . rootUri , this . messageConverters , this . requestFactorySupplier , this . uriTemplateHandler , this . errorHandler , this . basicAuthentication , this . restTemplateCustomizers , this . requestFactoryCustomizer . readTimeout ( readTimeout ) , this . interceptors ) ; |
public class EchoUntilQuit { /** * Handle input .
* @ param event the event */
@ Handler @ SuppressWarnings ( "PMD.SystemPrintln" ) public void onInput ( Input < ByteBuffer > event ) { } } | String data = Charset . defaultCharset ( ) . decode ( event . data ( ) ) . toString ( ) ; System . out . print ( data ) ; if ( data . trim ( ) . equals ( "QUIT" ) ) { fire ( new Stop ( ) ) ; } |
public class AdaptiveGrid { /** * Calculates the hypercube of a solution
* @ param solution The < code > Solution < / code > . */
public int location ( S solution ) { } } | // Create a int [ ] to store the range of each objective
int [ ] position = new int [ numberOfObjectives ] ; // Calculate the position for each objective
for ( int obj = 0 ; obj < numberOfObjectives ; obj ++ ) { if ( ( solution . getObjective ( obj ) > gridUpperLimits [ obj ] ) || ( solution . getObjective ( obj ) < gridLowerLimits [ obj ] ) ) { return - 1 ; } else if ( solution . getObjective ( obj ) == gridLowerLimits [ obj ] ) { position [ obj ] = 0 ; } else if ( solution . getObjective ( obj ) == gridUpperLimits [ obj ] ) { position [ obj ] = ( ( int ) Math . pow ( 2.0 , bisections ) ) - 1 ; } else { double tmpSize = divisionSize [ obj ] ; double value = solution . getObjective ( obj ) ; double account = gridLowerLimits [ obj ] ; int ranges = ( int ) Math . pow ( 2.0 , bisections ) ; for ( int b = 0 ; b < bisections ; b ++ ) { tmpSize /= 2.0 ; ranges /= 2 ; if ( value > ( account + tmpSize ) ) { position [ obj ] += ranges ; account += tmpSize ; } } } } // Calculate the location into the hypercubes
int location = 0 ; for ( int obj = 0 ; obj < numberOfObjectives ; obj ++ ) { location += position [ obj ] * Math . pow ( 2.0 , obj * bisections ) ; } return location ; |
public class StorableGenerator { /** * Generates code to get a trigger , forcing a transaction if trigger is not
* null . Also , if there is a trigger , the " before " method is called .
* @ param opType type of operation , Insert , Update , or Delete
* @ param forTryVar optional boolean variable for selecting whether to call
* " before " or " beforeTry " method
* @ param forTry used if forTryVar is null
* @ param triggerVar required variable of type Trigger for storing trigger
* @ param txnVar required variable of type Transaction for storing transaction
* @ param stateVar variable of type Object for storing state
* @ return try start label for transaction */
private Label addGetTriggerAndEnterTxn ( CodeBuilder b , String opType , LocalVariable forTryVar , boolean forTry , LocalVariable triggerVar , LocalVariable txnVar , LocalVariable stateVar ) { } } | // trigger = support $ . getXxxTrigger ( ) ;
b . loadThis ( ) ; b . loadField ( SUPPORT_FIELD_NAME , mSupportType ) ; Method m = lookupMethod ( mSupportType . toClass ( ) , "get" + opType + "Trigger" ) ; b . invoke ( m ) ; b . storeLocal ( triggerVar ) ; // state = null ;
b . loadNull ( ) ; b . storeLocal ( stateVar ) ; // if ( trigger = = null ) {
// txn = null ;
// } else {
// txn = support . getRootRepository ( ) . enterTransaction ( ) ;
// tryStart :
// if ( forTry ) {
// state = trigger . beforeTryXxx ( txn , this ) ;
// } else {
// state = trigger . beforeXxx ( txn , this ) ;
b . loadLocal ( triggerVar ) ; Label hasTrigger = b . createLabel ( ) ; b . ifNullBranch ( hasTrigger , false ) ; // txn = null
b . loadNull ( ) ; b . storeLocal ( txnVar ) ; Label cont = b . createLabel ( ) ; b . branch ( cont ) ; hasTrigger . setLocation ( ) ; // txn = support . getRootRepository ( ) . enterTransaction ( ) ;
TypeDesc repositoryType = TypeDesc . forClass ( Repository . class ) ; TypeDesc transactionType = TypeDesc . forClass ( Transaction . class ) ; b . loadThis ( ) ; b . loadField ( SUPPORT_FIELD_NAME , mSupportType ) ; b . invokeInterface ( mSupportType , "getRootRepository" , repositoryType , null ) ; b . invokeInterface ( repositoryType , ENTER_TRANSACTION_METHOD_NAME , transactionType , null ) ; b . storeLocal ( txnVar ) ; Label tryStart = b . createLabel ( ) . setLocation ( ) ; // if ( forTry ) {
// state = trigger . beforeTryXxx ( txn , this ) ;
// } else {
// state = trigger . beforeXxx ( txn , this ) ;
b . loadLocal ( triggerVar ) ; b . loadLocal ( txnVar ) ; b . loadThis ( ) ; if ( forTryVar == null ) { if ( forTry ) { b . invokeVirtual ( triggerVar . getType ( ) , "beforeTry" + opType , TypeDesc . OBJECT , new TypeDesc [ ] { transactionType , TypeDesc . OBJECT } ) ; } else { b . invokeVirtual ( triggerVar . getType ( ) , "before" + opType , TypeDesc . OBJECT , new TypeDesc [ ] { transactionType , TypeDesc . OBJECT } ) ; } b . storeLocal ( stateVar ) ; } else { b . loadLocal ( forTryVar ) ; Label isForTry = b . createLabel ( ) ; b . ifZeroComparisonBranch ( isForTry , "!=" ) ; b . invokeVirtual ( triggerVar . getType ( ) , "before" + opType , TypeDesc . OBJECT , new TypeDesc [ ] { transactionType , TypeDesc . OBJECT } ) ; b . storeLocal ( stateVar ) ; b . branch ( cont ) ; isForTry . setLocation ( ) ; b . invokeVirtual ( triggerVar . getType ( ) , "beforeTry" + opType , TypeDesc . OBJECT , new TypeDesc [ ] { transactionType , TypeDesc . OBJECT } ) ; b . storeLocal ( stateVar ) ; } cont . setLocation ( ) ; return tryStart ; |
public class EmbeddedApacheDS { /** * Get a free port .
* @ return The free port .
* @ throws IOException If a free port could not be found . */
private static int getOpenPort ( ) throws IOException { } } | Log . info ( c , "getOpenPort" , "Entry." ) ; ServerSocket s = new ServerSocket ( 0 ) ; Log . info ( c , "getOpenPort" , "Got socket." ) ; int port = s . getLocalPort ( ) ; Log . info ( c , "getOpenPort" , "Got port " + s ) ; s . close ( ) ; Log . info ( c , "getOpenPort" , "Close socket" ) ; return port ; |
public class DynamicTimeoutStoreClient { /** * Performs a Versioned put operation with the specified composite request
* object
* @ param requestWrapper Composite request object containing the key and the
* versioned object
* @ return Version of the value for the successful put
* @ throws ObsoleteVersionException */
public Version putVersionedWithCustomTimeout ( CompositeVoldemortRequest < K , V > requestWrapper ) throws ObsoleteVersionException { } } | validateTimeout ( requestWrapper . getRoutingTimeoutInMs ( ) ) ; for ( int attempts = 0 ; attempts < this . metadataRefreshAttempts ; attempts ++ ) { try { String keyHexString = "" ; long startTimeInMs = System . currentTimeMillis ( ) ; if ( logger . isDebugEnabled ( ) ) { ByteArray key = ( ByteArray ) requestWrapper . getKey ( ) ; keyHexString = RestUtils . getKeyHexString ( key ) ; debugLogStart ( "PUT_VERSION" , requestWrapper . getRequestOriginTimeInMs ( ) , startTimeInMs , keyHexString ) ; } store . put ( requestWrapper ) ; if ( logger . isDebugEnabled ( ) ) { debugLogEnd ( "PUT_VERSION" , requestWrapper . getRequestOriginTimeInMs ( ) , startTimeInMs , System . currentTimeMillis ( ) , keyHexString , 0 ) ; } return requestWrapper . getValue ( ) . getVersion ( ) ; } catch ( InvalidMetadataException e ) { logger . info ( "Received invalid metadata exception during put [ " + e . getMessage ( ) + " ] on store '" + storeName + "'. Rebootstrapping" ) ; bootStrap ( ) ; } } throw new VoldemortException ( this . metadataRefreshAttempts + " metadata refresh attempts failed." ) ; |
public class TSSSSLTransportConfig { /** * Authenticate using a certificate chain . Exception handling done in caller method . */
private Subject authenticateWithCertificateChain ( SSLSession session ) throws SSLPeerUnverifiedException , AuthenticationException , CredentialExpiredException , CredentialDestroyedException { } } | Subject transportSubject = null ; if ( session != null ) { Certificate [ ] certificateChain = session . getPeerCertificates ( ) ; transportSubject = authenticator . authenticate ( ( X509Certificate [ ] ) certificateChain ) ; /* Here we need to get the WSCredential from the subject . We will use the subject manager for the same . */
SubjectHelper subjectHelper = new SubjectHelper ( ) ; WSCredential wsCredential = subjectHelper . getWSCredential ( transportSubject ) ; /* * First we tell the WSCredential that the identity token is in the form of a certificate chain . This is
* done by setting the property " wssecurity . identity _ name " to " ClientCertificate " */
wsCredential . set ( Constants . IDENTITY_NAME , Constants . ClientCertificate ) ; /* * Now we need to put the certificate chain into the WScredential object . By doing this , we
* make sure that , the authenticated certificates are indeed part of the credential . This credential
* can be used further down the CSIv2 flow . The certificate is set as a name value pair , with the name
* " wssecurity . identity _ value " */
wsCredential . set ( Constants . IDENTITY_VALUE , certificateChain ) ; } return transportSubject ; |
public class StylesheetComposed { /** * Get a stylesheet from the " import " list .
* @ see < a href = " http : / / www . w3 . org / TR / xslt # import " > import in XSLT Specification < / a >
* @ param i Index of stylesheet in import list
* @ return The stylesheet at the given index
* @ throws ArrayIndexOutOfBoundsException */
public StylesheetComposed getImportComposed ( int i ) throws ArrayIndexOutOfBoundsException { } } | StylesheetRoot root = getStylesheetRoot ( ) ; // Get the stylesheet that is offset past this stylesheet .
// Thus , if the index of this stylesheet is 3 , an argument
// to getImportComposed of 0 will return the 4th stylesheet
// in the global import list .
return root . getGlobalImport ( 1 + m_importNumber + i ) ; |
public class DateUtils { /** * Get specify months back from given date .
* @ param monthsBack how many months want to be back .
* @ param date date to be handled .
* @ return a new Date object . */
public static Date getDateOfMonthsBack ( final int monthsBack , final Date date ) { } } | return dateBack ( Calendar . MONTH , monthsBack , date ) ; |
public class CanonicalLabeler { /** * Rank atomic vector , corresponds to step 4.
* @ param v the invariance pair vector */
private void rankArrayList ( List < InvPair > v ) { } } | int num = 1 ; int [ ] temp = new int [ v . size ( ) ] ; InvPair last = ( InvPair ) v . get ( 0 ) ; Iterator < InvPair > it = v . iterator ( ) ; InvPair curr ; for ( int x = 0 ; it . hasNext ( ) ; x ++ ) { curr = ( InvPair ) it . next ( ) ; if ( ! last . equals ( curr ) ) { num ++ ; } temp [ x ] = num ; last = curr ; } it = v . iterator ( ) ; for ( int x = 0 ; it . hasNext ( ) ; x ++ ) { curr = ( InvPair ) it . next ( ) ; curr . setCurr ( temp [ x ] ) ; curr . setPrime ( ) ; } |
public class HlsGroupSettings { /** * Choose one or more ad marker types to pass SCTE35 signals through to this group of Apple HLS outputs .
* @ param adMarkers
* Choose one or more ad marker types to pass SCTE35 signals through to this group of Apple HLS outputs .
* @ see HlsAdMarkers */
public void setAdMarkers ( java . util . Collection < String > adMarkers ) { } } | if ( adMarkers == null ) { this . adMarkers = null ; return ; } this . adMarkers = new java . util . ArrayList < String > ( adMarkers ) ; |
public class UserHandlerImpl { /** * Notifying listeners before enabling / disabling a user .
* @ param user
* the user which is used in enabling / disabling operation
* @ throws Exception
* if any listener failed to handle the event */
private void preSetEnabled ( User user ) throws Exception { } } | for ( UserEventListener listener : listeners ) listener . preSetEnabled ( user ) ; |
public class ComputerVisionImpl { /** * This operation extracts a rich set of visual features based on the image content .
* @ param image An image stream .
* @ param analyzeImageInStreamOptionalParameter the object representing the optional parameters to be set before calling this API
* @ 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 < ImageAnalysis > analyzeImageInStreamAsync ( byte [ ] image , AnalyzeImageInStreamOptionalParameter analyzeImageInStreamOptionalParameter , final ServiceCallback < ImageAnalysis > serviceCallback ) { } } | return ServiceFuture . fromResponse ( analyzeImageInStreamWithServiceResponseAsync ( image , analyzeImageInStreamOptionalParameter ) , serviceCallback ) ; |
public class AbstractApacheHttpClient { /** * Creates default request config .
* @ param settings
* settings to use .
* @ return instance of { @ link RequestConfig } . */
private RequestConfig createDefaultRequestConfig ( HttpSettings settings ) { } } | int connectionTimeout = settings . getConnectionTimeout ( ) ; int socketTimeout = settings . getReadTimeout ( ) ; return RequestConfig . custom ( ) . setConnectionRequestTimeout ( connectionTimeout ) . setSocketTimeout ( socketTimeout ) . build ( ) ; |
public class ClassDescriptor { /** * returns the zero argument constructor for the class represented by this class descriptor
* or null if a zero argument constructor does not exist . If the zero argument constructor
* for this class is not public it is made accessible before being returned . */
public Constructor getZeroArgumentConstructor ( ) { } } | if ( zeroArgumentConstructor == null && ! alreadyLookedupZeroArguments ) { try { zeroArgumentConstructor = getClassOfObject ( ) . getConstructor ( NO_PARAMS ) ; } catch ( NoSuchMethodException e ) { // no public zero argument constructor available let ' s try for a private / protected one
try { zeroArgumentConstructor = getClassOfObject ( ) . getDeclaredConstructor ( NO_PARAMS ) ; // we found one , now let ' s make it accessible
zeroArgumentConstructor . setAccessible ( true ) ; } catch ( NoSuchMethodException e2 ) { // out of options , log the fact and let the method return null
LoggerFactory . getDefaultLogger ( ) . warn ( this . getClass ( ) . getName ( ) + ": " + "No zero argument constructor defined for " + this . getClassOfObject ( ) ) ; } } alreadyLookedupZeroArguments = true ; } return zeroArgumentConstructor ; |
public class DeviceImpl { /** * read an attribute history . IDL 5 version . The history is filled only be
* attribute polling
* @ param attributeName The attribute to retrieve
* @ param maxSize The history maximum size returned
* @ throws DevFailed */
@ Override public DevAttrHistory_5 read_attribute_history_5 ( final String attributeName , final int maxSize ) throws DevFailed { } } | MDC . setContextMap ( contextMap ) ; xlogger . entry ( ) ; checkInitialization ( ) ; deviceMonitoring . startRequest ( "read_attribute_history_5" ) ; DevAttrHistory_5 result = null ; try { final AttributeImpl attr = AttributeGetterSetter . getAttribute ( attributeName , attributeList ) ; if ( attr . getBehavior ( ) instanceof ForwardedAttribute ) { final ForwardedAttribute fwdAttr = ( ForwardedAttribute ) attr . getBehavior ( ) ; result = fwdAttr . getAttributeHistory ( maxSize ) ; } else { if ( ! attr . isPolled ( ) ) { throw DevFailedUtils . newDevFailed ( ExceptionMessages . ATTR_NOT_POLLED , attr . getName ( ) + " is not polled" ) ; } result = attr . getHistory ( ) . getAttrHistory5 ( maxSize ) ; } } catch ( final Exception e ) { deviceMonitoring . addError ( ) ; if ( e instanceof DevFailed ) { throw ( DevFailed ) e ; } else { // with CORBA , the stack trace is not visible by the client if
// not inserted in DevFailed .
throw DevFailedUtils . newDevFailed ( e ) ; } } return result ; |
public class TaskScheduler { /** * Gets all { @ link ScheduledTask } s .
* @ return the { @ link ScheduledTask } s */
public final Iterable < T > getScheduledTasks ( ) { } } | return Iterables . transform ( this . cancellableTaskMap . asMap ( ) . values ( ) , new Function < CancellableTask < K , T > , T > ( ) { @ Override public T apply ( CancellableTask < K , T > cancellableTask ) { return cancellableTask . getScheduledTask ( ) ; } } ) ; |
public class JNvgraph { /** * nvGRAPH Semi - ring sparse matrix vector multiplication */
public static int nvgraphSrSpmv ( nvgraphHandle handle , nvgraphGraphDescr descrG , long weight_index , Pointer alpha , long x_index , Pointer beta , long y_index , int SR ) { } } | return checkResult ( nvgraphSrSpmvNative ( handle , descrG , weight_index , alpha , x_index , beta , y_index , SR ) ) ; |
public class RelationType { /** * Gets the index of all columns matching the specified name */
public List < Field > resolveFields ( QualifiedName name ) { } } | return allFields . stream ( ) . filter ( input -> input . canResolve ( name ) ) . collect ( toImmutableList ( ) ) ; |
public class AcceleratedScreen { /** * Make the EGL drawing surface current or not
* @ param flag */
public void enableRendering ( boolean flag ) { } } | if ( flag ) { egl . eglMakeCurrent ( eglDisplay , eglSurface , eglSurface , eglContext ) ; } else { egl . eglMakeCurrent ( eglDisplay , 0 , 0 , eglContext ) ; } |
public class RebalanceController { /** * Validates all aspects of the plan ( i . e . , all config files )
* @ param rebalancePlan */
private void validateRebalancePlanState ( RebalancePlan rebalancePlan ) { } } | logger . info ( "Validating rebalance plan state." ) ; Cluster currentCluster = rebalancePlan . getCurrentCluster ( ) ; List < StoreDefinition > currentStores = rebalancePlan . getCurrentStores ( ) ; Cluster finalCluster = rebalancePlan . getFinalCluster ( ) ; List < StoreDefinition > finalStores = rebalancePlan . getFinalStores ( ) ; RebalanceUtils . validateClusterStores ( currentCluster , currentStores ) ; RebalanceUtils . validateClusterStores ( finalCluster , finalStores ) ; RebalanceUtils . validateCurrentFinalCluster ( currentCluster , finalCluster ) ; RebalanceUtils . validateRebalanceStore ( currentStores ) ; RebalanceUtils . validateRebalanceStore ( finalStores ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.