signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class ResourceIndexImpl { /** * { @ inheritDoc } */
public int countTuples ( String queryLang , String tupleQuery , int limit , boolean distinct ) throws TrippiException { } } | return _writer . countTuples ( queryLang , tupleQuery , limit , distinct ) ; |
public class ThreadUtil { /** * 执行异步方法
* @ param runnable 需要执行的方法体
* @ param isDeamon 是否守护线程 。 守护线程会在主线程结束后自动结束
* @ return 执行的方法体 */
public static Runnable excAsync ( final Runnable runnable , boolean isDeamon ) { } } | Thread thread = new Thread ( ) { @ Override public void run ( ) { runnable . run ( ) ; } } ; thread . setDaemon ( isDeamon ) ; thread . start ( ) ; return runnable ; |
public class Tree { /** * 得到层次 、 叶子节点等信息 */
private void travel ( ) { } } | for ( int i = 0 ; i < nodes . size ( ) ; i ++ ) { int l = getLevel ( nodes . get ( i ) ) ; if ( l > hier . size ( ) || hier . get ( l ) == null ) { Set set = new HashSet < Integer > ( ) ; hier . put ( l , set ) ; } hier . get ( l ) . add ( i ) ; if ( edges . get ( i ) == null ) { leafs . add ( i ) ; } } depth = hier . size ( ) ; CalcPath ( ) ; |
public class SpanId { /** * Returns a { @ code SpanId } built from a lowercase base16 representation .
* @ param src the lowercase base16 representation .
* @ param srcOffset the offset in the buffer where the representation of the { @ code SpanId }
* begins .
* @ return a { @ code SpanId } built from a lowercase base16 representation .
* @ throws NullPointerException if { @ code src } is null .
* @ throws IllegalArgumentException if not enough characters in the { @ code src } from the { @ code
* srcOffset } .
* @ since 0.11 */
public static SpanId fromLowerBase16 ( CharSequence src , int srcOffset ) { } } | Utils . checkNotNull ( src , "src" ) ; return new SpanId ( BigendianEncoding . longFromBase16String ( src , srcOffset ) ) ; |
public class VirtualNetworkGatewayConnectionsInner { /** * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkGatewayConnectionName The virtual network gateway connection name .
* @ param parameters Parameters supplied to the Begin Set Virtual Network Gateway connection Shared key operation throughNetwork resource provider .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ConnectionSharedKeyInner object */
public Observable < ServiceResponse < ConnectionSharedKeyInner > > beginSetSharedKeyWithServiceResponseAsync ( String resourceGroupName , String virtualNetworkGatewayConnectionName , ConnectionSharedKeyInner parameters ) { } } | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( virtualNetworkGatewayConnectionName == null ) { throw new IllegalArgumentException ( "Parameter virtualNetworkGatewayConnectionName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( parameters == null ) { throw new IllegalArgumentException ( "Parameter parameters is required and cannot be null." ) ; } Validator . validate ( parameters ) ; final String apiVersion = "2018-08-01" ; return service . beginSetSharedKey ( resourceGroupName , virtualNetworkGatewayConnectionName , this . client . subscriptionId ( ) , parameters , apiVersion , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < ConnectionSharedKeyInner > > > ( ) { @ Override public Observable < ServiceResponse < ConnectionSharedKeyInner > > call ( Response < ResponseBody > response ) { try { ServiceResponse < ConnectionSharedKeyInner > clientResponse = beginSetSharedKeyDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class ProbeManagerImpl { /** * Remove the listeners associated with the specified monitor from the set
* of registered listeners .
* @ param monitor the monitor that owns the listeners
* @ return the set of listeners that were associated with the monitor */
Set < ProbeListener > removeListenersForMonitor ( Object monitor ) { } } | Set < ProbeListener > listeners = null ; listenersLock . writeLock ( ) . lock ( ) ; try { listeners = listenersForMonitor . remove ( monitor ) ; if ( listeners == null ) { listeners = Collections . emptySet ( ) ; } else { allRegisteredListeners . removeAll ( listeners ) ; } } finally { listenersLock . writeLock ( ) . unlock ( ) ; } return listeners ; |
public class RepositoryApi { /** * Creates a branch for the project . Support as of version 6.8 . x
* < pre > < code > GitLab Endpoint : POST / projects / : id / repository / branches < / code > < / pre >
* @ param projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance
* @ param branchName the name of the branch to create
* @ param ref Source to create the branch from , can be an existing branch , tag or commit SHA
* @ return the branch info for the created branch
* @ throws GitLabApiException if any exception occurs */
public Branch createBranch ( Object projectIdOrPath , String branchName , String ref ) throws GitLabApiException { } } | Form formData = new GitLabApiForm ( ) . withParam ( isApiVersion ( ApiVersion . V3 ) ? "branch_name" : "branch" , branchName , true ) . withParam ( "ref" , ref , true ) ; Response response = post ( Response . Status . CREATED , formData . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "branches" ) ; return ( response . readEntity ( Branch . class ) ) ; |
public class AbstractSubCodeBuilderFragment { /** * Binds the given references according to the standard policy .
* < p > If an custom implementation is defined , it is binded to . Otherwise , the default implementation
* is binded .
* @ param factory the binding factory to use for creating the bindings .
* @ param interfaceType the type to bind to an implementation type .
* @ param implementationType the implementation to bind to the interface type .
* @ param customImplementationType the custom implementation to bind to the interface type . */
protected void bindTypeReferences ( BindingFactory factory , TypeReference interfaceType , TypeReference implementationType , TypeReference customImplementationType ) { } } | final IFileSystemAccess2 fileSystem = getSrc ( ) ; final TypeReference type ; if ( ( fileSystem . isFile ( implementationType . getJavaPath ( ) ) ) || ( fileSystem . isFile ( customImplementationType . getXtendPath ( ) ) ) ) { type = customImplementationType ; } else { type = implementationType ; } factory . addfinalTypeToType ( interfaceType , type ) ; |
public class ByteArrayUtil { /** * Put the source < i > int < / i > into the destination byte array starting at the given offset
* in big endian order .
* There is no bounds checking .
* @ param array destination byte array
* @ param offset destination offset
* @ param value source < i > int < / i > */
public static void putIntBE ( final byte [ ] array , final int offset , final int value ) { } } | array [ offset + 3 ] = ( byte ) ( value ) ; array [ offset + 2 ] = ( byte ) ( value >>> 8 ) ; array [ offset + 1 ] = ( byte ) ( value >>> 16 ) ; array [ offset ] = ( byte ) ( value >>> 24 ) ; |
public class PolicyAssignmentsInner { /** * Gets policy assignments for a resource .
* @ 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 ; PolicyAssignmentInner & gt ; object */
public Observable < Page < PolicyAssignmentInner > > listForResourceNextAsync ( final String nextPageLink ) { } } | return listForResourceNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < PolicyAssignmentInner > > , Page < PolicyAssignmentInner > > ( ) { @ Override public Page < PolicyAssignmentInner > call ( ServiceResponse < Page < PolicyAssignmentInner > > response ) { return response . body ( ) ; } } ) ; |
public class RestUtils { /** * Batch update response as JSON .
* @ param app the current App object
* @ param oldObjects a list of old objects read from DB
* @ param newProperties a list of new object properties to be updated
* @ return a status code 200 or 400 */
public static Response getBatchUpdateResponse ( App app , Map < String , ParaObject > oldObjects , List < Map < String , Object > > newProperties ) { } } | try ( final Metrics . Context context = Metrics . time ( app == null ? null : app . getAppid ( ) , RestUtils . class , "batch" , "update" ) ) { if ( app != null && oldObjects != null && newProperties != null ) { LinkedList < ParaObject > updatedObjects = new LinkedList < > ( ) ; boolean hasPositiveVersions = false ; for ( Map < String , Object > newProps : newProperties ) { if ( newProps != null && newProps . containsKey ( Config . _ID ) ) { ParaObject oldObject = oldObjects . get ( ( String ) newProps . get ( Config . _ID ) ) ; // updating apps in batch is not allowed
if ( oldObject != null && checkImplicitAppPermissions ( app , oldObject ) ) { ParaObject updatedObject = ParaObjectUtils . setAnnotatedFields ( oldObject , newProps , Locked . class ) ; if ( isValidObject ( app , updatedObject ) && checkIfUserCanModifyObject ( app , updatedObject ) ) { updatedObject . setAppid ( app . getAppIdentifier ( ) ) ; updatedObjects . add ( updatedObject ) ; if ( updatedObject . getVersion ( ) != null && updatedObject . getVersion ( ) > 0 ) { hasPositiveVersions = true ; } } } } } Para . getDAO ( ) . updateAll ( app . getAppIdentifier ( ) , updatedObjects ) ; // check if any or all updates failed due to optimistic locking
return handleFailedUpdates ( hasPositiveVersions , updatedObjects ) ; } else { return getStatusResponse ( Response . Status . BAD_REQUEST ) ; } } |
public class UpdateConfigAction { /** * Adds a command to update a config file while sparing you the details of
* the Manager ' s required syntax . If you want to omit one of the command ' s
* sections , provide a null value to this method . The command index will be
* incremented even if you supply a null for all parameters , though the map
* will be unaffected .
* @ param action Action to Take
* ( NewCat , RenameCat , DelCat , Update , Delete , Append ) , see static
* fields
* @ param cat Category to operate on
* @ param var Variable to work on
* @ param value Value to work on
* @ param match Extra match required to match line */
public void addCommand ( String action , String cat , String var , String value , String match ) { } } | // for convienence of reference , shorter !
final String stringCounter = String . format ( "%06d" , this . actionCounter ) ; if ( action != null ) { actions . put ( "Action-" + stringCounter , action ) ; } if ( cat != null ) { actions . put ( "Cat-" + stringCounter , cat ) ; } if ( var != null ) { actions . put ( "Var-" + stringCounter , var ) ; } if ( value != null ) { actions . put ( "Value-" + stringCounter , value ) ; } if ( match != null ) { actions . put ( "Match-" + stringCounter , match ) ; } this . actionCounter ++ ; |
public class AjcReportMojo { /** * Get the directories containg sources */
@ SuppressWarnings ( "unchecked" ) protected List < String > getSourceDirectories ( ) { } } | List < String > sourceDirectories = new ArrayList < String > ( ) ; sourceDirectories . addAll ( project . getCompileSourceRoots ( ) ) ; sourceDirectories . addAll ( project . getTestCompileSourceRoots ( ) ) ; return sourceDirectories ; |
public class IfcProductDefinitionShapeImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcProduct > getShapeOfProduct ( ) { } } | return ( EList < IfcProduct > ) eGet ( Ifc4Package . Literals . IFC_PRODUCT_DEFINITION_SHAPE__SHAPE_OF_PRODUCT , true ) ; |
public class Parsable { /** * Store a newly parsed value in the result set */
public Parsable < RECORD > addDissection ( final String base , final String type , final String name , final int value ) throws DissectionFailure { } } | LOG . debug ( "Got new (int) dissection: base={}; type={}; name=\"{}\"" , base , type , name ) ; return addDissection ( base , type , name , new Value ( ( long ) value ) , false ) ; |
public class StubInvocationBenchmark { /** * Performs a benchmark for a trivial class creation using Byte Buddy .
* @ param blackHole A black hole for avoiding JIT erasure . */
@ Benchmark @ OperationsPerInvocation ( 20 ) public void benchmarkByteBuddy ( Blackhole blackHole ) { } } | blackHole . consume ( byteBuddyInstance . method ( booleanValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( byteValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( shortValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( intValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( charValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( intValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( longValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( floatValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( doubleValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( stringValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( booleanValue , booleanValue , booleanValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( byteValue , byteValue , byteValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( shortValue , shortValue , shortValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( intValue , intValue , intValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( charValue , charValue , charValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( intValue , intValue , intValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( longValue , longValue , longValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( floatValue , floatValue , floatValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( doubleValue , doubleValue , doubleValue ) ) ; blackHole . consume ( byteBuddyInstance . method ( stringValue , stringValue , stringValue ) ) ; |
public class AbstractPrincipalAttributesRepository { /** * Convert attributes to principal attributes and cache .
* @ param principal the principal
* @ param sourceAttributes the source attributes
* @ param registeredService the registered service
* @ return the map */
protected Map < String , List < Object > > convertAttributesToPrincipalAttributesAndCache ( final Principal principal , final Map < String , List < Object > > sourceAttributes , final RegisteredService registeredService ) { } } | val finalAttributes = convertPersonAttributesToPrincipalAttributes ( sourceAttributes ) ; addPrincipalAttributes ( principal . getId ( ) , finalAttributes , registeredService ) ; return finalAttributes ; |
public class FontFactoryImp { /** * Register a font file and use an alias for the font contained in it .
* @ param path the path to a font file
* @ param alias the alias you want to use for the font */
public void register ( String path , String alias ) { } } | try { if ( path . toLowerCase ( ) . endsWith ( ".ttf" ) || path . toLowerCase ( ) . endsWith ( ".otf" ) || path . toLowerCase ( ) . indexOf ( ".ttc," ) > 0 ) { Object allNames [ ] = BaseFont . getAllFontNames ( path , BaseFont . WINANSI , null ) ; trueTypeFonts . setProperty ( ( ( String ) allNames [ 0 ] ) . toLowerCase ( ) , path ) ; if ( alias != null ) { trueTypeFonts . setProperty ( alias . toLowerCase ( ) , path ) ; } // register all the font names with all the locales
String [ ] [ ] names = ( String [ ] [ ] ) allNames [ 2 ] ; // full name
for ( int i = 0 ; i < names . length ; i ++ ) { trueTypeFonts . setProperty ( names [ i ] [ 3 ] . toLowerCase ( ) , path ) ; } String fullName = null ; String familyName = null ; names = ( String [ ] [ ] ) allNames [ 1 ] ; // family name
for ( int k = 0 ; k < TTFamilyOrder . length ; k += 3 ) { for ( int i = 0 ; i < names . length ; i ++ ) { if ( TTFamilyOrder [ k ] . equals ( names [ i ] [ 0 ] ) && TTFamilyOrder [ k + 1 ] . equals ( names [ i ] [ 1 ] ) && TTFamilyOrder [ k + 2 ] . equals ( names [ i ] [ 2 ] ) ) { familyName = names [ i ] [ 3 ] . toLowerCase ( ) ; k = TTFamilyOrder . length ; break ; } } } if ( familyName != null ) { String lastName = "" ; names = ( String [ ] [ ] ) allNames [ 2 ] ; // full name
for ( int i = 0 ; i < names . length ; i ++ ) { for ( int k = 0 ; k < TTFamilyOrder . length ; k += 3 ) { if ( TTFamilyOrder [ k ] . equals ( names [ i ] [ 0 ] ) && TTFamilyOrder [ k + 1 ] . equals ( names [ i ] [ 1 ] ) && TTFamilyOrder [ k + 2 ] . equals ( names [ i ] [ 2 ] ) ) { fullName = names [ i ] [ 3 ] ; if ( fullName . equals ( lastName ) ) continue ; lastName = fullName ; registerFamily ( familyName , fullName , null ) ; break ; } } } } } else if ( path . toLowerCase ( ) . endsWith ( ".ttc" ) ) { if ( alias != null ) System . err . println ( "class FontFactory: You can't define an alias for a true type collection." ) ; String [ ] names = BaseFont . enumerateTTCNames ( path ) ; for ( int i = 0 ; i < names . length ; i ++ ) { register ( path + "," + i ) ; } } else if ( path . toLowerCase ( ) . endsWith ( ".afm" ) || path . toLowerCase ( ) . endsWith ( ".pfm" ) ) { BaseFont bf = BaseFont . createFont ( path , BaseFont . CP1252 , false ) ; String fullName = bf . getFullFontName ( ) [ 0 ] [ 3 ] . toLowerCase ( ) ; String familyName = bf . getFamilyFontName ( ) [ 0 ] [ 3 ] . toLowerCase ( ) ; String psName = bf . getPostscriptFontName ( ) . toLowerCase ( ) ; registerFamily ( familyName , fullName , null ) ; trueTypeFonts . setProperty ( psName , path ) ; trueTypeFonts . setProperty ( fullName , path ) ; } } catch ( DocumentException de ) { // this shouldn ' t happen
throw new ExceptionConverter ( de ) ; } catch ( IOException ioe ) { throw new ExceptionConverter ( ioe ) ; } |
public class MediaApi { /** * Switch to barge - in
* Switch to the barge - in monitoring mode for the specified chat . Both the agent and the customer can see the supervisor & # 39 ; s messages .
* @ param mediatype The media channel . ( required )
* @ param id The ID of the chat interaction . ( required )
* @ param mediaSwicthToCoachData Request parameters . ( optional )
* @ return ApiSuccessResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiSuccessResponse mediaSwicthToBargeIn ( String mediatype , String id , MediaSwicthToCoachData mediaSwicthToCoachData ) throws ApiException { } } | ApiResponse < ApiSuccessResponse > resp = mediaSwicthToBargeInWithHttpInfo ( mediatype , id , mediaSwicthToCoachData ) ; return resp . getData ( ) ; |
public class HandleSuperBuilder { /** * Generates a < code > $ fillValuesFrom ( ) < / code > method in the abstract builder class that looks
* like this :
* < pre >
* protected B $ fillValuesFrom ( final C instance ) {
* super . $ fillValuesFrom ( instance ) ;
* FoobarBuilderImpl . $ fillValuesFromInstanceIntoBuilder ( instance , this ) ;
* return self ( ) ;
* < / pre > */
private MethodDeclaration generateFillValuesMethod ( EclipseNode tdParent , boolean inherited , String builderGenericName , String classGenericName , String builderClassName , TypeParameter [ ] typeParams ) { } } | MethodDeclaration out = new MethodDeclaration ( ( ( CompilationUnitDeclaration ) tdParent . top ( ) . get ( ) ) . compilationResult ) ; out . selector = FILL_VALUES_METHOD_NAME ; out . bits |= ECLIPSE_DO_NOT_TOUCH_FLAG ; out . modifiers = ClassFileConstants . AccProtected ; if ( inherited ) out . annotations = new Annotation [ ] { makeMarkerAnnotation ( TypeConstants . JAVA_LANG_OVERRIDE , tdParent . get ( ) ) } ; out . returnType = new SingleTypeReference ( builderGenericName . toCharArray ( ) , 0 ) ; TypeReference builderType = new SingleTypeReference ( classGenericName . toCharArray ( ) , 0 ) ; out . arguments = new Argument [ ] { new Argument ( INSTANCE_VARIABLE_NAME , 0 , builderType , Modifier . FINAL ) } ; List < Statement > body = new ArrayList < Statement > ( ) ; if ( inherited ) { // Call super .
MessageSend callToSuper = new MessageSend ( ) ; callToSuper . receiver = new SuperReference ( 0 , 0 ) ; callToSuper . selector = FILL_VALUES_METHOD_NAME ; callToSuper . arguments = new Expression [ ] { new SingleNameReference ( INSTANCE_VARIABLE_NAME , 0 ) } ; body . add ( callToSuper ) ; } // Call the builder implemention ' s helper method that actually fills the values from the instance .
MessageSend callStaticFillValuesMethod = new MessageSend ( ) ; callStaticFillValuesMethod . receiver = new SingleNameReference ( builderClassName . toCharArray ( ) , 0 ) ; callStaticFillValuesMethod . selector = FILL_VALUES_STATIC_METHOD_NAME ; callStaticFillValuesMethod . arguments = new Expression [ ] { new SingleNameReference ( INSTANCE_VARIABLE_NAME , 0 ) , new ThisReference ( 0 , 0 ) } ; body . add ( callStaticFillValuesMethod ) ; // Return self ( ) .
MessageSend returnCall = new MessageSend ( ) ; returnCall . receiver = ThisReference . implicitThis ( ) ; returnCall . selector = SELF_METHOD_NAME ; body . add ( new ReturnStatement ( returnCall , 0 , 0 ) ) ; out . statements = body . isEmpty ( ) ? null : body . toArray ( new Statement [ 0 ] ) ; return out ; |
public class StringHelper { /** * Replaces the ' search string ' with ' replace string ' in a given ' source string '
* @ param aSrcStr A source String value .
* @ param aSearchStr A String value to be searched for in the source String .
* @ param aReplaceStr A String value that replaces the search String .
* @ return A String with the ' search string ' replaced by ' replace string ' . */
public static String Replace ( String aSrcStr , String aSearchStr , String aReplaceStr ) { } } | if ( aSrcStr == null || aSearchStr == null || aReplaceStr == null ) return aSrcStr ; if ( aSearchStr . length ( ) == 0 || aSrcStr . length ( ) == 0 || aSrcStr . indexOf ( aSearchStr ) == - 1 ) { return aSrcStr ; } StringBuffer mBuff = new StringBuffer ( ) ; int mSrcStrLen , mSearchStrLen ; mSrcStrLen = aSrcStr . length ( ) ; mSearchStrLen = aSearchStr . length ( ) ; for ( int i = 0 , j = 0 ; i < mSrcStrLen ; i = j + mSearchStrLen ) { j = aSrcStr . indexOf ( aSearchStr , i ) ; if ( j == - 1 ) { mBuff . append ( aSrcStr . substring ( i ) ) ; break ; } mBuff . append ( aSrcStr . substring ( i , j ) ) ; mBuff . append ( aReplaceStr ) ; } return mBuff . toString ( ) ; |
public class Normalizer2Impl { /** * Public in Java for collation implementation code . */
public void decomposeShort ( CharSequence s , int src , int limit , ReorderingBuffer buffer ) { } } | while ( src < limit ) { int c = Character . codePointAt ( s , src ) ; src += Character . charCount ( c ) ; decompose ( c , getNorm16 ( c ) , buffer ) ; } |
public class CartesianLinearTicks { /** * Write the options of cartesian linear ticks
* @ return options as JSON object
* @ throws java . io . IOException If an I / O error occurs */
@ Override public String encode ( ) throws IOException { } } | FastStringWriter fsw = new FastStringWriter ( ) ; try { fsw . write ( super . encode ( ) ) ; ChartUtils . writeDataValue ( fsw , "beginAtZero" , this . beginAtZero , true ) ; ChartUtils . writeDataValue ( fsw , "min" , this . min , true ) ; ChartUtils . writeDataValue ( fsw , "max" , this . max , true ) ; ChartUtils . writeDataValue ( fsw , "maxTicksLimit" , this . maxTicksLimit , true ) ; ChartUtils . writeDataValue ( fsw , "precision" , this . precision , true ) ; ChartUtils . writeDataValue ( fsw , "stepSize" , this . stepSize , true ) ; ChartUtils . writeDataValue ( fsw , "suggestedMax" , this . suggestedMax , true ) ; ChartUtils . writeDataValue ( fsw , "suggestedMin" , this . suggestedMin , true ) ; } finally { fsw . close ( ) ; } return fsw . toString ( ) ; |
public class MongoService { /** * Declarative Services method for setting the SSL Support service reference
* @ param ref reference to the service */
protected void setSsl ( ServiceReference < Object > reference ) { } } | sslConfigurationRef . setReference ( reference ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "sslRef set to " + reference . getProperty ( CONFIG_DISPLAY_ID ) ) ; } |
public class JSON { /** * Get a { @ link JSONArray } from a { @ link JSONValue } . Return { @ code null } if the
* { @ link JSONValue } is { @ code null } .
* @ param value the { @ link JSONValue }
* @ return the value as a { @ link JSONArray }
* @ throws JSONException if the value is not an array */
public static JSONArray getArray ( JSONValue value ) { } } | if ( value == null ) return null ; if ( ! ( value instanceof JSONArray ) ) throw new JSONException ( NOT_AN_ARRAY ) ; return ( JSONArray ) value ; |
public class WarningPropertySet { /** * Add a warning property to the set . The warning implicitly has the boolean
* value " true " as its attribute .
* @ param prop
* the WarningProperty
* @ return this object */
public WarningPropertySet < T > addProperty ( T prop ) { } } | map . put ( prop , Boolean . TRUE ) ; return this ; |
public class TarImporterImpl { /** * { @ inheritDoc }
* @ see org . jboss . shrinkwrap . impl . base . importer . tar . TarImporterBase # getInputStreamForRawStream ( java . io . InputStream ) */
@ Override TarInputStream getInputStreamForRawStream ( final InputStream in ) throws IOException { } } | assert in != null : "Specified inputstream was null" ; return new TarInputStream ( in ) ; |
import java . util . ArrayList ; import java . util . Arrays ; public class addItemBeforeEach { /** * This function adds an item before each item in a list
* Args : input _ list : Original list element : element that needs to be added before
* each item of the list
* Returns : List with new element inserted before each item .
* Example :
* > > > add _ item _ before _ each ( [ ' Red ' , ' Green ' , ' Black ' ] , ' c ' )
* [ ' c ' , ' Red ' , ' c ' , ' Green ' , ' c ' , ' Black ' ]
* > > > add _ item _ before _ each ( [ ' python ' , ' java ' ] , ' program ' )
* [ ' program ' , ' python ' , ' program ' , ' java ' ]
* > > > add _ item _ before _ each ( [ ' happy ' , ' sad ' ] , ' laugh ' )
* [ ' laugh ' , ' happy ' , ' laugh ' , ' sad ' ] */
public static < T > ArrayList < T > addItemBeforeEach ( ArrayList < T > input_list , T element ) { } public static void main ( String [ ] args ) { ArrayList < String > list1 = new ArrayList < String > ( Arrays . asList ( "Red" , "Green" , "Black" ) ) ; ArrayList < String > list2 = new ArrayList < String > ( Arrays . asList ( "python" , "java" ) ) ; ArrayList < String > list3 = new ArrayList < String > ( Arrays . asList ( "happy" , "sad" ) ) ; System . out . println ( addItemBeforeEach ( list1 , "c" ) ) ; System . out . println ( addItemBeforeEach ( list2 , "program" ) ) ; System . out . println ( addItemBeforeEach ( list3 , "laugh" ) ) ; } } | ArrayList < T > modified_list = new ArrayList < T > ( ) ; for ( T item : input_list ) { modified_list . add ( element ) ; modified_list . add ( item ) ; } return modified_list ; |
public class Sneaky { /** * Sneaky throws a Consumer lambda .
* @ param consumer Consumer that can throw an exception
* @ param < T > type of first argument
* @ return a Consumer as defined in java . util . function */
public static < T , E extends Exception > Consumer < T > sneaked ( SneakyConsumer < T , E > consumer ) { } } | return t -> { @ SuppressWarnings ( "unchecked" ) SneakyConsumer < T , RuntimeException > casedConsumer = ( SneakyConsumer < T , RuntimeException > ) consumer ; casedConsumer . accept ( t ) ; } ; |
public class SemanticAPI { /** * 获取语音识别结果
* @ param accessToken 接口调用凭证
* @ param voiceId 语音唯一标识
* @ param lang 语言 , zh _ CN 或 en _ US , 默认中文
* @ return QueryrecoresultfortextResult
* @ since 2.8.22 */
public static QueryrecoresultfortextResult queryrecoresultfortext ( String accessToken , String voiceId , String lang ) { } } | HttpUriRequest httpUriRequest = RequestBuilder . post ( ) . setUri ( BASE_URI + "/cgi-bin/media/voice/queryrecoresultfortext" ) . addParameter ( PARAM_ACCESS_TOKEN , API . accessToken ( accessToken ) ) . addParameter ( "voice_id" , voiceId ) . addParameter ( "lang" , lang == null || lang . isEmpty ( ) ? "zh_CN" : lang ) . build ( ) ; return LocalHttpClient . executeJsonResult ( httpUriRequest , QueryrecoresultfortextResult . class ) ; |
public class InstantiationUtils { /** * Instantiate the given class rethrowing any exceptions as { @ link InstantiationException } .
* @ param type The type
* @ param < T > The generic type
* @ return The instantiated instance
* @ throws InstantiationException When an error occurs */
public static < T > T instantiate ( Class < T > type ) { } } | try { return BeanIntrospector . SHARED . findIntrospection ( type ) . map ( BeanIntrospection :: instantiate ) . orElseGet ( ( ) -> { try { Logger log = ClassUtils . REFLECTION_LOGGER ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Reflectively instantiating type: " + type ) ; } return type . newInstance ( ) ; } catch ( Throwable e ) { throw new InstantiationException ( "Could not instantiate type [" + type . getName ( ) + "]: " + e . getMessage ( ) , e ) ; } } ) ; } catch ( Throwable e ) { throw new InstantiationException ( "Could not instantiate type [" + type . getName ( ) + "]: " + e . getMessage ( ) , e ) ; } |
public class JavaSPIExtensionLoader { private void addVetoedClasses ( String serviceName , String serviceImpls , ClassLoader classLoader , Map < Class < ? > , Set < Class < ? > > > vetoed ) { } } | try { final Class < ? > serviceClass = classLoader . loadClass ( serviceName ) ; final Set < Class < ? > > classes = loadVetoedServiceImpl ( serviceImpls , classLoader ) ; final Set < Class < ? > > registeredVetoedClasses = vetoed . get ( serviceClass ) ; if ( registeredVetoedClasses == null ) { vetoed . put ( serviceClass , classes ) ; } else { registeredVetoedClasses . addAll ( classes ) ; } } catch ( ClassNotFoundException e ) { // ignores since this is a veto that it is not applicable
} |
public class GVRSceneObject { /** * Called when is removed the parent of the scene object .
* @ param parent Old parent of this scene object . */
protected void onRemoveParentObject ( GVRSceneObject parent ) { } } | for ( GVRComponent comp : mComponents . values ( ) ) { comp . onRemoveOwnersParent ( parent ) ; } |
public class PersistentFactory { /** * Removes the specified item from the system permanently .
* @ param xaction the transaction under which this event is occurring
* @ param item the item to be removed
* @ throws PersistenceException an error occurred talking to the data store or
* removal of these objects is prohibited */
public void remove ( Transaction xaction , T item ) throws PersistenceException { } } | Map < String , Object > keys = cache . getKeys ( item ) ; if ( remove == null ) { synchronized ( this ) { while ( remove == null ) { compileDeleter ( ) ; try { wait ( 1000L ) ; } catch ( InterruptedException ignore ) { /* ignore this */
} } } } xaction . execute ( remove , keys ) ; if ( dependency != null ) { dependency . removeDependencies ( xaction , keys ) ; } cache . release ( item ) ; |
public class FloatColumnsMathOpTransform { /** * Transform an object
* in to another object
* @ param input the record to transform
* @ return the transformed writable */
@ Override public Object map ( Object input ) { } } | List < Float > row = ( List < Float > ) input ; switch ( mathOp ) { case Add : float sum = 0f ; for ( Float w : row ) sum += w ; return sum ; case Subtract : return row . get ( 0 ) - row . get ( 1 ) ; case Multiply : float product = 1.0f ; for ( Float w : row ) product *= w ; return product ; case Divide : return row . get ( 0 ) / row . get ( 1 ) ; case Modulus : return row . get ( 0 ) % row . get ( 1 ) ; case ReverseSubtract : case ReverseDivide : case ScalarMin : case ScalarMax : default : throw new RuntimeException ( "Invalid mathOp: " + mathOp ) ; // Should never happen
} |
public class DataEncoder { /** * Encodes the given signed integer into exactly 4 bytes .
* @ param value signed integer value to encode
* @ param dst destination for encoded bytes
* @ param dstOffset offset into destination array */
public static void encode ( int value , byte [ ] dst , int dstOffset ) { } } | value ^= 0x80000000 ; dst [ dstOffset ] = ( byte ) ( value >> 24 ) ; dst [ dstOffset + 1 ] = ( byte ) ( value >> 16 ) ; dst [ dstOffset + 2 ] = ( byte ) ( value >> 8 ) ; dst [ dstOffset + 3 ] = ( byte ) value ; |
public class HttpResponseMessageImpl { /** * Query whether a body is expected to be present with this message . Note
* that this is only an expectation and not a definitive answer . This will
* check the necessary headers , status codes , etc , to see if any indicate
* a body should be present . Without actually reading for a body , this
* cannot be sure however .
* @ return boolean ( true - - a body is expected to be present ) */
@ Override public boolean isBodyExpected ( ) { } } | if ( VersionValues . V10 . equals ( getVersionValue ( ) ) ) { // if 1.0 then check the isBodyAllowed because the scenario of 1.0
// servers dumping bodies and closing the socket without any body
// indicator throws this logic off
return isBodyAllowed ( ) ; } // sending a body with the response is not valid for a HEAD request
if ( getServiceContext ( ) . getRequestMethod ( ) . equals ( MethodValues . HEAD ) ) { return false ; } // base layer checks explicit length markers ( chunked , content - length ) ;
boolean rc = super . isBodyExpected ( ) ; if ( ! rc ) { // if content - length or chunked encoding don ' t explicitly mark a body
// we could still have one if certain content headers are present since
// a response can be sent until socket closure with no length delimiters
rc = containsHeader ( HttpHeaderKeys . HDR_CONTENT_ENCODING ) || containsHeader ( HttpHeaderKeys . HDR_CONTENT_RANGE ) ; } if ( rc ) { // if we think a body exists , then check the status code flag
rc = this . myStatusCode . isBodyAllowed ( ) ; } return rc ; |
public class ServiceDirectoryConfig { /** * Get the property object as double , or return defaultVal if property is not defined .
* @ param name
* property name .
* @ param defaultVal
* default property value .
* @ return
* property value as double , return defaultVal if property is undefined . */
public double getDouble ( String name , double defaultVal ) { } } | if ( this . configuration . containsKey ( name ) ) { return this . configuration . getDouble ( name ) ; } else { return defaultVal ; } |
public class MusicController { /** * Accepts HTTP GET requests .
* URL : / musics / search
* View : / WEB - INF / jsp / music / search . jsp
* Searches are not unique resources , so it is ok to use searches with
* query parameters . */
@ Get ( "/musics/search" ) public void search ( Music music ) { } } | String title = MoreObjects . firstNonNull ( music . getTitle ( ) , "" ) ; result . include ( "musics" , this . musicDao . searchSimilarTitle ( title ) ) ; |
public class SceneStructureCommon { /** * Specifies that the point was observed in this view .
* @ param pointIndex index of point
* @ param viewIndex index of view */
public void connectPointToView ( int pointIndex , int viewIndex ) { } } | SceneStructureMetric . Point p = points [ pointIndex ] ; for ( int i = 0 ; i < p . views . size ; i ++ ) { if ( p . views . data [ i ] == viewIndex ) throw new IllegalArgumentException ( "Tried to add the same view twice. viewIndex=" + viewIndex ) ; } p . views . add ( viewIndex ) ; |
public class BackoffHelper { /** * Executes the given task using the configured backoff strategy until the task succeeds as
* indicated by returning a non - null value .
* @ param task the retryable task to execute until success
* @ return the result of the successfully executed task
* @ throws InterruptedException if interrupted while waiting for the task to execute successfully
* @ throws BackoffStoppedException if the backoff stopped unsuccessfully
* @ throws E if the task throws */
public < T , E extends Exception > T doUntilResult ( ExceptionalSupplier < T , E > task ) throws InterruptedException , BackoffStoppedException , E { } } | T result = task . get ( ) ; // give an immediate try
return ( result != null ) ? result : retryWork ( task ) ; |
public class Field { /** * Creates a field of a given type , the value is converted to the specified type . The attributes are set to null .
* If the type is < code > MAP < / code > , < code > LIST < / code > or < code > LIST _ MAP < / code > this method performs a deep copy of
* the value .
* @ param type the type of the field to create .
* @ param value the value to set in the field .
* @ return the created Field .
* @ throws IllegalArgumentException if the value cannot be converted to the specified type . */
public static < T > Field create ( Type type , T value ) { } } | return create ( type , value , null ) ; |
public class IdentityMarshaller { /** * Marshall the given parameter object . */
public void marshall ( Identity identity , ProtocolMarshaller protocolMarshaller ) { } } | if ( identity == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( identity . getPrincipalId ( ) , PRINCIPALID_BINDING ) ; protocolMarshaller . marshall ( identity . getType ( ) , TYPE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class BigtableTableAdminClient { /** * Returns a future that is resolved when replication has caught up to the point this method was
* called . This allows callers to make sure that their mutations have been replicated across all
* of their clusters .
* < p > Sample code :
* < pre > { @ code
* ApiFuture < Void > replicationFuture = client . awaitReplicationAsync ( " my - table " ) ;
* ApiFutures . addCallback (
* replicationFuture ,
* new ApiFutureCallback < Void > ( ) {
* public void onSuccess ( Table table ) {
* System . out . println ( " All clusters are now consistent " ) ;
* public void onFailure ( Throwable t ) {
* t . printStackTrace ( ) ;
* MoreExecutors . directExecutor ( )
* } < / pre > */
@ SuppressWarnings ( "WeakerAccess" ) public ApiFuture < Void > awaitReplicationAsync ( final String tableId ) { } } | // TODO ( igorbernstein2 ) : remove usage of trypesafe names
com . google . bigtable . admin . v2 . TableName tableName = com . google . bigtable . admin . v2 . TableName . of ( projectId , instanceId , tableId ) ; return stub . awaitReplicationCallable ( ) . futureCall ( tableName ) ; |
public class JAXRSContract { /** * parseAndValidateMetadata ( Method ) was public . . */
@ Override protected MethodMetadata parseAndValidateMetadata ( Class < ? > targetType , Method method ) { } } | return super . parseAndValidateMetadata ( targetType , method ) ; |
public class XMemcachedClient { /** * ( non - Javadoc )
* @ see net . rubyeye . xmemcached . MemcachedClient # get ( java . lang . String ,
* net . rubyeye . xmemcached . transcoders . Transcoder ) */
public final < T > T get ( final String key , final Transcoder < T > transcoder ) throws TimeoutException , InterruptedException , MemcachedException { } } | return this . get ( key , this . opTimeout , transcoder ) ; |
public class snmp_alarm_config { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | snmp_alarm_config_responses result = ( snmp_alarm_config_responses ) service . get_payload_formatter ( ) . string_to_resource ( snmp_alarm_config_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . snmp_alarm_config_response_array ) ; } snmp_alarm_config [ ] result_snmp_alarm_config = new snmp_alarm_config [ result . snmp_alarm_config_response_array . length ] ; for ( int i = 0 ; i < result . snmp_alarm_config_response_array . length ; i ++ ) { result_snmp_alarm_config [ i ] = result . snmp_alarm_config_response_array [ i ] . snmp_alarm_config [ 0 ] ; } return result_snmp_alarm_config ; |
public class RepeatedFieldBuilder { /** * Appends the specified element to the end of this list .
* @ param message the message to add
* @ return the builder */
public RepeatedFieldBuilder < MType , BType , IType > addMessage ( MType message ) { } } | if ( message == null ) { throw new NullPointerException ( ) ; } ensureMutableMessageList ( ) ; messages . add ( message ) ; if ( builders != null ) { builders . add ( null ) ; } onChanged ( ) ; incrementModCounts ( ) ; return this ; |
public class BitmapAdapter { /** * This function should be called by subclasses when they could not load a bitmap
* @ param position the position of the item */
protected void onBitmapNotAvailable ( int position ) { } } | BitmapCache bc = cachedBitmaps . get ( position ) ; if ( bc != null ) { bc . status = SlideStatus . NOT_AVAILABLE ; bc . bitmap = null ; } |
public class MiniTemplator { /** * Generates the HTML page and writes it to a character stream .
* @ param outputWriter a character stream ( < code > writer < / code > ) to which the HTML page will be written .
* @ throws IOException when an i / o error occurs while writing to the stream . */
public void generateOutput ( Writer outputWriter ) throws IOException { } } | String s = generateOutput ( ) ; outputWriter . write ( s ) ; |
public class QueryParser { /** * src / riemann / Query . g : 26:1 : expr : ( or EOF ) - > or ; */
public final QueryParser . expr_return expr ( ) throws RecognitionException { } } | QueryParser . expr_return retval = new QueryParser . expr_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; Token EOF2 = null ; QueryParser . or_return or1 = null ; CommonTree EOF2_tree = null ; RewriteRuleTokenStream stream_EOF = new RewriteRuleTokenStream ( adaptor , "token EOF" ) ; RewriteRuleSubtreeStream stream_or = new RewriteRuleSubtreeStream ( adaptor , "rule or" ) ; try { // src / riemann / Query . g : 26:6 : ( ( or EOF ) - > or )
// src / riemann / Query . g : 26:8 : ( or EOF )
{ // src / riemann / Query . g : 26:8 : ( or EOF )
// src / riemann / Query . g : 26:9 : or EOF
{ pushFollow ( FOLLOW_or_in_expr145 ) ; or1 = or ( ) ; state . _fsp -- ; stream_or . add ( or1 . getTree ( ) ) ; EOF2 = ( Token ) match ( input , EOF , FOLLOW_EOF_in_expr147 ) ; stream_EOF . add ( EOF2 ) ; } // AST REWRITE
// elements : or
// token labels :
// rule labels : retval
// token list labels :
// rule list labels :
// wildcard labels :
retval . tree = root_0 ; RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream ( adaptor , "rule retval" , retval != null ? retval . tree : null ) ; root_0 = ( CommonTree ) adaptor . nil ( ) ; // 26:17 : - > or
{ adaptor . addChild ( root_0 , stream_or . nextTree ( ) ) ; } retval . tree = root_0 ; } retval . stop = input . LT ( - 1 ) ; retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( CommonTree ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { } return retval ; |
public class XmlRepositoryFactory { /** * Reads XML stream and returns it is DOM XML Document instance .
* Can be used in conjunction with { @ link # addAll ( org . w3c . dom . Document ) }
* @ param inputStream stream which should be read
* @ return { @ link Document } instance */
public static Document getDocument ( InputStream inputStream ) { } } | Document result = null ; try { // memory optimization over minor performance sacrifice
synchronized ( XmlRepositoryFactory . class ) { if ( documentBuilder == null ) { documentBuilder = builderFactory . newDocumentBuilder ( ) ; } result = documentBuilder . parse ( inputStream ) ; } } catch ( ParserConfigurationException ex ) { throw new MjdbcRuntimeException ( ex ) ; } catch ( SAXException ex ) { throw new MjdbcRuntimeException ( ex ) ; } catch ( IOException ex ) { throw new MjdbcRuntimeException ( ex ) ; } return result ; |
public class PushStrategy { /** * Handle exceptions in separate run ( ) method to allow replicate ( ) to
* just return when cancel is set to true rather than having to keep
* track of whether we terminated via an error in replicate ( ) . */
@ Override public void run ( ) { } } | if ( this . state != null && this . state . cancel ) { // we were already cancelled , don ' t run , but still post completion
this . state . documentCounter = 0 ; this . state . batchCounter = 0 ; runComplete ( null ) ; return ; } // reset internal state
this . state = new State ( ) ; Throwable errorInfo = null ; try { replicate ( ) ; } catch ( Throwable e ) { logger . log ( Level . SEVERE , String . format ( "Batch %s ended with error:" , this . state . batchCounter ) , e ) ; errorInfo = e ; } runComplete ( errorInfo ) ; |
public class InternalXbaseWithAnnotationsParser { /** * $ ANTLR start synpred2 _ InternalXbaseWithAnnotations */
public final void synpred2_InternalXbaseWithAnnotations_fragment ( ) throws RecognitionException { } } | // InternalXbaseWithAnnotations . g : 2077:2 : ( ( ( rule _ _ XAnnotation _ _ Group _ 3_1_0 _ _ 0 ) ) )
// InternalXbaseWithAnnotations . g : 2077:2 : ( ( rule _ _ XAnnotation _ _ Group _ 3_1_0 _ _ 0 ) )
{ // InternalXbaseWithAnnotations . g : 2077:2 : ( ( rule _ _ XAnnotation _ _ Group _ 3_1_0 _ _ 0 ) )
// InternalXbaseWithAnnotations . g : 2078:3 : ( rule _ _ XAnnotation _ _ Group _ 3_1_0 _ _ 0 )
{ if ( state . backtracking == 0 ) { before ( grammarAccess . getXAnnotationAccess ( ) . getGroup_3_1_0 ( ) ) ; } // InternalXbaseWithAnnotations . g : 2079:3 : ( rule _ _ XAnnotation _ _ Group _ 3_1_0 _ _ 0 )
// InternalXbaseWithAnnotations . g : 2079:4 : rule _ _ XAnnotation _ _ Group _ 3_1_0 _ _ 0
{ pushFollow ( FOLLOW_2 ) ; rule__XAnnotation__Group_3_1_0__0 ( ) ; state . _fsp -- ; if ( state . failed ) return ; } } } |
public class ASTManager { /** * Parses Java code and store the AST into a
* { @ link org . walkmod . javalang . ast . CompilationUnit } object with or without
* the nodes start & end locations ( line numbers and columns ) .
* @ param code
* source code to parse .
* @ param withoutLocation
* true does not fulfill the location information inside the AST .
* Otherwise , it is defined .
* @ return the abstract syntax tree ( AST ) .
* @ throws ParseException
* when the code contains an invalid syntax . */
public static CompilationUnit parse ( String code , boolean withoutLocation ) throws ParseException { } } | ASTParser astParser = null ; StringReader sr = new StringReader ( code ) ; if ( ! withoutLocation ) { astParser = new ASTParser ( sr ) ; astParser . jj_input_stream . setTabSize ( 1 ) ; } else { JavaCharStream stream = new JavaCharStream ( sr , 1 , 1 ) ; CleanerTokenManager ctm = new CleanerTokenManager ( stream ) ; astParser = new ASTParser ( ctm ) ; } CompilationUnit cu = null ; try { cu = astParser . CompilationUnit ( ) ; } finally { sr . close ( ) ; } return cu ; |
public class S3ResourceClassificationUpdateMarshaller { /** * Marshall the given parameter object . */
public void marshall ( S3ResourceClassificationUpdate s3ResourceClassificationUpdate , ProtocolMarshaller protocolMarshaller ) { } } | if ( s3ResourceClassificationUpdate == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( s3ResourceClassificationUpdate . getBucketName ( ) , BUCKETNAME_BINDING ) ; protocolMarshaller . marshall ( s3ResourceClassificationUpdate . getPrefix ( ) , PREFIX_BINDING ) ; protocolMarshaller . marshall ( s3ResourceClassificationUpdate . getClassificationTypeUpdate ( ) , CLASSIFICATIONTYPEUPDATE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class BaseMonetaryRoundingsSingletonSpi { /** * Query a specific rounding with the given query . If multiple roundings match the query the first one is
* selected , since the query allows to determine the providers and their ordering by setting { @ link
* javax . money . RoundingQuery # getProviderNames ( ) } .
* @ param query the rounding query , not null .
* @ return the rounding found , or null , if no rounding matches the query . */
public MonetaryRounding getRounding ( RoundingQuery query ) { } } | Collection < MonetaryRounding > roundings = getRoundings ( query ) ; if ( roundings . isEmpty ( ) ) { return null ; } return roundings . iterator ( ) . next ( ) ; |
public class RoleAssignmentsInner { /** * Deletes a role assignment .
* @ param roleId The ID of the role assignment to delete .
* @ 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 < RoleAssignmentInner > deleteByIdAsync ( String roleId , final ServiceCallback < RoleAssignmentInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( deleteByIdWithServiceResponseAsync ( roleId ) , serviceCallback ) ; |
public class VerificationConditionGenerator { /** * Generate a logical conjunction which represents the given ranges of all
* quantified variables . That is a conjunction of the form
* < code > start < = var & & var < end < / code > .
* @ return */
private Expr generateQuantifierRanges ( WyilFile . Expr . Quantifier expr , LocalEnvironment environment ) { } } | Expr ranges = null ; Tuple < WyilFile . Decl . Variable > parameters = expr . getParameters ( ) ; for ( int i = 0 ; i != parameters . size ( ) ; ++ i ) { WyilFile . Decl . Variable var = parameters . get ( i ) ; WyilFile . Expr . ArrayRange range = ( WyilFile . Expr . ArrayRange ) var . getInitialiser ( ) ; WyalFile . VariableDeclaration varDecl = environment . read ( var ) ; Expr . VariableAccess varExpr = new Expr . VariableAccess ( varDecl ) ; Expr startExpr = translateExpression ( range . getFirstOperand ( ) , null , environment ) ; Expr endExpr = translateExpression ( range . getSecondOperand ( ) , null , environment ) ; Expr lhs = new Expr . LessThanOrEqual ( startExpr , varExpr ) ; Expr rhs = new Expr . LessThan ( varExpr , endExpr ) ; ranges = and ( ranges , and ( lhs , rhs ) ) ; } return ranges ; |
public class SwivelMultifactorAuthenticationProvider { /** * Can ping provider ?
* @ return the boolean */
public boolean canPing ( ) { } } | try { val connection = ( HttpURLConnection ) new URL ( this . swivelUrl ) . openConnection ( ) ; connection . setRequestMethod ( HttpMethod . GET . name ( ) ) ; connection . connect ( ) ; return connection . getResponseCode ( ) == HttpStatus . SC_OK ; } catch ( final Exception e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; } return false ; |
public class ApproveSuggestedAdUnits { /** * Runs the example .
* @ param adManagerServices the services factory .
* @ param session the session .
* @ param numRequests the number of requests for suggested ad units greater than which to approve .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors . */
public static void runExample ( AdManagerServices adManagerServices , AdManagerSession session , long numRequests ) throws RemoteException { } } | // Get the SuggestedAdUnitService .
SuggestedAdUnitServiceInterface suggestedAdUnitService = adManagerServices . get ( session , SuggestedAdUnitServiceInterface . class ) ; // Create a statement to only select suggested ad units that are highly
// requested .
StatementBuilder statementBuilder = new StatementBuilder ( ) . where ( "numRequests >= :numRequests" ) . orderBy ( "id ASC" ) . limit ( StatementBuilder . SUGGESTED_PAGE_LIMIT ) . withBindVariableValue ( "numRequests" , numRequests ) ; // Default for total result set size .
int totalResultSetSize = 0 ; do { // Get suggested ad units by statement .
SuggestedAdUnitPage page = suggestedAdUnitService . getSuggestedAdUnitsByStatement ( statementBuilder . toStatement ( ) ) ; if ( page . getResults ( ) != null ) { totalResultSetSize = page . getTotalResultSetSize ( ) ; int i = page . getStartIndex ( ) ; for ( SuggestedAdUnit suggestedAdUnit : page . getResults ( ) ) { System . out . printf ( "%d) Suggested ad unit with ID '%s' will be approved.%n" , i ++ , suggestedAdUnit . getId ( ) ) ; } } statementBuilder . increaseOffsetBy ( StatementBuilder . SUGGESTED_PAGE_LIMIT ) ; } while ( statementBuilder . getOffset ( ) < totalResultSetSize ) ; System . out . printf ( "Number of suggested ad units to be approved: %d%n" , totalResultSetSize ) ; if ( totalResultSetSize > 0 ) { // Remove limit and offset from statement .
statementBuilder . removeLimitAndOffset ( ) ; // Create action .
com . google . api . ads . admanager . axis . v201808 . ApproveSuggestedAdUnits action = new com . google . api . ads . admanager . axis . v201808 . ApproveSuggestedAdUnits ( ) ; // Perform action .
SuggestedAdUnitUpdateResult result = suggestedAdUnitService . performSuggestedAdUnitAction ( action , statementBuilder . toStatement ( ) ) ; if ( result != null && result . getNumChanges ( ) > 0 ) { System . out . printf ( "Number of new ad units created: %d%n" , result . getNewAdUnitIds ( ) . length ) ; } else { System . out . println ( "No suggested ad units were approved." ) ; } } |
public class StyleCounter { /** * Computes the percentage of the given style among all the style occurences .
* @ param style the style
* @ return the style percentage */
public double getPercentage ( T style ) { } } | int scnt = 0 ; int allcnt = 0 ; for ( Map . Entry < T , Integer > entry : getAll ( ) . entrySet ( ) ) { if ( entry . getKey ( ) . equals ( style ) ) scnt = entry . getValue ( ) ; allcnt += entry . getValue ( ) ; } return scnt / ( double ) allcnt ; |
public class CDDB { /** * Issues a request to the CDDB server and parses the response . */
protected Response request ( String req ) throws IOException { } } | System . err . println ( "REQ:" + req ) ; // send the request to the server
_out . println ( req ) ; _out . flush ( ) ; // now read the response
String rspstr = _in . readLine ( ) ; // if they closed the connection on us , we should deal
if ( rspstr == null ) { throw new EOFException ( ) ; } System . err . println ( "RSP:" + rspstr ) ; // parse the response
Response rsp = new Response ( ) ; String codestr = rspstr ; // assume the response is just a code unless we see a space
int sidx = rspstr . indexOf ( " " ) ; if ( sidx != - 1 ) { codestr = rspstr . substring ( 0 , sidx ) ; rsp . message = rspstr . substring ( sidx + 1 ) ; } try { rsp . code = Integer . parseInt ( codestr ) ; } catch ( NumberFormatException nfe ) { rsp . code = 599 ; rsp . message = "Unparseable response" ; } return rsp ; |
public class ClustersInner { /** * Lists the HDInsight clusters 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 ; ClusterInner & gt ; object */
public Observable < Page < ClusterInner > > listByResourceGroupAsync ( final String resourceGroupName ) { } } | return listByResourceGroupWithServiceResponseAsync ( resourceGroupName ) . map ( new Func1 < ServiceResponse < Page < ClusterInner > > , Page < ClusterInner > > ( ) { @ Override public Page < ClusterInner > call ( ServiceResponse < Page < ClusterInner > > response ) { return response . body ( ) ; } } ) ; |
public class CoordinateFormat { /** * Formats latitude
* @ param out
* @ param locale
* @ param latitude
* @ param unit */
public static void formatLatitude ( Appendable out , Locale locale , double latitude , UnitType unit ) { } } | format ( out , locale , latitude , unit , NS ) ; |
public class Input { /** * Reads a boolean
* @ return boolean Boolean value */
@ Override public Boolean readBoolean ( ) { } } | return ( currentDataType == AMF3 . TYPE_BOOLEAN_TRUE ) ? Boolean . TRUE : Boolean . FALSE ; |
public class VdmThread { /** * IDbgpTerminationListener */
public void objectTerminated ( Object object , Exception e ) { } } | terminated = true ; Assert . isTrue ( object == session ) ; // HotCodeReplaceManager . getDefault ( ) . removeHotCodeReplaceListener ( this ) ;
manager . terminateThread ( this ) ; |
public class JobCallbackValidator { /** * Make sure all the job callback related properties are valid
* @ return number of valid job callback properties . Mainly for testing purpose . */
public static int validate ( final String jobName , final Props serverProps , final Props jobProps , final Collection < String > errors ) { } } | final int maxNumCallback = serverProps . getInt ( JobCallbackConstants . MAX_CALLBACK_COUNT_PROPERTY_KEY , JobCallbackConstants . DEFAULT_MAX_CALLBACK_COUNT ) ; final int maxPostBodyLength = serverProps . getInt ( MAX_POST_BODY_LENGTH_PROPERTY_KEY , DEFAULT_POST_BODY_LENGTH ) ; int totalCallbackCount = 0 ; for ( final JobCallbackStatusEnum jobStatus : JobCallbackStatusEnum . values ( ) ) { totalCallbackCount += validateBasedOnStatus ( jobProps , errors , jobStatus , maxNumCallback , maxPostBodyLength ) ; } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Found " + totalCallbackCount + " job callbacks for job " + jobName ) ; } return totalCallbackCount ; |
public class SqlQueryImpl { /** * { @ inheritDoc }
* @ see jp . co . future . uroborosql . fluent . SqlQuery # findFirst ( java . lang . Class ) */
@ Override public < T > Optional < T > findFirst ( final Class < T > type ) { } } | try ( Stream < T > stream = stream ( new EntityResultSetConverter < > ( type , new PropertyMapperManager ( ) ) ) ) { return stream . findFirst ( ) ; } |
public class ModuleFields { /** * Returns a list of input ports defined by the module .
* @ return A list of input ports defined by the module . */
public List < String > getInPorts ( ) { } } | List < String > ports = new ArrayList < > ( ) ; JsonObject jsonPorts = config . getObject ( "ports" ) ; if ( jsonPorts == null ) { return ports ; } JsonArray jsonInPorts = jsonPorts . getArray ( "in" ) ; if ( jsonInPorts == null ) { return ports ; } for ( Object jsonInPort : jsonInPorts ) { ports . add ( ( String ) jsonInPort ) ; } return ports ; |
public class SchemaSet { /** * Returns a printable view of the SchemaSet and contents for use in
* debugging and Unit Tests .
* @ return String Printable view of the SchemaSet and contents */
public String toVerboseString ( ) { } } | /* Take a local reference to the table in case a resize happens . */
Entry [ ] tempTable = table ; StringBuffer buf = new StringBuffer ( ) ; /* Include the SchemaSet hashcode just in case we need to distinguish them */
buf . append ( "SchemaSet " ) ; buf . append ( this . hashCode ( ) ) ; buf . append ( " {\n" ) ; /* For each table entry , write out all the SchemaIds */
for ( int i = 0 ; i < tempTable . length ; i ++ ) { buf . append ( " [" ) ; buf . append ( i ) ; buf . append ( "] " ) ; Entry ent = tempTable [ i ] ; buf . append ( ent ) ; while ( ent != null ) { ent = ent . next ; buf . append ( " " ) ; buf . append ( ent ) ; } buf . append ( "\n" ) ; } buf . append ( " }\n" ) ; return buf . toString ( ) ; |
public class QueryUtil { /** * Convenience method for packaging query results .
* @ param < T > Class of query result .
* @ param results Results to package .
* @ return Packaged results . */
public static < T > IQueryResult < T > packageResult ( List < T > results ) { } } | return packageResult ( results , null ) ; |
public class Function2Args { /** * Set an argument expression for a function . This method is called by the
* XPath compiler .
* @ param arg non - null expression that represents the argument .
* @ param argNum The argument number index .
* @ throws WrongNumberArgsException If the argNum parameter is greater than 1. */
public void setArg ( Expression arg , int argNum ) throws WrongNumberArgsException { } } | // System . out . println ( " argNum : " + argNum ) ;
if ( argNum == 0 ) super . setArg ( arg , argNum ) ; else if ( 1 == argNum ) { m_arg1 = arg ; arg . exprSetParent ( this ) ; } else reportWrongNumberArgs ( ) ; |
public class TemplateTypeMap { /** * Returns the index of the JSType value associated with the specified
* template key . If no JSType value is associated , returns - 1. */
private int getTemplateTypeIndex ( TemplateType key ) { } } | int maxIndex = Math . min ( templateKeys . size ( ) , templateValues . size ( ) ) ; for ( int i = maxIndex - 1 ; i >= 0 ; i -- ) { if ( isSameKey ( templateKeys . get ( i ) , key ) ) { return i ; } } return - 1 ; |
public class MemoryChunkUtil { /** * Computes number of bytes that can be safely read / written starting at given offset , but no more
* than count . */
static int adjustByteCount ( final int offset , final int count , final int memorySize ) { } } | final int available = Math . max ( 0 , memorySize - offset ) ; return Math . min ( available , count ) ; |
public class CollectionDef { /** * < code > optional . tensorflow . CollectionDef . NodeList node _ list = 1 ; < / code > */
public org . tensorflow . framework . CollectionDef . NodeList getNodeList ( ) { } } | if ( kindCase_ == 1 ) { return ( org . tensorflow . framework . CollectionDef . NodeList ) kind_ ; } return org . tensorflow . framework . CollectionDef . NodeList . getDefaultInstance ( ) ; |
public class UniverseApi { /** * Get region information ( asynchronously ) Get information on a region - - -
* This route expires daily at 11:05
* @ param regionId
* region _ id integer ( required )
* @ param acceptLanguage
* Language to use in the response ( optional , default to en - us )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ param language
* Language to use in the response , takes precedence over
* Accept - Language ( optional , default to en - us )
* @ param callback
* The callback to be executed when the API call finishes
* @ return The request call
* @ throws ApiException
* If fail to process the API call , e . g . serializing the request
* body object */
public com . squareup . okhttp . Call getUniverseRegionsRegionIdAsync ( Integer regionId , String acceptLanguage , String datasource , String ifNoneMatch , String language , final ApiCallback < RegionResponse > callback ) throws ApiException { } } | com . squareup . okhttp . Call call = getUniverseRegionsRegionIdValidateBeforeCall ( regionId , acceptLanguage , datasource , ifNoneMatch , language , callback ) ; Type localVarReturnType = new TypeToken < RegionResponse > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , callback ) ; return call ; |
public class CmsContainerElementBean { /** * Gets the hash code for the element settings . < p >
* @ return the hash code for the element settings */
private String getSettingsHash ( ) { } } | String instanceId = getInstanceId ( ) ; if ( instanceId == null ) { throw new RuntimeException ( "Missing instance id" ) ; } return CmsADEManager . CLIENT_ID_SEPERATOR + getInstanceId ( ) ; |
public class CmsVfsResourceBundle { /** * Initializes the type given the string value of the type . < p >
* @ param type a string representation of the type
* @ return the actual type object */
private static I_Loader initLoader ( String type ) { } } | if ( TYPE_PROPERTIES . equals ( type ) ) { return new CmsVfsBundleLoaderProperties ( ) ; } else if ( TYPE_XML . equals ( type ) ) { return new CmsVfsBundleLoaderXml ( ) ; } else { return new CmsVfsBundleLoaderXml ( ) ; } |
public class SARLAnnotationUtil { /** * Extract the integer values of the given annotation , if they exist .
* @ param op the annotated element .
* @ param annotationType the type of the annotation to consider
* @ return the values of the annotation , never { @ code null } .
* @ since 0.6 */
public List < Integer > findIntValues ( JvmAnnotationTarget op , Class < ? extends Annotation > annotationType ) { } } | final JvmAnnotationReference reference = this . lookup . findAnnotation ( op , annotationType ) ; if ( reference != null ) { return findIntValues ( reference ) ; } return null ; |
public class AbstractGrabber { /** * This method releases resources used by the FrameCapture object .
* @ throws StateException if if this
* < code > FrameGrabber < / code > has been already released , and therefore must
* not be used anymore . */
final void release ( ) { } } | try { stopCapture ( ) ; } catch ( StateException se ) { // capture already stopped
} state . release ( ) ; doRelease ( object ) ; state . commit ( ) ; |
public class MRCompactorJobRunner { /** * Submit an event reporting late record counts and non - late record counts . */
private void submitRecordsCountsEvent ( ) { } } | long lateOutputRecordCount = this . datasetHelper . getLateOutputRecordCount ( ) ; long outputRecordCount = this . datasetHelper . getOutputRecordCount ( ) ; try { CompactionSlaEventHelper . getEventSubmitterBuilder ( this . dataset , Optional . < Job > absent ( ) , this . fs ) . eventSubmitter ( this . eventSubmitter ) . eventName ( CompactionSlaEventHelper . COMPACTION_RECORD_COUNT_EVENT ) . additionalMetadata ( CompactionSlaEventHelper . DATASET_OUTPUT_PATH , this . dataset . outputPath ( ) . toString ( ) ) . additionalMetadata ( CompactionSlaEventHelper . LATE_RECORD_COUNT , Long . toString ( lateOutputRecordCount ) ) . additionalMetadata ( CompactionSlaEventHelper . REGULAR_RECORD_COUNT , Long . toString ( outputRecordCount ) ) . additionalMetadata ( CompactionSlaEventHelper . NEED_RECOMPACT , Boolean . toString ( this . dataset . needToRecompact ( ) ) ) . build ( ) . submit ( ) ; } catch ( Throwable e ) { LOG . warn ( "Failed to submit late event count:" + e , e ) ; } |
public class EpsReader { /** * Treats a byte as an ASCII character , and returns it ' s numerical value in hexadecimal .
* If conversion is not possible , returns - 1. */
private static int tryHexToInt ( byte b ) { } } | if ( b >= '0' && b <= '9' ) return b - '0' ; if ( b >= 'A' && b <= 'F' ) return b - 'A' + 10 ; if ( b >= 'a' && b <= 'f' ) return b - 'a' + 10 ; return - 1 ; |
public class Task { /** * Checks if the state of the thread which is associated with this task is < code > TERMINATED < / code > .
* @ return < code > true < / code > if the state of this thread which is associated with this task is
* < code > TERMINATED < / code > , < code > false < / code > otherwise */
public boolean isTerminated ( ) { } } | final Thread executingThread = this . environment . getExecutingThread ( ) ; if ( executingThread . getState ( ) == Thread . State . TERMINATED ) { return true ; } return false ; |
public class Symmetry010Date { /** * Obtains a { @ code Symmetry010Date } representing a date in the Symmetry010 calendar
* system from the epoch - day .
* @ param epochDay the epoch day to convert based on 1970-01-01 ( ISO ) , corresponds to 1970-01-04 ( Sym010)
* @ return the date in Symmetry010 calendar system , not null
* @ throws DateTimeException if the epoch - day is out of range */
static Symmetry010Date ofEpochDay ( long epochDay ) { } } | EPOCH_DAY_RANGE . checkValidValue ( epochDay + 3 , ChronoField . EPOCH_DAY ) ; long zeroDay = epochDay + DAYS_0001_TO_1970 + 1 ; long year = 1 + ( ( 293 * zeroDay ) / DAYS_PER_CYCLE ) ; long doy = zeroDay - ( DAYS_IN_YEAR * ( year - 1 ) + Symmetry010Chronology . getLeapYearsBefore ( year ) * DAYS_IN_WEEK ) ; if ( doy < 1 ) { year -- ; doy += INSTANCE . isLeapYear ( year ) ? DAYS_IN_YEAR_LONG : DAYS_IN_YEAR ; } int diy = INSTANCE . isLeapYear ( year ) ? DAYS_IN_YEAR_LONG : DAYS_IN_YEAR ; if ( doy > diy ) { doy -= diy ; year ++ ; } return ofYearDay ( ( int ) year , ( int ) doy ) ; |
public class EsriJsonFactory { /** * Create JSON from an { @ link com . esri . json . EsriFeatureClass }
* @ param featureClass feature class to convert to JSON
* @ return JSON string representing the given feature class
* @ throws JsonGenerationException
* @ throws JsonMappingException
* @ throws IOException */
public static String JsonFromFeatureClass ( EsriFeatureClass featureClass ) throws JsonGenerationException , JsonMappingException , IOException { } } | return jsonObjectMapper . writeValueAsString ( featureClass ) ; |
public class ArrayUtils { /** * Returns a new array with the given size containing the default value at
* each index .
* @ param < T >
* Array type .
* @ param size
* The desired size of the array .
* @ param defaultValue
* The default value to use
* @ return The created array */
public static < T > T [ ] createArray ( int size , T defaultValue ) { } } | T [ ] result = ( T [ ] ) GenericReflection . newArray ( defaultValue . getClass ( ) , size ) ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = defaultValue ; } return result ; |
public class AttrValue { /** * < pre >
* " shape "
* < / pre >
* < code > optional . tensorflow . TensorShapeProto shape = 7 ; < / code > */
public org . tensorflow . framework . TensorShapeProtoOrBuilder getShapeOrBuilder ( ) { } } | if ( valueCase_ == 7 ) { return ( org . tensorflow . framework . TensorShapeProto ) value_ ; } return org . tensorflow . framework . TensorShapeProto . getDefaultInstance ( ) ; |
public class KeySignature { /** * Set the accidentals , ensure that the byte array is copied
* < TT > accidentals = accidentalRules . . . [ . . . ] < / TT > keeps the reference
* to accidentalRules . . . so if you set an accidental with { @ link # setAccidental ( byte , Accidental ) }
* the static accidentalRule . . . [ ] is altered . */
private void setAccidentals ( Accidental [ ] accidentalsDefinition ) { } } | Accidental [ ] newArray = new Accidental [ 7 ] ; System . arraycopy ( accidentalsDefinition , 0 , newArray , 0 , 7 ) ; accidentals = newArray ; |
public class LabelParameterVersionResult { /** * The label does not meet the requirements . For information about parameter label requirements , see < a
* href = " http : / / docs . aws . amazon . com / systems - manager / latest / userguide / sysman - paramstore - labels . html " > Labeling
* Parameters < / a > in the < i > AWS Systems Manager User Guide < / i > .
* @ return The label does not meet the requirements . For information about parameter label requirements , see < a
* href = " http : / / docs . aws . amazon . com / systems - manager / latest / userguide / sysman - paramstore - labels . html " > Labeling
* Parameters < / a > in the < i > AWS Systems Manager User Guide < / i > . */
public java . util . List < String > getInvalidLabels ( ) { } } | if ( invalidLabels == null ) { invalidLabels = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return invalidLabels ; |
public class CLIQUEUnit { /** * Returns true , if the intervals of this unit contain the specified feature
* vector .
* @ param vector the feature vector to be tested for containment
* @ return true , if the intervals of this unit contain the specified feature
* vector , false otherwise */
public boolean contains ( NumberVector vector ) { } } | for ( int i = 0 ; i < dims . length ; i ++ ) { final double value = vector . doubleValue ( dims [ i ] ) ; if ( bounds [ i << 1 ] > value || value >= bounds [ ( i << 1 ) + 1 ] ) { return false ; } } return true ; |
public class PersistentState { /** * Updates the last seen configuration .
* @ param conf the updated configuration .
* @ throws IOException in case of IO failure . */
void setLastSeenConfig ( ClusterConfiguration conf ) throws IOException { } } | String version = conf . getVersion ( ) . toSimpleString ( ) ; File file = new File ( rootDir , String . format ( "cluster_config.%s" , version ) ) ; FileUtils . writePropertiesToFile ( conf . toProperties ( ) , file ) ; // Since the new config file gets created , we need to fsync the directory .
fsyncDirectory ( ) ; |
public class DefaultWebResourceFactoryImpl { /** * Return a configured Jersey client for Galaxy API code to interact with . If this method is overridden ensure
* FEATURE _ POJO _ MAPPING is enabled .
* clientConfig . getFeatures ( ) . put ( JSONConfiguration . FEATURE _ POJO _ MAPPING , Boolean . TRUE ) ;
* @ return Jersey client . */
protected com . sun . jersey . api . client . Client getJerseyClient ( ) { } } | final ClientConfig clientConfig = new DefaultClientConfig ( ) ; clientConfig . getFeatures ( ) . put ( JSONConfiguration . FEATURE_POJO_MAPPING , Boolean . TRUE ) ; com . sun . jersey . api . client . Client client = com . sun . jersey . api . client . Client . create ( clientConfig ) ; if ( this . debug ) { client . addFilter ( new LoggingFilter ( System . out ) ) ; } return client ; |
public class NFAppenderAttachableImpl { /** * ( non - Javadoc )
* @ see
* org . apache . log4j . helpers . AppenderAttachableImpl # removeAppender ( java . lang
* . String ) */
@ Override public void removeAppender ( String name ) { } } | if ( name == null || appenderList == null ) return ; Iterator < Appender > it = appenderList . iterator ( ) ; while ( it . hasNext ( ) ) { Appender a = ( Appender ) it . next ( ) ; if ( name . equals ( a . getName ( ) ) ) { it . remove ( ) ; configuredAppenderList . remove ( a . getName ( ) ) ; break ; } } |
public class NavigationDrawerFragment { /** * Users of this fragment must call this method to set up the navigation drawer interactions .
* @ param fragmentId The android : id of this fragment in its activity ' s layout .
* @ param drawerLayout The DrawerLayout containing this fragment ' s UI . */
public void setUp ( int fragmentId , final DrawerLayout drawerLayout ) { } } | fragmentContainerView = getActivity ( ) . findViewById ( fragmentId ) ; this . drawerLayout = drawerLayout ; // Set the custom scrim color ( the overlay color ) for the etsy like effect
drawerLayout . setScrimColor ( ContextCompat . getColor ( getContext ( ) , R . color . bg_glass ) ) ; // set a custom shadow that overlays the main content when the drawer opens
// drawerLayout . setDrawerShadow ( R . drawable . drawer _ shadow , GravityCompat . START ) ;
// set up the drawer ' s list view with items and click listener
ActionBar actionBar = getActionBar ( ) ; actionBar . setDisplayHomeAsUpEnabled ( true ) ; actionBar . setHomeButtonEnabled ( true ) ; // ActionBarDrawerToggle ties together the the proper interactions
// between the navigation drawer and the action bar app icon .
drawerToggle = new ActionBarDrawerToggle ( getActivity ( ) , /* host Activity */
drawerLayout , /* DrawerLayout object */
R . string . navigation_drawer_open , /* " open drawer " description for accessibility */
R . string . navigation_drawer_close /* " close drawer " description for accessibility */
) { @ Override public void onDrawerClosed ( View drawerView ) { super . onDrawerClosed ( drawerView ) ; if ( ! isAdded ( ) ) { return ; } getActivity ( ) . supportInvalidateOptionsMenu ( ) ; // calls onPrepareOptionsMenu ( )
} @ Override public void onDrawerOpened ( View drawerView ) { super . onDrawerOpened ( drawerView ) ; if ( ! isAdded ( ) ) { return ; } if ( ! userLearnedDrawer ) { // The user manually opened the drawer ; store this flag to prevent auto - showing
// the navigation drawer automatically in the future .
userLearnedDrawer = true ; SharedPreferences sp = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; sp . edit ( ) . putBoolean ( PREF_USER_LEARNED_DRAWER , true ) . commit ( ) ; } getActivity ( ) . supportInvalidateOptionsMenu ( ) ; // calls onPrepareOptionsMenu ( )
} } ; drawerLayout . addDrawerListener ( drawerToggle ) ; // If the user hasn ' t ' learned ' about the drawer , open it to introduce them to the drawer ,
// per the navigation drawer design guidelines .
if ( ! userLearnedDrawer && ! fromSavedInstanceState ) { drawerLayout . openDrawer ( fragmentContainerView ) ; drawerLayout . post ( new Runnable ( ) { @ Override public void run ( ) { drawerToggle . onDrawerSlide ( fragmentContainerView , 1f ) ; } } ) ; } // Defer code dependent on restoration of previous instance state .
drawerLayout . post ( new Runnable ( ) { @ Override public void run ( ) { drawerToggle . syncState ( ) ; } } ) ; |
public class UTFWriterImpl { /** * Schliesst die Datei und den FileChannel */
@ Override public void close ( ) { } } | if ( raf != null ) { // close Quietly
try { // Schliessen der Daten - Datei
raf . close ( ) ; file = null ; } catch ( Exception e ) { } finally { raf = null ; } } |
public class KiteRequestHandler { /** * Creates a GET request .
* @ param url is the endpoint to which request has to be done .
* @ param apiKey is the api key of the Kite Connect app .
* @ param accessToken is the access token obtained after successful login process . */
public Request createGetRequest ( String url , String apiKey , String accessToken ) { } } | HttpUrl . Builder httpBuilder = HttpUrl . parse ( url ) . newBuilder ( ) ; return new Request . Builder ( ) . url ( httpBuilder . build ( ) ) . header ( "User-Agent" , USER_AGENT ) . header ( "X-Kite-Version" , "3" ) . header ( "Authorization" , "token " + apiKey + ":" + accessToken ) . build ( ) ; |
public class SamlSettingsApi { /** * Set region settings .
* Change region settings .
* @ param region The name of region ( required )
* @ param data ( required )
* @ return SetAnyLocationsResponse
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public SetAnyLocationsResponse postAnyLocations ( String region , SettingsData data ) throws ApiException { } } | ApiResponse < SetAnyLocationsResponse > resp = postAnyLocationsWithHttpInfo ( region , data ) ; return resp . getData ( ) ; |
public class CmsADEConfigData { /** * Returns the restricted dynamic functions or < code > null < / code > . < p >
* @ return the dynamic functions */
public Collection < CmsUUID > getDynamicFunctions ( ) { } } | CmsADEConfigData parentData = parent ( ) ; Collection < CmsUUID > result = m_data . getDynamicFunctions ( ) ; if ( ( result == null ) && ( parentData != null ) ) { result = parentData . getDynamicFunctions ( ) ; } return result ; |
public class IonTextWriterBuilder { /** * Declares that this builder should minimize system - level output
* ( Ion version markers and local symbol tables ) .
* This is equivalent to :
* < ul >
* < li > { @ link # setInitialIvmHandling ( IonWriterBuilder . InitialIvmHandling )
* setInitialIvmHandling } { @ code ( } { @ link IonWriterBuilder . InitialIvmHandling # SUPPRESS SUPPRESS } { @ code ) }
* < li > { @ link # setIvmMinimizing ( IonWriterBuilder . IvmMinimizing )
* setIvmMinimizing } { @ code ( } { @ link IonWriterBuilder . IvmMinimizing # DISTANT DISTANT } { @ code ) }
* < li > { @ link # setLstMinimizing ( LstMinimizing )
* setLstMinimizing } { @ code ( } { @ link LstMinimizing # EVERYTHING EVERYTHING } { @ code ) }
* < / ul >
* @ return this instance , if mutable ;
* otherwise a mutable copy of this instance . */
public final IonTextWriterBuilder withMinimalSystemData ( ) { } } | IonTextWriterBuilder b = mutable ( ) ; b . setInitialIvmHandling ( SUPPRESS ) ; b . setIvmMinimizing ( IvmMinimizing . DISTANT ) ; b . setLstMinimizing ( LstMinimizing . EVERYTHING ) ; return b ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.