signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class BindTypeBuilder { /** * Generate serialize on xml .
* @ param context
* the context
* @ param entity
* the entity */
private static void generateSerializeOnXml ( BindTypeContext context , BindEntity entity ) { } }
|
// @ formatter : off
MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "serializeOnXml" ) . addJavadoc ( "method for xml serialization\n" ) . addAnnotation ( Override . class ) . addModifiers ( Modifier . PUBLIC ) // . addParameter ( typeName ( KriptonXmlContext . class ) , " context " )
. addParameter ( typeName ( entity . getElement ( ) ) , "object" ) . addParameter ( typeName ( XMLSerializer . class ) , "xmlSerializer" ) . addParameter ( typeName ( Integer . TYPE ) , "currentEventType" ) . returns ( Void . TYPE ) . addException ( Exception . class ) ; // @ formatter : on
methodBuilder . beginControlFlow ( "if (currentEventType == 0)" ) ; methodBuilder . addStatement ( "xmlSerializer.writeStartElement(\"$L\")" , entity . xmlInfo . label ) ; // write namespace
for ( Pair < String , String > namespace : entity . xmlInfo . namespaces ) { if ( StringUtils . hasText ( namespace . value0 ) ) { methodBuilder . addStatement ( "xmlSerializer.writeAttribute(\"\", $S, $S)" , "xmlns:" + namespace . value0 , namespace . value1 ) ; } else { methodBuilder . addStatement ( "xmlSerializer.writeAttribute(\"\", $S, $S)" , "xmlns" , namespace . value1 ) ; } } methodBuilder . endControlFlow ( ) ; BindTransform bindTransform ; methodBuilder . addCode ( "\n" ) ; // attributes
methodBuilder . addCode ( "// Persisted fields:\n\n" ) ; for ( BindProperty item : entity . getCollection ( ) ) { bindTransform = BindTransformer . lookup ( item ) ; methodBuilder . addCode ( "// field $L (mapped with $S)\n" , item . getName ( ) , BindProperty . xmlName ( item ) ) ; if ( item . hasTypeAdapter ( ) ) { methodBuilder . addCode ( "// field trasformation $L $L \n" , item . typeAdapter . dataType , item . typeAdapter . adapterClazz ) ; } bindTransform . generateSerializeOnXml ( context , methodBuilder , "xmlSerializer" , item . getPropertyType ( ) . getTypeName ( ) , "object" , item ) ; methodBuilder . addCode ( "\n" ) ; } methodBuilder . beginControlFlow ( "if (currentEventType == 0)" ) ; methodBuilder . addStatement ( "xmlSerializer.writeEndElement()" ) ; methodBuilder . endControlFlow ( ) ; // methodBuilder . nextControlFlow ( " catch ( $ T e ) " ,
// typeName ( Exception . class ) ) ;
// methodBuilder . addStatement ( " e . printStackTrace ( ) " ) ;
// methodBuilder . addStatement ( " throw ( new $ T ( e ) ) " ,
// typeName ( KriptonRuntimeException . class ) ) ;
// methodBuilder . endControlFlow ( ) ;
context . builder . addMethod ( methodBuilder . build ( ) ) ;
|
public class SGraphSegment { /** * Disconnect the begin point of this segment . */
public void disconnectBegin ( ) { } }
|
if ( this . startPoint != null ) { this . startPoint . remove ( this ) ; } this . startPoint = new SGraphPoint ( getGraph ( ) ) ; this . startPoint . add ( this ) ;
|
public class WebhookManager { /** * Mostly debug method . Logs hook manipulation result
* @ param format prepended comment for log
* @ return always true predicate */
protected Predicate < GHHook > log ( final String format ) { } }
|
return new NullSafePredicate < GHHook > ( ) { @ Override protected boolean applyNullSafe ( @ Nonnull GHHook input ) { LOGGER . debug ( format ( "%s {} (events: {})" , format ) , input . getUrl ( ) , input . getEvents ( ) ) ; return true ; } } ;
|
public class Matrix4f { /** * Set this matrix to be an arbitrary perspective projection frustum transformation for a left - handed coordinate system
* using OpenGL ' s NDC z range of < code > [ - 1 . . + 1 ] < / code > .
* In order to apply the perspective frustum transformation to an existing transformation ,
* use { @ link # frustumLH ( float , float , float , float , float , float , boolean ) frustumLH ( ) } .
* Reference : < a href = " http : / / www . songho . ca / opengl / gl _ projectionmatrix . html # perspective " > http : / / www . songho . ca < / a >
* @ see # frustumLH ( float , float , float , float , float , float , boolean )
* @ param left
* the distance along the x - axis to the left frustum edge
* @ param right
* the distance along the x - axis to the right frustum edge
* @ param bottom
* the distance along the y - axis to the bottom frustum edge
* @ param top
* the distance along the y - axis to the top frustum edge
* @ param zNear
* near clipping plane distance . If the special value { @ link Float # POSITIVE _ INFINITY } is used , the near clipping plane will be at positive infinity .
* In that case , < code > zFar < / code > may not also be { @ link Float # POSITIVE _ INFINITY } .
* @ param zFar
* far clipping plane distance . If the special value { @ link Float # POSITIVE _ INFINITY } is used , the far clipping plane will be at positive infinity .
* In that case , < code > zNear < / code > may not also be { @ link Float # POSITIVE _ INFINITY } .
* @ param zZeroToOne
* whether to use Vulkan ' s and Direct3D ' s NDC z range of < code > [ 0 . . + 1 ] < / code > when < code > true < / code >
* or whether to use OpenGL ' s NDC z range of < code > [ - 1 . . + 1 ] < / code > when < code > false < / code >
* @ return this */
public Matrix4f setFrustumLH ( float left , float right , float bottom , float top , float zNear , float zFar , boolean zZeroToOne ) { } }
|
if ( ( properties & PROPERTY_IDENTITY ) == 0 ) MemUtil . INSTANCE . identity ( this ) ; this . _m00 ( ( zNear + zNear ) / ( right - left ) ) ; this . _m11 ( ( zNear + zNear ) / ( top - bottom ) ) ; this . _m20 ( ( right + left ) / ( right - left ) ) ; this . _m21 ( ( top + bottom ) / ( top - bottom ) ) ; boolean farInf = zFar > 0 && Float . isInfinite ( zFar ) ; boolean nearInf = zNear > 0 && Float . isInfinite ( zNear ) ; if ( farInf ) { // See : " Infinite Projection Matrix " ( http : / / www . terathon . com / gdc07 _ lengyel . pdf )
float e = 1E-6f ; this . _m22 ( 1.0f - e ) ; this . _m32 ( ( e - ( zZeroToOne ? 1.0f : 2.0f ) ) * zNear ) ; } else if ( nearInf ) { float e = 1E-6f ; this . _m22 ( ( zZeroToOne ? 0.0f : 1.0f ) - e ) ; this . _m32 ( ( ( zZeroToOne ? 1.0f : 2.0f ) - e ) * zFar ) ; } else { this . _m22 ( ( zZeroToOne ? zFar : zFar + zNear ) / ( zFar - zNear ) ) ; this . _m32 ( ( zZeroToOne ? zFar : zFar + zFar ) * zNear / ( zNear - zFar ) ) ; } this . _m23 ( 1.0f ) ; this . _m33 ( 0.0f ) ; _properties ( 0 ) ; return this ;
|
public class UserResources { /** * Returns redirectURI based on whether this user has previously accepted the authorization page
* @ param req The Http Request with authorization header
* @ return Returns either redirectURI or OauthException */
@ GET @ Produces ( MediaType . APPLICATION_JSON ) @ Path ( "/check_oauth_access" ) @ Description ( "Returns redirectURI based on whether this user has previously accepted the authorization page" ) public OAuthAcceptResponseDto checkOauthAccess ( @ Context HttpServletRequest req ) { } }
|
String userName = findUserByToken ( req ) ; int result = authService . countByUserId ( userName ) ; OAuthAcceptResponseDto responseDto = new OAuthAcceptResponseDto ( ) ; if ( result == 0 ) { throw new OAuthException ( ResponseCodes . ERR_FINDING_USERNAME , HttpResponseStatus . BAD_REQUEST ) ; } else { responseDto . setRedirectURI ( applicationRedirectURI ) ; return responseDto ; }
|
public class JnlpFileScreen { /** * Add button ( s ) to the toolbar . */
public void addToolbarButtons ( ToolScreen toolScreen ) { } }
|
new SCannedBox ( toolScreen . getNextLocation ( ScreenConstants . NEXT_LOGICAL , ScreenConstants . SET_ANCHOR ) , toolScreen , null , ScreenConstants . DEFAULT_DISPLAY , null , JnlpFileScreen . WRITE_FILE , MenuConstants . PRINT , JnlpFileScreen . WRITE_FILE , null ) ;
|
public class LuceneIndexer { /** * Updates document .
* @ param metadata
* the metadata
* @ param entity
* the object
* @ param parentId
* the parent id
* @ param clazz
* the clazz
* @ return the document */
private void updateDocument ( EntityMetadata metadata , final MetamodelImpl metaModel , Object entity , String parentId , Class < ? extends Object > class1 , boolean b ) { } }
|
updateOrCreateIndex ( metadata , metaModel , entity , parentId , entity . getClass ( ) , true ) ; onCommit ( ) ;
|
public class Polyline { /** * default behaviour when no click listener is set */
public boolean onClickDefault ( Polyline polyline , MapView mapView , GeoPoint eventPos ) { } }
|
polyline . setInfoWindowLocation ( eventPos ) ; polyline . showInfoWindow ( ) ; return true ;
|
public class Curve25519 { /** * / * Check if reduced - form input > = 2 ^ 255-19 */
private static final boolean is_overflow ( long10 x ) { } }
|
return ( ( ( x . _0 > P26 - 19 ) ) && ( ( x . _1 & x . _3 & x . _5 & x . _7 & x . _9 ) == P25 ) && ( ( x . _2 & x . _4 & x . _6 & x . _8 ) == P26 ) ) || ( x . _9 > P25 ) ;
|
public class AnimatedDrawable2 { /** * Stop the animation at the current frame . It can be resumed by calling { @ link # start ( ) } again . */
@ Override public void stop ( ) { } }
|
if ( ! mIsRunning ) { return ; } mIsRunning = false ; mStartTimeMs = 0 ; mExpectedRenderTimeMs = mStartTimeMs ; mLastFrameAnimationTimeMs = - 1 ; mLastDrawnFrameNumber = - 1 ; unscheduleSelf ( mInvalidateRunnable ) ; mAnimationListener . onAnimationStop ( this ) ;
|
public class ReflectCache { /** * 往缓存里放入方法
* @ param serviceName 服务名 ( 非接口名 )
* @ param method 方法 */
public static void putMethodCache ( String serviceName , Method method ) { } }
|
ConcurrentHashMap < String , Method > cache = NOT_OVERLOAD_METHOD_CACHE . get ( serviceName ) ; if ( cache == null ) { cache = new ConcurrentHashMap < String , Method > ( ) ; ConcurrentHashMap < String , Method > old = NOT_OVERLOAD_METHOD_CACHE . putIfAbsent ( serviceName , cache ) ; if ( old != null ) { cache = old ; } } cache . putIfAbsent ( method . getName ( ) , method ) ;
|
public class Key { /** * Returns raw class of associated type
* @ return raw class */
public Class < T > rawClass ( ) { } }
|
Type type = type ( ) ; if ( type instanceof Class ) { return ( Class ) type ; } else if ( type instanceof ParameterizedType ) { ParameterizedType pType = ( ParameterizedType ) type ; return ( Class ) pType . getRawType ( ) ; } else { throw new UnsupportedOperationException ( type + " " + type . getClass ( ) . getName ( ) ) ; }
|
public class chemicalStructureImpl { /** * - - - - - CANONICAL METHODS - - - - - */
public int equivalenceCode ( ) { } }
|
int result = 29 + ( STRUCTURE_FORMAT != null ? STRUCTURE_FORMAT . hashCode ( ) : 0 ) ; result = 29 * result + ( STRUCTURE_DATA != null ? STRUCTURE_DATA . hashCode ( ) : 0 ) ; return result ;
|
public class HttpUtils { /** * Execute http response .
* @ param url the url
* @ param method the method
* @ param headers the headers
* @ return the http response */
public static HttpResponse execute ( final String url , final String method , final Map < String , Object > headers ) { } }
|
return execute ( url , method , null , null , new HashMap < > ( ) , headers ) ;
|
public class AdminToolUtils { /** * Utility function that fetches system store definitions
* @ return The map container that maps store names to store definitions */
public static Map < String , StoreDefinition > getSystemStoreDefMap ( ) { } }
|
Map < String , StoreDefinition > sysStoreDefMap = Maps . newHashMap ( ) ; List < StoreDefinition > storesDefs = SystemStoreConstants . getAllSystemStoreDefs ( ) ; for ( StoreDefinition def : storesDefs ) { sysStoreDefMap . put ( def . getName ( ) , def ) ; } return sysStoreDefMap ;
|
public class Histogram { /** * Prints a bucket of this histogram in a human readable ASCII format .
* @ param out The buffer to which to write the output .
* @ see # printAscii */
final void printAsciiBucket ( final StringBuilder out , final int i ) { } }
|
out . append ( '[' ) . append ( bucketLowInterval ( i ) ) . append ( '-' ) . append ( i == buckets . length - 1 ? "Inf" : bucketHighInterval ( i ) ) . append ( "): " ) . append ( buckets [ i ] ) . append ( '\n' ) ;
|
public class LogcatWriter { /** * Clears an existing string builder or creates a new one if given string builder is { @ code null } .
* @ param builder
* String builder instance or { @ code null }
* @ param capacity
* Initial capacity for new string builder if created
* @ return Empty string builder */
private static StringBuilder reuseOrCreate ( final StringBuilder builder , final int capacity ) { } }
|
if ( builder == null ) { return new StringBuilder ( capacity ) ; } else { builder . setLength ( 0 ) ; return builder ; }
|
public class CryptoServiceSingleton { /** * Build an hexadecimal MD5 hash for a String .
* @ param value The String to hash
* @ return An hexadecimal Hash */
@ Override public String hexMD5 ( String value ) { } }
|
return String . valueOf ( Hex . encodeHex ( md5 ( value ) ) ) ;
|
public class ApplicationGatewaysInner { /** * Lists all application gateways in a resource group .
* @ param resourceGroupName The name of the resource group .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ApplicationGatewayInner & gt ; object */
public Observable < Page < ApplicationGatewayInner > > listByResourceGroupAsync ( final String resourceGroupName ) { } }
|
return listByResourceGroupWithServiceResponseAsync ( resourceGroupName ) . map ( new Func1 < ServiceResponse < Page < ApplicationGatewayInner > > , Page < ApplicationGatewayInner > > ( ) { @ Override public Page < ApplicationGatewayInner > call ( ServiceResponse < Page < ApplicationGatewayInner > > response ) { return response . body ( ) ; } } ) ;
|
public class FilePath { /** * Returns the native path . */
@ Override public String getNativePath ( ) { } }
|
if ( ! isWindows ( ) ) { return getFullPath ( ) ; } String path = getFullPath ( ) ; int length = path . length ( ) ; CharBuffer cb = new CharBuffer ( ) ; char ch ; int offset = 0 ; // For windows , convert / c : to c :
if ( length >= 3 && path . charAt ( 0 ) == '/' && path . charAt ( 2 ) == ':' && ( 'a' <= ( ch = path . charAt ( 1 ) ) && ch <= 'z' || 'A' <= ch && ch <= 'Z' ) ) { offset = 1 ; } else if ( length >= 3 && path . charAt ( 0 ) == '/' && path . charAt ( 1 ) == ':' && path . charAt ( 2 ) == '/' ) { cb . append ( '\\' ) ; cb . append ( '\\' ) ; offset = 3 ; } for ( ; offset < length ; offset ++ ) { ch = path . charAt ( offset ) ; if ( ch == '/' ) cb . append ( _separatorChar ) ; else cb . append ( ch ) ; } return cb . toString ( ) ;
|
public class DefaultProcessDiagramCanvas { /** * This method returns intersection point of shape border and line .
* @ param shape
* @ param line
* @ return Point */
private static Point getIntersection ( Shape shape , Line2D . Double line ) { } }
|
if ( shape instanceof Ellipse2D ) { return getEllipseIntersection ( shape , line ) ; } else if ( shape instanceof Rectangle2D || shape instanceof Path2D ) { return getShapeIntersection ( shape , line ) ; } else { // something strange
return null ; }
|
public class AWSRoboMakerClient { /** * Returns a list of robot application . You can optionally provide filters to retrieve specific robot applications .
* @ param listRobotApplicationsRequest
* @ return Result of the ListRobotApplications operation returned by the service .
* @ throws InvalidParameterException
* A parameter specified in a request is not valid , is unsupported , or cannot be used . The returned message
* provides an explanation of the error value .
* @ throws ThrottlingException
* AWS RoboMaker is temporarily unable to process the request . Try your call again .
* @ throws InternalServerException
* AWS RoboMaker experienced a service issue . Try your call again .
* @ sample AWSRoboMaker . ListRobotApplications
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / robomaker - 2018-06-29 / ListRobotApplications "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ListRobotApplicationsResult listRobotApplications ( ListRobotApplicationsRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeListRobotApplications ( request ) ;
|
public class WFGHypervolume { /** * Updates the reference point */
private void updateReferencePoint ( Front front ) { } }
|
double [ ] maxObjectives = new double [ numberOfObjectives ] ; for ( int i = 0 ; i < numberOfObjectives ; i ++ ) { maxObjectives [ i ] = 0 ; } for ( int i = 0 ; i < front . getNumberOfPoints ( ) ; i ++ ) { for ( int j = 0 ; j < numberOfObjectives ; j ++ ) { if ( maxObjectives [ j ] < front . getPoint ( i ) . getValue ( j ) ) { maxObjectives [ j ] = front . getPoint ( i ) . getValue ( j ) ; } } } if ( referencePoint == null ) { referencePoint = new ArrayPoint ( numberOfObjectives ) ; for ( int i = 0 ; i < numberOfObjectives ; i ++ ) { referencePoint . setValue ( i , Double . MAX_VALUE ) ; } } for ( int i = 0 ; i < referencePoint . getDimension ( ) ; i ++ ) { referencePoint . setValue ( i , maxObjectives [ i ] + offset ) ; }
|
public class CreateProcedureAsSQL { /** * Check whether or not a procedure name is acceptible .
* @ param identifier the identifier to check
* @ param statement the statement where the identifier is
* @ return the given identifier unmodified
* @ throws VoltCompilerException */
private String checkProcedureIdentifier ( final String identifier , final String statement ) throws VoltCompilerException { } }
|
String retIdent = checkIdentifierStart ( identifier , statement ) ; if ( retIdent . contains ( "." ) ) { String msg = String . format ( "Invalid procedure name containing dots \"%s\" in DDL: \"%s\"" , identifier , statement . substring ( 0 , statement . length ( ) - 1 ) ) ; throw m_compiler . new VoltCompilerException ( msg ) ; } return retIdent ;
|
public class DialogImpl { /** * Adding the new incoming invokeId into incomingInvokeList list
* @ param invokeId
* @ return false : failure - this invokeId already present in the list */
private boolean addIncomingInvokeId ( Long invokeId ) { } }
|
synchronized ( this . incomingInvokeList ) { if ( this . incomingInvokeList . contains ( invokeId ) ) return false ; else { this . incomingInvokeList . add ( invokeId ) ; return true ; } }
|
public class SavedRequestAwareProcessor { /** * Checks if there ' s a request in the request cache ( which means that a previous request was cached ) . If there ' s
* one , the request cache creates a new request by merging the saved request with the current request . The new
* request is used through the rest of the processor chain .
* @ param context the context which holds the current request and response
* @ param processorChain the processor chain , used to call the next processor */
public void processRequest ( RequestContext context , RequestSecurityProcessorChain processorChain ) throws Exception { } }
|
HttpServletRequest request = context . getRequest ( ) ; HttpServletResponse response = context . getResponse ( ) ; HttpServletRequest wrappedSavedRequest = requestCache . getMatchingRequest ( request , response ) ; if ( wrappedSavedRequest != null ) { logger . debug ( "A previously saved request was found, and has been merged with the current request" ) ; context . setRequest ( wrappedSavedRequest ) ; } processorChain . processRequest ( context ) ;
|
public class DamerauLevenshtein { /** * Convenience method for calling { @ link # damerauLevenshteinDistance ( String str1 , String str2 ) }
* when you don ' t care about case sensitivity .
* @ param str1 First string being compared
* @ param str2 Second string being compared
* @ return Case - insensitive edit distance between strings */
public static int damerauLevenshteinDistanceCaseInsensitive ( String str1 , String str2 ) { } }
|
return damerauLevenshteinDistance ( str1 . toLowerCase ( ) , str2 . toLowerCase ( ) ) ;
|
public class BandwidthClient { /** * Helper method that builds the request to the server .
* Only POST is supported currently since we have cases in the API
* like token creation that accepts empty string payload " " , instead of { }
* @ param method the method .
* @ param path the path .
* @ param params json string .
* @ return the request . */
protected HttpUriRequest buildMethod ( final String method , final String path , final String params ) { } }
|
if ( StringUtils . equalsIgnoreCase ( method , HttpPost . METHOD_NAME ) ) { return generatePostRequest ( path , params ) ; } else { throw new RuntimeException ( String . format ( "Method %s not supported." , method ) ) ; }
|
public class SingleBusLocatorRegistrar { /** * Is the transport secured by a JAX - WS property */
private boolean isSecuredByProperty ( Server server ) { } }
|
boolean isSecured = false ; Object value = server . getEndpoint ( ) . get ( "org.talend.tesb.endpoint.secured" ) ; // Property name TBD
if ( value instanceof String ) { try { isSecured = Boolean . valueOf ( ( String ) value ) ; } catch ( Exception ex ) { } } return isSecured ;
|
public class ProjectApi { /** * Get a Pager instance of projects accessible by the authenticated user .
* < pre > < code > GET / projects < / code > < / pre >
* @ param itemsPerPage the number of Project instances that will be fetched per page
* @ return a Pager instance of projects accessible by the authenticated user
* @ throws GitLabApiException if any exception occurs */
public Pager < Project > getProjects ( int itemsPerPage ) throws GitLabApiException { } }
|
return ( new Pager < Project > ( this , Project . class , itemsPerPage , null , "projects" ) ) ;
|
public class LogicSchema { /** * Renew data source configuration .
* @ param dataSourceChangedEvent data source changed event .
* @ throws Exception exception */
@ Subscribe public final synchronized void renew ( final DataSourceChangedEvent dataSourceChangedEvent ) throws Exception { } }
|
if ( ! name . equals ( dataSourceChangedEvent . getShardingSchemaName ( ) ) ) { return ; } backendDataSource . close ( ) ; dataSources . clear ( ) ; dataSources . putAll ( DataSourceConverter . getDataSourceParameterMap ( dataSourceChangedEvent . getDataSourceConfigurations ( ) ) ) ; backendDataSource = new JDBCBackendDataSource ( dataSources ) ;
|
public class MQLinkMessageItemStream { /** * Link specific warning message
* ( 510343) */
protected void issueDepthIntervalMessage ( long depth ) { } }
|
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "issueDepthIntervalMessage" , new Long ( depth ) ) ; // {0 } messages queued for transmission from messaging engine { 1 } to foreign bus { 2 } on link { 3 } .
SibTr . info ( tc , "REMOTE_LINK_DESTINATION_DEPTH_INTERVAL_REACHED_CWSIP0789" , new Object [ ] { new Long ( depth ) , destinationHandler . getMessageProcessor ( ) . getMessagingEngineName ( ) , ( ( LinkHandler ) destinationHandler ) . getBusName ( ) , destinationHandler . getName ( ) } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "issueDepthIntervalMessage" ) ;
|
public class LookupService { /** * Returns the country the IP address is in .
* @ param ipAddress
* the IP address in long format .
* @ return the country the IP address is from . */
public synchronized Country getCountry ( long ipAddress ) { } }
|
if ( file == null && ( dboptions & GEOIP_MEMORY_CACHE ) == 0 ) { throw new IllegalStateException ( "Database has been closed." ) ; } int ret = seekCountry ( ipAddress ) - COUNTRY_BEGIN ; if ( ret == 0 ) { return UNKNOWN_COUNTRY ; } else { return new Country ( countryCode [ ret ] , countryName [ ret ] ) ; }
|
public class ArcSort { /** * Applies the ArcSort on the provided fst . Sorting can be applied either on input or output label based on the
* provided comparator .
* @ param fst the fst to sort it ' s arcs
* @ param comparator the provided Comparator */
public static void sortBy ( MutableFst fst , Comparator < Arc > comparator ) { } }
|
int numStates = fst . getStateCount ( ) ; for ( int i = 0 ; i < numStates ; i ++ ) { MutableState s = fst . getState ( i ) ; s . arcSort ( comparator ) ; }
|
public class AggregatorModelV99 { /** * Version & Schema - specific filling into the impl */
@ Override public AggregatorModel createImpl ( ) { } }
|
AggregatorModel . AggregatorParameters parms = parameters . createImpl ( ) ; return new AggregatorModel ( model_id . key ( ) , parms , null ) ;
|
public class GeneratorSingleCluster { /** * Apply a rotation to the generator
* @ param axis1 First axis ( 0 & lt ; = axis1 & lt ; dim )
* @ param axis2 Second axis ( 0 & lt ; = axis2 & lt ; dim )
* @ param angle Angle in Radians */
public void addRotation ( int axis1 , int axis2 , double angle ) { } }
|
if ( trans == null ) { trans = new AffineTransformation ( dim ) ; } trans . addRotation ( axis1 , axis2 , angle ) ;
|
public class MeasureFormat { /** * Create a format from the locale , formatWidth , and format .
* @ param locale the locale .
* @ param formatWidth hints how long formatted strings should be .
* @ param format This is defensively copied .
* @ return The new MeasureFormat object . */
public static MeasureFormat getInstance ( ULocale locale , FormatWidth formatWidth , NumberFormat format ) { } }
|
PluralRules rules = PluralRules . forLocale ( locale ) ; NumericFormatters formatters = null ; MeasureFormatData data = localeMeasureFormatData . get ( locale ) ; if ( data == null ) { data = loadLocaleData ( locale ) ; localeMeasureFormatData . put ( locale , data ) ; } if ( formatWidth == FormatWidth . NUMERIC ) { formatters = localeToNumericDurationFormatters . get ( locale ) ; if ( formatters == null ) { formatters = loadNumericFormatters ( locale ) ; localeToNumericDurationFormatters . put ( locale , formatters ) ; } } NumberFormat intFormat = NumberFormat . getInstance ( locale ) ; intFormat . setMaximumFractionDigits ( 0 ) ; intFormat . setMinimumFractionDigits ( 0 ) ; intFormat . setRoundingMode ( BigDecimal . ROUND_DOWN ) ; return new MeasureFormat ( locale , data , formatWidth , new ImmutableNumberFormat ( format ) , rules , formatters , new ImmutableNumberFormat ( NumberFormat . getInstance ( locale , formatWidth . getCurrencyStyle ( ) ) ) , new ImmutableNumberFormat ( intFormat ) ) ;
|
public class VoiceApi { /** * Initiate a transfer
* Initiate a two - step transfer by placing the first call on hold and dialing the destination number ( step 1 ) . After initiating the transfer , you can use [ / voice / calls / { id } / complete - transfer ] ( / reference / workspace / Voice / index . html # completeTransfer ) to complete the transfer ( step 2 ) .
* @ param id The connection ID of the call to be transferred . This call will be placed on hold . ( required )
* @ param initiateTransferData ( required )
* @ return ApiSuccessResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiSuccessResponse initiateTransfer ( String id , InitiateTransferData initiateTransferData ) throws ApiException { } }
|
ApiResponse < ApiSuccessResponse > resp = initiateTransferWithHttpInfo ( id , initiateTransferData ) ; return resp . getData ( ) ;
|
public class GetBotAliasesResult { /** * An array of < code > BotAliasMetadata < / code > objects , each describing a bot alias .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setBotAliases ( java . util . Collection ) } or { @ link # withBotAliases ( java . util . Collection ) } if you want to
* override the existing values .
* @ param botAliases
* An array of < code > BotAliasMetadata < / code > objects , each describing a bot alias .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GetBotAliasesResult withBotAliases ( BotAliasMetadata ... botAliases ) { } }
|
if ( this . botAliases == null ) { setBotAliases ( new java . util . ArrayList < BotAliasMetadata > ( botAliases . length ) ) ; } for ( BotAliasMetadata ele : botAliases ) { this . botAliases . add ( ele ) ; } return this ;
|
public class SqlHelper { /** * 判断自动 ! = null的条件结构
* @ param column
* @ param contents
* @ param empty
* @ return */
public static String getIfNotNull ( EntityColumn column , String contents , boolean empty ) { } }
|
return getIfNotNull ( null , column , contents , empty ) ;
|
public class S3ClientCache { /** * Returns a { @ link TransferManager } for the given region , or throws an
* exception when unable . The returned { @ link TransferManager } will always
* be instantiated from whatever { @ link AmazonS3 } is in the cache ,
* whether provided with { @ link # useClient ( AmazonS3 ) } or instantiated
* automatically from { @ link AWSCredentials } .
* Any { @ link TransferManager } returned could be shut down if a new
* underlying { @ link AmazonS3 } is provided with
* { @ link # useClient ( AmazonS3 ) } .
* @ param region
* The region string the returned { @ link TransferManager } will be
* configured to use .
* @ return A transfer manager for the given region from the cache , or one
* instantiated automatically from any existing
* { @ link AmazonS3 } , */
public TransferManager getTransferManager ( String region ) { } }
|
synchronized ( transferManagersByRegion ) { TransferManager tm = transferManagersByRegion . get ( region ) ; if ( tm == null ) { tm = new TransferManager ( getClient ( region ) ) ; transferManagersByRegion . put ( region , tm ) ; } return tm ; }
|
public class AppServiceEnvironmentsInner { /** * Get diagnostic information for an App Service Environment .
* Get diagnostic information for an App Service Environment .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; HostingEnvironmentDiagnosticsInner & gt ; object */
public Observable < List < HostingEnvironmentDiagnosticsInner > > listDiagnosticsAsync ( String resourceGroupName , String name ) { } }
|
return listDiagnosticsWithServiceResponseAsync ( resourceGroupName , name ) . map ( new Func1 < ServiceResponse < List < HostingEnvironmentDiagnosticsInner > > , List < HostingEnvironmentDiagnosticsInner > > ( ) { @ Override public List < HostingEnvironmentDiagnosticsInner > call ( ServiceResponse < List < HostingEnvironmentDiagnosticsInner > > response ) { return response . body ( ) ; } } ) ;
|
public class HTTPUtil { /** * public static ContentType getContentType ( HttpMethod http ) { Header [ ] headers =
* http . getResponseHeaders ( ) ; for ( int i = 0 ; i < headers . length ; i + + ) {
* if ( " Content - Type " . equalsIgnoreCase ( headers [ i ] . getName ( ) ) ) { String [ ] mimeCharset =
* splitMimeTypeAndCharset ( headers [ i ] . getValue ( ) ) ; String [ ] typeSub =
* splitTypeAndSubType ( mimeCharset [ 0 ] ) ; return new
* ContentTypeImpl ( typeSub [ 0 ] , typeSub [ 1 ] , mimeCharset [ 1 ] ) ; } } return null ; } */
public static Map < String , String > parseParameterList ( String _str , boolean decode , String charset ) { } }
|
// return lucee . commons . net . HTTPUtil . toURI ( strUrl , port ) ;
Map < String , String > data = new HashMap < String , String > ( ) ; StringList list = ListUtil . toList ( _str , '&' ) ; String str ; int index ; while ( list . hasNext ( ) ) { str = list . next ( ) ; index = str . indexOf ( '=' ) ; if ( index == - 1 ) { data . put ( decode ( str , decode ) , "" ) ; } else { data . put ( decode ( str . substring ( 0 , index ) , decode ) , decode ( str . substring ( index + 1 ) , decode ) ) ; } } return data ;
|
public class Main { /** * HeaderKey1 : value1 | HeaderKey2 : value2 . . .
* @ param value
* @ return */
private static Map < String , String > extractHeaders ( String value ) { } }
|
if ( value == null ) return null ; return Splitter . on ( "|" ) . withKeyValueSeparator ( ":" ) . split ( value ) ;
|
public class LunarCalendar { /** * 获取今天的农历日期
* @ return 今天的农历日期数组 , 数组第一个元素是年 , 第二个元素是月 , 第三个元素是日 */
public static int [ ] today ( ) { } }
|
Calendar today = Calendar . getInstance ( ) ; int year = today . get ( Calendar . YEAR ) ; int month = today . get ( Calendar . MONTH ) + 1 ; int date = today . get ( Calendar . DATE ) ; return calElement ( year , month , date ) ;
|
public class BundleUtils { /** * Returns a optional int array value . In other words , returns the value mapped by key if it exists and is a int array .
* The bundle argument is allowed to be { @ code null } . If the bundle is null , this method returns null .
* @ param bundle a bundle . If the bundle is null , this method will return null .
* @ param key a key for the value .
* @ param fallback fallback value .
* @ return a int array value if exists , null otherwise .
* @ see android . os . Bundle # getIntArray ( String ) */
@ Nullable public static int [ ] optIntArray ( @ Nullable Bundle bundle , @ Nullable String key , @ Nullable int [ ] fallback ) { } }
|
if ( bundle == null ) { return fallback ; } return bundle . getIntArray ( key ) ;
|
public class VTimeZone { /** * Write the time zone rules in RFC2445 VTIMEZONE format */
private void writeZone ( Writer w , BasicTimeZone basictz , String [ ] customProperties ) throws IOException { } }
|
// Write the header
writeHeader ( w ) ; if ( customProperties != null && customProperties . length > 0 ) { for ( int i = 0 ; i < customProperties . length ; i ++ ) { if ( customProperties [ i ] != null ) { w . write ( customProperties [ i ] ) ; w . write ( NEWLINE ) ; } } } long t = MIN_TIME ; String dstName = null ; int dstFromOffset = 0 ; int dstFromDSTSavings = 0 ; int dstToOffset = 0 ; int dstStartYear = 0 ; int dstMonth = 0 ; int dstDayOfWeek = 0 ; int dstWeekInMonth = 0 ; int dstMillisInDay = 0 ; long dstStartTime = 0 ; long dstUntilTime = 0 ; int dstCount = 0 ; AnnualTimeZoneRule finalDstRule = null ; String stdName = null ; int stdFromOffset = 0 ; int stdFromDSTSavings = 0 ; int stdToOffset = 0 ; int stdStartYear = 0 ; int stdMonth = 0 ; int stdDayOfWeek = 0 ; int stdWeekInMonth = 0 ; int stdMillisInDay = 0 ; long stdStartTime = 0 ; long stdUntilTime = 0 ; int stdCount = 0 ; AnnualTimeZoneRule finalStdRule = null ; int [ ] dtfields = new int [ 6 ] ; boolean hasTransitions = false ; // Going through all transitions
while ( true ) { TimeZoneTransition tzt = basictz . getNextTransition ( t , false ) ; if ( tzt == null ) { break ; } hasTransitions = true ; t = tzt . getTime ( ) ; String name = tzt . getTo ( ) . getName ( ) ; boolean isDst = ( tzt . getTo ( ) . getDSTSavings ( ) != 0 ) ; int fromOffset = tzt . getFrom ( ) . getRawOffset ( ) + tzt . getFrom ( ) . getDSTSavings ( ) ; int fromDSTSavings = tzt . getFrom ( ) . getDSTSavings ( ) ; int toOffset = tzt . getTo ( ) . getRawOffset ( ) + tzt . getTo ( ) . getDSTSavings ( ) ; Grego . timeToFields ( tzt . getTime ( ) + fromOffset , dtfields ) ; int weekInMonth = Grego . getDayOfWeekInMonth ( dtfields [ 0 ] , dtfields [ 1 ] , dtfields [ 2 ] ) ; int year = dtfields [ 0 ] ; boolean sameRule = false ; if ( isDst ) { if ( finalDstRule == null && tzt . getTo ( ) instanceof AnnualTimeZoneRule ) { if ( ( ( AnnualTimeZoneRule ) tzt . getTo ( ) ) . getEndYear ( ) == AnnualTimeZoneRule . MAX_YEAR ) { finalDstRule = ( AnnualTimeZoneRule ) tzt . getTo ( ) ; } } if ( dstCount > 0 ) { if ( year == dstStartYear + dstCount && name . equals ( dstName ) && dstFromOffset == fromOffset && dstToOffset == toOffset && dstMonth == dtfields [ 1 ] && dstDayOfWeek == dtfields [ 3 ] && dstWeekInMonth == weekInMonth && dstMillisInDay == dtfields [ 5 ] ) { // Update until time
dstUntilTime = t ; dstCount ++ ; sameRule = true ; } if ( ! sameRule ) { if ( dstCount == 1 ) { writeZonePropsByTime ( w , true , dstName , dstFromOffset , dstToOffset , dstStartTime , true ) ; } else { writeZonePropsByDOW ( w , true , dstName , dstFromOffset , dstToOffset , dstMonth , dstWeekInMonth , dstDayOfWeek , dstStartTime , dstUntilTime ) ; } } } if ( ! sameRule ) { // Reset this DST information
dstName = name ; dstFromOffset = fromOffset ; dstFromDSTSavings = fromDSTSavings ; dstToOffset = toOffset ; dstStartYear = year ; dstMonth = dtfields [ 1 ] ; dstDayOfWeek = dtfields [ 3 ] ; dstWeekInMonth = weekInMonth ; dstMillisInDay = dtfields [ 5 ] ; dstStartTime = dstUntilTime = t ; dstCount = 1 ; } if ( finalStdRule != null && finalDstRule != null ) { break ; } } else { if ( finalStdRule == null && tzt . getTo ( ) instanceof AnnualTimeZoneRule ) { if ( ( ( AnnualTimeZoneRule ) tzt . getTo ( ) ) . getEndYear ( ) == AnnualTimeZoneRule . MAX_YEAR ) { finalStdRule = ( AnnualTimeZoneRule ) tzt . getTo ( ) ; } } if ( stdCount > 0 ) { if ( year == stdStartYear + stdCount && name . equals ( stdName ) && stdFromOffset == fromOffset && stdToOffset == toOffset && stdMonth == dtfields [ 1 ] && stdDayOfWeek == dtfields [ 3 ] && stdWeekInMonth == weekInMonth && stdMillisInDay == dtfields [ 5 ] ) { // Update until time
stdUntilTime = t ; stdCount ++ ; sameRule = true ; } if ( ! sameRule ) { if ( stdCount == 1 ) { writeZonePropsByTime ( w , false , stdName , stdFromOffset , stdToOffset , stdStartTime , true ) ; } else { writeZonePropsByDOW ( w , false , stdName , stdFromOffset , stdToOffset , stdMonth , stdWeekInMonth , stdDayOfWeek , stdStartTime , stdUntilTime ) ; } } } if ( ! sameRule ) { // Reset this STD information
stdName = name ; stdFromOffset = fromOffset ; stdFromDSTSavings = fromDSTSavings ; stdToOffset = toOffset ; stdStartYear = year ; stdMonth = dtfields [ 1 ] ; stdDayOfWeek = dtfields [ 3 ] ; stdWeekInMonth = weekInMonth ; stdMillisInDay = dtfields [ 5 ] ; stdStartTime = stdUntilTime = t ; stdCount = 1 ; } if ( finalStdRule != null && finalDstRule != null ) { break ; } } } if ( ! hasTransitions ) { // No transition - put a single non transition RDATE
int offset = basictz . getOffset ( 0 /* any time */
) ; boolean isDst = ( offset != basictz . getRawOffset ( ) ) ; writeZonePropsByTime ( w , isDst , getDefaultTZName ( basictz . getID ( ) , isDst ) , offset , offset , DEF_TZSTARTTIME - offset , false ) ; } else { if ( dstCount > 0 ) { if ( finalDstRule == null ) { if ( dstCount == 1 ) { writeZonePropsByTime ( w , true , dstName , dstFromOffset , dstToOffset , dstStartTime , true ) ; } else { writeZonePropsByDOW ( w , true , dstName , dstFromOffset , dstToOffset , dstMonth , dstWeekInMonth , dstDayOfWeek , dstStartTime , dstUntilTime ) ; } } else { if ( dstCount == 1 ) { writeFinalRule ( w , true , finalDstRule , dstFromOffset - dstFromDSTSavings , dstFromDSTSavings , dstStartTime ) ; } else { // Use a single rule if possible
if ( isEquivalentDateRule ( dstMonth , dstWeekInMonth , dstDayOfWeek , finalDstRule . getRule ( ) ) ) { writeZonePropsByDOW ( w , true , dstName , dstFromOffset , dstToOffset , dstMonth , dstWeekInMonth , dstDayOfWeek , dstStartTime , MAX_TIME ) ; } else { // Not equivalent rule - write out two different rules
writeZonePropsByDOW ( w , true , dstName , dstFromOffset , dstToOffset , dstMonth , dstWeekInMonth , dstDayOfWeek , dstStartTime , dstUntilTime ) ; Date nextStart = finalDstRule . getNextStart ( dstUntilTime , dstFromOffset - dstFromDSTSavings , dstFromDSTSavings , false ) ; assert nextStart != null ; if ( nextStart != null ) { writeFinalRule ( w , true , finalDstRule , dstFromOffset - dstFromDSTSavings , dstFromDSTSavings , nextStart . getTime ( ) ) ; } } } } } if ( stdCount > 0 ) { if ( finalStdRule == null ) { if ( stdCount == 1 ) { writeZonePropsByTime ( w , false , stdName , stdFromOffset , stdToOffset , stdStartTime , true ) ; } else { writeZonePropsByDOW ( w , false , stdName , stdFromOffset , stdToOffset , stdMonth , stdWeekInMonth , stdDayOfWeek , stdStartTime , stdUntilTime ) ; } } else { if ( stdCount == 1 ) { writeFinalRule ( w , false , finalStdRule , stdFromOffset - stdFromDSTSavings , stdFromDSTSavings , stdStartTime ) ; } else { // Use a single rule if possible
if ( isEquivalentDateRule ( stdMonth , stdWeekInMonth , stdDayOfWeek , finalStdRule . getRule ( ) ) ) { writeZonePropsByDOW ( w , false , stdName , stdFromOffset , stdToOffset , stdMonth , stdWeekInMonth , stdDayOfWeek , stdStartTime , MAX_TIME ) ; } else { // Not equivalent rule - write out two different rules
writeZonePropsByDOW ( w , false , stdName , stdFromOffset , stdToOffset , stdMonth , stdWeekInMonth , stdDayOfWeek , stdStartTime , stdUntilTime ) ; Date nextStart = finalStdRule . getNextStart ( stdUntilTime , stdFromOffset - stdFromDSTSavings , stdFromDSTSavings , false ) ; assert nextStart != null ; if ( nextStart != null ) { writeFinalRule ( w , false , finalStdRule , stdFromOffset - stdFromDSTSavings , stdFromDSTSavings , nextStart . getTime ( ) ) ; } } } } } } writeFooter ( w ) ;
|
public class ChunkFetcherBase { /** * Fetch existing domain objects based on natural keys
* @ param keys
* Set of natural keys for the domain objects to fetch
* @ param resultAsSet
* indicates if the keys are unique or not , eg . the resulting map
* must be a set of objects .
* @ return Map with keys and domain objects */
public List < T > getDomainObjectsAsList ( Set < ? extends KEY > keys ) { } }
|
// it is not " possible " to use huge number of parameters in a
// Restrictions . in criterion and therefore we chunk the query
// into pieces
List < T > all = new ArrayList < T > ( ) ; Iterator < ? extends KEY > iter = keys . iterator ( ) ; List < KEY > chunkKeys = new ArrayList < KEY > ( ) ; for ( int i = 1 ; iter . hasNext ( ) ; i ++ ) { KEY element = iter . next ( ) ; chunkKeys . add ( element ) ; if ( ( i % CHUNK_SIZE ) == 0 ) { all . addAll ( getChunk ( chunkKeys ) ) ; chunkKeys = new ArrayList < KEY > ( ) ; } } // and then the last part
if ( ! chunkKeys . isEmpty ( ) ) { all . addAll ( getChunk ( chunkKeys ) ) ; } return all ;
|
public class Form { /** * Sets a new int value to a given form ' s field . The field whose variable matches the
* requested variable will be completed with the specified value . If no field could be found
* for the specified variable then an exception will be raised .
* @ param variable the variable name that was completed .
* @ param value the int value that was answered .
* @ throws IllegalStateException if the form is not of type " submit " .
* @ throws IllegalArgumentException if the form does not include the specified variable or
* if the answer type does not correspond with the field type . */
public void setAnswer ( String variable , int value ) { } }
|
FormField field = getField ( variable ) ; if ( field == null ) { throw new IllegalArgumentException ( "Field not found for the specified variable name." ) ; } validateThatFieldIsText ( field ) ; setAnswer ( field , value ) ;
|
public class BufferedElementReader { /** * Reads an element at a specific position .
* < p > This method does not influence the order in which the elements
* are read by { @ link # readElement ( ) } . < / p >
* < p > The execution time of this method can be in the order of
* { @ code O ( index ) } in the worst case . On average its { @ code O ( 1 ) } . < / p >
* @ param index Zero - bound index of the element to read .
* @ return Element at the given index .
* @ throws IOException if reading fails .
* @ throws IndexOutOfBoundsException if the index is out of range ( negative
* or greater - equal to the number of elements ) . */
@ Override public Element readElement ( final int index ) throws IOException { } }
|
if ( index < 0 ) { throw new IndexOutOfBoundsException ( "Index is negative." ) ; } if ( closed ) { throw new IllegalStateException ( "Reader is closed." ) ; } while ( index >= buffer . size ( ) ) { Element element = reader . readElement ( ) ; if ( element == null ) { throw new IndexOutOfBoundsException ( "Index is larger or equal to the number of elements." ) ; } else { buffer . add ( element ) ; } } return buffer . get ( index ) ;
|
public class ShadedNettyGrpcServerFactory { /** * Converts the given client auth option to netty ' s client auth .
* @ param clientAuth The client auth option to convert .
* @ return The converted client auth option . */
protected static io . grpc . netty . shaded . io . netty . handler . ssl . ClientAuth of ( final ClientAuth clientAuth ) { } }
|
switch ( clientAuth ) { case NONE : return io . grpc . netty . shaded . io . netty . handler . ssl . ClientAuth . NONE ; case OPTIONAL : return io . grpc . netty . shaded . io . netty . handler . ssl . ClientAuth . OPTIONAL ; case REQUIRE : return io . grpc . netty . shaded . io . netty . handler . ssl . ClientAuth . REQUIRE ; default : throw new IllegalArgumentException ( "Unsupported ClientAuth: " + clientAuth ) ; }
|
public class MavenRepositorySystem { /** * Resolves artifact dependencies .
* The { @ link ArtifactResult } contains a reference to a file in Maven local repository .
* @ param repoSession The current Maven session
* @ param swrSession SWR Aether session abstraction
* @ param request The request to be computed
* @ param filters The filters of dependency results
* @ return A collection of artifacts which have built dependency tree from { @ code request }
* @ throws DependencyResolutionException If a dependency could not be computed or collected */
public Collection < ArtifactResult > resolveDependencies ( final RepositorySystemSession repoSession , final MavenWorkingSession swrSession , final CollectRequest request , final MavenResolutionFilter [ ] filters ) throws DependencyResolutionException { } }
|
final DependencyRequest depRequest = new DependencyRequest ( request , new MavenResolutionFilterWrap ( filters , Collections . unmodifiableList ( new ArrayList < MavenDependency > ( swrSession . getDependenciesForResolution ( ) ) ) ) ) ; DependencyResult result = system . resolveDependencies ( repoSession , depRequest ) ; return result . getArtifactResults ( ) ;
|
public class AbstractRowPlotter { /** * Check if the point ( x , y ) is contained in the chart area
* We check only minX , maxX , and maxY to avoid flickering .
* We take max ( chartRect . y , y ) as redering value
* This is done to prevent line out of range if new point is added
* during chart paint . */
protected boolean isChartPointValid ( int xx , int yy ) { } }
|
boolean ret = true ; // check x
if ( xx < chartRect . x || xx > chartRect . x + chartRect . width ) { ret = false ; } else // check y bellow x axis
if ( yy > chartRect . y + chartRect . height ) { ret = false ; } return ret ;
|
public class AbstractCIBase { /** * Updates Computers .
* This method tries to reuse existing { @ link Computer } objects
* so that we won ' t upset { @ link Executor } s running in it . */
protected void updateComputerList ( final boolean automaticSlaveLaunch ) { } }
|
final Map < Node , Computer > computers = getComputerMap ( ) ; final Set < Computer > old = new HashSet < Computer > ( computers . size ( ) ) ; Queue . withLock ( new Runnable ( ) { @ Override public void run ( ) { Map < String , Computer > byName = new HashMap < String , Computer > ( ) ; for ( Computer c : computers . values ( ) ) { old . add ( c ) ; Node node = c . getNode ( ) ; if ( node == null ) continue ; // this computer is gone
byName . put ( node . getNodeName ( ) , c ) ; } Set < Computer > used = new HashSet < > ( old . size ( ) ) ; updateComputer ( AbstractCIBase . this , byName , used , automaticSlaveLaunch ) ; for ( Node s : getNodes ( ) ) { long start = System . currentTimeMillis ( ) ; updateComputer ( s , byName , used , automaticSlaveLaunch ) ; if ( LOG_STARTUP_PERFORMANCE && LOGGER . isLoggable ( Level . FINE ) ) { LOGGER . fine ( String . format ( "Took %dms to update node %s" , System . currentTimeMillis ( ) - start , s . getNodeName ( ) ) ) ; } } // find out what computers are removed , and kill off all executors .
// when all executors exit , it will be removed from the computers map .
// so don ' t remove too quickly
old . removeAll ( used ) ; // we need to start the process of reducing the executors on all computers as distinct
// from the killing action which should not excessively use the Queue lock .
for ( Computer c : old ) { c . inflictMortalWound ( ) ; } } } ) ; for ( Computer c : old ) { // when we get to here , the number of executors should be zero so this call should not need the Queue . lock
killComputer ( c ) ; } getQueue ( ) . scheduleMaintenance ( ) ; for ( ComputerListener cl : ComputerListener . all ( ) ) { try { cl . onConfigurationChange ( ) ; } catch ( Throwable t ) { LOGGER . log ( Level . WARNING , null , t ) ; } }
|
public class PythonHelper { /** * Executes a python script and return its output .
* @ param fileName the filename of the python script to execute
* @ param arguments the arguments to pass to the python script
* @ return the output of the python script execution ( combined standard and error outputs )
* @ throws PyException in case of exception during Python script execution */
public static String execute ( String fileName , String ... arguments ) throws PyException { } }
|
return execute ( fileName , true , arguments ) ;
|
public class UserConnection { /** * { @ inheritDoc } */
@ Override public TResult rawQuery ( String sql , String [ ] selectionArgs ) { } }
|
ResultSet resultSet = SQLUtils . query ( connection , sql , selectionArgs ) ; int count = SQLUtils . count ( connection , sql , selectionArgs ) ; return createResult ( resultSet , count ) ;
|
public class Yylex { /** * Resumes scanning until the next regular expression is matched ,
* the end of input is encountered or an I / O - Error occurs .
* @ return the next token
* @ exception java . io . IOException if any I / O - Error occurs */
public Yytoken yylex ( ) throws java . io . IOException , ParseException { } }
|
int zzInput ; int zzAction ; // cached fields :
int zzCurrentPosL ; int zzMarkedPosL ; int zzEndReadL = zzEndRead ; char [ ] zzBufferL = zzBuffer ; char [ ] zzCMapL = ZZ_CMAP ; int [ ] zzTransL = ZZ_TRANS ; int [ ] zzRowMapL = ZZ_ROWMAP ; int [ ] zzAttrL = ZZ_ATTRIBUTE ; while ( true ) { zzMarkedPosL = zzMarkedPos ; yychar += zzMarkedPosL - zzStartRead ; zzAction = - 1 ; zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL ; zzState = ZZ_LEXSTATE [ zzLexicalState ] ; zzForAction : { while ( true ) { if ( zzCurrentPosL < zzEndReadL ) zzInput = zzBufferL [ zzCurrentPosL ++ ] ; else if ( zzAtEOF ) { zzInput = YYEOF ; break zzForAction ; } else { // store back cached positions
zzCurrentPos = zzCurrentPosL ; zzMarkedPos = zzMarkedPosL ; boolean eof = zzRefill ( ) ; // get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos ; zzMarkedPosL = zzMarkedPos ; zzBufferL = zzBuffer ; zzEndReadL = zzEndRead ; if ( eof ) { zzInput = YYEOF ; break zzForAction ; } else { zzInput = zzBufferL [ zzCurrentPosL ++ ] ; } } int zzNext = zzTransL [ zzRowMapL [ zzState ] + zzCMapL [ zzInput ] ] ; if ( zzNext == - 1 ) break zzForAction ; zzState = zzNext ; int zzAttributes = zzAttrL [ zzState ] ; if ( ( zzAttributes & 1 ) == 1 ) { zzAction = zzState ; zzMarkedPosL = zzCurrentPosL ; if ( ( zzAttributes & 8 ) == 8 ) break zzForAction ; } } } // store back cached position
zzMarkedPos = zzMarkedPosL ; switch ( zzAction < 0 ? zzAction : ZZ_ACTION [ zzAction ] ) { case 11 : { sb . append ( yytext ( ) ) ; } case 25 : break ; case 4 : { sb = null ; sb = new StringBuffer ( ) ; yybegin ( STRING_BEGIN ) ; } case 26 : break ; case 16 : { sb . append ( '\b' ) ; } case 27 : break ; case 6 : { return new Yytoken ( Yytoken . TYPE_RIGHT_BRACE , null ) ; } case 28 : break ; case 23 : { Boolean val = Boolean . valueOf ( yytext ( ) ) ; return new Yytoken ( Yytoken . TYPE_VALUE , val ) ; } case 29 : break ; case 22 : { return new Yytoken ( Yytoken . TYPE_VALUE , null ) ; } case 30 : break ; case 13 : { yybegin ( YYINITIAL ) ; return new Yytoken ( Yytoken . TYPE_VALUE , sb . toString ( ) ) ; } case 31 : break ; case 12 : { sb . append ( '\\' ) ; } case 32 : break ; case 21 : { Double val = Double . valueOf ( yytext ( ) ) ; return new Yytoken ( Yytoken . TYPE_VALUE , val ) ; } case 33 : break ; case 1 : { throw new ParseException ( yychar , ParseException . ERROR_UNEXPECTED_CHAR , new Character ( yycharat ( 0 ) ) ) ; } case 34 : break ; case 8 : { return new Yytoken ( Yytoken . TYPE_RIGHT_SQUARE , null ) ; } case 35 : break ; case 19 : { sb . append ( '\r' ) ; } case 36 : break ; case 15 : { sb . append ( '/' ) ; } case 37 : break ; case 10 : { return new Yytoken ( Yytoken . TYPE_COLON , null ) ; } case 38 : break ; case 14 : { sb . append ( '"' ) ; } case 39 : break ; case 5 : { return new Yytoken ( Yytoken . TYPE_LEFT_BRACE , null ) ; } case 40 : break ; case 17 : { sb . append ( '\f' ) ; } case 41 : break ; case 24 : { try { int ch = Integer . parseInt ( yytext ( ) . substring ( 2 ) , 16 ) ; sb . append ( ( char ) ch ) ; } catch ( Exception e ) { throw new ParseException ( yychar , ParseException . ERROR_UNEXPECTED_EXCEPTION , e ) ; } } case 42 : break ; case 20 : { sb . append ( '\t' ) ; } case 43 : break ; case 7 : { return new Yytoken ( Yytoken . TYPE_LEFT_SQUARE , null ) ; } case 44 : break ; case 2 : { Long val = Long . valueOf ( yytext ( ) ) ; return new Yytoken ( Yytoken . TYPE_VALUE , val ) ; } case 45 : break ; case 18 : { sb . append ( '\n' ) ; } case 46 : break ; case 9 : { return new Yytoken ( Yytoken . TYPE_COMMA , null ) ; } case 47 : break ; case 3 : { } case 48 : break ; default : if ( zzInput == YYEOF && zzStartRead == zzCurrentPos ) { zzAtEOF = true ; return null ; } else { zzScanError ( ZZ_NO_MATCH ) ; } } }
|
public class ComponentCommander { /** * Finds all popups . A Component is a popup if it ' s a DialogPane , modal and not resizable .
* @ return the list of all found popups . */
protected static List < Stage > findPopups ( ) throws QTasteTestFailException { } }
|
// find all popups
List < Stage > popupFound = new ArrayList < > ( ) ; for ( Stage stage : getStages ( ) ) { Parent root = stage . getScene ( ) . getRoot ( ) ; if ( isAPopup ( stage ) ) { // it ' s maybe a popup . . . a popup is modal and not resizable and has a DialogPane root
DialogPane dialog = ( DialogPane ) root ; LOGGER . trace ( "Find a popup with the title '" + stage . getTitle ( ) + "'." ) ; popupFound . add ( stage ) ; } } return popupFound ;
|
public class Searcher { /** * Adds a facet refinement for the next queries .
* < b > This method resets the current page to 0 . < / b >
* @ param attribute the attribute to refine on .
* @ param value the facet ' s value to refine with .
* @ return this { @ link Searcher } for chaining . */
@ NonNull @ SuppressWarnings ( { } }
|
"WeakerAccess" , "unused" } ) // For library users
public Searcher addFacetRefinement ( @ NonNull String attribute , @ NonNull String value ) { return addFacetRefinement ( attribute , Collections . singletonList ( value ) , disjunctiveFacets . contains ( attribute ) ) ;
|
public class AdditionalRequestHeadersInterceptor { /** * Adds the given header value .
* Note that { @ code headerName } and { @ code headerValue } cannot be null .
* @ param headerName the name of the header
* @ param headerValue the value to add for the header
* @ throws NullPointerException if either parameter is { @ code null } */
public void addHeaderValue ( String headerName , String headerValue ) { } }
|
Objects . requireNonNull ( headerName , "headerName cannot be null" ) ; Objects . requireNonNull ( headerValue , "headerValue cannot be null" ) ; getHeaderValues ( headerName ) . add ( headerValue ) ;
|
public class SoundStore { /** * Set the stream being played
* @ param stream The stream being streamed */
void setStream ( OpenALStreamPlayer stream ) { } }
|
if ( ! soundWorks ) { return ; } currentMusic = sources . get ( 0 ) ; this . stream = stream ; if ( stream != null ) { this . mod = null ; } paused = false ;
|
public class ListViewCompat { /** * Find a position that can be selected ( i . e . , is not a separator ) .
* @ param position The starting position to look at .
* @ param lookDown Whether to look down for other positions .
* @ return The next selectable position starting at position and then searching either up or
* down . Returns { @ link # INVALID _ POSITION } if nothing can be found . */
public int lookForSelectablePosition ( int position , boolean lookDown ) { } }
|
final ListAdapter adapter = getAdapter ( ) ; if ( adapter == null || isInTouchMode ( ) ) { return INVALID_POSITION ; } final int count = adapter . getCount ( ) ; if ( ! getAdapter ( ) . areAllItemsEnabled ( ) ) { if ( lookDown ) { position = Math . max ( 0 , position ) ; while ( position < count && ! adapter . isEnabled ( position ) ) { position ++ ; } } else { position = Math . min ( position , count - 1 ) ; while ( position >= 0 && ! adapter . isEnabled ( position ) ) { position -- ; } } if ( position < 0 || position >= count ) { return INVALID_POSITION ; } return position ; } else { if ( position < 0 || position >= count ) { return INVALID_POSITION ; } return position ; }
|
public class ExportTaskMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ExportTask exportTask , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( exportTask == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( exportTask . getTaskId ( ) , TASKID_BINDING ) ; protocolMarshaller . marshall ( exportTask . getTaskName ( ) , TASKNAME_BINDING ) ; protocolMarshaller . marshall ( exportTask . getLogGroupName ( ) , LOGGROUPNAME_BINDING ) ; protocolMarshaller . marshall ( exportTask . getFrom ( ) , FROM_BINDING ) ; protocolMarshaller . marshall ( exportTask . getTo ( ) , TO_BINDING ) ; protocolMarshaller . marshall ( exportTask . getDestination ( ) , DESTINATION_BINDING ) ; protocolMarshaller . marshall ( exportTask . getDestinationPrefix ( ) , DESTINATIONPREFIX_BINDING ) ; protocolMarshaller . marshall ( exportTask . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( exportTask . getExecutionInfo ( ) , EXECUTIONINFO_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class InvokeDynamicFieldAccess { /** * Get a new instance that can access the given Field
* @ param classAccess The InvokeDynamicClassAccess instance to be delegated to
* @ param f Field to be accessed
* @ param < C > The type of class being accessed
* @ return New InvokeDynamicFieldAccess instance */
public static final < C > InvokeDynamicFieldAccess < C > get ( InvokeDynamicClassAccess < C > classAccess , Field f ) { } }
|
return new InvokeDynamicFieldAccess < C > ( classAccess , f ) ;
|
public class DefaultSentryClientFactory { /** * Maximum time to wait for { @ link BufferedConnection } shutdown when closed , in milliseconds .
* @ param dsn Sentry server DSN which may contain options .
* @ return Maximum time to wait for { @ link BufferedConnection } shutdown when closed , in milliseconds . */
protected long getBufferedConnectionShutdownTimeout ( Dsn dsn ) { } }
|
return Util . parseLong ( Lookup . lookup ( BUFFER_SHUTDOWN_TIMEOUT_OPTION , dsn ) , BUFFER_SHUTDOWN_TIMEOUT_DEFAULT ) ;
|
public class NativeGlobal { /** * The global unescape method , as per ECMA - 262 15.1.2.5. */
private Object js_unescape ( Object [ ] args ) { } }
|
String s = ScriptRuntime . toString ( args , 0 ) ; int firstEscapePos = s . indexOf ( '%' ) ; if ( firstEscapePos >= 0 ) { int L = s . length ( ) ; char [ ] buf = s . toCharArray ( ) ; int destination = firstEscapePos ; for ( int k = firstEscapePos ; k != L ; ) { char c = buf [ k ] ; ++ k ; if ( c == '%' && k != L ) { int end , start ; if ( buf [ k ] == 'u' ) { start = k + 1 ; end = k + 5 ; } else { start = k ; end = k + 2 ; } if ( end <= L ) { int x = 0 ; for ( int i = start ; i != end ; ++ i ) { x = Kit . xDigitToInt ( buf [ i ] , x ) ; } if ( x >= 0 ) { c = ( char ) x ; k = end ; } } } buf [ destination ] = c ; ++ destination ; } s = new String ( buf , 0 , destination ) ; } return s ;
|
public class ParallelTaskBuilder { /** * Sets the response context .
* @ param responseContext
* the response context
* @ return the parallel task builder */
public ParallelTaskBuilder setResponseContext ( Map < String , Object > responseContext ) { } }
|
if ( responseContext != null ) this . responseContext = responseContext ; else logger . error ( "context cannot be null. skip set." ) ; return this ;
|
public class D6CrudHelperBase { /** * get primary key field of model class
* @ return */
final List < Field > getPrimaryKeyFieldList ( ) { } }
|
final List < Field > fieldList = new ArrayList < Field > ( ) ; final Set < String > columnNameSet = getAllColumnNames ( ) ; for ( String columnName : columnNameSet ) { final D6ModelClassFieldInfo fieldInfo = getFieldInfo ( columnName ) ; final Field field = fieldInfo . field ; final DBColumn dbColumn = field . getAnnotation ( DBColumn . class ) ; if ( dbColumn . isPrimaryKey ( ) ) { fieldList . add ( field ) ; } } return fieldList ;
|
public class SynchronizedStatesManager { /** * Track state machine membership . If it changes , notify all state machine instances */
private void checkForMembershipChanges ( ) throws KeeperException , InterruptedException { } }
|
Set < String > children = ImmutableSet . copyOf ( m_zk . getChildren ( m_stateMachineMemberPath , m_membershipWatcher ) ) ; Set < String > removedMembers ; Set < String > addedMembers ; if ( m_registeredStateMachineInstances == m_registeredStateMachines . length && ! m_groupMembers . equals ( children ) ) { removedMembers = Sets . difference ( m_groupMembers , children ) ; addedMembers = Sets . difference ( children , m_groupMembers ) ; m_groupMembers = children ; for ( StateMachineInstance stateMachine : m_registeredStateMachines ) { stateMachine . membershipChanged ( m_groupMembers , addedMembers , removedMembers ) ; } }
|
public class HINFormat { /** * { @ inheritDoc } */
@ Override public boolean matches ( int lineNumber , String line ) { } }
|
if ( line . startsWith ( "atom " ) && ( line . endsWith ( " s" ) || line . endsWith ( " d" ) || line . endsWith ( " t" ) || line . endsWith ( " a" ) ) ) { StringTokenizer tokenizer = new StringTokenizer ( line , " " ) ; if ( ( tokenizer . countTokens ( ) % 2 ) == 0 ) { // odd number of values found , typical for HIN
return true ; } } return false ;
|
public class DerIndefLenConverter { /** * Parse the tag and if it is an end - of - contents tag then
* add the current position to the < code > eocList < / code > vector . */
private void parseTag ( ) throws IOException { } }
|
if ( dataPos == dataSize ) return ; if ( isEOC ( data [ dataPos ] ) && ( data [ dataPos + 1 ] == 0 ) ) { int numOfEncapsulatedLenBytes = 0 ; Object elem = null ; int index ; for ( index = ndefsList . size ( ) - 1 ; index >= 0 ; index -- ) { // Determine the first element in the vector that does not
// have a matching EOC
elem = ndefsList . get ( index ) ; if ( elem instanceof Integer ) { break ; } else { numOfEncapsulatedLenBytes += ( ( byte [ ] ) elem ) . length - 3 ; } } if ( index < 0 ) { throw new IOException ( "EOC does not have matching " + "indefinite-length tag" ) ; } int sectionLen = dataPos - ( ( Integer ) elem ) . intValue ( ) + numOfEncapsulatedLenBytes ; byte [ ] sectionLenBytes = getLengthBytes ( sectionLen ) ; ndefsList . set ( index , sectionLenBytes ) ; unresolved -- ; // Add the number of bytes required to represent this section
// to the total number of length bytes ,
// and subtract the indefinite - length tag ( 1 byte ) and
// EOC bytes ( 2 bytes ) for this section
numOfTotalLenBytes += ( sectionLenBytes . length - 3 ) ; } dataPos ++ ;
|
public class RemoteBundleContextImpl { /** * { @ inheritDoc } */
public void setBundleStartLevel ( long bundleId , int startLevel ) throws RemoteException , BundleException { } }
|
try { final StartLevel startLevelService = getService ( StartLevel . class , 0 ) ; startLevelService . setBundleStartLevel ( m_bundleContext . getBundle ( bundleId ) , startLevel ) ; } catch ( NoSuchServiceException e ) { throw new BundleException ( "Cannot get the start level service to set bundle start level" ) ; }
|
public class RecoverableMultiPartUploadImpl { @ VisibleForTesting static String createIncompletePartObjectNamePrefix ( String objectName ) { } }
|
checkNotNull ( objectName ) ; final int lastSlash = objectName . lastIndexOf ( '/' ) ; final String parent ; final String child ; if ( lastSlash == - 1 ) { parent = "" ; child = objectName ; } else { parent = objectName . substring ( 0 , lastSlash + 1 ) ; child = objectName . substring ( lastSlash + 1 ) ; } return parent + ( child . isEmpty ( ) ? "" : '_' ) + child + "_tmp_" ;
|
public class UCSReader { /** * Read a single character . This method will block until a character is available , an I / O error
* occurs , or the end of the stream is reached .
* < p > If supplementary Unicode character is encountered in < code > UCS - 4 < / code > input , it will be
* encoded into < code > UTF - 16 < / code > surrogate pair according to RFC 2781 . High surrogate code
* unit will be returned immediately , and low surrogate saved in the internal buffer to be read
* during next < code > read ( ) < / code > or < code > read ( char [ ] , int , int ) < / code > invocation . - AK
* @ return Java 16 - bit < code > char < / code > value containing UTF - 16 code unit which may be either
* code point from Basic Multilingual Plane or one of the surrogate code units ( high or low )
* of the pair representing supplementary Unicode character ( one in < code > 0x10000 - 0x10FFFF
* < / code > range ) - AK
* @ exception IOException when I / O error occurs */
public int read ( ) throws IOException { } }
|
// If we got something in the char buffer , let ' s use it .
if ( 0 != fCharCount ) { fCharCount -- ; return ( ( int ) fCharBuf [ fCharCount ] ) & 0xFFFF ; } int b0 = fInputStream . read ( ) & 0xff ; // 1st byte
if ( b0 == 0xff ) { return - 1 ; } int b1 = fInputStream . read ( ) & 0xff ; // 2nd byte
if ( b1 == 0xff ) { return - 1 ; } if ( fEncoding >= 4 ) { // UCS - 4
int b2 = fInputStream . read ( ) & 0xff ; // 3rd byte
if ( b2 == 0xff ) { return - 1 ; } int b3 = fInputStream . read ( ) & 0xff ; // 4th byte
if ( b3 == 0xff ) { return - 1 ; } int codepoint ; if ( UCS4BE == fEncoding ) { codepoint = ( ( b0 << 24 ) + ( b1 << 16 ) + ( b2 << 8 ) + b3 ) ; } else { codepoint = ( ( b3 << 24 ) + ( b2 << 16 ) + ( b1 << 8 ) + b0 ) ; } /* * Encoding from UCS - 4 to UTF - 16 as described in RFC 2781
* In theory there should be additional ` isValidCodePoint ( ) ` check
* but I simply don ' t know what to do if invalid one is encountered . */
if ( ! isSupplementaryCodePoint ( codepoint ) ) { return codepoint ; } else { int cp1 = ( codepoint - 0x10000 ) & 0xFFFFF ; int highSurrogate = 0xD800 + ( cp1 >>> 10 ) ; // " > > " should work too
// Saving low surrogate for future use
fCharBuf [ fCharCount ] = ( char ) ( 0xDC00 + ( cp1 & 0x3FF ) ) ; // low surrogate code unit will be returned during next call
return highSurrogate ; } } else { // UCS - 2
if ( fEncoding == UCS2BE ) { return ( b0 << 8 ) + b1 ; } else { return ( b1 << 8 ) + b0 ; } }
|
public class ObjectMarshallingStrategyStoreImpl { /** * / * ( non - Javadoc )
* @ see org . kie . api . marshalling . impl . ObjectMarshallingStrategyStore # getStrategyObject ( java . lang . Object ) */
public ObjectMarshallingStrategy getStrategyObject ( Object object ) { } }
|
for ( int i = 0 , length = this . strategiesList . length ; i < length ; i ++ ) { if ( strategiesList [ i ] . accept ( object ) ) { return strategiesList [ i ] ; } } throw new RuntimeException ( "Unable to find PlaceholderResolverStrategy for class : " + object . getClass ( ) + " object : " + object ) ;
|
public class BasicBondGenerator { /** * { @ inheritDoc } */
@ Override public IRenderingElement generate ( IAtomContainer container , RendererModel model ) { } }
|
ElementGroup group = new ElementGroup ( ) ; this . ringSet = this . getRingSet ( container ) ; // Sort the ringSet consistently to ensure consistent rendering .
// If this is omitted , the bonds may ' tremble ' .
ringSet . sortAtomContainers ( new AtomContainerComparatorBy2DCenter ( ) ) ; for ( IBond bond : container . bonds ( ) ) { group . add ( MarkedElement . markupBond ( this . generate ( bond , model ) , bond ) ) ; } return group ;
|
public class AsteriskServerImpl { /** * shutdown */
public List < PeerEntryEvent > getPeerEntries ( ) throws ManagerCommunicationException { } }
|
ResponseEvents responseEvents = sendEventGeneratingAction ( new SipPeersAction ( ) , 2000 ) ; List < PeerEntryEvent > peerEntries = new ArrayList < > ( 30 ) ; for ( ResponseEvent re : responseEvents . getEvents ( ) ) { if ( re instanceof PeerEntryEvent ) { peerEntries . add ( ( PeerEntryEvent ) re ) ; } } return peerEntries ;
|
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EEnum getIfcLampTypeEnum ( ) { } }
|
if ( ifcLampTypeEnumEEnum == null ) { ifcLampTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 851 ) ; } return ifcLampTypeEnumEEnum ;
|
public class MessageServiceImp { /** * ( non - Javadoc )
* @ see com . popbill . api . MessageService # getAutoDenyList ( java . lang . String ) */
@ Override public AutoDeny [ ] getAutoDenyList ( String CorpNum ) throws PopbillException { } }
|
return httpget ( "/Message/Denied" , CorpNum , null , AutoDeny [ ] . class ) ;
|
public class XMLResource { /** * This method will be called when a new XML file has to be stored within the
* database . The user request will be forwarded to this method . Afterwards it
* creates a response message with the ' created ' HTTP status code , if the
* storing has been successful .
* @ param system
* The associated system with this request .
* @ param resource
* The name of the new resource .
* @ param headers
* HTTP header attributes .
* @ param xml
* The XML file as { @ link InputStream } that will be stored .
* @ return The HTTP status code as response . */
@ PUT @ Consumes ( { } }
|
MediaType . TEXT_XML , MediaType . APPLICATION_XML } ) public Response putResource ( @ PathParam ( JaxRxConstants . SYSTEM ) final String system , @ PathParam ( JaxRxConstants . RESOURCE ) final String resource , @ Context final HttpHeaders headers , final InputStream xml ) { final JaxRx impl = Systems . getInstance ( system ) ; final String info = impl . update ( xml , new ResourcePath ( resource , headers ) ) ; return Response . created ( null ) . entity ( info ) . build ( ) ;
|
public class PropertiesUtils { /** * Loads a resource from the classpath as properties .
* @ param loader
* Class loader to use .
* @ param resource
* Resource to load .
* @ return Properties . */
public static Properties loadProperties ( final ClassLoader loader , final String resource ) { } }
|
checkNotNull ( "loader" , loader ) ; checkNotNull ( "resource" , resource ) ; final Properties props = new Properties ( ) ; try ( final InputStream inStream = loader . getResourceAsStream ( resource ) ) { if ( inStream == null ) { throw new IllegalArgumentException ( "Resource '" + resource + "' not found!" ) ; } props . load ( inStream ) ; } catch ( final IOException ex ) { throw new RuntimeException ( ex ) ; } return props ;
|
public class BlockingCalculator { /** * In ascending order */
protected List < DisabledDuration > createBlockingDurations ( final Iterable < BlockingState > inputBundleEvents ) { } }
|
final List < DisabledDuration > result = new ArrayList < DisabledDuration > ( ) ; final Set < String > services = ImmutableSet . copyOf ( Iterables . transform ( inputBundleEvents , new Function < BlockingState , String > ( ) { @ Override public String apply ( final BlockingState input ) { return input . getService ( ) ; } } ) ) ; final Map < String , BlockingStateService > svcBlockedMap = new HashMap < String , BlockingStateService > ( ) ; for ( String svc : services ) { svcBlockedMap . put ( svc , new BlockingStateService ( ) ) ; } for ( final BlockingState e : inputBundleEvents ) { svcBlockedMap . get ( e . getService ( ) ) . addBlockingState ( e ) ; } final Iterable < DisabledDuration > unorderedDisabledDuration = Iterables . concat ( Iterables . transform ( svcBlockedMap . values ( ) , new Function < BlockingStateService , List < DisabledDuration > > ( ) { @ Override public List < DisabledDuration > apply ( final BlockingStateService input ) { return input . build ( ) ; } } ) ) ; final List < DisabledDuration > sortedDisabledDuration = Ordering . natural ( ) . sortedCopy ( unorderedDisabledDuration ) ; DisabledDuration prevDuration = null ; for ( DisabledDuration d : sortedDisabledDuration ) { // isDisjoint
if ( prevDuration == null ) { prevDuration = d ; } else { if ( prevDuration . isDisjoint ( d ) ) { result . add ( prevDuration ) ; prevDuration = d ; } else { prevDuration = DisabledDuration . mergeDuration ( prevDuration , d ) ; } } } if ( prevDuration != null ) { result . add ( prevDuration ) ; } return result ;
|
public class QueryResultsRowImpl { /** * Return the FactHandles for the Tuple .
* @ return */
public FactHandle [ ] getFactHandles ( ) { } }
|
int size = size ( ) ; FactHandle [ ] subArray = new FactHandle [ size ] ; System . arraycopy ( this . row . getHandles ( ) , 1 , subArray , 0 , size ) ; return subArray ;
|
public class BoxFile { /** * Unlocks a file . */
public void unlock ( ) { } }
|
String queryString = new QueryStringBuilder ( ) . appendParam ( "fields" , "lock" ) . toString ( ) ; URL url = FILE_URL_TEMPLATE . buildWithQuery ( this . getAPI ( ) . getBaseURL ( ) , queryString , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "PUT" ) ; JsonObject lockObject = new JsonObject ( ) ; lockObject . add ( "lock" , JsonObject . NULL ) ; request . setBody ( lockObject . toString ( ) ) ; request . send ( ) ;
|
public class FileUtils { /** * Method to retrieve all files with given file name pattern in given directory .
* Hierarchy of folders is supported .
* @ param startDir the directory to hold the files
* @ param fileNamePatterns the file names to include
* @ return list of test files as filename paths */
public static List < File > findFiles ( final String startDir , final Set < String > fileNamePatterns ) { } }
|
/* file names to be returned */
final List < File > files = new ArrayList < File > ( ) ; /* Stack to hold potential sub directories */
final Stack < File > dirs = new Stack < File > ( ) ; /* start directory */
final File startdir = new File ( startDir ) ; if ( ! startdir . exists ( ) ) { throw new CitrusRuntimeException ( "Test directory " + startdir . getAbsolutePath ( ) + " does not exist" ) ; } if ( startdir . isDirectory ( ) ) { dirs . push ( startdir ) ; } /* walk through the directories */
while ( dirs . size ( ) > 0 ) { final File file = dirs . pop ( ) ; File [ ] foundFiles = file . listFiles ( ( dir , name ) -> { File tmp = new File ( dir . getPath ( ) + File . separator + name ) ; boolean accepted = tmp . isDirectory ( ) ; for ( String fileNamePattern : fileNamePatterns ) { if ( fileNamePattern . contains ( "/" ) ) { fileNamePattern = fileNamePattern . substring ( fileNamePattern . lastIndexOf ( '/' ) + 1 ) ; } fileNamePattern = fileNamePattern . replace ( "." , "\\." ) . replace ( "*" , ".*" ) ; if ( name . matches ( fileNamePattern ) ) { accepted = true ; } } /* Only allowing XML files as spring configuration files */
return accepted && ! name . startsWith ( "CVS" ) && ! name . startsWith ( ".svn" ) && ! name . startsWith ( ".git" ) ; } ) ; for ( File found : Optional . ofNullable ( foundFiles ) . orElse ( new File [ ] { } ) ) { /* Subfolder support */
if ( found . isDirectory ( ) ) { dirs . push ( found ) ; } else { files . add ( found ) ; } } } return files ;
|
public class CmsUndoChanges { /** * Returns the HTML for the undo changes options and detailed output for single resource operations . < p >
* @ return the HTML for the undo changes options */
public String buildDialogOptions ( ) { } }
|
StringBuffer result = new StringBuffer ( 256 ) ; boolean isMoved = isOperationOnMovedResource ( ) ; if ( ! isMultiOperation ( ) ) { result . append ( dialogSpacer ( ) ) ; result . append ( key ( Messages . GUI_UNDO_LASTMODIFIED_INFO_3 , new Object [ ] { getFileName ( ) , getLastModifiedDate ( ) , getLastModifiedUser ( ) } ) ) ; if ( isMoved ) { result . append ( dialogSpacer ( ) ) ; result . append ( key ( Messages . GUI_UNDO_MOVE_OPERATION_INFO_2 , new Object [ ] { getFileName ( ) , resourceOriginalPath ( getCms ( ) , getParamResource ( ) ) } ) ) ; } } result . append ( dialogSpacer ( ) ) ; result . append ( key ( Messages . GUI_UNDO_CONFIRMATION_0 ) ) ; if ( isMoved || isOperationOnFolder ( ) ) { // show undo move option if both options are available
result . append ( dialogSpacer ( ) ) ; result . append ( "<input type=\"checkbox\" name=\"" ) ; result . append ( PARAM_MOVE ) ; result . append ( "\" value=\"true\" checked='checked'> " ) ; if ( isMultiOperation ( ) ) { result . append ( key ( Messages . GUI_UNDO_CHANGES_MOVE_MULTI_SUBRESOURCES_0 ) ) ; } else { result . append ( key ( Messages . GUI_UNDO_CHANGES_MOVE_SUBRESOURCES_0 ) ) ; } } else { if ( isMoved ) { result . append ( dialogSpacer ( ) ) ; result . append ( "<input type=\"hidden\" name=\"" ) ; result . append ( PARAM_MOVE ) ; result . append ( "\" value=\"true\"> " ) ; } } if ( isOperationOnFolder ( ) ) { // show recursive option if folder ( s ) is / are selected
result . append ( dialogSpacer ( ) ) ; result . append ( dialogBlockStart ( key ( Messages . GUI_UNDO_CHANGES_RECURSIVE_TITLE_0 ) ) ) ; result . append ( "<input type=\"checkbox\" name=\"" ) ; result . append ( PARAM_RECURSIVE ) ; result . append ( "\" value=\"true\"> " ) ; if ( isMultiOperation ( ) ) { result . append ( key ( Messages . GUI_UNDO_CHANGES_RECURSIVE_MULTI_SUBRESOURCES_0 ) ) ; } else { result . append ( key ( Messages . GUI_UNDO_CHANGES_RECURSIVE_SUBRESOURCES_0 ) ) ; } result . append ( dialogBlockEnd ( ) ) ; } return result . toString ( ) ;
|
public class EventDeliverySummaryUrl { /** * Get Resource Url for GetDeliveryAttemptSummary
* @ param processId
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting to update data using this parameter may cause data loss .
* @ param subscriptionId Unique identifier for a subscription , such as subscribing tenants for an event or to receive a notification .
* @ return String Resource Url */
public static MozuUrl getDeliveryAttemptSummaryUrl ( Integer processId , String responseFields , String subscriptionId ) { } }
|
UrlFormatter formatter = new UrlFormatter ( "/api/event/push/subscriptions/{subscriptionId}/deliveryattempts/{id}?responseFields={responseFields}" ) ; formatter . formatUrl ( "processId" , processId ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "subscriptionId" , subscriptionId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ;
|
public class Organizer { /** * Copy collection objects to a given array
* @ param collection
* the collection source
* @ param objects
* array destination */
public static void copyToArray ( Collection < Object > collection , Object [ ] objects ) { } }
|
System . arraycopy ( collection . toArray ( ) , 0 , objects , 0 , objects . length ) ;
|
public class ProxiedStatusMessageLookupFunction { /** * { @ inheritDoc } */
@ Override public String apply ( @ SuppressWarnings ( "rawtypes" ) final ProfileRequestContext input ) { } }
|
String msg = null ; if ( input != null ) { ProxiedStatusContext context = input . getSubcontext ( ProxiedStatusContext . class , false ) ; if ( context != null && context . getStatus ( ) != null && context . getStatus ( ) . getStatusMessage ( ) != null ) { msg = context . getStatus ( ) . getStatusMessage ( ) . getMessage ( ) ; } } return msg != null ? msg : super . apply ( input ) ;
|
public class CookieConverter { /** * Converts a Selenium cookie to a HTTP client one .
* @ param seleniumCookie the browser cookie to be converted
* @ return the converted HTTP client cookie */
public static BasicClientCookie convertToHttpClientCookie ( final Cookie seleniumCookie ) { } }
|
BasicClientCookie httpClientCookie = new BasicClientCookie ( seleniumCookie . getName ( ) , seleniumCookie . getValue ( ) ) ; httpClientCookie . setDomain ( seleniumCookie . getDomain ( ) ) ; httpClientCookie . setPath ( seleniumCookie . getPath ( ) ) ; httpClientCookie . setExpiryDate ( seleniumCookie . getExpiry ( ) ) ; httpClientCookie . setSecure ( seleniumCookie . isSecure ( ) ) ; if ( seleniumCookie . isHttpOnly ( ) ) { httpClientCookie . setAttribute ( HTTP_ONLY_ATTRIBUTE , StringUtils . EMPTY ) ; } return httpClientCookie ;
|
public class FluoOutputFormat { /** * Call this method to initialize the Fluo connection props
* @ param conf Job configuration
* @ param props Use { @ link org . apache . fluo . api . config . FluoConfiguration } to set props
* programmatically */
public static void configure ( Job conf , SimpleConfiguration props ) { } }
|
try { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; props . save ( baos ) ; conf . getConfiguration ( ) . set ( PROPS_CONF_KEY , new String ( baos . toByteArray ( ) , StandardCharsets . UTF_8 ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
|
public class RfSessionFactoryImpl { @ Override public AppSession getSession ( String sessionId , Class < ? extends AppSession > aClass ) { } }
|
if ( sessionId == null ) { throw new IllegalArgumentException ( "SessionId must not be null" ) ; } if ( ! this . iss . exists ( sessionId ) ) { return null ; } AppSession appSession = null ; try { if ( aClass == ServerRfSession . class ) { IServerRfSessionData sessionData = ( IServerRfSessionData ) this . sessionDataFactory . getAppSessionData ( ServerRfSession . class , sessionId ) ; // FIXME : determine how to get boolean flag !
ServerRfSessionImpl session = new ServerRfSessionImpl ( sessionData , sessionFactory , getServerSessionListener ( ) , getServerContextListener ( ) , getStateListener ( ) , messageTimeout , true ) ; session . getSessions ( ) . get ( 0 ) . setRequestListener ( session ) ; appSession = session ; } else if ( aClass == ClientRfSession . class ) { IClientRfSessionData sessionData = ( IClientRfSessionData ) this . sessionDataFactory . getAppSessionData ( ClientRfSession . class , sessionId ) ; ClientRfSessionImpl session = new ClientRfSessionImpl ( sessionData , sessionFactory , getClientSessionListener ( ) , getClientContextListener ( ) , getStateListener ( ) , this . getApplicationId ( ) ) ; session . getSessions ( ) . get ( 0 ) . setRequestListener ( session ) ; appSession = session ; } else { throw new IllegalArgumentException ( "Wrong session class: " + aClass + ". Supported[" + ClientRfSession . class + "," + ServerRfSession . class + "]" ) ; } } catch ( Exception e ) { logger . error ( "Failure to obtain new Rf Session." , e ) ; } return appSession ;
|
public class AbstractParsedStmt { /** * Extract all subexpressions of a given expression class from this statement */
protected Set < AbstractExpression > findAllSubexpressionsOfClass ( Class < ? extends AbstractExpression > aeClass ) { } }
|
HashSet < AbstractExpression > exprs = new HashSet < > ( ) ; if ( m_joinTree != null ) { AbstractExpression treeExpr = m_joinTree . getAllFilters ( ) ; if ( treeExpr != null ) { exprs . addAll ( treeExpr . findAllSubexpressionsOfClass ( aeClass ) ) ; } } return exprs ;
|
public class Arrays { /** * join multi array
* @ param arrays
* @ return */
public static byte [ ] join ( List < byte [ ] > arrays ) { } }
|
int maxlength = 0 ; for ( byte [ ] array : arrays ) { maxlength += array . length ; } byte [ ] rs = new byte [ maxlength ] ; int pos = 0 ; for ( byte [ ] array : arrays ) { System . arraycopy ( array , 0 , rs , pos , array . length ) ; pos += array . length ; } return rs ;
|
public class PebbleEngineFactory { /** * Creates a PebbleEngine instance .
* @ return a PebbleEngine object that can be used to create PebbleTemplate objects */
public PebbleEngine createPebbleEngine ( ) { } }
|
PebbleEngine . Builder builder = new PebbleEngine . Builder ( ) ; builder . strictVariables ( strictVariables ) ; if ( defaultLocale != null ) { builder . defaultLocale ( defaultLocale ) ; } if ( templateLoaders == null ) { if ( templateLoaderPaths != null && templateLoaderPaths . length > 0 ) { List < Loader < ? > > templateLoaderList = new ArrayList < > ( ) ; for ( String path : templateLoaderPaths ) { templateLoaderList . add ( getTemplateLoaderForPath ( path ) ) ; } setTemplateLoader ( templateLoaderList ) ; } } Loader < ? > templateLoader = getAggregateTemplateLoader ( templateLoaders ) ; builder . loader ( templateLoader ) ; return builder . build ( ) ;
|
public class LocalMapStatsProvider { /** * Gets replica address . Waits if necessary .
* @ see # waitForReplicaAddress */
private Address getReplicaAddress ( int partitionId , int replicaNumber , int backupCount ) { } }
|
IPartition partition = partitionService . getPartition ( partitionId ) ; Address replicaAddress = partition . getReplicaAddress ( replicaNumber ) ; if ( replicaAddress == null ) { replicaAddress = waitForReplicaAddress ( replicaNumber , partition , backupCount ) ; } return replicaAddress ;
|
public class BacnetClient { /** * gateways */
public IdResponse createGateway ( CreateBacnetGatewayRequest request ) { } }
|
InternalRequest internalRequest = createRequest ( request , HttpMethodName . POST , BACNET , GATEWAY ) ; return this . invokeHttpClient ( internalRequest , IdResponse . class ) ;
|
public class JsHdrsImpl { /** * Get the value of the MessageWaitTime field from the message header .
* Javadoc description supplied by JsMessage interface . */
public final Long getMessageWaitTime ( ) { } }
|
/* If the transient has never been set , get the value in the message */
if ( cachedMessageWaitTime == null ) { cachedMessageWaitTime = ( Long ) getHdr2 ( ) . getField ( JsHdr2Access . MESSAGEWAITTIME ) ; } return cachedMessageWaitTime ;
|
public class ComposableFutures { /** * builds a lazy future from a producer . the producer itself is cached
* and used afresh on every consumption .
* @ param producer the result producer
* @ param < T > the future type
* @ return the future */
public static < T > ComposableFuture < T > buildLazy ( final Producer < T > producer ) { } }
|
return LazyComposableFuture . build ( producer ) ;
|
public class AnyAdapter { /** * Marshals an Attribute to a DOM Element .
* @ see javax . xml . bind . annotation . adapters . XmlAdapter # marshal ( java . lang . Object ) */
public Object marshal ( org . openprovenance . prov . model . Attribute attribute ) { } }
|
return DOMProcessing . marshalAttribute ( attribute ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.