signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class HttpMessage { /** * Compares this { @ code HttpMessage } against another . Messages are equal
* type if the host , port , path and parameter names are equal . Even though
* the query values may differ . For POST this assumes x - www - form - urlencoded ,
* for other types ( such as JSON ) this means that parameter names and values
* ( the full request body ) could be included .
* @ param msg
* the message against which this { @ code HttpMessage } is being
* compared .
* @ return { @ code true } if the messages are considered equal ,
* { @ code false } otherwise */
public boolean equalType ( HttpMessage msg ) { } } | boolean result = false ; // compare method
if ( ! this . getRequestHeader ( ) . getMethod ( ) . equalsIgnoreCase ( msg . getRequestHeader ( ) . getMethod ( ) ) ) { return false ; } // compare host , port and URI
URI uri1 = this . getRequestHeader ( ) . getURI ( ) ; URI uri2 = msg . getRequestHeader ( ) . getURI ( ) ; try { if ( uri1 . getHost ( ) == null || uri2 . getHost ( ) == null || ! uri1 . getHost ( ) . equalsIgnoreCase ( uri2 . getHost ( ) ) ) { return false ; } if ( uri1 . getPort ( ) != uri2 . getPort ( ) ) { return false ; } String path1 = uri1 . getPath ( ) ; String path2 = uri2 . getPath ( ) ; if ( path1 == null && path2 == null ) { return true ; } if ( path1 != null && path2 != null && ! path1 . equalsIgnoreCase ( path2 ) ) { return false ; } else { if ( path1 == null || path2 == null ) { return false ; } } if ( ! queryEquals ( msg ) ) { return false ; } result = true ; } catch ( URIException e ) { // ZAP : log error
log . error ( e . getMessage ( ) , e ) ; } return result ; |
public class Cache { /** * Insert the value into the Cache using the specified key .
* @ param key the key of the entry to be inserted
* @ param value the value of the entry to be inserted
* @ return the previous value associated with key , or null if there was none */
public synchronized Object insert ( String key , Object value ) { } } | // evict until size < maxSize
while ( isEvictionRequired ( ) && entryLimit > 0 && entryLimit < Integer . MAX_VALUE ) { evictStaleEntries ( ) ; } CacheEntry curEntry = new CacheEntry ( value ) ; CacheEntry oldEntry1 = ( CacheEntry ) primaryTable . put ( key , curEntry ) ; CacheEntry oldEntry2 = ( CacheEntry ) secondaryTable . remove ( key ) ; CacheEntry oldEntry3 = ( CacheEntry ) tertiaryTable . remove ( key ) ; return ( oldEntry1 != null ) ? oldEntry1 . value : ( oldEntry2 != null ) ? oldEntry2 . value : ( oldEntry3 != null ) ? oldEntry3 . value : null ; |
public class DictionarySettings { /** * { @ inheritDoc } */
@ SuppressWarnings ( { } } | "unchecked" } ) public < V > void put ( Key < ? super V > key , V value ) { dictionary . put ( key . getKey ( ) , value ) ; |
public class DateRangeChooser { /** * Searches for a Listitem that has a label that matches the specified value . The search is case
* insensitive .
* @ param label Label text to find .
* @ return A Listitem with a matching label . , or null if not found . */
public Listitem findMatchingItem ( String label ) { } } | for ( Listitem item : getChildren ( Listitem . class ) ) { if ( label . equalsIgnoreCase ( item . getLabel ( ) ) ) { return item ; } } return null ; |
public class Es6RewriteRestAndSpread { /** * Processes new calls containing spreads .
* < p > Example :
* < pre > < code >
* new F ( . . . args ) = >
* new Function . prototype . bind . apply ( F , [ ] . concat ( $ jscomp . arrayFromIterable ( args ) ) )
* < / code > < / pre > */
private void visitNewWithSpread ( Node spreadParent ) { } } | checkArgument ( spreadParent . isNew ( ) ) ; // Must remove callee before extracting argument groups .
Node callee = spreadParent . removeFirstChild ( ) ; List < Node > groups = extractSpreadGroups ( spreadParent ) ; // We need to generate
// ` new ( Function . prototype . bind . apply ( callee , [ null ] . concat ( other , args ) ) ( ) ; ` .
// ` null ` stands in for the ' this ' arg to the contructor .
final Node baseArrayLit ; if ( groups . get ( 0 ) . isArrayLit ( ) ) { baseArrayLit = groups . remove ( 0 ) ; } else { baseArrayLit = arrayLitWithJSType ( ) ; } baseArrayLit . addChildToFront ( nullWithJSType ( ) ) ; Node joinedGroups = groups . isEmpty ( ) ? baseArrayLit : IR . call ( IR . getprop ( baseArrayLit , IR . string ( "concat" ) ) . setJSType ( concatFnType ) , groups . toArray ( new Node [ 0 ] ) ) . setJSType ( arrayType ) ; if ( FeatureSet . ES3 . contains ( compiler . getOptions ( ) . getOutputFeatureSet ( ) ) ) { // TODO ( tbreisacher ) : Support this in ES3 too by not relying on Function . bind .
Es6ToEs3Util . cannotConvert ( compiler , spreadParent , "\"...\" passed to a constructor (consider using --language_out=ES5)" ) ; } // Function . prototype . bind = >
// function ( this : function ( new : [ spreadParent ] , . . . ? ) , . . . ? ) : function ( new : [ spreadParent ] )
// Function . prototype . bind . apply = >
// function ( function ( new : [ spreadParent ] , . . . ? ) , ! Array < ? > ) : function ( new : [ spreadParent ] )
Node bindApply = getpropInferringJSType ( IR . getprop ( getpropInferringJSType ( IR . name ( "Function" ) . setJSType ( functionFunctionType ) , "prototype" ) , "bind" ) . setJSType ( u2uFunctionType ) , "apply" ) ; Node result = IR . newNode ( callInferringJSType ( bindApply , callee , joinedGroups /* function ( new : [ spreadParent ] ) */
) ) . setJSType ( spreadParent . getJSType ( ) ) ; result . useSourceInfoIfMissingFromForTree ( spreadParent ) ; spreadParent . replaceWith ( result ) ; compiler . reportChangeToEnclosingScope ( result ) ; |
public class CommerceWishListLocalServiceWrapper { /** * Returns the commerce wish list matching the UUID and group .
* @ param uuid the commerce wish list ' s UUID
* @ param groupId the primary key of the group
* @ return the matching commerce wish list , or < code > null < / code > if a matching commerce wish list could not be found */
@ Override public com . liferay . commerce . wish . list . model . CommerceWishList fetchCommerceWishListByUuidAndGroupId ( String uuid , long groupId ) { } } | return _commerceWishListLocalService . fetchCommerceWishListByUuidAndGroupId ( uuid , groupId ) ; |
public class DescribeAssociationExecutionTargetsResult { /** * Information about the execution .
* @ param associationExecutionTargets
* Information about the execution . */
public void setAssociationExecutionTargets ( java . util . Collection < AssociationExecutionTarget > associationExecutionTargets ) { } } | if ( associationExecutionTargets == null ) { this . associationExecutionTargets = null ; return ; } this . associationExecutionTargets = new com . amazonaws . internal . SdkInternalList < AssociationExecutionTarget > ( associationExecutionTargets ) ; |
public class PartitionTable { /** * Retrieve the partition identifier for this set of matching variables . */
private String getPartition ( Set < String > variables ) { } } | String key = buildKey ( variables ) ; return partitionIds . computeIfAbsent ( key , k -> Character . toString ( ( char ) ( BASE_ID + idSequence ++ ) ) ) ; |
public class Configs { /** * Get self config string .
* @ param key config key with configAbsoluteClassPath in config file
* @ return config value string . Return null if not add config file or not config in config file .
* @ see # addSelfConfigs ( String , OneProperties ) */
public static String getHavePathSelfConfig ( IConfigKeyWithPath key ) { } } | String configAbsoluteClassPath = key . getConfigPath ( ) ; return getSelfConfig ( configAbsoluteClassPath , key ) ; |
public class ListFunctionsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListFunctionsRequest listFunctionsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listFunctionsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listFunctionsRequest . getApiId ( ) , APIID_BINDING ) ; protocolMarshaller . marshall ( listFunctionsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listFunctionsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ApiClientMgr { /** * Activity onResume回调
* @ param activity 发生 onResume 事件的activity */
@ Override public void onActivityResume ( Activity activity ) { } } | // 通知hmssdk activity onResume了
HuaweiApiClient client = getApiClient ( ) ; if ( client != null ) { HMSAgentLog . d ( "tell hmssdk: onResume" ) ; client . onResume ( activity ) ; } // 如果正在解决错误 , 则处理被覆盖的场景
HMSAgentLog . d ( "is resolving:" + isResolving ) ; if ( isResolving && ! PACKAGE_NAME_HIAPP . equals ( curAppPackageName ) ) { if ( activity instanceof BridgeActivity ) { resolveActivity = ( BridgeActivity ) activity ; hasOverActivity = false ; HMSAgentLog . d ( "received bridgeActivity:" + StrUtils . objDesc ( resolveActivity ) ) ; } else if ( resolveActivity != null && ! resolveActivity . isFinishing ( ) ) { hasOverActivity = true ; HMSAgentLog . d ( "received other Activity:" + StrUtils . objDesc ( resolveActivity ) ) ; } timeoutHandler . removeMessages ( UPDATE_OVER_ACTIVITY_CHECK_TIMEOUT_HANDLE_MSG ) ; timeoutHandler . sendEmptyMessageDelayed ( UPDATE_OVER_ACTIVITY_CHECK_TIMEOUT_HANDLE_MSG , UPDATE_OVER_ACTIVITY_CHECK_TIMEOUT ) ; } |
public class AWSCodeCommitClient { /** * Sets or changes the comment or description for a repository .
* < note >
* The description field for a repository accepts all HTML characters and all valid Unicode characters . Applications
* that do not HTML - encode the description and display it in a web page could expose users to potentially malicious
* code . Make sure that you HTML - encode the description field in any application that uses this API to display the
* repository description on a web page .
* < / note >
* @ param updateRepositoryDescriptionRequest
* Represents the input of an update repository description operation .
* @ return Result of the UpdateRepositoryDescription operation returned by the service .
* @ throws RepositoryNameRequiredException
* A repository name is required but was not specified .
* @ throws RepositoryDoesNotExistException
* The specified repository does not exist .
* @ throws InvalidRepositoryNameException
* At least one specified repository name is not valid . < / p > < note >
* This exception only occurs when a specified repository name is not valid . Other exceptions occur when a
* required repository parameter is missing , or when a specified repository does not exist .
* @ throws InvalidRepositoryDescriptionException
* The specified repository description is not valid .
* @ throws EncryptionIntegrityChecksFailedException
* An encryption integrity check failed .
* @ throws EncryptionKeyAccessDeniedException
* An encryption key could not be accessed .
* @ throws EncryptionKeyDisabledException
* The encryption key is disabled .
* @ throws EncryptionKeyNotFoundException
* No encryption key was found .
* @ throws EncryptionKeyUnavailableException
* The encryption key is not available .
* @ sample AWSCodeCommit . UpdateRepositoryDescription
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codecommit - 2015-04-13 / UpdateRepositoryDescription "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public UpdateRepositoryDescriptionResult updateRepositoryDescription ( UpdateRepositoryDescriptionRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeUpdateRepositoryDescription ( request ) ; |
public class JsonWriter { /** * Write a tab character to a character stream .
* @ throws IOException if an I / O error has occurred */
protected void indent ( ) throws IOException { } } | if ( prettyPrint ) { for ( int i = 0 ; i < indentDepth ; i ++ ) { writer . write ( indentString ) ; } } |
public class WTree { /** * Sets the row expansion mode .
* @ param expandMode the expand mode to set . */
public void setExpandMode ( final ExpandMode expandMode ) { } } | getOrCreateComponentModel ( ) . expandMode = expandMode == null ? ExpandMode . CLIENT : expandMode ; |
public class ModelsImpl { /** * Update an entity role for a given entity .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param entityId The entity ID .
* @ param roleId The entity role ID .
* @ param updateEntityRoleOptionalParameter 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 < OperationStatus > updateEntityRoleAsync ( UUID appId , String versionId , UUID entityId , UUID roleId , UpdateEntityRoleOptionalParameter updateEntityRoleOptionalParameter , final ServiceCallback < OperationStatus > serviceCallback ) { } } | return ServiceFuture . fromResponse ( updateEntityRoleWithServiceResponseAsync ( appId , versionId , entityId , roleId , updateEntityRoleOptionalParameter ) , serviceCallback ) ; |
public class AlluxioStatusException { /** * Converts an IOException to a corresponding status exception . Unless special cased , IOExceptions
* are converted to { @ link UnavailableException } .
* @ param ioe the IO exception to convert
* @ return the corresponding status exception */
public static AlluxioStatusException fromIOException ( IOException ioe ) { } } | try { throw ioe ; } catch ( FileNotFoundException e ) { return new NotFoundException ( e ) ; } catch ( MalformedURLException e ) { return new InvalidArgumentException ( e ) ; } catch ( UserPrincipalNotFoundException e ) { return new UnauthenticatedException ( e ) ; } catch ( ClosedChannelException e ) { return new FailedPreconditionException ( e ) ; } catch ( AlluxioStatusException e ) { return e ; } catch ( IOException e ) { return new UnknownException ( e ) ; } |
public class AnnotatedHttpServiceFactory { /** * Returns an { @ link AnnotatedHttpService } instance defined to { @ code method } of { @ code object } using
* { @ link Path } annotation . */
private static AnnotatedHttpServiceElement create ( String pathPrefix , Object object , Method method , List < ExceptionHandlerFunction > baseExceptionHandlers , List < RequestConverterFunction > baseRequestConverters , List < ResponseConverterFunction > baseResponseConverters ) { } } | final Set < Annotation > methodAnnotations = httpMethodAnnotations ( method ) ; if ( methodAnnotations . isEmpty ( ) ) { throw new IllegalArgumentException ( "HTTP Method specification is missing: " + method . getName ( ) ) ; } final Set < HttpMethod > methods = toHttpMethods ( methodAnnotations ) ; if ( methods . isEmpty ( ) ) { throw new IllegalArgumentException ( method . getDeclaringClass ( ) . getName ( ) + '#' + method . getName ( ) + " must have an HTTP method annotation." ) ; } final Class < ? > clazz = object . getClass ( ) ; final PathMapping pathMapping = pathStringMapping ( pathPrefix , method , methodAnnotations ) . withHttpHeaderInfo ( methods , consumableMediaTypes ( method , clazz ) , producibleMediaTypes ( method , clazz ) ) ; final List < ExceptionHandlerFunction > eh = getAnnotatedInstances ( method , clazz , ExceptionHandler . class , ExceptionHandlerFunction . class ) . addAll ( baseExceptionHandlers ) . add ( defaultExceptionHandler ) . build ( ) ; final List < RequestConverterFunction > req = getAnnotatedInstances ( method , clazz , RequestConverter . class , RequestConverterFunction . class ) . addAll ( baseRequestConverters ) . build ( ) ; final List < ResponseConverterFunction > res = getAnnotatedInstances ( method , clazz , ResponseConverter . class , ResponseConverterFunction . class ) . addAll ( baseResponseConverters ) . build ( ) ; List < AnnotatedValueResolver > resolvers ; try { resolvers = AnnotatedValueResolver . ofServiceMethod ( method , pathMapping . paramNames ( ) , toRequestObjectResolvers ( req ) ) ; } catch ( NoParameterException ignored ) { // Allow no parameter like below :
// @ Get ( " / " )
// public String method1 ( ) { . . . }
resolvers = ImmutableList . of ( ) ; } final Set < String > expectedParamNames = pathMapping . paramNames ( ) ; final Set < String > requiredParamNames = resolvers . stream ( ) . filter ( AnnotatedValueResolver :: isPathVariable ) . map ( AnnotatedValueResolver :: httpElementName ) . collect ( Collectors . toSet ( ) ) ; if ( ! expectedParamNames . containsAll ( requiredParamNames ) ) { final Set < String > missing = Sets . difference ( requiredParamNames , expectedParamNames ) ; throw new IllegalArgumentException ( "cannot find path variables: " + missing ) ; } // Warn unused path variables only if there ' s no ' @ RequestObject ' annotation .
if ( resolvers . stream ( ) . noneMatch ( r -> r . annotationType ( ) == RequestObject . class ) && ! requiredParamNames . containsAll ( expectedParamNames ) ) { final Set < String > missing = Sets . difference ( expectedParamNames , requiredParamNames ) ; logger . warn ( "Some path variables of the method '" + method . getName ( ) + "' of the class '" + clazz . getName ( ) + "' do not have their corresponding parameters annotated with @Param. " + "They would not be automatically injected: " + missing ) ; } final Optional < HttpStatus > defaultResponseStatus = findFirst ( method , StatusCode . class ) . map ( code -> { final int statusCode = code . value ( ) ; checkArgument ( statusCode >= 0 , "invalid HTTP status code: %s (expected: >= 0)" , statusCode ) ; return HttpStatus . valueOf ( statusCode ) ; } ) ; final HttpHeaders defaultHeaders = HttpHeaders . of ( defaultResponseStatus ( defaultResponseStatus , method ) ) ; final HttpHeaders defaultTrailingHeaders = HttpHeaders . of ( ) ; final String classAlias = clazz . getName ( ) ; final String methodAlias = String . format ( "%s.%s()" , classAlias , method . getName ( ) ) ; setAdditionalHeader ( defaultHeaders , clazz , "header" , classAlias , "class" , AdditionalHeader . class , AdditionalHeader :: name , AdditionalHeader :: value ) ; setAdditionalHeader ( defaultHeaders , method , "header" , methodAlias , "method" , AdditionalHeader . class , AdditionalHeader :: name , AdditionalHeader :: value ) ; setAdditionalHeader ( defaultTrailingHeaders , clazz , "trailer" , classAlias , "class" , AdditionalTrailer . class , AdditionalTrailer :: name , AdditionalTrailer :: value ) ; setAdditionalHeader ( defaultTrailingHeaders , method , "trailer" , methodAlias , "method" , AdditionalTrailer . class , AdditionalTrailer :: name , AdditionalTrailer :: value ) ; if ( ArmeriaHttpUtil . isContentAlwaysEmpty ( defaultHeaders . status ( ) ) && ! defaultTrailingHeaders . isEmpty ( ) ) { logger . warn ( "A response with HTTP status code '{}' cannot have a content. " + "Trailing headers defined at '{}' might be ignored." , defaultHeaders . status ( ) . code ( ) , methodAlias ) ; } // A CORS preflight request can be received because we handle it specially . The following
// decorator will prevent the service from an unexpected request which has OPTIONS method .
final Function < Service < HttpRequest , HttpResponse > , ? extends Service < HttpRequest , HttpResponse > > initialDecorator ; if ( methods . contains ( HttpMethod . OPTIONS ) ) { initialDecorator = Function . identity ( ) ; } else { initialDecorator = delegate -> new SimpleDecoratingService < HttpRequest , HttpResponse > ( delegate ) { @ Override public HttpResponse serve ( ServiceRequestContext ctx , HttpRequest req ) throws Exception { if ( req . method ( ) == HttpMethod . OPTIONS ) { // This must be a CORS preflight request .
throw HttpStatusException . of ( HttpStatus . FORBIDDEN ) ; } return delegate ( ) . serve ( ctx , req ) ; } } ; } return new AnnotatedHttpServiceElement ( pathMapping , new AnnotatedHttpService ( object , method , resolvers , eh , res , pathMapping , defaultHeaders , defaultTrailingHeaders ) , decorator ( method , clazz , initialDecorator ) ) ; |
public class GrpcUtil { /** * Quietly closes all messages in MessageProducer . */
static void closeQuietly ( MessageProducer producer ) { } } | InputStream message ; while ( ( message = producer . next ( ) ) != null ) { closeQuietly ( message ) ; } |
public class GSLTImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public boolean eIsSet ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . GSLT__LINETYPE : return LINETYPE_EDEFAULT == null ? linetype != null : ! LINETYPE_EDEFAULT . equals ( linetype ) ; } return super . eIsSet ( featureID ) ; |
public class JAltGridScreen { /** * Move the the data record ( s ) to the screen controls . */
public void fieldsToControls ( ) { } } | super . fieldsToControls ( ) ; for ( int iRowIndex = 0 ; iRowIndex < m_vComponentCache . size ( ) ; iRowIndex ++ ) { ComponentCache componentCache = ( ComponentCache ) m_vComponentCache . elementAt ( iRowIndex ) ; if ( componentCache != null ) { // Move the data to the model
for ( int iColumnIndex = 0 ; iColumnIndex < componentCache . m_rgcompoments . length ; iColumnIndex ++ ) { this . fieldToData ( componentCache , iRowIndex , iColumnIndex ) ; } } } |
public class EventLogQueue { /** * On event .
* @ param log
* the log
* @ param eventType
* the event type */
void onEvent ( EventLog log , EventType eventType ) { } } | switch ( eventType ) { case INSERT : onInsert ( log ) ; break ; case UPDATE : onUpdate ( log ) ; break ; case DELETE : onDelete ( log ) ; break ; default : throw new KunderaException ( "Invalid event type:" + eventType ) ; } |
public class OWLSubClassOfAxiomImpl_CustomFieldSerializer { /** * Deserializes the content of the object from the
* { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } .
* @ param streamReader the { @ link com . google . gwt . user . client . rpc . SerializationStreamReader } to read the
* object ' s content from
* @ param instance the object instance to deserialize
* @ throws com . google . gwt . user . client . rpc . SerializationException
* if the deserialization operation is not
* successful */
@ Override public void deserializeInstance ( SerializationStreamReader streamReader , OWLSubClassOfAxiomImpl instance ) throws SerializationException { } } | deserialize ( streamReader , instance ) ; |
public class AllGroupCombineDriver { @ Override public void setup ( TaskContext < GroupCombineFunction < IN , OUT > , OUT > context ) { } } | this . taskContext = context ; |
public class FeatureUtilities { /** * Make a { @ link SimpleFeatureCollection } from a set of { @ link Geometry } .
* < p > This is a fast utility and adds no attributes . < / p >
* @ param crs The { @ link CoordinateReferenceSystem } .
* @ param geometries the set of { @ link Geometry } to add .
* @ return the features wrapping the geoms . */
public static SimpleFeatureCollection featureCollectionFromGeometry ( CoordinateReferenceSystem crs , Geometry ... geometries ) { } } | SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder ( ) ; b . setName ( "simplegeom" ) ; b . setCRS ( crs ) ; DefaultFeatureCollection newCollection = new DefaultFeatureCollection ( ) ; EGeometryType geometryType = EGeometryType . forGeometry ( geometries [ 0 ] ) ; b . add ( "the_geom" , geometryType . getClazz ( ) ) ; Object userData = geometries [ 0 ] . getUserData ( ) ; int userDataSize = 1 ; if ( userData != null ) { if ( userData instanceof String [ ] ) { String [ ] string = ( String [ ] ) userData ; userDataSize = string . length ; for ( int i = 0 ; i < userDataSize ; i ++ ) { b . add ( "data" + i , String . class ) ; } } else { b . add ( "userdata" , userData . getClass ( ) ) ; } } SimpleFeatureType type = b . buildFeatureType ( ) ; SimpleFeatureBuilder builder = new SimpleFeatureBuilder ( type ) ; for ( Geometry g : geometries ) { Object [ ] values ; if ( userData == null ) { values = new Object [ ] { g } ; } else { Object tmpUserData = g . getUserData ( ) ; if ( tmpUserData instanceof String [ ] ) { String [ ] string = ( String [ ] ) tmpUserData ; values = new Object [ userDataSize + 1 ] ; values [ 0 ] = g ; for ( int i = 0 ; i < string . length ; i ++ ) { values [ i + 1 ] = string [ i ] ; } } else { values = new Object [ ] { g , tmpUserData } ; } } builder . addAll ( values ) ; SimpleFeature feature = builder . buildFeature ( null ) ; newCollection . add ( feature ) ; } return newCollection ; |
public class GeometryUtilities { /** * Creates a polygon that may help out as placeholder .
* @ return a dummy { @ link Polygon } . */
public static Polygon createDummyPolygon ( ) { } } | Coordinate [ ] c = new Coordinate [ ] { new Coordinate ( 0.0 , 0.0 ) , new Coordinate ( 1.0 , 1.0 ) , new Coordinate ( 1.0 , 0.0 ) , new Coordinate ( 0.0 , 0.0 ) } ; LinearRing linearRing = gf ( ) . createLinearRing ( c ) ; return gf ( ) . createPolygon ( linearRing , null ) ; |
public class CTLuMoranScatterplotOutlier { /** * Main method .
* @ param database Database
* @ param nrel Neighborhood relation
* @ param relation Data relation ( 1d ! )
* @ return Outlier detection result */
public OutlierResult run ( Database database , Relation < N > nrel , Relation < ? extends NumberVector > relation ) { } } | final NeighborSetPredicate npred = getNeighborSetPredicateFactory ( ) . instantiate ( database , nrel ) ; // Compute the global mean and variance
MeanVariance globalmv = new MeanVariance ( ) ; for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { globalmv . put ( relation . get ( iditer ) . doubleValue ( 0 ) ) ; } DoubleMinMax minmax = new DoubleMinMax ( ) ; WritableDoubleDataStore scores = DataStoreUtil . makeDoubleStorage ( relation . getDBIDs ( ) , DataStoreFactory . HINT_STATIC ) ; // calculate normalized attribute values
// calculate neighborhood average of normalized attribute values .
for ( DBIDIter iditer = relation . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { // Compute global z score
final double globalZ = ( relation . get ( iditer ) . doubleValue ( 0 ) - globalmv . getMean ( ) ) / globalmv . getNaiveStddev ( ) ; // Compute local average z score
Mean localm = new Mean ( ) ; for ( DBIDIter iter = npred . getNeighborDBIDs ( iditer ) . iter ( ) ; iter . valid ( ) ; iter . advance ( ) ) { if ( DBIDUtil . equal ( iditer , iter ) ) { continue ; } localm . put ( ( relation . get ( iter ) . doubleValue ( 0 ) - globalmv . getMean ( ) ) / globalmv . getNaiveStddev ( ) ) ; } // if neighors . size = = 0
final double localZ ; if ( localm . getCount ( ) > 0 ) { localZ = localm . getMean ( ) ; } else { // if s has no neighbors = > Wzi = zi
localZ = globalZ ; } // compute score
// Note : in the original moran scatterplot , any object with a score < 0
// would be an outlier .
final double score = Math . max ( - globalZ * localZ , 0 ) ; minmax . put ( score ) ; scores . putDouble ( iditer , score ) ; } DoubleRelation scoreResult = new MaterializedDoubleRelation ( "MoranOutlier" , "Moran Scatterplot Outlier" , scores , relation . getDBIDs ( ) ) ; OutlierScoreMeta scoreMeta = new BasicOutlierScoreMeta ( minmax . getMin ( ) , minmax . getMax ( ) , Double . NEGATIVE_INFINITY , Double . POSITIVE_INFINITY , 0 ) ; OutlierResult or = new OutlierResult ( scoreMeta , scoreResult ) ; or . addChildResult ( npred ) ; return or ; |
public class ConvertImage { /** * Converts an { @ link boofcv . struct . image . GrayF32 } into a { @ link boofcv . struct . image . GrayU16 } .
* @ param input Input image which is being converted . Not modified .
* @ param output ( Optional ) The output image . If null a new image is created . Modified .
* @ return Converted image . */
public static GrayU16 convert ( GrayF32 input , GrayU16 output ) { } } | if ( output == null ) { output = new GrayU16 ( input . width , input . height ) ; } else { output . reshape ( input . width , input . height ) ; } // threaded code is not significantly faster here
ImplConvertImage . convert ( input , output ) ; return output ; |
public class A_CmsReport { /** * Initializes some member variables for this report . < p >
* @ param locale the locale for this report
* @ param siteRoot the site root of the user who started this report ( may be < code > null < / code > ) */
protected void init ( Locale locale , String siteRoot ) { } } | m_starttime = System . currentTimeMillis ( ) ; m_locale = locale ; m_siteRoot = siteRoot ; m_messages = Messages . get ( ) . getBundle ( locale ) ; |
public class MetricDto { /** * Converts a metric entity to a DTO .
* @ param metric The metric to convert .
* @ return The corresponding DTO .
* @ throws WebApplicationException If an error occurs . */
public static MetricDto transformToDto ( Metric metric ) { } } | if ( metric == null ) { throw new WebApplicationException ( "Null entity object cannot be converted to Dto object." , Status . INTERNAL_SERVER_ERROR ) ; } MetricDto result = createDtoObject ( MetricDto . class , metric ) ; return result ; |
public class ListPlaybackConfigurationsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListPlaybackConfigurationsRequest listPlaybackConfigurationsRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( listPlaybackConfigurationsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listPlaybackConfigurationsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( listPlaybackConfigurationsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CmsSearchIndex { /** * Appends the a category filter to the given filter clause that matches all given categories . < p >
* In case the provided List is null or empty , the original filter is left unchanged . < p >
* The original filter parameter is extended and also provided as return value . < p >
* @ param cms the current OpenCms search context
* @ param filter the filter to extend
* @ param categories the categories that will compose the filter
* @ return the extended filter clause */
protected BooleanQuery . Builder appendCategoryFilter ( CmsObject cms , BooleanQuery . Builder filter , List < String > categories ) { } } | if ( ( categories != null ) && ( categories . size ( ) > 0 ) ) { // add query categories ( if required )
// categories are indexed as lower - case strings
// @ see org . opencms . search . fields . CmsSearchFieldConfiguration # appendCategories
List < String > lowerCaseCategories = new ArrayList < String > ( ) ; for ( String category : categories ) { lowerCaseCategories . add ( category . toLowerCase ( ) ) ; } filter . add ( new BooleanClause ( getMultiTermQueryFilter ( CmsSearchField . FIELD_CATEGORY , lowerCaseCategories ) , BooleanClause . Occur . MUST ) ) ; } return filter ; |
public class RegExStringUtil { /** * Return a list of < code > SearchLocation < / code > s representing the occurrences of the
* specified pattern in the specified source string .
* @ param strSource A string to search .
* @ param strPattern A pattern to search for .
* @ return A list of SearchLocations for each occurrence of the specified pattern .
* Returns an empty list for zero occurrences . */
public static List < SearchLocation > searchIgnoreCase ( String strSource , String strPattern ) { } } | return search ( strSource , strPattern , true ) ; |
public class TimeFilter { /** * Set start ( inclusive ) of time span .
* @ param s string representation of start time as HH : mm : ss . */
public void setStart ( final String s ) { } } | SimpleDateFormat stf = new SimpleDateFormat ( "HH:mm:ss" ) ; stf . setTimeZone ( TimeZone . getTimeZone ( "UTC" ) ) ; try { start = stf . parse ( s ) . getTime ( ) ; } catch ( ParseException ex ) { LogLog . warn ( "Error parsing start value " + s , ex ) ; } |
public class AbstractExtractionCondition { /** * { @ inheritDoc }
* @ see jp . co . future . uroborosql . fluent . ExtractionCondition # in ( java . lang . String , java . lang . Object [ ] ) */
@ SuppressWarnings ( "unchecked" ) @ Override public T in ( final String col , final Object ... values ) { } } | context ( ) . param ( CaseFormat . CAMEL_CASE . convert ( col ) , new In ( col , values ) ) ; this . useOperator = true ; return ( T ) this ; |
public class MSExcelUtil { /** * Generate a cell address in A1 format from a row and column number
* @ param rowNum row number
* @ param columnNum column number
* @ return Address in A1 format */
public static String getCellAddressA1Format ( int rowNum , int columnNum ) { } } | CellAddress cellAddr = new CellAddress ( rowNum , columnNum ) ; return cellAddr . formatAsString ( ) ; |
public class GridFTPServerFacade { /** * authenticate socket .
* if protection on , return authenticated socket wrapped over the original simpleSocket ,
* else return original socket . */
public static Socket authenticate ( Socket simpleSocket , boolean isClientSocket , GSSCredential credential , int protection , DataChannelAuthentication dcau ) throws Exception { } } | GSSContext gssContext = null ; GSSManager manager = ExtendedGSSManager . getInstance ( ) ; if ( isClientSocket ) { gssContext = manager . createContext ( null , GSSConstants . MECH_OID , credential , GSSContext . DEFAULT_LIFETIME ) ; } else { gssContext = manager . createContext ( credential ) ; } if ( protection != GridFTPSession . PROTECTION_CLEAR ) { ( ( ExtendedGSSContext ) gssContext ) . setOption ( GSSConstants . GSS_MODE , GSIConstants . MODE_SSL ) ; } gssContext . requestConf ( protection == GridFTPSession . PROTECTION_PRIVATE ) ; // Wrap the simple socket with GSI
logger . debug ( "Creating secure socket" ) ; GssSocketFactory factory = GssSocketFactory . getDefault ( ) ; GssSocket secureSocket = ( GssSocket ) factory . createSocket ( simpleSocket , null , 0 , gssContext ) ; secureSocket . setUseClientMode ( isClientSocket ) ; if ( dcau == null ) { secureSocket . setAuthorization ( null ) ; } else if ( dcau == DataChannelAuthentication . SELF ) { secureSocket . setAuthorization ( SelfAuthorization . getInstance ( ) ) ; } else if ( dcau == DataChannelAuthentication . NONE ) { // this should never be
} else if ( dcau instanceof DataChannelAuthentication ) { // dcau . toFtpCmdArgument ( ) kinda hackish but it works
secureSocket . setAuthorization ( new IdentityAuthorization ( dcau . toFtpCmdArgument ( ) ) ) ; } /* that will force handshake */
secureSocket . getOutputStream ( ) . flush ( ) ; if ( protection == GridFTPSession . PROTECTION_SAFE || protection == GridFTPSession . PROTECTION_PRIVATE ) { logger . debug ( "Data channel protection: on" ) ; return secureSocket ; } else { // PROTECTION _ CLEAR
logger . debug ( "Data channel protection: off" ) ; return simpleSocket ; } |
public class Location { /** * Compare two locations and return if the locations are near or not
* @ param location Location to compare with
* @ param distance The distance between two locations
* @ return true is the real distance is lower or equals than the distance parameter */
public boolean isNearTo ( Location location , double distance ) { } } | if ( this . is2DLocation ( ) && location . is2DLocation ( ) ) { return this . isNearTo ( location . getLocation2D ( ) , distance ) ; } else if ( this . is3DLocation ( ) && location . is3DLocation ( ) ) { return this . isNearTo ( location . getLocation3D ( ) , distance ) ; } else { return false ; } |
public class CommerceNotificationTemplateUtil { /** * Returns the first commerce notification template in the ordered set where uuid = & # 63 ; .
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce notification template , or < code > null < / code > if a matching commerce notification template could not be found */
public static CommerceNotificationTemplate fetchByUuid_First ( String uuid , OrderByComparator < CommerceNotificationTemplate > orderByComparator ) { } } | return getPersistence ( ) . fetchByUuid_First ( uuid , orderByComparator ) ; |
public class IOUtil { /** * return the mime type of a file , dont check extension
* @ param barr
* @ return mime type of the file
* @ throws IOException */
public static String getMimeType ( byte [ ] barr , String defaultValue ) { } } | PrintStream out = System . out ; try { Tika tika = new Tika ( ) ; return tika . detect ( barr ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; return defaultValue ; } |
public class PdfContentByte { /** * Gets a < CODE > Graphics2D < / CODE > to print on . The graphics
* are translated to PDF commands .
* @ param width the width of the panel
* @ param height the height of the panel
* @ param printerJob
* @ return a < CODE > Graphics2D < / CODE > */
public java . awt . Graphics2D createPrinterGraphics ( float width , float height , PrinterJob printerJob ) { } } | return new PdfPrinterGraphics2D ( this , width , height , null , false , false , 0 , printerJob ) ; |
public class ProfilerParseRunner { /** * Returns a string describing , in order of ' expensiveness ' , the top - level failed rule chains in the parse run . */
public String getOverviewReport ( ) { } } | TreeSet < ReportEntry < V > > topLevelFailed = new TreeSet < ReportEntry < V > > ( ) ; fillReport ( topLevelFailed , rootReport ) ; StringBuilder out = new StringBuilder ( ) ; for ( ReportEntry < V > entry : topLevelFailed ) { if ( entry . getSubSteps ( ) < 100 ) break ; out . append ( formatReport ( entry , false ) ) ; } return out . toString ( ) ; |
public class EventManger { /** * Signal an event and the event result .
* This method will return < code > false < / code > if the event was not created with
* { @ link # performActionAndWaitForEvent ( Object , long , Callback ) } .
* @ param eventKey the event key , must not be null .
* @ param eventResult the event result , may be null .
* @ return true if the event was found and signaled , false otherwise . */
public boolean signalEvent ( K eventKey , R eventResult ) { } } | final Reference < R > reference = events . get ( eventKey ) ; if ( reference == null ) { return false ; } reference . eventResult = eventResult ; synchronized ( reference ) { reference . notifyAll ( ) ; } return true ; |
public class URL { /** * Makes a copy of a given URL with some additional components .
* @ param serviceUUID UUID of a GATT service
* @ return a copy of a given URL with some additional components */
public URL copyWithService ( String serviceUUID ) { } } | return new URL ( this . protocol , this . adapterAddress , this . deviceAddress , this . deviceAttributes , serviceUUID , null , null ) ; |
public class ForwardCurveWithFixings { /** * Returns the forwards for a given vector fixing times .
* @ param model An analytic model providing a context . The discount curve ( if needed ) is obtained from this model .
* @ param fixingTimes The given fixing times .
* @ return The forward rates . */
public double [ ] getForwards ( AnalyticModelInterface model , double [ ] fixingTimes ) { } } | double [ ] values = new double [ fixingTimes . length ] ; for ( int i = 0 ; i < fixingTimes . length ; i ++ ) { values [ i ] = getForward ( model , fixingTimes [ i ] ) ; } return values ; |
public class BaasUser { /** * Asynchronously fetches the list of users from the server .
* @ param flags { @ link RequestOptions }
* @ param handler an handler to be invoked upon completion of the request
* @ return a { @ link com . baasbox . android . RequestToken } to manage the request */
public static RequestToken fetchAll ( BaasQuery . Criteria filter , int flags , BaasHandler < List < BaasUser > > handler ) { } } | BaasBox box = BaasBox . getDefaultChecked ( ) ; FetchUsers users = new FetchUsers ( box , "users" , null , filter , flags , handler ) ; return box . submitAsync ( users ) ; |
public class ClasspathElementZip { /** * / * ( non - Javadoc )
* @ see io . github . classgraph . ClasspathElement # getURI ( ) */
@ Override URI getURI ( ) { } } | try { return new URI ( URLPathEncoder . normalizeURLPath ( getZipFilePath ( ) ) ) ; } catch ( final URISyntaxException e ) { throw new IllegalArgumentException ( "Could not form URI: " + e ) ; } |
public class AWSJavaMailTransport { /** * Sends a MIME message through Amazon ' s E - mail Service with the specified
* recipients . Addresses that are passed into this method are merged with
* the ones already embedded in the message ( duplicates are removed ) .
* @ param msg
* A Mime type e - mail message to be sent
* @ param addresses
* Additional e - mail addresses ( RFC - 822 ) to be included in the
* message */
@ Override public void sendMessage ( Message msg , Address [ ] addresses ) throws MessagingException , SendFailedException { } } | checkConnection ( ) ; checkMessage ( msg ) ; checkAddresses ( msg , addresses ) ; collateRecipients ( msg , addresses ) ; SendRawEmailRequest req = prepareEmail ( msg ) ; sendEmail ( msg , req ) ; |
public class KeyVaultClientBaseImpl { /** * Gets the creation operation of a certificate .
* Gets the creation operation associated with a specified certificate . This operation requires the certificates / get permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param certificateName The name of the certificate .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the CertificateOperation object */
public Observable < CertificateOperation > getCertificateOperationAsync ( String vaultBaseUrl , String certificateName ) { } } | return getCertificateOperationWithServiceResponseAsync ( vaultBaseUrl , certificateName ) . map ( new Func1 < ServiceResponse < CertificateOperation > , CertificateOperation > ( ) { @ Override public CertificateOperation call ( ServiceResponse < CertificateOperation > response ) { return response . body ( ) ; } } ) ; |
public class FctBnPublicTradeProcessors { /** * < p > Lazy get PrBur . < / p >
* @ param pAddParam additional param
* @ return requested PrBur
* @ throws Exception - an exception */
protected final PrBur < RS > lazyGetPrBur ( final Map < String , Object > pAddParam ) throws Exception { } } | String beanName = PrBur . class . getSimpleName ( ) ; @ SuppressWarnings ( "unchecked" ) PrBur < RS > proc = ( PrBur < RS > ) this . processorsMap . get ( beanName ) ; if ( proc == null ) { proc = new PrBur < RS > ( ) ; proc . setSrvOrm ( getSrvOrm ( ) ) ; proc . setSrvDb ( getSrvDatabase ( ) ) ; proc . setLog ( getLogger ( ) ) ; proc . setProcFac ( this ) ; proc . setBuySr ( getBuySr ( ) ) ; // assigning fully initialized object :
this . processorsMap . put ( beanName , proc ) ; this . logger . info ( null , FctBnPublicTradeProcessors . class , beanName + " has been created." ) ; } return proc ; |
public class AttributeCollector { /** * Method called to decode the whole attribute value as a single
* typed value .
* Decoding is done using the decoder provided . */
public final void decodeValue ( int index , TypedValueDecoder tvd ) throws IllegalArgumentException { } } | if ( index < 0 || index >= mAttrCount ) { throwIndex ( index ) ; } /* Should be faster to pass the char array even if we might
* have a String */
// Either way , need to trim before passing :
char [ ] buf = mValueBuilder . getCharBuffer ( ) ; int start = mAttributes [ index ] . mValueStartOffset ; int end = getValueStartOffset ( index + 1 ) ; while ( true ) { if ( start >= end ) { tvd . handleEmptyValue ( ) ; return ; } if ( ! StringUtil . isSpace ( buf [ start ] ) ) { break ; } ++ start ; } // Trailing space ?
while ( -- end > start && StringUtil . isSpace ( buf [ end ] ) ) { } tvd . decode ( buf , start , end + 1 ) ; |
public class SolrIndexer { /** * Index a payload using the provided data using a python script
* @ param object
* : The DigitalObject to index
* @ param payload
* : The Payload to index
* @ param in
* : Reader containing the new empty document
* @ param inConf
* : An InputStream holding the config file
* @ param rulesOid
* : The oid of the rules file to use
* @ param props
* : Properties object containing the object ' s metadata
* @ return File : Temporary file containing the output to index
* @ throws IOException
* if there were errors accessing files
* @ throws RuleException
* if there were errors during indexing */
private String indexByPythonScript ( DigitalObject object , Payload payload , String confOid , String rulesOid , Properties props ) throws IOException , RuleException { } } | try { JsonSimpleConfig jsonConfig = getConfigFile ( confOid ) ; // Get our data ready
Map < String , Object > bindings = new HashMap < String , Object > ( ) ; Map < String , List < String > > fields = new HashMap < String , List < String > > ( ) ; bindings . put ( "fields" , fields ) ; bindings . put ( "jsonConfig" , jsonConfig ) ; bindings . put ( "indexer" , this ) ; bindings . put ( "object" , object ) ; bindings . put ( "payload" , payload ) ; bindings . put ( "params" , props ) ; bindings . put ( "pyUtils" , getPyUtils ( ) ) ; bindings . put ( "log" , log ) ; // Run the data through our script
PyObject script = getPythonObject ( rulesOid ) ; if ( script . __findattr__ ( SCRIPT_ACTIVATE_METHOD ) != null ) { script . invoke ( SCRIPT_ACTIVATE_METHOD , Py . java2py ( bindings ) ) ; object . close ( ) ; } else { log . warn ( "Activation method not found!" ) ; } return getPyUtils ( ) . solrDocument ( fields ) ; } catch ( Exception e ) { throw new RuleException ( e ) ; } |
public class CmsSitemapController { /** * Validates the entry and the given path . < p >
* @ param entry the entry
* @ param toPath the path
* @ return < code > true < / code > if entry and path are valid */
private boolean isValidEntryAndPath ( CmsClientSitemapEntry entry , String toPath ) { } } | return ( ( toPath != null ) && ( CmsResource . getParentFolder ( toPath ) != null ) && ( entry != null ) && ( getEntry ( CmsResource . getParentFolder ( toPath ) ) != null ) && ( getEntry ( entry . getSitePath ( ) ) != null ) ) ; |
public class SmartHandle { /** * Use this SmartHandle as a test to guard target and fallback handles .
* @ param target the " true " path for this handle ' s test
* @ param fallback the " false " path for this handle ' s test
* @ return a new SmartHandle that performs the test and branch */
public SmartHandle guard ( SmartHandle target , SmartHandle fallback ) { } } | return new SmartHandle ( target . signature , MethodHandles . guardWithTest ( handle , target . handle , fallback . handle ) ) ; |
public class SchemaService { /** * Delete the given application ' s schema row from the Applications CF . */
private void deleteAppProperties ( ApplicationDefinition appDef ) { } } | Tenant tenant = Tenant . getTenant ( appDef ) ; DBTransaction dbTran = DBService . instance ( tenant ) . startTransaction ( ) ; dbTran . deleteRow ( SchemaService . APPS_STORE_NAME , appDef . getAppName ( ) ) ; DBService . instance ( tenant ) . commit ( dbTran ) ; |
public class LongStream { /** * Returns a { @ code LongStream } produced by iterative application of a accumulation function
* to an initial element { @ code identity } and next element of the current stream .
* Produces a { @ code LongStream } consisting of { @ code identity } , { @ code acc ( identity , value1 ) } ,
* { @ code acc ( acc ( identity , value1 ) , value2 ) } , etc .
* < p > This is an intermediate operation .
* < p > Example :
* < pre >
* identity : 0
* accumulator : ( a , b ) - & gt ; a + b
* stream : [ 1 , 2 , 3 , 4 , 5]
* result : [ 0 , 1 , 3 , 6 , 10 , 15]
* < / pre >
* @ param identity the initial value
* @ param accumulator the accumulation function
* @ return the new stream
* @ throws NullPointerException if { @ code accumulator } is null
* @ since 1.1.6 */
@ NotNull public LongStream scan ( final long identity , @ NotNull final LongBinaryOperator accumulator ) { } } | Objects . requireNonNull ( accumulator ) ; return new LongStream ( params , new LongScanIdentity ( iterator , identity , accumulator ) ) ; |
public class CreateFleetRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < CreateFleetRequest > getDryRunRequest ( ) { } } | Request < CreateFleetRequest > request = new CreateFleetRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class CompletedJobStatusStore { /** * This method retrieves Counters information from DFS stored using
* store method .
* @ param jobId the jobId for which Counters is queried
* @ return Counters object , null if not able to retrieve */
public Counters readCounters ( JobID jobId ) { } } | Counters counters = null ; if ( active ) { try { FSDataInputStream dataIn = getJobInfoFile ( jobId ) ; if ( dataIn != null ) { readJobStatus ( dataIn ) ; readJobProfile ( dataIn ) ; counters = readCounters ( dataIn ) ; dataIn . close ( ) ; } } catch ( IOException ex ) { LOG . warn ( "Could not read [" + jobId + "] job counters : " + ex , ex ) ; } } return counters ; |
public class SqlUtil { /** * 将RowId转为字符串
* @ param rowId RowId
* @ return RowId字符串 */
public static String rowIdToString ( RowId rowId ) { } } | return StrUtil . str ( rowId . getBytes ( ) , CharsetUtil . CHARSET_ISO_8859_1 ) ; |
public class DescribeConfigurationRecorderStatusRequest { /** * The name ( s ) of the configuration recorder . If the name is not specified , the action returns the current status of
* all the configuration recorders associated with the account .
* @ param configurationRecorderNames
* The name ( s ) of the configuration recorder . If the name is not specified , the action returns the current
* status of all the configuration recorders associated with the account . */
public void setConfigurationRecorderNames ( java . util . Collection < String > configurationRecorderNames ) { } } | if ( configurationRecorderNames == null ) { this . configurationRecorderNames = null ; return ; } this . configurationRecorderNames = new com . amazonaws . internal . SdkInternalList < String > ( configurationRecorderNames ) ; |
public class ServiceContainerHelper { /** * Ensures the specified service is removed .
* @ param controller a service controller */
public static void remove ( ServiceController < ? > controller ) { } } | try { transition ( controller , State . REMOVED ) ; } catch ( StartException e ) { // This can ' t happen
throw new IllegalStateException ( e ) ; } |
public class DoubleTupleCollections { /** * Returns a deep copy of the given collection of tuples . If any element
* of the given collection is < code > null < / code > , then < code > null < / code >
* will also be added to the target collection .
* @ param tuples The input tuples
* @ return The deep copy */
public static List < MutableDoubleTuple > deepCopy ( Collection < ? extends DoubleTuple > tuples ) { } } | List < MutableDoubleTuple > result = new ArrayList < MutableDoubleTuple > ( tuples . size ( ) ) ; for ( DoubleTuple t : tuples ) { if ( t == null ) { result . add ( null ) ; } else { result . add ( DoubleTuples . copy ( t ) ) ; } } return result ; |
public class DatabaseVulnerabilityAssessmentScansInner { /** * Lists the vulnerability assessment scans of a database .
* @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; VulnerabilityAssessmentScanRecordInner & gt ; object */
public Observable < Page < VulnerabilityAssessmentScanRecordInner > > listByDatabaseNextAsync ( final String nextPageLink ) { } } | return listByDatabaseNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < VulnerabilityAssessmentScanRecordInner > > , Page < VulnerabilityAssessmentScanRecordInner > > ( ) { @ Override public Page < VulnerabilityAssessmentScanRecordInner > call ( ServiceResponse < Page < VulnerabilityAssessmentScanRecordInner > > response ) { return response . body ( ) ; } } ) ; |
public class PrefsAdapter { /** * Get a View that displays the data at the specified position in the data set . You can either create a View manually or inflate it from an XML
* layout file . When the View is inflated , the parent View ( GridView , ListView . . . ) will apply default layout parameters unless you use { @ link
* android . view . LayoutInflater # inflate ( int , android . view . ViewGroup , boolean ) } to specify a root view and to prevent attachment to the root .
* @ param position
* The position of the item within the adapter ' s data set of the item whose view we want .
* @ param convertView
* The old view to reuse , if possible . Note : You should check that this view is non - null and of an appropriate type before using . If it is not
* possible to convert this view to display the correct data , this method can create a new view . Heterogeneous lists can specify their number of
* view types , so that this View is always of the right type ( see { @ link # getViewTypeCount ( ) } and { @ link # getItemViewType ( int ) } ) .
* @ param parent
* The parent that this view will eventually be attached to
* @ return A View corresponding to the data at the specified position . */
@ Override public View getView ( int position , View convertView , ViewGroup parent ) { } } | ViewHolder holder ; Pair < String , ? > keyVal = getItem ( position ) ; if ( convertView == null ) { holder = new ViewHolder ( ) ; convertView = inflater . inflate ( R . layout . preference_item , parent , false ) ; holder . key = ( TextView ) convertView . findViewById ( R . id . key ) ; holder . value = ( TextView ) convertView . findViewById ( R . id . value ) ; convertView . setTag ( holder ) ; } else { holder = ( ViewHolder ) convertView . getTag ( ) ; } holder . key . setText ( keyVal . first ) ; String value = "" ; Object second = keyVal . second ; if ( second != null ) { value = second . toString ( ) + " (" + second . getClass ( ) . getSimpleName ( ) + ")" ; } holder . value . setText ( value ) ; return convertView ; |
public class A_CmsHtmlIconButton { /** * Generates a default html code where several buttons can have the same help text . < p >
* @ param style the style of the button
* @ param id the id
* @ param helpId the id of the helptext div tag
* @ param name the name , if empty only the icon is displayed
* @ param helpText the help text , if empty no mouse events are generated
* @ param enabled if enabled or not , if not set be sure to take an according helptext
* @ param iconPath the path to the icon , if empty only the name is displayed
* @ param confirmationMessage the confirmation message
* @ param onClick the js code to execute , if empty no link is generated
* @ param singleHelp if set , no helptext is written , you have to use the defaultHelpHtml ( ) method later
* @ param rightHtml optional html code that should come direct after the button
* @ return html code */
public static String defaultButtonHtml ( CmsHtmlIconButtonStyleEnum style , String id , String helpId , String name , String helpText , boolean enabled , String iconPath , String confirmationMessage , String onClick , boolean singleHelp , String rightHtml ) { } } | StringBuffer html = new StringBuffer ( 1024 ) ; if ( style == CmsHtmlIconButtonStyleEnum . BIG_ICON_TEXT ) { html . append ( "<div class='bigLink' id='img" ) ; html . append ( id ) ; html . append ( "'>\n" ) ; } html . append ( "\t<span class=\"link" ) ; if ( enabled ) { html . append ( "\"" ) ; } else { html . append ( " linkdisabled\"" ) ; } if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( helpText ) ) { if ( ! singleHelp ) { html . append ( " onMouseOver=\"sMH('" ) ; html . append ( id ) ; html . append ( "');\" onMouseOut=\"hMH('" ) ; html . append ( id ) ; html . append ( "');\"" ) ; } else { html . append ( " onMouseOver=\"sMHS('" ) ; html . append ( id ) ; html . append ( "', '" ) ; html . append ( helpId ) ; html . append ( "');\" onMouseOut=\"hMH('" ) ; html . append ( id ) ; html . append ( "', '" ) ; html . append ( helpId ) ; html . append ( "');\"" ) ; } } if ( enabled && CmsStringUtil . isNotEmptyOrWhitespaceOnly ( onClick ) ) { html . append ( " onClick=\"" ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( confirmationMessage ) ) { html . append ( "if (confirm('" + CmsStringUtil . escapeJavaScript ( confirmationMessage ) + "')) {" ) ; } html . append ( onClick ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( confirmationMessage ) ) { html . append ( " }" ) ; } html . append ( "\"" ) ; } if ( style == CmsHtmlIconButtonStyleEnum . SMALL_ICON_ONLY ) { html . append ( " title='" ) ; html . append ( name ) ; html . append ( "'" ) ; } html . append ( ">" ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( iconPath ) ) { html . append ( "<img src='" ) ; html . append ( CmsWorkplace . getSkinUri ( ) ) ; if ( ! enabled ) { StringBuffer icon = new StringBuffer ( 128 ) ; icon . append ( iconPath . substring ( 0 , iconPath . lastIndexOf ( '.' ) ) ) ; icon . append ( "_disabled" ) ; icon . append ( iconPath . substring ( iconPath . lastIndexOf ( '.' ) ) ) ; String resourcesRoot = OpenCms . getSystemInfo ( ) . getWebApplicationRfsPath ( ) + "resources/" ; File test = new File ( resourcesRoot + icon . toString ( ) ) ; if ( test . exists ( ) ) { html . append ( icon ) ; } else { html . append ( iconPath ) ; } } else { html . append ( iconPath ) ; } html . append ( "'" ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( helpText ) ) { html . append ( " alt='" ) ; html . append ( helpText ) ; html . append ( "'" ) ; html . append ( " title='" ) ; html . append ( helpText ) ; html . append ( "'" ) ; } html . append ( ">" ) ; if ( style == CmsHtmlIconButtonStyleEnum . BIG_ICON_TEXT ) { html . append ( "<br>" ) ; } } if ( ( style != CmsHtmlIconButtonStyleEnum . SMALL_ICON_ONLY ) && CmsStringUtil . isNotEmptyOrWhitespaceOnly ( name ) ) { if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( iconPath ) && ( style != CmsHtmlIconButtonStyleEnum . BIG_ICON_TEXT ) ) { html . append ( " " ) ; } if ( enabled ) { if ( style != CmsHtmlIconButtonStyleEnum . SMALL_ICON_TEXT ) { html . append ( "<a href='#'>" ) ; } else { html . append ( "<a href='#' style='white-space: nowrap;'>" ) ; } } html . append ( name ) ; if ( enabled ) { html . append ( "</a>" ) ; } // doesn ' t work in new dialog for the radio button cols
// couldn ' t find a place where this is needed
// if ( style ! = CmsHtmlIconButtonStyleEnum . BIG _ ICON _ TEXT & & name . length ( ) > 1 ) {
// html . append ( " & nbsp ; " ) ;
} html . append ( "</span>" ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( rightHtml ) ) { html . append ( rightHtml ) ; } if ( style == CmsHtmlIconButtonStyleEnum . BIG_ICON_TEXT ) { html . append ( "</div>\n" ) ; } if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( helpText ) && ! singleHelp ) { html . append ( "<div class='help' id='help" ) ; html . append ( helpId ) ; html . append ( "' onMouseOver=\"sMH('" ) ; html . append ( id ) ; html . append ( "');\" onMouseOut=\"hMH('" ) ; html . append ( id ) ; html . append ( "');\">" ) ; html . append ( helpText ) ; html . append ( "</div>\n" ) ; } return html . toString ( ) ; |
public class StackBenchmarkParameterized { /** * Simple setUp of a benchmark . The { @ link Benchmark } is initialized with two Meters ( < code > TimeMeter < / code > and
* < code > MemMeter < / code > ) . Afterwards the benchmark is running with a TabularOutput as a listener registered . The
* result of the benchmark is displayed in a complete table at the end .
* @ param args not used here
* @ throws SecurityException
* @ throws NoSuchMethodException
* @ throws InvocationTargetException
* @ throws IllegalArgumentException
* @ throws IllegalAccessException */
public static void main ( final String [ ] args ) throws NoSuchMethodException , SecurityException , IllegalAccessException , IllegalArgumentException , InvocationTargetException { } } | final Benchmark bench = new Benchmark ( config ) ; bench . add ( StackBenchmarkParameterized . class ) ; final BenchmarkResult res = bench . run ( ) ; new TabularSummaryOutput ( ) . visitBenchmark ( res ) ; |
public class MetricReportReporter { /** * Converts a single key - value pair into a metric .
* @ param name name of the metric
* @ param value value of the metric to report
* @ param path additional suffixes to further identify the meaning of the reported value
* @ return a { @ link org . apache . gobblin . metrics . Metric } . */
protected Metric serializeValue ( String name , Number value , String ... path ) { } } | return new Metric ( MetricRegistry . name ( name , path ) , value . doubleValue ( ) ) ; |
public class CmsAliasTableController { /** * Triggers server - side validation of the alias table and of a new entry which should be added to it . < p >
* @ param newEntry the new entry */
protected void validateNew ( final CmsAliasTableRow newEntry ) { } } | CmsRpcAction < CmsAliasEditValidationReply > action = new CmsRpcAction < CmsAliasEditValidationReply > ( ) { @ Override public void execute ( ) { start ( 200 , true ) ; CmsAliasEditValidationRequest validationRequest = new CmsAliasEditValidationRequest ( ) ; List < CmsAliasTableRow > rows = m_view . getLiveData ( ) ; validationRequest . setEditedData ( rows ) ; validationRequest . setNewEntry ( newEntry ) ; validationRequest . setOriginalData ( m_initialData ) ; getService ( ) . validateAliases ( validationRequest , this ) ; } @ Override public void onResponse ( CmsAliasEditValidationReply result ) { stop ( false ) ; List < CmsAliasTableRow > tableRows = result . getChangedRows ( ) ; CmsAliasTableRow validatedNewEntry = result . getValidatedNewEntry ( ) ; if ( validatedNewEntry . hasErrors ( ) ) { m_view . setNewAliasPathError ( validatedNewEntry . getAliasError ( ) ) ; m_view . setNewAliasResourceError ( validatedNewEntry . getPathError ( ) ) ; } else { m_view . clearNew ( ) ; tableRows . add ( validatedNewEntry ) ; } m_view . update ( tableRows ) ; updateValidationStatus ( ) ; } } ; action . execute ( ) ; |
public class AbstractInstant { /** * Checks if the field type specified is supported by this instant and chronology .
* This can be used to avoid exceptions in { @ link # get ( DateTimeFieldType ) } .
* @ param type a field type , usually obtained from DateTimeFieldType
* @ return true if the field type is supported */
public boolean isSupported ( DateTimeFieldType type ) { } } | if ( type == null ) { return false ; } return type . getField ( getChronology ( ) ) . isSupported ( ) ; |
public class TransformationDescription { /** * Adds a value step to the transformation description . The given value is written to the target field . */
public void valueField ( String targetField , String value ) { } } | TransformationStep step = new TransformationStep ( ) ; step . setTargetField ( targetField ) ; step . setOperationParameter ( TransformationConstants . VALUE_PARAM , value ) ; step . setOperationName ( "value" ) ; steps . add ( step ) ; |
public class KeyVaultClientBaseImpl { /** * Creates or updates a new storage account . This operation requires the storage / set permission .
* @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net .
* @ param storageAccountName The name of the storage account .
* @ param resourceId Storage account resource id .
* @ param activeKeyName Current active storage account key name .
* @ param autoRegenerateKey whether keyvault should manage the storage account for the user .
* @ 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 < StorageBundle > setStorageAccountAsync ( String vaultBaseUrl , String storageAccountName , String resourceId , String activeKeyName , boolean autoRegenerateKey , final ServiceCallback < StorageBundle > serviceCallback ) { } } | return ServiceFuture . fromResponse ( setStorageAccountWithServiceResponseAsync ( vaultBaseUrl , storageAccountName , resourceId , activeKeyName , autoRegenerateKey ) , serviceCallback ) ; |
public class AppEngineStrongDatastoreSession { /** * Updates entity with the specified entity instance with
* { @ code AppEngineCoordinator } .
* This method must be invoked under a transaction .
* @ param entity The entity instance to be updated . */
@ Override public void update ( Object entity ) { } } | if ( entity == null ) { throw new IllegalArgumentException ( "'entity' must not be [" + entity + "]" ) ; } assertTransactional ( ) ; ( ( AppEngineGlobalTransaction ) transaction . get ( ) ) . coordinator ( ) . update ( entity ) ; |
public class Expression { /** * Create a logical AND expression that performs logical AND operation with
* the current expression .
* @ param expression the expression to AND with the current expression .
* @ return a logical AND expression . */
@ NonNull public Expression and ( @ NonNull Expression expression ) { } } | if ( expression == null ) { throw new IllegalArgumentException ( "expression cannot be null." ) ; } return new CompoundExpression ( Arrays . asList ( this , expression ) , CompoundExpression . OpType . And ) ; |
public class ClassDescriptorDef { /** * Returns the field descriptors given in the the field names list .
* @ param fieldNames The field names , separated by commas
* @ return The field descriptors in the order given by the field names
* @ throws NoSuchFieldException If a field hasn ' t been found */
public ArrayList getFields ( String fieldNames ) throws NoSuchFieldException { } } | ArrayList result = new ArrayList ( ) ; FieldDescriptorDef fieldDef ; String name ; for ( CommaListIterator it = new CommaListIterator ( fieldNames ) ; it . hasNext ( ) ; ) { name = it . getNext ( ) ; fieldDef = getField ( name ) ; if ( fieldDef == null ) { throw new NoSuchFieldException ( name ) ; } result . add ( fieldDef ) ; } return result ; |
public class BaseLexicon { /** * Evaluates how many words ( = terminals ) in a collection of trees are
* covered by the lexicon . First arg is the collection of trees ; second
* through fourth args get the results . Currently unused ; this probably
* only works if train and test at same time so tags and words variables
* are initialized . */
public double evaluateCoverage ( Collection < Tree > trees , Set < String > missingWords , Set < String > missingTags , Set < IntTaggedWord > missingTW ) { } } | List < IntTaggedWord > iTW1 = new ArrayList < IntTaggedWord > ( ) ; for ( Tree t : trees ) { iTW1 . addAll ( treeToEvents ( t ) ) ; } int total = 0 ; int unseen = 0 ; for ( IntTaggedWord itw : iTW1 ) { total ++ ; if ( ! words . contains ( new IntTaggedWord ( itw . word ( ) , nullTag ) ) ) { missingWords . add ( wordIndex . get ( itw . word ( ) ) ) ; } if ( ! tags . contains ( new IntTaggedWord ( nullWord , itw . tag ( ) ) ) ) { missingTags . add ( tagIndex . get ( itw . tag ( ) ) ) ; } // if ( ! rules . contains ( itw ) ) {
if ( seenCounter . getCount ( itw ) == 0.0 ) { unseen ++ ; missingTW . add ( itw ) ; } } return ( double ) unseen / total ; |
public class AmazonSimpleEmailServiceClient { /** * Creates a receipt rule .
* For information about setting up receipt rules , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / receiving - email - receipt - rules . html " > Amazon SES
* Developer Guide < / a > .
* You can execute this operation no more than once per second .
* @ param createReceiptRuleRequest
* Represents a request to create a receipt rule . You use receipt rules to receive email with Amazon SES . For
* more information , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / receiving - email - concepts . html " > Amazon SES
* Developer Guide < / a > .
* @ return Result of the CreateReceiptRule operation returned by the service .
* @ throws InvalidSnsTopicException
* Indicates that the provided Amazon SNS topic is invalid , or that Amazon SES could not publish to the
* topic , possibly due to permissions issues . For information about giving permissions , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / receiving - email - permissions . html " > Amazon SES
* Developer Guide < / a > .
* @ throws InvalidS3ConfigurationException
* Indicates that the provided Amazon S3 bucket or AWS KMS encryption key is invalid , or that Amazon SES
* could not publish to the bucket , possibly due to permissions issues . For information about giving
* permissions , see the < a
* href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / receiving - email - permissions . html " > Amazon SES
* Developer Guide < / a > .
* @ throws InvalidLambdaFunctionException
* Indicates that the provided AWS Lambda function is invalid , or that Amazon SES could not execute the
* provided function , possibly due to permissions issues . For information about giving permissions , see the
* < a href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / receiving - email - permissions . html " > Amazon
* SES Developer Guide < / a > .
* @ throws AlreadyExistsException
* Indicates that a resource could not be created because of a naming conflict .
* @ throws RuleDoesNotExistException
* Indicates that the provided receipt rule does not exist .
* @ throws RuleSetDoesNotExistException
* Indicates that the provided receipt rule set does not exist .
* @ throws LimitExceededException
* Indicates that a resource could not be created because of service limits . For a list of Amazon SES
* limits , see the < a href = " http : / / docs . aws . amazon . com / ses / latest / DeveloperGuide / limits . html " > Amazon SES
* Developer Guide < / a > .
* @ sample AmazonSimpleEmailService . CreateReceiptRule
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / email - 2010-12-01 / CreateReceiptRule " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public CreateReceiptRuleResult createReceiptRule ( CreateReceiptRuleRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateReceiptRule ( request ) ; |
public class ConfluenceGreenPepper { /** * < p > getTokenAuthenticationManager . < / p >
* @ return a { @ link com . atlassian . confluence . rpc . auth . TokenAuthenticationManager } object . */
public TokenAuthenticationManager getTokenAuthenticationManager ( ) { } } | if ( tokenManager != null ) { return tokenManager ; } tokenManager = ( TokenAuthenticationManager ) ContainerManager . getComponent ( "tokenAuthenticationManager" ) ; return tokenManager ; |
public class LaTypicalPostcard { public void attachPlainText ( String filenameOnHeader , InputStream resourceStream , String textEncoding ) { } } | assertArgumentNotEmpty ( "filenameOnHeader" , filenameOnHeader ) ; assertArgumentNotNull ( "resourceStream" , resourceStream ) ; assertArgumentNotEmpty ( "textEncoding" , textEncoding ) ; postcard . attachPlainText ( filenameOnHeader , resourceStream , textEncoding ) ; |
public class Timex3Interval { /** * setter for endTimex - sets
* @ generated
* @ param v value to set into the feature */
public void setEndTimex ( String v ) { } } | if ( Timex3Interval_Type . featOkTst && ( ( Timex3Interval_Type ) jcasType ) . casFeat_endTimex == null ) jcasType . jcas . throwFeatMissing ( "endTimex" , "de.unihd.dbs.uima.types.heideltime.Timex3Interval" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Timex3Interval_Type ) jcasType ) . casFeatCode_endTimex , v ) ; |
public class GeneralStorable { /** * Returns the key belonging to the given field as long
* @ param field
* the name of the field
* @ return the requested value
* @ throws IOException */
public double getKeyAsDouble ( String field ) throws IOException { } } | int hash = Arrays . hashCode ( field . getBytes ( ) ) ; return getKeyAsDouble ( structure . keyHash2Index . get ( hash ) ) ; |
public class YggdrasilAuthenticator { /** * Creates a < code > YggdrasilAuthenticator < / code > , and initializes it with
* password .
* @ param username the username
* @ param password the password
* @ param characterSelector the character selector
* @ return a YggdrasilAuthenticator
* @ throws AuthenticationException If an exception occurs during the
* authentication */
public static YggdrasilAuthenticator password ( String username , String password , CharacterSelector characterSelector ) throws AuthenticationException { } } | return password ( username , password , characterSelector , UUIDUtils . randomUnsignedUUID ( ) ) ; |
public class PoolManager { /** * This method releases ManagedConnection . If the affinity is used and the connection is associated
* with the affinity , it is registered as unused . Otherwise it is prepared
* for reuse ( using < code > cleanup < / code > method and then registered as unused .
* @ param managed ManagedConnection A connection to release
* @ param affinity Object , an affinity , can be represented using < code > Identifier < / code > interface .
* @ concurrency concurrent
* @ throws ResourceException
* @ throws ApplicationServerInternalException */
public void release ( MCWrapper mcWrapper , Object affinity ) throws ResourceException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( this , tc , "release" , mcWrapper , affinity , "Pool contents ==>" , toString2 ( 1 ) ) ; } if ( ( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . isAlreadyBeingReleased ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "AddingJMS - release - Already releasing managed connection " + mcWrapper ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "release" , new Object [ ] { mcWrapper . getManagedConnectionWithoutStateCheck ( ) , "Pool contents ==>" , this } ) ; } return ; } ( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . setAlreadyBeingReleased ( true ) ; /* * Added for holding out connection request while
* a free or shared pool is being updated */
requestingAccessToPool ( ) ; // start thread local fast path . . .
if ( localConnection_ != null ) { if ( mcWrapper . getPoolState ( ) == MCWrapper . ConnectionState_sharedTLSPool || mcWrapper . getPoolState ( ) == MCWrapper . ConnectionState_unsharedTLSPool ) { if ( mcWrapper . isDestroyState ( ) || mcWrapper . isStale ( ) || mcWrapper . hasFatalErrorNotificationOccurred ( freePool [ 0 ] . getFatalErrorNotificationTime ( ) ) || ( ( this . agedTimeout != - 1 ) && ( mcWrapper . hasAgedTimedOut ( this . agedTimeoutMillis ) ) ) ) { removeMCWFromTLS ( mcWrapper ) ; return ; } else { try { if ( waiterCount > 0 ) { /* * If we have waiters , its likely the max connections and tls settings are not correct .
* When we have waiters , we need to try and remove one connection from this thread local
* and send the mcw to the waiter queue . By sending the mcw to the waiter queue , this connection may be assigned
* to a different thread local . */
synchronized ( waiterFreePoolLock ) { if ( ( waiterCount > 0 ) && ( waiterCount > mcWrapperWaiterList . size ( ) ) ) { // there are requests waiting
ArrayList < MCWrapper > mh = localConnection_ . get ( ) ; if ( mh != null ) { requestingAccessToTLSPool ( ) ; // remove a mcw from this thread local .
mh . remove ( mcWrapper ) ; tlsArrayLists . remove ( mcWrapper ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { ( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . setThreadID ( ( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . getThreadID ( ) + "-release-waiter-removed" ) ; Tr . debug ( this , tc , "removed mcWrapper from thread local " + mcWrapper ) ; } endingAccessToTLSPool ( ) ; } ( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . tlsCleanup ( ) ; mcWrapper . setSharedPoolCoordinator ( null ) ; mcWrapperWaiterList . add ( mcWrapper ) ; mcWrapper . setPoolState ( MCWrapper . ConnectionState_waiterPool ) ; // notify a waiter .
waiterFreePoolLock . notify ( ) ; activeRequest . decrementAndGet ( ) ; ( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . setAlreadyBeingReleased ( false ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) Tr . exit ( this , tc , "release" ) ; return ; } } // end synchronized ( waiterFreePoolLock )
} mcWrapper . setSharedPoolCoordinator ( null ) ; ( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . tlsCleanup ( ) ; /* * Our goal is for this mcw to stay on this thread , but if needed , after
* switching the state to freeTLSPool , this mcwrapper can be removed from this
* threads thread local storage and added to a different thread local storage or be placed
* in the main pool of connections . This should be the only place in the code that we set the
* pool state to MCWrapper . ConnectionState _ freeTLSPool . */
mcWrapper . setPoolState ( MCWrapper . ConnectionState_freeTLSPool ) ; activeRequest . decrementAndGet ( ) ; ( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . setAlreadyBeingReleased ( false ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "release" , new Object [ ] { mcWrapper . getManagedConnectionWithoutStateCheck ( ) , "Pool contents ==>" , this } ) ; } return ; } catch ( ResourceException re ) { removeMCWFromTLS ( mcWrapper ) ; return ; } } } if ( mcWrapper . getPoolState ( ) == MCWrapper . ConnectionState_freeTLSPool ) { // Already released , do nothing .
( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . setAlreadyBeingReleased ( false ) ; activeRequest . decrementAndGet ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "release" , new Object [ ] { mcWrapper . getManagedConnectionWithoutStateCheck ( ) , "Pool contents ==>" , this } ) ; } return ; } } // end thread local fast path . . .
if ( mcWrapper . isInSharedPool ( ) ) { ( ( SharedPool ) mcWrapper . getSharedPool ( ) ) . removeSharedConnection ( mcWrapper ) ; mcWrapper . setSharedPoolCoordinator ( null ) ; mcWrapper . setSharedPool ( null ) ; mcWrapper . setInSharedPool ( false ) ; } // Check to see if the pool is disabled .
if ( ! gConfigProps . connectionPoolingEnabled || ( mcWrapper instanceof com . ibm . ejs . j2c . MCWrapper && ( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . isMCAborted ( ) ) ) { // The pool is disabled , cleanup and destroy the connection .
// No pooling of connection is allowed
// remove the mcw from the mcToMCWMap
mcToMCWMapWrite . lock ( ) ; try { mcToMCWMap . remove ( mcWrapper . getManagedConnectionWithoutStateCheck ( ) ) ; } finally { mcToMCWMapWrite . unlock ( ) ; } try { mcWrapper . cleanup ( ) ; } catch ( Exception exn1 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "MCWrapper cleanup failed, datasource: " + gConfigProps . cfName ) ; boolean aborted = mcWrapper . getManagedConnection ( ) instanceof WSManagedConnection && ( ( WSManagedConnection ) mcWrapper . getManagedConnection ( ) ) . isAborted ( ) ; if ( ! aborted ) { com . ibm . ws . ffdc . FFDCFilter . processException ( exn1 , "com.ibm.ejs.j2c.poolmanager.PoolManager.release" , "1131" , this ) ; } } try { mcWrapper . destroy ( ) ; } catch ( Exception exn2 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( this , tc , "MCWrapper destroy failed, datasource: " + gConfigProps . cfName ) ; com . ibm . ws . ffdc . FFDCFilter . processException ( exn2 , "com.ibm.ejs.j2c.poolmanager.PoolManager.release" , "1144" , this ) ; } synchronized ( waiterFreePoolLock ) { this . totalConnectionCount . decrementAndGet ( ) ; if ( waiterCount > 0 ) waiterFreePoolLock . notify ( ) ; } } else { // Move the pooled connection from the inuse state to the FreePool
if ( ! mcWrapper . isInSharedPool ( ) ) mcWrapper . setPoolState ( 0 ) ; int hashMapBucket = mcWrapper . getHashMapBucket ( ) ; freePool [ hashMapBucket ] . returnToFreePool ( mcWrapper ) ; } activeRequest . decrementAndGet ( ) ; if ( _quiesce ) { /* * QuiesceIfPossible should be called for the first time in ConnectionFactoryDetailsImpl . stop ( )
* at which point _ quiesce will be set to true . At that time if there are no connections in the pool
* the pool will be quiesced , otherwise we will try again each time a connection is returned to the
* pool ( here ) . */
quiesceIfPossible ( ) ; } ( ( com . ibm . ejs . j2c . MCWrapper ) mcWrapper ) . setAlreadyBeingReleased ( false ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "released managed connection " + mcWrapper . getManagedConnectionWithoutStateCheck ( ) , "pool contents ==>" , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( this , tc , "release" ) ; } |
public class MarkLogicRepositoryConnection { /** * set bindings ? s , ? p and special handling of Value ? o ( and ? ctx )
* @ param query
* @ param subj
* @ param pred
* @ param obj
* @ param contexts
* @ throws RepositoryException */
private void setBindings ( Query query , Resource subj , URI pred , Value obj , Resource ... contexts ) throws RepositoryException { } } | if ( subj != null ) { query . setBinding ( "s" , subj ) ; } if ( pred != null && pred instanceof URI ) { query . setBinding ( "p" , pred ) ; } if ( obj != null ) { query . setBinding ( "o" , obj ) ; } if ( contexts != null && contexts . length > 0 ) { DatasetImpl dataset = new DatasetImpl ( ) ; if ( notNull ( contexts ) ) { for ( int i = 0 ; i < contexts . length ; i ++ ) { if ( notNull ( contexts [ i ] ) || contexts [ i ] instanceof URI ) { dataset . addDefaultGraph ( ( URI ) contexts [ i ] ) ; } else { dataset . addDefaultGraph ( getValueFactory ( ) . createURI ( DEFAULT_GRAPH_URI ) ) ; } } } else { dataset . addDefaultGraph ( getValueFactory ( ) . createURI ( DEFAULT_GRAPH_URI ) ) ; } query . setDataset ( dataset ) ; } |
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public STOBORNTION createSTOBORNTIONFromString ( EDataType eDataType , String initialValue ) { } } | STOBORNTION result = STOBORNTION . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ; |
public class UTS46 { /** * returns the new label length */
private int processLabel ( StringBuilder dest , int labelStart , int labelLength , boolean toASCII , Info info ) { } } | StringBuilder fromPunycode ; StringBuilder labelString ; int destLabelStart = labelStart ; int destLabelLength = labelLength ; boolean wasPunycode ; if ( labelLength >= 4 && dest . charAt ( labelStart ) == 'x' && dest . charAt ( labelStart + 1 ) == 'n' && dest . charAt ( labelStart + 2 ) == '-' && dest . charAt ( labelStart + 3 ) == '-' ) { // Label starts with " xn - - " , try to un - Punycode it .
wasPunycode = true ; try { fromPunycode = Punycode . decode ( dest . subSequence ( labelStart + 4 , labelStart + labelLength ) , null ) ; } catch ( StringPrepParseException e ) { addLabelError ( info , Error . PUNYCODE ) ; return markBadACELabel ( dest , labelStart , labelLength , toASCII , info ) ; } // Check for NFC , and for characters that are not
// valid or deviation characters according to the normalizer .
// If there is something wrong , then the string will change .
// Note that the normalizer passes through non - LDH ASCII and deviation characters .
// Deviation characters are ok in Punycode even in transitional processing .
// In the code further below , if we find non - LDH ASCII and we have UIDNA _ USE _ STD3 _ RULES
// then we will set UIDNA _ ERROR _ INVALID _ ACE _ LABEL there too .
boolean isValid = uts46Norm2 . isNormalized ( fromPunycode ) ; if ( ! isValid ) { addLabelError ( info , Error . INVALID_ACE_LABEL ) ; return markBadACELabel ( dest , labelStart , labelLength , toASCII , info ) ; } labelString = fromPunycode ; labelStart = 0 ; labelLength = fromPunycode . length ( ) ; } else { wasPunycode = false ; labelString = dest ; } // Validity check
if ( labelLength == 0 ) { addLabelError ( info , Error . EMPTY_LABEL ) ; return replaceLabel ( dest , destLabelStart , destLabelLength , labelString , labelLength ) ; } // labelLength > 0
if ( labelLength >= 4 && labelString . charAt ( labelStart + 2 ) == '-' && labelString . charAt ( labelStart + 3 ) == '-' ) { // label starts with " ? ? - - "
addLabelError ( info , Error . HYPHEN_3_4 ) ; } if ( labelString . charAt ( labelStart ) == '-' ) { // label starts with " - "
addLabelError ( info , Error . LEADING_HYPHEN ) ; } if ( labelString . charAt ( labelStart + labelLength - 1 ) == '-' ) { // label ends with " - "
addLabelError ( info , Error . TRAILING_HYPHEN ) ; } // If the label was not a Punycode label , then it was the result of
// mapping , normalization and label segmentation .
// If the label was in Punycode , then we mapped it again above
// and checked its validity .
// Now we handle the STD3 restriction to LDH characters ( if set )
// and we look for U + FFFD which indicates disallowed characters
// in a non - Punycode label or U + FFFD itself in a Punycode label .
// We also check for dots which can come from the input to a single - label function .
// Ok to cast away const because we own the UnicodeString .
int i = labelStart ; int limit = labelStart + labelLength ; char oredChars = 0 ; // If we enforce STD3 rules , then ASCII characters other than LDH and dot are disallowed .
boolean disallowNonLDHDot = ( options & USE_STD3_RULES ) != 0 ; do { char c = labelString . charAt ( i ) ; if ( c <= 0x7f ) { if ( c == '.' ) { addLabelError ( info , Error . LABEL_HAS_DOT ) ; labelString . setCharAt ( i , '\ufffd' ) ; } else if ( disallowNonLDHDot && asciiData [ c ] < 0 ) { addLabelError ( info , Error . DISALLOWED ) ; labelString . setCharAt ( i , '\ufffd' ) ; } } else { oredChars |= c ; if ( disallowNonLDHDot && isNonASCIIDisallowedSTD3Valid ( c ) ) { addLabelError ( info , Error . DISALLOWED ) ; labelString . setCharAt ( i , '\ufffd' ) ; } else if ( c == 0xfffd ) { addLabelError ( info , Error . DISALLOWED ) ; } } ++ i ; } while ( i < limit ) ; // Check for a leading combining mark after other validity checks
// so that we don ' t report IDNA . Error . DISALLOWED for the U + FFFD from here .
int c ; // " Unsafe " is ok because unpaired surrogates were mapped to U + FFFD .
c = labelString . codePointAt ( labelStart ) ; if ( ( U_GET_GC_MASK ( c ) & U_GC_M_MASK ) != 0 ) { addLabelError ( info , Error . LEADING_COMBINING_MARK ) ; labelString . setCharAt ( labelStart , '\ufffd' ) ; if ( c > 0xffff ) { // Remove c ' s trail surrogate .
labelString . deleteCharAt ( labelStart + 1 ) ; -- labelLength ; if ( labelString == dest ) { -- destLabelLength ; } } } if ( ! hasCertainLabelErrors ( info , severeErrors ) ) { // Do contextual checks only if we do not have U + FFFD from a severe error
// because U + FFFD can make these checks fail .
if ( ( options & CHECK_BIDI ) != 0 && ( ! isBiDi ( info ) || isOkBiDi ( info ) ) ) { checkLabelBiDi ( labelString , labelStart , labelLength , info ) ; } if ( ( options & CHECK_CONTEXTJ ) != 0 && ( oredChars & 0x200c ) == 0x200c && ! isLabelOkContextJ ( labelString , labelStart , labelLength ) ) { addLabelError ( info , Error . CONTEXTJ ) ; } if ( ( options & CHECK_CONTEXTO ) != 0 && oredChars >= 0xb7 ) { checkLabelContextO ( labelString , labelStart , labelLength , info ) ; } if ( toASCII ) { if ( wasPunycode ) { // Leave a Punycode label unchanged if it has no severe errors .
if ( destLabelLength > 63 ) { addLabelError ( info , Error . LABEL_TOO_LONG ) ; } return destLabelLength ; } else if ( oredChars >= 0x80 ) { // Contains non - ASCII characters .
StringBuilder punycode ; try { punycode = Punycode . encode ( labelString . subSequence ( labelStart , labelStart + labelLength ) , null ) ; } catch ( StringPrepParseException e ) { throw new ICUException ( e ) ; // unexpected
} punycode . insert ( 0 , "xn--" ) ; if ( punycode . length ( ) > 63 ) { addLabelError ( info , Error . LABEL_TOO_LONG ) ; } return replaceLabel ( dest , destLabelStart , destLabelLength , punycode , punycode . length ( ) ) ; } else { // all - ASCII label
if ( labelLength > 63 ) { addLabelError ( info , Error . LABEL_TOO_LONG ) ; } } } } else { // If a Punycode label has severe errors ,
// then leave it but make sure it does not look valid .
if ( wasPunycode ) { addLabelError ( info , Error . INVALID_ACE_LABEL ) ; return markBadACELabel ( dest , destLabelStart , destLabelLength , toASCII , info ) ; } } return replaceLabel ( dest , destLabelStart , destLabelLength , labelString , labelLength ) ; |
public class AllureThreadContext { /** * Returns first ( oldest ) uuid . */
public Optional < String > getRoot ( ) { } } | final LinkedList < String > uuids = context . get ( ) ; return uuids . isEmpty ( ) ? Optional . empty ( ) : Optional . of ( uuids . getLast ( ) ) ; |
public class DocumentConventions { /** * Gets the collection name for a given type .
* @ param entity entity to get collection name
* @ return collection name */
public String getCollectionName ( Object entity ) { } } | if ( entity == null ) { return null ; } return getCollectionName ( entity . getClass ( ) ) ; |
public class JenkinsController { /** * Creating a configuration */
@ RequestMapping ( value = "configurations/create" , method = RequestMethod . POST ) public JenkinsConfiguration newConfiguration ( @ RequestBody JenkinsConfiguration configuration ) { } } | return jenkinsService . newConfiguration ( configuration ) ; |
public class PaxLoggingServiceImpl { /** * use local class to delegate calls to underlying instance while keeping bundle reference */
public Object getService ( final Bundle bundle , ServiceRegistration registration ) { } } | class ManagedPaxLoggingService implements PaxLoggingService , LogService , ManagedService { private final String fqcn = getClass ( ) . getName ( ) ; public void log ( int level , String message ) { PaxLoggingServiceImpl . this . log ( bundle , level , message , null , fqcn ) ; } public void log ( int level , String message , Throwable exception ) { PaxLoggingServiceImpl . this . log ( bundle , level , message , exception , fqcn ) ; } public void log ( ServiceReference sr , int level , String message ) { Bundle b = bundle == null && sr != null ? sr . getBundle ( ) : bundle ; PaxLoggingServiceImpl . this . log ( b , level , message , null , fqcn ) ; } public void log ( ServiceReference sr , int level , String message , Throwable exception ) { Bundle b = bundle == null && sr != null ? sr . getBundle ( ) : bundle ; PaxLoggingServiceImpl . this . log ( b , level , message , exception , fqcn ) ; } public int getLogLevel ( ) { return PaxLoggingServiceImpl . this . getLogLevel ( ) ; } public PaxLogger getLogger ( Bundle myBundle , String category , String fqcn ) { return PaxLoggingServiceImpl . this . getLogger ( myBundle , category , fqcn ) ; } public void updated ( Dictionary < String , ? > configuration ) throws ConfigurationException { PaxLoggingServiceImpl . this . updated ( configuration ) ; } public PaxContext getPaxContext ( ) { return PaxLoggingServiceImpl . this . getPaxContext ( ) ; } } return new ManagedPaxLoggingService ( ) ; |
public class SequenceMixin { /** * A case - sensitive manner of comparing two sequence objects together .
* We will throw out any compounds which fail to match on their sequence
* length & compound sets used . The code will also bail out the moment
* we find something is wrong with a Sequence . Cost to run is linear to
* the length of the Sequence .
* @ param < C > The type of compound
* @ param source Source sequence to assess
* @ param target Target sequence to assess
* @ return Boolean indicating if the sequences matched */
public static < C extends Compound > boolean sequenceEquality ( Sequence < C > source , Sequence < C > target ) { } } | return baseSequenceEquality ( source , target , false ) ; |
public class WebSocketConnection { /** * Returns the input stream for this connection . If { @ code untilCloseFrame } is { @ code true } then the returned stream
* completes after receiving ( and emitting ) a { @ link CloseWebSocketFrame } , otherwise , it completes with an error
* when the underlying channel is closed .
* @ return The input stream for this connection . */
@ Beta public Observable < WebSocketFrame > getInput ( boolean untilCloseFrame ) { } } | Observable < WebSocketFrame > rawInput = delegate . getInput ( ) ; if ( untilCloseFrame ) { return rawInput . takeUntil ( new Func1 < WebSocketFrame , Boolean > ( ) { @ Override public Boolean call ( WebSocketFrame webSocketFrame ) { return webSocketFrame instanceof CloseWebSocketFrame ; } } ) ; } else { return rawInput ; } |
public class NLS { /** * Create a simple default formatted string .
* @ param key which would look up the message in a resource bundle .
* @ param objects which would be inserted into the message .
* @ return String the formatted String . */
String objectsToString ( String key , Object objects ) { } } | java . io . StringWriter stringWriter = new java . io . StringWriter ( ) ; stringWriter . write ( key ) ; stringWriter . write ( ":" ) ; if ( objects == null ) { stringWriter . write ( "\n" ) ; } else if ( objects instanceof Object [ ] ) { for ( int i = 0 ; i < ( ( Object [ ] ) objects ) . length ; i ++ ) { Object object = ( ( Object [ ] ) objects ) [ i ] ; if ( object == null ) stringWriter . write ( "null\n" ) ; else { stringWriter . write ( ( ( Object [ ] ) objects ) [ i ] . toString ( ) ) ; stringWriter . write ( "\n" ) ; } } } else { stringWriter . write ( objects . toString ( ) ) ; stringWriter . write ( "\n" ) ; } return stringWriter . toString ( ) ; |
public class ZonedDateTime { /** * Returns a copy of this { @ code ZonedDateTime } with the specified number of minutes subtracted .
* This operates on the instant time - line , such that subtracting one minute will
* always be a duration of one minute earlier .
* This may cause the local date - time to change by an amount other than one minute .
* Note that this is a different approach to that used by days , months and years .
* This instance is immutable and unaffected by this method call .
* @ param minutes the minutes to subtract , may be negative
* @ return a { @ code ZonedDateTime } based on this date - time with the minutes subtracted , not null
* @ throws DateTimeException if the result exceeds the supported date range */
public ZonedDateTime minusMinutes ( long minutes ) { } } | return ( minutes == Long . MIN_VALUE ? plusMinutes ( Long . MAX_VALUE ) . plusMinutes ( 1 ) : plusMinutes ( - minutes ) ) ; |
public class WmfDumpFileManager { /** * Finds all page revision dump files , online or locally , that are relevant
* to obtain the most current state of the data . Revision dump files are
* dumps that contain page revisions in MediaWiki ' s XML format .
* If the parameter < b > preferCurrent < / b > is true , then dumps that contain
* only the current versions of all files will be preferred if available
* anywhere , even over previously downloaded dump files that contain all
* versions . However , dump files may still contain non - current revisions ,
* and when processing multiple dumps there might even be overlaps ( one
* revision occurring in multiple dumps ) .
* The result is ordered with the most recent dump first . If a dump file A
* contains revisions of a page P , and Rmax is the maximal revision of P in
* A , then every dump file that comes after A should contain only revisions
* of P that are smaller than or equal to Rmax . In other words , the maximal
* revision found in the first file that contains P at all should also be
* the maximal revision overall .
* @ param preferCurrent
* should dumps with current revisions be preferred ?
* @ return an ordered list of all dump files that match the given criteria */
public List < MwDumpFile > findAllRelevantRevisionDumps ( boolean preferCurrent ) { } } | MwDumpFile mainDump ; if ( preferCurrent ) { mainDump = findMostRecentDump ( DumpContentType . CURRENT ) ; } else { mainDump = findMostRecentDump ( DumpContentType . FULL ) ; } if ( mainDump == null ) { return findAllDumps ( DumpContentType . DAILY ) ; } List < MwDumpFile > result = new ArrayList < > ( ) ; for ( MwDumpFile dumpFile : findAllDumps ( DumpContentType . DAILY ) ) { if ( dumpFile . getDateStamp ( ) . compareTo ( mainDump . getDateStamp ( ) ) > 0 ) { result . add ( dumpFile ) ; } } result . add ( mainDump ) ; if ( logger . isInfoEnabled ( ) ) { StringBuilder logMessage = new StringBuilder ( ) ; logMessage . append ( "Found " ) . append ( result . size ( ) ) . append ( " relevant dumps to process:" ) ; for ( MwDumpFile dumpFile : result ) { logMessage . append ( "\n * " ) . append ( dumpFile . toString ( ) ) ; } logger . info ( logMessage . toString ( ) ) ; } return result ; |
public class RemoteBundleContextClient { /** * { @ inheritDoc } */
public void waitForState ( final long bundleId , final int state , final long timeoutInMillis ) throws TimeoutException { } } | try { getRemoteBundleContext ( ) . waitForState ( bundleId , state , timeoutInMillis ) ; } catch ( org . ops4j . pax . exam . rbc . internal . TimeoutException e ) { throw new TimeoutException ( e . getMessage ( ) ) ; } catch ( RemoteException e ) { throw new TestContainerException ( "Remote exception" , e ) ; } catch ( BundleException e ) { throw new TestContainerException ( "Bundle cannot be found" , e ) ; } |
public class StateFilter { /** * / * ( non - Javadoc )
* @ see tuwien . auto . calimero . buffer . Configuration . RequestFilter # request (
* tuwien . auto . calimero . KNXAddress , tuwien . auto . calimero . buffer . Configuration ) */
@ Override public CEMILData request ( final KNXAddress dst , final Configuration c ) { } } | final Cache cache = c . getCache ( ) ; if ( cache == null || ! ( dst instanceof GroupAddress ) ) return null ; final LDataObject o = ( LDataObject ) cache . get ( dst ) ; if ( o == null ) return null ; // check if there is an expiration timeout for a state based value
final Datapoint dp ; final DatapointModel < ? > m = c . getDatapointModel ( ) ; if ( m != null && ( dp = m . get ( ( GroupAddress ) dst ) ) != null && dp . isStateBased ( ) ) { final int t = ( ( StateDP ) dp ) . getExpirationTimeout ( ) * 1000 ; if ( t != 0 && System . currentTimeMillis ( ) > o . getTimestamp ( ) + t ) return null ; } return o . getFrame ( ) ; |
public class Slice { /** * Returns a slice of this buffer ' s sub - region . Modifying the content of
* the returned buffer or this buffer affects each other ' s content while
* they maintain separate indexes and marks . */
public Slice slice ( int index , int length ) { } } | if ( index == 0 && length == this . length ) { return this ; } checkPositionIndexes ( index , index + length , this . length ) ; if ( index >= 0 && length == 0 ) { return Slices . EMPTY_SLICE ; } return new Slice ( data , offset + index , length ) ; |
public class CommandArgs { /** * Add multiple key arguments .
* @ param keys must not be { @ literal null } .
* @ return the command args . */
public CommandArgs < K , V > addKeys ( Iterable < K > keys ) { } } | LettuceAssert . notNull ( keys , "Keys must not be null" ) ; for ( K key : keys ) { addKey ( key ) ; } return this ; |
public class DataStoreScanStatusDAO { /** * Returns the scan status table name . On the first call it also verifies that the table exists , then skips this
* check on future calls . */
private String getTable ( ) { } } | if ( ! _tableChecked ) { if ( ! _dataStore . getTableExists ( _tableName ) ) { _dataStore . createTable ( _tableName , new TableOptionsBuilder ( ) . setPlacement ( _tablePlacement ) . build ( ) , ImmutableMap . < String , Object > of ( ) , new AuditBuilder ( ) . setLocalHost ( ) . setComment ( "Create scan status table" ) . build ( ) ) ; _tableChecked = true ; } } return _tableName ; |
public class AIStream { /** * Turn a tick to L / A . Used to either :
* ( 1 ) turn an assured V / U to L / A , in which case acceptedItemId is valid , or
* ( 2 ) turn an express Q / G to L / A when discarding a message that came in out of order */
public void updateToAccepted ( long tick , AIProtocolItem acceptedItem ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "updateToAccepted" , new Object [ ] { Long . valueOf ( tick ) , acceptedItem } ) ; _targetStream . setCursor ( tick ) ; TickRange tr = _targetStream . getNext ( ) ; if ( ( tr . type == TickRange . Requested ) || ( tr . type == TickRange . Value ) ) { if ( acceptedItem != null ) { // At this point , the persist of the accepted item has committed so we can add it to the index
synchronized ( _completedPrefix ) { _itemStreamIndex . add ( acceptedItem ) ; } } writeAccepted ( tick ) ; // This is delayed until ACCEPT _ INITIAL _ THRESHOLD , writeAccepted batches the accepted tick
// When the TOM fires , it sends the initial batch of accepts
// long [ ] ticks = { tick } ;
// sendDispatcher . sendAccept ( ticks ) ;
} if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "updateToAccepted" ) ; |
public class ReferenceCountedOpenSslContext { /** * Return the pointer to a < a href = " https : / / www . openssl . org / docs / crypto / BIO _ get _ mem _ ptr . html " > in - memory BIO < / a >
* or { @ code 0 } if the { @ code certChain } is { @ code null } . The BIO contains the content of the { @ code certChain } . */
static long toBIO ( ByteBufAllocator allocator , X509Certificate ... certChain ) throws Exception { } } | if ( certChain == null ) { return 0 ; } if ( certChain . length == 0 ) { throw new IllegalArgumentException ( "certChain can't be empty" ) ; } PemEncoded pem = PemX509Certificate . toPEM ( allocator , true , certChain ) ; try { return toBIO ( allocator , pem . retain ( ) ) ; } finally { pem . release ( ) ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.