signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class PyExpressionGenerator { /** * Generate the given object . * @ param varDeclaration the variable declaration . * @ param it the target for the generated content . * @ param context the context . * @ return the statement . */ protected XExpression _generate ( XVariableDeclaration varDeclaration , IAppendable it , IExtraLanguageGeneratorContext context ) { } }
final String name = it . declareUniqueNameVariable ( varDeclaration , varDeclaration . getName ( ) ) ; it . append ( name ) ; it . append ( " = " ) ; // $ NON - NLS - 1 $ if ( varDeclaration . getRight ( ) != null ) { generate ( varDeclaration . getRight ( ) , it , context ) ; } else if ( varDeclaration . getType ( ) != null ) { it . append ( toDefaultValue ( varDeclaration . getType ( ) ) ) ; } else { it . append ( "None" ) ; // $ NON - NLS - 1 $ } if ( context . getExpectedExpressionType ( ) != null ) { it . newLine ( ) ; it . append ( "return " ) . append ( name ) ; // $ NON - NLS - 1 $ } return varDeclaration ;
public class CharBuffer { /** * Appends the contents of < code > cb < / code > to the end of this CharBuffer . * @ param cb the CharBuffer to append or null */ public void append ( final CharBuffer cb ) { } }
if ( cb == null ) { return ; } provideCapacity ( length + cb . length ) ; System . arraycopy ( cb . c , 0 , c , length , cb . length ) ; length += cb . length ;
public class PortableUtils { /** * Calculates and reads the position of the Portable object stored in a Portable array under the given index . * @ param in data input stream * @ param streamPosition streamPosition to begin the reading from * @ param cellIndex index of the cell * @ return the position of the given portable object in the stream * @ throws IOException on any stream errors */ static int getPortableArrayCellPosition ( BufferObjectDataInput in , int streamPosition , int cellIndex ) throws IOException { } }
return in . readInt ( streamPosition + cellIndex * Bits . INT_SIZE_IN_BYTES ) ;
public class DashboardService { /** * Returns the batch for the given ID . * @ param dashboardId The ID of the dashboard to retrieve . * @ return The dashboard . * @ throws IOException If the server cannot be reached . * @ throws TokenExpiredException If the token sent along with the request has expired */ public Dashboard getDashboard ( BigInteger dashboardId ) throws IOException , TokenExpiredException { } }
String requestUrl = RESOURCE + "/" + dashboardId . toString ( ) ; ArgusResponse response = getClient ( ) . executeHttpRequest ( ArgusHttpClient . RequestType . GET , requestUrl , null ) ; assertValidResponse ( response , requestUrl ) ; return fromJson ( response . getResult ( ) , Dashboard . class ) ;
public class CountedCompleter { /** * If this task has not completed , attempts to process at most the given number of other * unprocessed tasks for which this task is on the completion path , if any are known to exist . * @ param maxTasks the maximum number of tasks to process . If less than or equal to zero , then no * tasks are processed . */ public final void helpComplete ( int maxTasks ) { } }
Thread t ; ForkJoinWorkerThread wt ; if ( maxTasks > 0 && status >= 0 ) { if ( ( t = Thread . currentThread ( ) ) instanceof ForkJoinWorkerThread ) ( wt = ( ForkJoinWorkerThread ) t ) . pool . helpComplete ( wt . workQueue , this , maxTasks ) ; else ForkJoinPool . common . externalHelpComplete ( this , maxTasks ) ; }
public class DateIntervalMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DateInterval dateInterval , ProtocolMarshaller protocolMarshaller ) { } }
if ( dateInterval == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( dateInterval . getStart ( ) , START_BINDING ) ; protocolMarshaller . marshall ( dateInterval . getEnd ( ) , END_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class XMLCtor { /** * # / string _ id _ map # */ @ Override protected void initPrototypeId ( int id ) { } }
String s ; int arity ; switch ( id ) { case Id_defaultSettings : arity = 0 ; s = "defaultSettings" ; break ; case Id_settings : arity = 0 ; s = "settings" ; break ; case Id_setSettings : arity = 1 ; s = "setSettings" ; break ; default : throw new IllegalArgumentException ( String . valueOf ( id ) ) ; } initPrototypeMethod ( XMLCTOR_TAG , id , s , arity ) ;
public class AutoMlClient { /** * Lists column specs in a table spec . * < p > Sample code : * < pre > < code > * try ( AutoMlClient autoMlClient = AutoMlClient . create ( ) ) { * TableSpecName parent = TableSpecName . of ( " [ PROJECT ] " , " [ LOCATION ] " , " [ DATASET ] " , " [ TABLE _ SPEC ] " ) ; * for ( ColumnSpec element : autoMlClient . listColumnSpecs ( parent . toString ( ) ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param parent The resource name of the table spec to list column specs from . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final ListColumnSpecsPagedResponse listColumnSpecs ( String parent ) { } }
ListColumnSpecsRequest request = ListColumnSpecsRequest . newBuilder ( ) . setParent ( parent ) . build ( ) ; return listColumnSpecs ( request ) ;
public class GVRBone { /** * Pretty - print the object . */ @ Override public void prettyPrint ( StringBuffer sb , int indent ) { } }
sb . append ( Log . getSpaces ( indent ) ) ; sb . append ( GVRBone . class . getSimpleName ( ) ) ; sb . append ( " [name=" + getName ( ) + ", boneId=" + getBoneId ( ) + ", offsetMatrix=" + getOffsetMatrix ( ) + ", finalTransformMatrix=" + getFinalTransformMatrix ( ) // crashes debugger + "]" ) ; sb . append ( System . lineSeparator ( ) ) ;
public class StatementServiceImp { /** * / * ( non - Javadoc ) * @ see com . popbill . api . StatementService # getInfo ( java . lang . String , java . number . Integer , java . lang . String , java . lang . String ) */ @ Override public StatementInfo getInfo ( String CorpNum , int ItemCode , String MgtKey ) throws PopbillException { } }
if ( MgtKey == null || MgtKey . isEmpty ( ) ) throw new PopbillException ( - 99999999 , "관리번호가 입력되지 않았습니다." ) ; return httpget ( "/Statement/" + ItemCode + "/" + MgtKey , CorpNum , null , StatementInfo . class ) ;
public class AmazonDynamoDBClient { /** * Updates the provisioned throughput for the given table . * Setting the throughput for a table helps you manage performance and is * part of the Provisioned Throughput feature of Amazon DynamoDB . * @ param updateTableRequest Container for the necessary parameters to * execute the UpdateTable service method on AmazonDynamoDB . * @ return The response from the UpdateTable service method , as returned * by AmazonDynamoDB . * @ throws ResourceInUseException * @ throws LimitExceededException * @ throws InternalServerErrorException * @ throws ResourceNotFoundException * @ throws AmazonClientException * If any internal errors are encountered inside the client while * attempting to make the request or handle the response . For example * if a network connection is not available . * @ throws AmazonServiceException * If an error response is returned by AmazonDynamoDB indicating * either a problem with the data in the request , or a server side issue . */ public UpdateTableResult updateTable ( UpdateTableRequest updateTableRequest ) throws AmazonServiceException , AmazonClientException { } }
ExecutionContext executionContext = createExecutionContext ( updateTableRequest ) ; AWSRequestMetrics awsRequestMetrics = executionContext . getAwsRequestMetrics ( ) ; Request < UpdateTableRequest > request = marshall ( updateTableRequest , new UpdateTableRequestMarshaller ( ) , executionContext . getAwsRequestMetrics ( ) ) ; // Binds the request metrics to the current request . request . setAWSRequestMetrics ( awsRequestMetrics ) ; Unmarshaller < UpdateTableResult , JsonUnmarshallerContext > unmarshaller = new UpdateTableResultJsonUnmarshaller ( ) ; JsonResponseHandler < UpdateTableResult > responseHandler = new JsonResponseHandler < UpdateTableResult > ( unmarshaller ) ; return invoke ( request , responseHandler , executionContext ) ;
public class BigQuerySnippets { /** * [ VARIABLE " field " ] */ public TableResult listTableDataSchema ( String datasetName , String tableName , Schema schema , String field ) { } }
// [ START ] TableResult tableData = bigquery . listTableData ( datasetName , tableName , schema ) ; for ( FieldValueList row : tableData . iterateAll ( ) ) { row . get ( field ) ; } // [ END ] return tableData ;
public class SmartHandle { /** * Drop an argument from the handle at the given index , returning a new * SmartHandle . * @ param index index before which the dropped argument goes * @ param newName name of the argument * @ param type type of the argument * @ return a new SmartHandle with the additional argument */ public SmartHandle drop ( int index , String newName , Class < ? > type ) { } }
return new SmartHandle ( signature . insertArg ( index , newName , type ) , MethodHandles . dropArguments ( handle , index , type ) ) ;
public class ExamplesImpl { /** * Adds a labeled example to the application . * @ param appId The application ID . * @ param versionId The version ID . * @ param exampleLabelObject An example label with the expected intent and entities . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the LabelExampleResponse object */ public Observable < ServiceResponse < LabelExampleResponse > > addWithServiceResponseAsync ( UUID appId , String versionId , ExampleLabelObject exampleLabelObject ) { } }
if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgumentException ( "Parameter versionId is required and cannot be null." ) ; } if ( exampleLabelObject == null ) { throw new IllegalArgumentException ( "Parameter exampleLabelObject is required and cannot be null." ) ; } Validator . validate ( exampleLabelObject ) ; String parameterizedHost = Joiner . on ( ", " ) . join ( "{Endpoint}" , this . client . endpoint ( ) ) ; return service . add ( appId , versionId , exampleLabelObject , this . client . acceptLanguage ( ) , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < LabelExampleResponse > > > ( ) { @ Override public Observable < ServiceResponse < LabelExampleResponse > > call ( Response < ResponseBody > response ) { try { ServiceResponse < LabelExampleResponse > clientResponse = addDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class HelpCommand { /** * / * package */ static void printUsage ( PrintStream out ) { } }
out . printf ( usage ( "<COMMAND> [...]%n%n" ) ) ; out . printf ( "Available commands:%n%n" ) ; for ( CliCommand handler : sortedHandlers ( ) ) { CmdLineParser parser = new CmdLineParser ( handler ) ; out . print ( handler . getName ( ) ) ; parser . printSingleLineUsage ( out ) ; out . printf ( "%n\t%s%n" , handler . getDescription ( ) ) ; } printAvailableRuntimeSources ( out ) ;
public class CaptureSearchResult { /** * { @ code true } if HTTP response code is { @ code 2xx } . * @ return */ public boolean isHttpSuccess ( ) { } }
if ( isRevisitDigest ( ) && ( getDuplicatePayload ( ) != null ) ) { return getDuplicatePayload ( ) . isHttpSuccess ( ) ; } String httpCode = getHttpCode ( ) ; return ( httpCode . startsWith ( "2" ) ) ;
public class CheckUtil { /** * Check first . mmul ( second ) using Apache commons math mmul . Float / double matrices only . < br > * Returns true if OK , false otherwise . < br > * Checks each element according to relative error ( | a - b | / ( | a | + | b | ) ; however absolute error | a - b | must * also exceed minAbsDifference for it to be considered a failure . This is necessary to avoid instability * near 0 : i . e . , Nd4j mmul might return element of 0.0 ( due to underflow on float ) while Apache commons math * mmul might be say 1e - 30 or something ( using doubles ) . * Throws exception if matrices can ' t be multiplied * Checks each element of the result . If * @ param first First matrix * @ param second Second matrix * @ param maxRelativeDifference Maximum relative error * @ param minAbsDifference Minimum absolute difference for failure * @ return true if OK , false if result incorrect */ public static boolean checkMmul ( INDArray first , INDArray second , double maxRelativeDifference , double minAbsDifference ) { } }
if ( first . size ( 1 ) != second . size ( 0 ) ) throw new IllegalArgumentException ( "first.columns != second.rows" ) ; RealMatrix rmFirst = convertToApacheMatrix ( first ) ; RealMatrix rmSecond = convertToApacheMatrix ( second ) ; INDArray result = first . mmul ( second ) ; RealMatrix rmResult = rmFirst . multiply ( rmSecond ) ; if ( ! checkShape ( rmResult , result ) ) return false ; boolean ok = checkEntries ( rmResult , result , maxRelativeDifference , minAbsDifference ) ; if ( ! ok ) { INDArray onCopies = Shape . toOffsetZeroCopy ( first ) . mmul ( Shape . toOffsetZeroCopy ( second ) ) ; printFailureDetails ( first , second , rmResult , result , onCopies , "mmul" ) ; } return ok ;
public class MultiFieldDocument { /** * Returns the L2 norm factor of this vector ' s values . */ private void normalizeL2 ( double [ ] scores ) { } }
double square_sum = 0.0 ; for ( int i = 0 ; i < scores . length ; i ++ ) { square_sum += ( scores [ i ] * scores [ i ] ) ; } double norm = Math . sqrt ( square_sum ) ; if ( norm != 0 ) for ( int i = 0 ; i < scores . length ; i ++ ) { scores [ i ] = scores [ i ] / norm ; }
public class CommerceDiscountRelPersistenceImpl { /** * Returns the first commerce discount rel in the ordered set where commerceDiscountId = & # 63 ; and classNameId = & # 63 ; . * @ param commerceDiscountId the commerce discount ID * @ param classNameId the class name ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching commerce discount rel , or < code > null < / code > if a matching commerce discount rel could not be found */ @ Override public CommerceDiscountRel fetchByCD_CN_First ( long commerceDiscountId , long classNameId , OrderByComparator < CommerceDiscountRel > orderByComparator ) { } }
List < CommerceDiscountRel > list = findByCD_CN ( commerceDiscountId , classNameId , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ;
public class PrcRefreshItemsInList { /** * < p > Update ItemInList for Item Price . < / p > * @ param < T > item price type * @ param < I > item type * @ param pReqVars additional param * @ param pItemPrice Item Price * @ param pItemType EShopItemType * @ throws Exception - an exception */ public final < T extends AItemPrice < I , ? > , I extends IHasIdLongVersionName > void updateForItemPrice ( final Map < String , Object > pReqVars , final T pItemPrice , final EShopItemType pItemType ) throws Exception { } }
String whereStr = "where ITSTYPE=" + pItemType . ordinal ( ) + " and ITEMID=" + pItemPrice . getItem ( ) . getItsId ( ) ; ItemInList itemInList = getSrvOrm ( ) . retrieveEntityWithConditions ( pReqVars , ItemInList . class , whereStr ) ; if ( itemInList == null ) { itemInList = createItemInList ( pReqVars , pItemPrice . getItem ( ) ) ; } itemInList . setItsPrice ( pItemPrice . getItsPrice ( ) ) ; itemInList . setUnStep ( pItemPrice . getUnStep ( ) ) ; itemInList . setPreviousPrice ( pItemPrice . getPreviousPrice ( ) ) ; itemInList . setUnitOfMeasure ( pItemPrice . getUnitOfMeasure ( ) ) ; if ( itemInList . getIsNew ( ) ) { getSrvOrm ( ) . insertEntity ( pReqVars , itemInList ) ; } else { getSrvOrm ( ) . updateEntity ( pReqVars , itemInList ) ; }
public class RadioGroup { /** * ( non - Javadoc ) * @ see * qc . automation . framework . widget . IEditableField # setValue ( java . lang . String ) */ @ Override public void setValue ( Object value ) throws WidgetException { } }
try { if ( value instanceof String ) { boolean selected = false ; List < WebElement > elements = findElements ( ) ; for ( WebElement we : elements ) { if ( we . getAttribute ( "value" ) . equals ( value ) ) { we . click ( ) ; selected = true ; break ; } } if ( ! selected ) throw new WidgetException ( "Could not find desired option to select" , getLocator ( ) ) ; } else { throw new WidgetException ( "Invalid type. 'value' must be a 'String' type of desired option to select" , getLocator ( ) ) ; } } catch ( Exception e ) { throw new WidgetException ( "Error while selecting option on radio group" , getLocator ( ) , e ) ; }
public class LTernaryOperatorBuilder { /** * Builds the functional interface implementation and if previously provided calls the consumer . */ @ Nonnull public final LTernaryOperator < T > build ( ) { } }
final LTernaryOperator < T > eventuallyFinal = this . eventually ; LTernaryOperator < T > retval ; final Case < LTriPredicate < T , T , T > , LTernaryOperator < T > > [ ] casesArray = cases . toArray ( new Case [ cases . size ( ) ] ) ; retval = LTernaryOperator . < T > ternaryOp ( ( a1 , a2 , a3 ) -> { try { for ( Case < LTriPredicate < T , T , T > , LTernaryOperator < T > > aCase : casesArray ) { if ( aCase . casePredicate ( ) . test ( a1 , a2 , a3 ) ) { return aCase . caseFunction ( ) . apply ( a1 , a2 , a3 ) ; } } return eventuallyFinal . apply ( a1 , a2 , a3 ) ; } catch ( Error e ) { // NOSONAR throw e ; } catch ( Throwable e ) { // NOSONAR throw Handler . handleOrPropagate ( e , handling ) ; } } ) ; if ( consumer != null ) { consumer . accept ( retval ) ; } return retval ;
public class Resources { /** * Returns a { @ code URL } pointing to { @ code resourceName } if the resource is found using the * { @ linkplain Thread # getContextClassLoader ( ) context class loader } . In simple environments , the * context class loader will find resources from the class path . In environments where different * threads can have different class loaders , for example app servers , the context class loader * will typically have been set to an appropriate loader for the current thread . * < p > In the unusual case where the context class loader is null , the class loader that loaded * this class ( { @ code Resources } ) will be used instead . * @ throws IllegalArgumentException if the resource is not found */ public static URL getResource ( String resourceName ) { } }
final ClassLoader contextClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; final ClassLoader loader = contextClassLoader == null ? Resources . class . getClassLoader ( ) : contextClassLoader ; final URL url = loader . getResource ( resourceName ) ; if ( url == null ) { throw new IllegalArgumentException ( "resource " + resourceName + " not found." ) ; } return url ;
public class Services { /** * Run the dependency graph for the services . * @ param roots filled with the services that have no dependency . * @ param infraServices filled with the infrastructure services . * @ param freeServices filled with the services that are executed before / after all the dependent services . * @ param accessors permits to retreive information on the services . */ @ SuppressWarnings ( "checkstyle:npathcomplexity" ) private static void runDependencyGraph ( Queue < DependencyNode > roots , List < Service > infraServices , List < Service > freeServices , Accessors accessors ) { } }
final boolean async = accessors . isAsyncStateWaitingEnabled ( ) ; final Set < Class < ? extends Service > > executed = new TreeSet < > ( Comparators . CLASS_COMPARATOR ) ; accessors . runInfrastructureServicesBefore ( infraServices ) ; accessors . runFreeServicesBefore ( freeServices ) ; while ( ! roots . isEmpty ( ) ) { final DependencyNode node = roots . remove ( ) ; assert node != null && node . getType ( ) != null ; if ( ! executed . contains ( node . getType ( ) ) ) { executed . add ( node . getType ( ) ) ; roots . addAll ( node . getNextServices ( ) ) ; roots . addAll ( node . getNextWeakServices ( ) ) ; assert node . getService ( ) != null ; if ( async ) { for ( final WeakReference < DependencyNode > asyncService : node . getAsyncStateServices ( ) ) { final AsyncStateService as = ( AsyncStateService ) ( asyncService . get ( ) . getService ( ) ) ; assert as != null ; while ( ! as . isReadyForOtherServices ( ) ) { Thread . yield ( ) ; } } } accessors . run ( node . getService ( ) ) ; } } accessors . runFreeServicesAfter ( freeServices ) ; accessors . runInfrastructureServicesAfter ( infraServices ) ;
public class SSLEngineImpl { /** * Wraps a buffer . Does a variety of checks before grabbing * the wrapLock , which blocks multiple wraps from occuring . */ public SSLEngineResult wrap ( ByteBuffer [ ] appData , int offset , int length , ByteBuffer netData ) throws SSLException { } }
EngineArgs ea = new EngineArgs ( appData , offset , length , netData ) ; /* * We can be smarter about using smaller buffer sizes later . * For now , force it to be large enough to handle any * valid SSL / TLS record . */ if ( netData . remaining ( ) < outputRecord . maxRecordSize ) { return new SSLEngineResult ( Status . BUFFER_OVERFLOW , getHSStatus ( null ) , 0 , 0 ) ; } try { synchronized ( wrapLock ) { return writeAppRecord ( ea ) ; } } catch ( Exception e ) { ea . resetPos ( ) ; fatal ( Alerts . alert_internal_error , "problem wrapping app data" , e ) ; return null ; // make compiler happy } finally { /* * Just in case something didn ' t reset limits properly . */ ea . resetLim ( ) ; }
public class JQMPage { /** * Logical add operation . If you do this you are responsible for adding it * to the DOM yourself . * @ param child * the child widget to be added */ protected void addLogical ( Widget child ) { } }
// Detach new child . child . removeFromParent ( ) ; // Logical attach . getChildren ( ) . add ( child ) ; // Adopt . adopt ( child ) ;
public class TransitionManager { /** * Convenience method to simply change to the given scene using * the given transition . * < p > Passing in < code > null < / code > for the transition parameter will * result in the scene changing without any transition running , and is * equivalent to calling { @ link Scene # exit ( ) } on the scene root ' s * current scene , followed by { @ link Scene # enter ( ) } on the scene * specified by the < code > scene < / code > parameter . < / p > * @ param scene The Scene to change to * @ param transition The transition to use for this scene change . A * value of null causes the scene change to happen with no transition . */ public static void go ( @ NonNull Scene scene , @ Nullable Transition transition ) { } }
changeScene ( scene , transition ) ;
public class RendererUtils { /** * Invokes getConvertedUISelectManyValue ( ) with considerValueType = false , thus * implementing the standard behavior of the spec ( valueType comes from Tomahawk ) . * @ param facesContext * @ param selectMany * @ param submittedValue * @ return * @ throws ConverterException */ public static Object getConvertedUISelectManyValue ( FacesContext facesContext , UISelectMany selectMany , Object submittedValue ) throws ConverterException { } }
// do not consider the valueType attribute return getConvertedUISelectManyValue ( facesContext , selectMany , submittedValue , false ) ;
public class CPDefinitionInventoryLocalServiceBaseImpl { /** * Adds the cp definition inventory to the database . Also notifies the appropriate model listeners . * @ param cpDefinitionInventory the cp definition inventory * @ return the cp definition inventory that was added */ @ Indexable ( type = IndexableType . REINDEX ) @ Override public CPDefinitionInventory addCPDefinitionInventory ( CPDefinitionInventory cpDefinitionInventory ) { } }
cpDefinitionInventory . setNew ( true ) ; return cpDefinitionInventoryPersistence . update ( cpDefinitionInventory ) ;
public class CodeReviewEvaluatorLegacy { /** * Return an empty response in error situation * @ param repoItem the repo item * @ param scmBranch the scrm branch * @ param scmUrl the scm url * @ return code review audit response */ protected CodeReviewAuditResponse getErrorResponse ( CollectorItem repoItem , String scmBranch , String scmUrl ) { } }
CodeReviewAuditResponse noPRsCodeReviewAuditResponse = new CodeReviewAuditResponse ( ) ; noPRsCodeReviewAuditResponse . addAuditStatus ( COLLECTOR_ITEM_ERROR ) ; noPRsCodeReviewAuditResponse . setLastUpdated ( repoItem . getLastUpdated ( ) ) ; noPRsCodeReviewAuditResponse . setScmBranch ( scmBranch ) ; noPRsCodeReviewAuditResponse . setScmUrl ( scmUrl ) ; noPRsCodeReviewAuditResponse . setErrorMessage ( repoItem . getErrors ( ) . get ( 0 ) . getErrorMessage ( ) ) ; return noPRsCodeReviewAuditResponse ;
public class FileMovingUtil { /** * Create a temporary File object . Prefix the name of the base file with an * underscore . */ private static File createTempFile ( File baseFile ) { } }
File parentDirectory = baseFile . getParentFile ( ) ; String filename = baseFile . getName ( ) ; return new File ( parentDirectory , '_' + filename ) ;
public class Coordinate { /** * Tests if another coordinate has the same values for the X and Y ordinates . The Z ordinate is * ignored . * @ param c * a < code > Coordinate < / code > with which to do the 2D comparison . * @ param tolerance * margin of error * @ return true if < code > other < / code > is a < code > Coordinate < / code > with the same values for X * and Y . */ public boolean equals2D ( final Coordinate c , final double tolerance ) { } }
if ( ! equalsWithTolerance ( this . getX ( ) , c . getX ( ) , tolerance ) ) { return false ; } if ( ! equalsWithTolerance ( this . getY ( ) , c . getY ( ) , tolerance ) ) { return false ; } return true ;
public class CharInfo { /** * Factory that reads in a resource file that describes the mapping of * characters to entity references . * Resource files must be encoded in UTF - 8 and have a format like : * < pre > * # First char # is a comment * Entity numericValue * quot 34 * amp 38 * < / pre > * ( Note : Why don ' t we just switch to . properties files ? Oct - 01 - sc ) * @ param entitiesResource Name of entities resource file that should * be loaded , which describes that mapping of characters to entity references . * @ param method the output method type , which should be one of " xml " , " html " , " text " . . . * @ xsl . usage internal */ static CharInfo getCharInfo ( String entitiesFileName , String method ) { } }
CharInfo charInfo = ( CharInfo ) m_getCharInfoCache . get ( entitiesFileName ) ; if ( charInfo != null ) { return mutableCopyOf ( charInfo ) ; } // try to load it internally - cache try { charInfo = getCharInfoBasedOnPrivilege ( entitiesFileName , method , true ) ; // Put the common copy of charInfo in the cache , but return // a copy of it . m_getCharInfoCache . put ( entitiesFileName , charInfo ) ; return mutableCopyOf ( charInfo ) ; } catch ( Exception e ) { } // try to load it externally - do not cache try { return getCharInfoBasedOnPrivilege ( entitiesFileName , method , false ) ; } catch ( Exception e ) { } String absoluteEntitiesFileName ; if ( entitiesFileName . indexOf ( ':' ) < 0 ) { absoluteEntitiesFileName = SystemIDResolver . getAbsoluteURIFromRelative ( entitiesFileName ) ; } else { try { absoluteEntitiesFileName = SystemIDResolver . getAbsoluteURI ( entitiesFileName , null ) ; } catch ( TransformerException te ) { throw new WrappedRuntimeException ( te ) ; } } return getCharInfoBasedOnPrivilege ( entitiesFileName , method , false ) ;
public class DocServiceBuilder { /** * Adds the { @ link DocServiceFilter } that checks whether a method will be < b > excluded < / b > while building * { @ link DocService } . The { @ link DocServiceFilter } will be invoked with the plugin , service and * method name . The rule is as follows : * < ul > * < li > No { @ link # include ( DocServiceFilter ) } and { @ link # exclude ( DocServiceFilter ) } is called - * include all methods . < / li > * < li > Only { @ link # exclude ( DocServiceFilter ) } is called - * include all methods except the methods which the exclusion filter returns { @ code true } . < / li > * < li > Only { @ link # include ( DocServiceFilter ) } is called - * include the methods which the inclusion filter returns { @ code true } . < / li > * < li > { @ link # include ( DocServiceFilter ) } and { @ link # exclude ( DocServiceFilter ) } is called - * include the methods which the inclusion filter returns { @ code true } and the exclusion filter * returns { @ code false } . < / li > * < / ul > * < P > Note that this can be called multiple times and the { @ link DocServiceFilter } s are composed using * { @ link DocServiceFilter # or ( DocServiceFilter ) } and { @ link DocServiceFilter # and ( DocServiceFilter ) } . * @ see # exclude ( DocServiceFilter ) * @ see DocService to find out how DocService generates documentaion */ public DocServiceBuilder exclude ( DocServiceFilter filter ) { } }
requireNonNull ( filter , "filter" ) ; if ( excludeFilter == NO_SERVICE ) { excludeFilter = filter ; } else { excludeFilter = excludeFilter . or ( filter ) ; } return this ;
public class StreamEx { /** * Returns a stream consisting of the results of applying the given function * to the every adjacent pair of elements of this stream . * This is a < a href = " package - summary . html # StreamOps " > quasi - intermediate < / a > * operation . * The output stream will contain one element less than this stream . If this * stream contains zero or one element the output stream will be empty . * @ param < R > The element type of the new stream * @ param mapper a non - interfering , stateless function to apply to each * adjacent pair of this stream elements . * @ return the new stream * @ since 0.2.1 */ public < R > StreamEx < R > pairMap ( BiFunction < ? super T , ? super T , ? extends R > mapper ) { } }
PSOfRef < T , R > spliterator = new PairSpliterator . PSOfRef < > ( mapper , spliterator ( ) ) ; return new StreamEx < > ( spliterator , context ) ;
public class UIViewRoot { /** * null checks . */ private void notifyAfter ( FacesContext context , PhaseId phaseId ) { } }
if ( getAfterPhaseListener ( ) != null || phaseListenerIterator != null ) { notifyPhaseListeners ( context , phaseId , false ) ; }
public class DateUtils { /** * Checks the hour , minute and second are equal . */ @ SuppressWarnings ( "deprecation" ) public static boolean timeEquals ( java . util . Date d1 , java . util . Date d2 ) { } }
if ( d1 == null || d2 == null ) { return false ; } return d1 . getHours ( ) == d2 . getHours ( ) && d1 . getMinutes ( ) == d2 . getMinutes ( ) && d1 . getSeconds ( ) == d2 . getSeconds ( ) ;
public class PipelineApi { /** * Get a list of the project pipeline _ schedules for the specified project . * < pre > < code > GET / projects / : id / pipeline _ schedules < / code > < / pre > * @ param projectIdOrPath projectIdOrPath the project in the form of an Integer ( ID ) , String ( path ) , or Project instance , required * @ return a list of pipeline schedules for the specified project * @ throws GitLabApiException if any exception occurs */ public List < PipelineSchedule > getPipelineSchedules ( Object projectIdOrPath ) throws GitLabApiException { } }
return ( getPipelineSchedules ( projectIdOrPath , getDefaultPerPage ( ) ) . all ( ) ) ;
public class VCProjectHolder { /** * Return a { @ link List } of { @ link VCProject } beans for a given platform / configuration pair . Each { @ link VCProject } * bean holds properties for a parsed Visual C + + project . * @ param platform the platform to use for parsing ( for example , { @ code Win32 } , { @ code x64 } ) * @ param configuration the configuration to use for parsing ( for example , { @ code Release } , { @ code Debug } ) * @ return a { @ link List } of { @ link VCProject } s that hold properties for parsed Visual C + + projects * @ throws IOException if the input file does not exists or cannot be accessed , see * { @ link VCProjectHolder # VCProjectHolder ( inputFile , isSolution ) } * @ throws ParserConfigurationException if a parser cannot be created which satisfies the requested configuration * @ throws ParseException if an error occurs during parsing * @ throws SAXException if a SAX parsing error occurs */ public List < VCProject > getParsedProjects ( String platform , String configuration ) throws IOException , ParserConfigurationException , ParseException , SAXException { } }
String key = platform + "-" + configuration ; List < VCProject > vcProjects = parsedVCProjects . get ( key ) ; if ( vcProjects == null ) { if ( isSolution ) { vcProjects = parseVCSolution ( inputFile , platform , configuration ) ; } else { vcProjects = Arrays . asList ( parseStandaloneVCProject ( inputFile , platform , configuration ) ) ; } parsedVCProjects . put ( key , vcProjects ) ; } return vcProjects ;
public class TypeContainer { /** * Check if a StampedValue already exists for the type , if it does , return it , * otherwise create a new one and add it * @ param type * @ return */ public StampedValue asType ( final Type type ) { } }
StampedValue cachedValue = null ; // looping around a list is probably quicker than having a map since there are probably only one or two different // types in use at any one time for ( StampedValue value : typeCache ) { if ( value . getType ( ) . equals ( type ) ) { cachedValue = value ; break ; } } if ( cachedValue == null ) { StampedValue newValue = new StampedValue ( type , this , config ) ; typeCache . add ( newValue ) ; cachedValue = newValue ; } return cachedValue ;
public class JsonReader { /** * remap field name in custom classes * @ param fromJson * field name in json * @ param toJava * field name in Java * @ since 2.1.1 */ public < T > void remapField ( Class < T > type , String fromJson , String toJava ) { } }
JsonReaderI < T > map = this . getMapper ( type ) ; if ( ! ( map instanceof MapperRemapped ) ) { map = new MapperRemapped < T > ( map ) ; registerReader ( type , map ) ; } ( ( MapperRemapped < T > ) map ) . renameField ( fromJson , toJava ) ;
public class Matrix3d { /** * Set this matrix to be a simple scale matrix , which scales all axes uniformly by the given factor . * The resulting matrix can be multiplied against another transformation * matrix to obtain an additional scaling . * In order to post - multiply a scaling transformation directly to a * matrix , use { @ link # scale ( double ) scale ( ) } instead . * @ see # scale ( double ) * @ param factor * the scale factor in x , y and z * @ return this */ public Matrix3d scaling ( double factor ) { } }
m00 = factor ; m01 = 0.0 ; m02 = 0.0 ; m10 = 0.0 ; m11 = factor ; m12 = 0.0 ; m20 = 0.0 ; m21 = 0.0 ; m22 = factor ; return this ;
public class CoverageDataTiffImage { /** * Get the pixel at the coordinate * @ param x * x coordinate * @ param y * y coordinate * @ return pixel value */ public float getPixel ( int x , int y ) { } }
float pixel = - 1 ; if ( rasters == null ) { readPixels ( ) ; } if ( rasters != null ) { pixel = rasters . getFirstPixelSample ( x , y ) . floatValue ( ) ; } else { throw new GeoPackageException ( "Could not retrieve pixel value" ) ; } return pixel ;
public class JCurand { /** * < pre > * Generate uniformly distributed floats . * Use generator to generate num float results into the device memory at * outputPtr . The device memory must have been previously allocated and be * large enough to hold all the results . Launches are done with the stream * set using : : curandSetStream ( ) , or the null stream if no stream has been set . * Results are 32 - bit floating point values between 0.0f and 1.0f , * excluding 0.0f and including 1.0f . * @ param generator - Generator to use * @ param outputPtr - Pointer to device memory to store CUDA - generated results , or * Pointer to host memory to store CPU - generated results * @ param num - Number of floats to generate * @ return * CURAND _ STATUS _ NOT _ INITIALIZED if the generator was never created * CURAND _ STATUS _ PREEXISTING _ FAILURE if there was an existing error from * a previous kernel launch * CURAND _ STATUS _ LAUNCH _ FAILURE if the kernel launch failed for any reason * CURAND _ STATUS _ LENGTH _ NOT _ MULTIPLE if the number of output samples is * not a multiple of the quasirandom dimension * CURAND _ STATUS _ SUCCESS if the results were generated successfully * < / pre > */ public static int curandGenerateUniform ( curandGenerator generator , Pointer outputPtr , long num ) { } }
return checkResult ( curandGenerateUniformNative ( generator , outputPtr , num ) ) ;
public class DenseTensorBuilder { /** * Gets a { @ code TensorFactory } which creates { @ code DenseTensorBuilder } s . * @ return */ public static TensorFactory getFactory ( ) { } }
return new TensorFactory ( ) { @ Override public TensorBuilder getBuilder ( int [ ] dimNums , int [ ] dimSizes ) { return new DenseTensorBuilder ( dimNums , dimSizes ) ; } } ;
public class MeterValue { /** * Return the underlying value of the SLA in form suitable to apply to the given meter * type . * @ param meterType the meter type * @ return the value or { @ code null } if the value cannot be applied */ public Long getValue ( Meter . Type meterType ) { } }
if ( meterType == Meter . Type . DISTRIBUTION_SUMMARY ) { return getDistributionSummaryValue ( ) ; } if ( meterType == Meter . Type . TIMER ) { return getTimerValue ( ) ; } return null ;
public class Modal { /** * Add a modal component in the RootPaneContainer . * @ param rootPane * the RootPaneContainer * @ param component * the component for modal * @ param listener * the listener for modal * @ param modalDepth * the depth for modal */ private static void addModal_ ( RootPaneContainer rootPane , Component component , ModalListener listener , Integer modalDepth ) { } }
synchronized ( modals ) { if ( isModal ( component ) == false ) { getModal ( rootPane ) . addModal ( component , listener , modalDepth ) ; } }
public class ThrottledApiHandler { /** * Get a listing of leagues for the specified teams * @ param teamIds The ids of the team * @ return A mapping of team ids to lists of leagues * @ see < a href = https : / / developer . riotgames . com / api / methods # ! / 593/1860 > Official API documentation < / a > */ public Future < Map < String , List < LeagueList > > > getLeagues ( String ... teamIds ) { } }
return new ApiFuture < > ( ( ) -> handler . getLeagues ( teamIds ) ) ;
public class ClassFileImporter { /** * Imports packages via { @ link Locations # ofPackage ( String ) } * < br > < br > * For information about the impact of the imported classes on the evaluation of rules , * as well as configuration and details , refer to { @ link ClassFileImporter } . */ @ PublicAPI ( usage = ACCESS ) public JavaClasses importPackages ( Collection < String > packages ) { } }
Set < Location > locations = new HashSet < > ( ) ; for ( String pkg : packages ) { locations . addAll ( Locations . ofPackage ( pkg ) ) ; } return importLocations ( locations ) ;
public class StaticTypeCheckingSupport { /** * Given a receiver and a method node , parameterize the method arguments using * available generic type information . * @ param receiver the class * @ param m the method * @ return the parameterized arguments */ public static Parameter [ ] parameterizeArguments ( final ClassNode receiver , final MethodNode m ) { } }
Map < GenericsTypeName , GenericsType > genericFromReceiver = GenericsUtils . extractPlaceholders ( receiver ) ; Map < GenericsTypeName , GenericsType > contextPlaceholders = extractGenericsParameterMapOfThis ( m ) ; Parameter [ ] methodParameters = m . getParameters ( ) ; Parameter [ ] params = new Parameter [ methodParameters . length ] ; for ( int i = 0 ; i < methodParameters . length ; i ++ ) { Parameter methodParameter = methodParameters [ i ] ; ClassNode paramType = methodParameter . getType ( ) ; params [ i ] = buildParameter ( genericFromReceiver , contextPlaceholders , methodParameter , paramType ) ; } return params ;
public class ClassCache { /** * Returns the logger in use . * @ returnthe logger */ public synchronized Logger getLogger ( ) { } }
if ( m_Logger == null ) { m_Logger = Logger . getLogger ( getClass ( ) . getName ( ) ) ; m_Logger . setLevel ( LoggingHelper . getLevel ( getClass ( ) ) ) ; } return m_Logger ;
public class appflowaction { /** * Use this API to update appflowaction . */ public static base_response update ( nitro_service client , appflowaction resource ) throws Exception { } }
appflowaction updateresource = new appflowaction ( ) ; updateresource . name = resource . name ; updateresource . collectors = resource . collectors ; updateresource . comment = resource . comment ; return updateresource . update_resource ( client ) ;
public class LoggedInUserManager { /** * Manually log out the specified user * @ param sUserID * The user ID to log out * @ return { @ link EChange } if something changed */ @ Nonnull public EChange logoutUser ( @ Nullable final String sUserID ) { } }
LoginInfo aInfo ; m_aRWLock . writeLock ( ) . lock ( ) ; try { aInfo = m_aLoggedInUsers . remove ( sUserID ) ; if ( aInfo == null ) { AuditHelper . onAuditExecuteSuccess ( "logout" , sUserID , "user-not-logged-in" ) ; return EChange . UNCHANGED ; } // Ensure that the SessionUser is empty . This is only relevant if user is // manually logged out without destructing the underlying session final InternalSessionUserHolder aSUH = InternalSessionUserHolder . _getInstanceIfInstantiatedInScope ( aInfo . getSessionScope ( ) ) ; if ( aSUH != null ) aSUH . _reset ( ) ; // Set logout time - in case somebody has a strong reference to the // LoginInfo object aInfo . setLogoutDTNow ( ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "Logged out " + _getUserIDLogText ( sUserID ) + " after " + Duration . between ( aInfo . getLoginDT ( ) , aInfo . getLogoutDT ( ) ) . toString ( ) ) ; AuditHelper . onAuditExecuteSuccess ( "logout" , sUserID ) ; // Execute callback as the very last action m_aUserLogoutCallbacks . forEach ( aCB -> aCB . onUserLogout ( aInfo ) ) ; return EChange . CHANGED ;
public class ImageCache { /** * Enables / disables a layer for caching . * @ param layerName * name of the WMS layer * @ param enabled * is true if want to cache */ public void setEnabled ( String layerName , boolean enabled ) { } }
synchronized ( this ) { if ( enabled ) layers . add ( layerName ) ; else layers . remove ( layerName ) ; }
public class RestartStrategyFactory { /** * Creates a { @ link RestartStrategy } instance from the given { @ link org . apache . flink . api . common . restartstrategy . RestartStrategies . RestartStrategyConfiguration } . * @ param restartStrategyConfiguration Restart strategy configuration which specifies which * restart strategy to instantiate * @ return RestartStrategy instance */ public static RestartStrategy createRestartStrategy ( RestartStrategies . RestartStrategyConfiguration restartStrategyConfiguration ) { } }
if ( restartStrategyConfiguration instanceof RestartStrategies . NoRestartStrategyConfiguration ) { return new NoRestartStrategy ( ) ; } else if ( restartStrategyConfiguration instanceof RestartStrategies . FixedDelayRestartStrategyConfiguration ) { RestartStrategies . FixedDelayRestartStrategyConfiguration fixedDelayConfig = ( RestartStrategies . FixedDelayRestartStrategyConfiguration ) restartStrategyConfiguration ; return new FixedDelayRestartStrategy ( fixedDelayConfig . getRestartAttempts ( ) , fixedDelayConfig . getDelayBetweenAttemptsInterval ( ) . toMilliseconds ( ) ) ; } else if ( restartStrategyConfiguration instanceof RestartStrategies . FailureRateRestartStrategyConfiguration ) { RestartStrategies . FailureRateRestartStrategyConfiguration config = ( RestartStrategies . FailureRateRestartStrategyConfiguration ) restartStrategyConfiguration ; return new FailureRateRestartStrategy ( config . getMaxFailureRate ( ) , config . getFailureInterval ( ) , config . getDelayBetweenAttemptsInterval ( ) ) ; } else if ( restartStrategyConfiguration instanceof RestartStrategies . FallbackRestartStrategyConfiguration ) { return null ; } else { throw new IllegalArgumentException ( "Unknown restart strategy configuration " + restartStrategyConfiguration + "." ) ; }
public class CompositeTypeSerializerUtil { /** * Delegates compatibility checks to a { @ link CompositeTypeSerializerSnapshot } instance . * This can be used by legacy snapshot classes , which have a newer implementation * implemented as a { @ link CompositeTypeSerializerSnapshot } . * @ param newSerializer the new serializer to check for compatibility . * @ param newCompositeSnapshot an instance of the new snapshot class to delegate compatibility checks to . * This instance should already contain the outer snapshot information . * @ param legacyNestedSnapshots the nested serializer snapshots of the legacy composite snapshot . * @ return the result compatibility . */ public static < T > TypeSerializerSchemaCompatibility < T > delegateCompatibilityCheckToNewSnapshot ( TypeSerializer < T > newSerializer , CompositeTypeSerializerSnapshot < T , ? extends TypeSerializer > newCompositeSnapshot , TypeSerializerSnapshot < ? > ... legacyNestedSnapshots ) { } }
checkArgument ( legacyNestedSnapshots . length > 0 ) ; return newCompositeSnapshot . internalResolveSchemaCompatibility ( newSerializer , legacyNestedSnapshots ) ;
public class HelloWorld { /** * Creates a ClassFile which defines a simple interactive HelloWorld class . * @ param className name given to class */ private static RuntimeClassFile createClassFile ( ) { } }
// Create a ClassFile with the super class of Object . RuntimeClassFile cf = new RuntimeClassFile ( ) ; // Default constructor works only if super class has an accessible // no - arg constructor . cf . addDefaultConstructor ( ) ; // Add the main method , and construct a CodeBuilder for defining the // bytecode . TypeDesc [ ] params = new TypeDesc [ ] { TypeDesc . STRING . toArrayType ( ) } ; MethodInfo mi = cf . addMethod ( Modifiers . PUBLIC_STATIC , "main" , null , params ) ; CodeBuilder b = new CodeBuilder ( mi ) ; // Create some types which will be needed later . TypeDesc bufferedReader = TypeDesc . forClass ( "java.io.BufferedReader" ) ; TypeDesc inputStreamReader = TypeDesc . forClass ( "java.io.InputStreamReader" ) ; TypeDesc inputStream = TypeDesc . forClass ( "java.io.InputStream" ) ; TypeDesc reader = TypeDesc . forClass ( "java.io.Reader" ) ; TypeDesc stringBuffer = TypeDesc . forClass ( "java.lang.StringBuffer" ) ; TypeDesc printStream = TypeDesc . forClass ( "java.io.PrintStream" ) ; // Declare local variables to be used . LocalVariable in = b . createLocalVariable ( "in" , bufferedReader ) ; LocalVariable name = b . createLocalVariable ( "name" , TypeDesc . STRING ) ; // Create the first line of code , corresponding to // in = new BufferedReader ( new InputStreamReader ( System . in ) ) ; b . newObject ( bufferedReader ) ; b . dup ( ) ; b . newObject ( inputStreamReader ) ; b . dup ( ) ; b . loadStaticField ( "java.lang.System" , "in" , inputStream ) ; params = new TypeDesc [ ] { inputStream } ; b . invokeConstructor ( inputStreamReader . getRootName ( ) , params ) ; params = new TypeDesc [ ] { reader } ; b . invokeConstructor ( bufferedReader . getRootName ( ) , params ) ; b . storeLocal ( in ) ; // Create and locate a label for the start of the " try " block . Label tryStart = b . createLabel ( ) . setLocation ( ) ; // Create input prompt . b . loadStaticField ( "java.lang.System" , "out" , printStream ) ; b . loadConstant ( "Please enter your name> " ) ; params = new TypeDesc [ ] { TypeDesc . STRING } ; b . invokeVirtual ( printStream , "print" , null , params ) ; // Read a line from the reader , and store it in the " name " variable . b . loadLocal ( in ) ; b . invokeVirtual ( bufferedReader , "readLine" , TypeDesc . STRING , null ) ; b . storeLocal ( name ) ; // If no exception is thrown , branch to a label to print the // response . The location of the label has not yet been set . Label printResponse = b . createLabel ( ) ; b . branch ( printResponse ) ; // Create and locate a label for the end of the " try " block . Label tryEnd = b . createLabel ( ) . setLocation ( ) ; // Create the " catch " block . b . exceptionHandler ( tryStart , tryEnd , "java.io.IOException" ) ; b . returnVoid ( ) ; // If no exception , then branch to this location to print the response . printResponse . setLocation ( ) ; // Create the line of code , corresponding to // System . out . println ( " Hello , " + name ) ; b . loadStaticField ( "java.lang.System" , "out" , printStream ) ; b . newObject ( stringBuffer ) ; b . dup ( ) ; b . loadConstant ( "Hello, " ) ; params = new TypeDesc [ ] { TypeDesc . STRING } ; b . invokeConstructor ( stringBuffer , params ) ; b . loadLocal ( name ) ; b . invokeVirtual ( stringBuffer , "append" , stringBuffer , params ) ; b . invokeVirtual ( stringBuffer , "toString" , TypeDesc . STRING , null ) ; params = new TypeDesc [ ] { TypeDesc . STRING } ; b . invokeVirtual ( printStream , "println" , null , params ) ; // The last instruction reached must be a return or else the class // verifier will complain . b . returnVoid ( ) ; return cf ;
public class OPFChecks { /** * Checks is a service has been described in the AndroidManifest . xml file . * @ param context The instance of { @ link android . content . Context } . * @ param service The checked service . */ @ SuppressWarnings ( "PMD.PreserveStackTrace" ) public static void checkService ( @ NonNull final Context context , @ NonNull final ComponentName service ) { } }
final PackageManager packageManager = context . getPackageManager ( ) ; try { packageManager . getServiceInfo ( service , 0 ) ; } catch ( PackageManager . NameNotFoundException e ) { throw new IllegalStateException ( "Service " + service . getClassName ( ) + " hasn't been declared in AndroidManifest.xml" ) ; }
public class ODocumentModel { /** * Get { @ link ORID } of a stored { @ link ODocument } * @ return identifactor { @ link ORID } */ public ORID getIdentity ( ) { } }
if ( orid != null ) return orid ; ODocument doc = getObject ( ) ; return doc != null ? doc . getIdentity ( ) : null ;
public class Functions { /** * Fluent integer concat operation using primitive types * e . g . * < pre > * { @ code * import static cyclops . ReactiveSeq . concatDoubles ; * ReactiveSeq . ofDoubles ( 1d , 2d , 3d ) * . to ( concatDoubles ( ReactiveSeq . ofDoubles ( 5,6,7,8,9 ) ) ) ; * / / [ 1d , 2d , 3d , 5d , 6d , 7d , 8d , 9d ] * < / pre > */ public static Function < ? super ReactiveSeq < Double > , ? extends ReactiveSeq < Double > > concatDoubles ( ReactiveSeq < Double > b ) { } }
return a -> ReactiveSeq . fromSpliterator ( DoubleStream . concat ( a . mapToDouble ( i -> i ) , b . mapToDouble ( i -> i ) ) . spliterator ( ) ) ;
public class Basic1DMatrix { /** * Decodes { @ link Basic1DMatrix } from the given byte { @ code array } . * @ param array the byte array representing a matrix * @ return a decoded matrix */ public static Basic1DMatrix fromBinary ( byte [ ] array ) { } }
ByteBuffer buffer = ByteBuffer . wrap ( array ) ; if ( buffer . get ( ) != MATRIX_TAG ) { throw new IllegalArgumentException ( "Can not decode Basic1DMatrix from the given byte array." ) ; } int rows = buffer . getInt ( ) ; int columns = buffer . getInt ( ) ; int capacity = rows * columns ; double [ ] values = new double [ capacity ] ; for ( int i = 0 ; i < capacity ; i ++ ) { values [ i ] = buffer . getDouble ( ) ; } return new Basic1DMatrix ( rows , columns , values ) ;
public class ParsingModelIo { /** * Saves the model into another file . * @ param targetFile the target file ( may not exist ) * @ param relationsFile the relations file * @ param writeComments true to write comments * @ param lineSeparator the line separator ( if null , the OS ' one is used ) * @ throws IOException if the file could not be saved */ public static void saveRelationsFileInto ( File targetFile , FileDefinition relationsFile , boolean writeComments , String lineSeparator ) throws IOException { } }
String s = writeConfigurationFile ( relationsFile , writeComments , lineSeparator ) ; Utils . copyStream ( new ByteArrayInputStream ( s . getBytes ( StandardCharsets . UTF_8 ) ) , targetFile ) ;
public class Logging { /** * For each device , save its current logging Level then set it to OFF */ public void stop_logging ( ) { } }
Vector dl = Util . instance ( ) . get_device_list ( "*" ) ; for ( Object aDl : dl ) { ( ( DeviceImpl ) aDl ) . stop_logging ( ) ; }
public class WorkflowExecutionSignaledEventAttributesMarshaller { /** * Marshall the given parameter object . */ public void marshall ( WorkflowExecutionSignaledEventAttributes workflowExecutionSignaledEventAttributes , ProtocolMarshaller protocolMarshaller ) { } }
if ( workflowExecutionSignaledEventAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( workflowExecutionSignaledEventAttributes . getSignalName ( ) , SIGNALNAME_BINDING ) ; protocolMarshaller . marshall ( workflowExecutionSignaledEventAttributes . getInput ( ) , INPUT_BINDING ) ; protocolMarshaller . marshall ( workflowExecutionSignaledEventAttributes . getExternalWorkflowExecution ( ) , EXTERNALWORKFLOWEXECUTION_BINDING ) ; protocolMarshaller . marshall ( workflowExecutionSignaledEventAttributes . getExternalInitiatedEventId ( ) , EXTERNALINITIATEDEVENTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AbstractConsistencyFixer { /** * Decide on the specific key - value to write everywhere . * @ param nodeValues * @ return The subset of entries from nodeValues that need to be repaired . */ private List < NodeValue < ByteArray , byte [ ] > > resolveReadConflicts ( final List < NodeValue < ByteArray , byte [ ] > > nodeValues ) { } }
if ( logger . isTraceEnabled ( ) ) { logger . trace ( "NodeValues passed into resolveReadConflicts." ) ; if ( nodeValues . size ( ) == 0 ) { logger . trace ( "Empty nodeValues passed to resolveReadConflicts" ) ; } for ( NodeValue < ByteArray , byte [ ] > nodeValue : nodeValues ) { logger . trace ( "\t" + nodeValue . getNodeId ( ) + " - " + nodeValue . getKey ( ) . toString ( ) + " - " + nodeValue . getVersion ( ) . toString ( ) ) ; } } // If orphaned values exist , add them to fake nodes to be processed by // " getRepairs " int currentFakeNodeId = fakeNodeID ; if ( this . orphanedValues != null ) { for ( Versioned < byte [ ] > value : this . orphanedValues . getValues ( ) ) { nodeValues . add ( new NodeValue < ByteArray , byte [ ] > ( currentFakeNodeId , this . orphanedValues . getKey ( ) , value ) ) ; currentFakeNodeId ++ ; } } // Some cut - paste - and - modify coding from // store / routed / action / AbstractReadRepair . java and // store / routed / ThreadPoolRoutedStore . java ReadRepairer < ByteArray , byte [ ] > readRepairer = new ReadRepairer < ByteArray , byte [ ] > ( ) ; List < NodeValue < ByteArray , byte [ ] > > nodeKeyValues = readRepairer . getRepairs ( nodeValues ) ; if ( logger . isTraceEnabled ( ) ) { if ( nodeKeyValues . size ( ) == 0 ) { logger . trace ( "\treadRepairer returned an empty list." ) ; } for ( NodeValue < ByteArray , byte [ ] > nodeKeyValue : nodeKeyValues ) { logger . trace ( "\tNodeKeyValue result from readRepairer.getRepairs : " + ByteUtils . toHexString ( nodeKeyValue . getKey ( ) . get ( ) ) + " on node with id " + nodeKeyValue . getNodeId ( ) + " for version " + nodeKeyValue . getVersion ( ) ) ; } } List < NodeValue < ByteArray , byte [ ] > > toReadRepair = Lists . newArrayList ( ) ; for ( NodeValue < ByteArray , byte [ ] > v : nodeKeyValues ) { if ( v . getNodeId ( ) > currentFakeNodeId ) { // Only copy repairs intended for real nodes . Versioned < byte [ ] > versioned = Versioned . value ( v . getVersioned ( ) . getValue ( ) , ( ( VectorClock ) v . getVersion ( ) ) . clone ( ) ) ; toReadRepair . add ( new NodeValue < ByteArray , byte [ ] > ( v . getNodeId ( ) , v . getKey ( ) , versioned ) ) ; } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "\tIgnoring repair to fake node: " + ByteUtils . toHexString ( v . getKey ( ) . get ( ) ) + " on node with id " + v . getNodeId ( ) + " for version " + v . getVersion ( ) ) ; } } } if ( logger . isTraceEnabled ( ) ) { if ( toReadRepair . size ( ) == 0 ) { logger . trace ( "\ttoReadRepair is empty." ) ; } for ( NodeValue < ByteArray , byte [ ] > nodeKeyValue : toReadRepair ) { logger . trace ( "\tRepair key " + ByteUtils . toHexString ( nodeKeyValue . getKey ( ) . get ( ) ) + " on node with id " + nodeKeyValue . getNodeId ( ) + " for version " + nodeKeyValue . getVersion ( ) ) ; } } return toReadRepair ;
public class DBCPPoolAdapter { /** * { @ inheritDoc } */ @ Override protected boolean isAcquireTimeoutException ( Exception e ) { } }
return e . getMessage ( ) != null && Pattern . matches ( ACQUIRE_TIMEOUT_MESSAGE , e . getMessage ( ) ) ;
public class L3ToSBGNPDConverter { /** * Gets the members of the Complex that needs to be displayed in a flattened view . * @ param cx to get members * @ return members to display */ private Set < PhysicalEntity > getFlattenedMembers ( Complex cx ) { } }
Set < PhysicalEntity > set = new HashSet < PhysicalEntity > ( ) ; for ( PhysicalEntity mem : cx . getComponent ( ) ) { if ( mem instanceof Complex ) { if ( ! hasNonComplexMember ( ( Complex ) mem ) ) { set . add ( mem ) ; } else { set . addAll ( getFlattenedMembers ( ( Complex ) mem ) ) ; } } else set . add ( mem ) ; } return set ;
public class IO { /** * Copy input to output and close the output stream before returning */ public static int copyAndCloseOutput ( Reader input , Writer output ) throws IOException { } }
try { return copy ( input , output ) ; } finally { output . close ( ) ; }
public class HttpChannelConfig { /** * Check the configuration to see if the remoteIp element has been configured * to consider forwarding header values in the NCSA Access Log * @ param props */ private void parseRemoteIp ( Map < Object , Object > props ) { } }
Object value = props . get ( HttpConfigConstants . PROPNAME_REMOTE_IP ) ; if ( null != value ) { this . useForwardingHeaders = convertBoolean ( value ) ; if ( this . useForwardingHeaders && ( TraceComponent . isAnyTracingEnabled ( ) ) && ( tc . isEventEnabled ( ) ) ) { Tr . event ( tc , "HTTP Channel Config: remoteIp has been enabled" ) ; } }
public class BlurBuilder { /** * / * GETTER METHODS * * * * * */ public JobDescription into ( final ImageView imageView ) { } }
if ( data . placeholder != Dali . NO_RESID ) { imageView . setImageResource ( data . placeholder ) ; } return start ( new BlurWorker . BlurWorkerListener ( ) { @ Override public void onResult ( final BlurWorker . Result result ) { // run on ui thread because we need to modify ui uiThreadHandler . post ( new Runnable ( ) { @ Override public void run ( ) { if ( result . isError ( ) ) { Log . e ( TAG , "Could not set into imageview" , result . getThrowable ( ) ) ; if ( data . errorResId == Dali . NO_RESID ) { imageView . setImageResource ( data . errorResId ) ; } } else { if ( data . alphaFadeIn ) { // use what is currently in the imageview to fade Drawable placeholder ; Drawable oldDrawable = imageView . getDrawable ( ) ; if ( oldDrawable != null ) { if ( oldDrawable instanceof LayerDrawable ) { LayerDrawable oldLayerDrawable = ( LayerDrawable ) oldDrawable ; placeholder = oldLayerDrawable . getDrawable ( 0 ) ; } else { placeholder = imageView . getDrawable ( ) ; } } else { placeholder = new ColorDrawable ( Color . parseColor ( "#00FFFFFF" ) ) ; } final TransitionDrawable transition = new TransitionDrawable ( new Drawable [ ] { placeholder , new BitmapDrawable ( data . contextWrapper . getResources ( ) , result . getBitmap ( ) ) } ) ; imageView . setImageDrawable ( transition ) ; transition . startTransition ( FADE_IN_MS ) ; // after the transition set only the processed bitmap to avoid keeping both images in memory } else { imageView . setImageDrawable ( new BitmapDrawable ( data . contextWrapper . getResources ( ) , result . getBitmap ( ) ) ) ; } } } } ) ; } } ) ;
public class cudaError { /** * Returns the String identifying the given cudaError * @ param error The cudaError * @ return The String identifying the given cudaError */ public static String stringFor ( int error ) { } }
switch ( error ) { case cudaSuccess : return "cudaSuccess" ; case cudaErrorMissingConfiguration : return "cudaErrorMissingConfiguration" ; case cudaErrorMemoryAllocation : return "cudaErrorMemoryAllocation" ; case cudaErrorInitializationError : return "cudaErrorInitializationError" ; case cudaErrorLaunchFailure : return "cudaErrorLaunchFailure" ; case cudaErrorPriorLaunchFailure : return "cudaErrorPriorLaunchFailure" ; case cudaErrorLaunchTimeout : return "cudaErrorLaunchTimeout" ; case cudaErrorLaunchOutOfResources : return "cudaErrorLaunchOutOfResources" ; case cudaErrorInvalidDeviceFunction : return "cudaErrorInvalidDeviceFunction" ; case cudaErrorInvalidConfiguration : return "cudaErrorInvalidConfiguration" ; case cudaErrorInvalidDevice : return "cudaErrorInvalidDevice" ; case cudaErrorInvalidValue : return "cudaErrorInvalidValue" ; case cudaErrorInvalidPitchValue : return "cudaErrorInvalidPitchValue" ; case cudaErrorInvalidSymbol : return "cudaErrorInvalidSymbol" ; case cudaErrorMapBufferObjectFailed : return "cudaErrorMapBufferObjectFailed" ; case cudaErrorUnmapBufferObjectFailed : return "cudaErrorUnmapBufferObjectFailed" ; case cudaErrorInvalidHostPointer : return "cudaErrorInvalidHostPointer" ; case cudaErrorInvalidDevicePointer : return "cudaErrorInvalidDevicePointer" ; case cudaErrorInvalidTexture : return "cudaErrorInvalidTexture" ; case cudaErrorInvalidTextureBinding : return "cudaErrorInvalidTextureBinding" ; case cudaErrorInvalidChannelDescriptor : return "cudaErrorInvalidChannelDescriptor" ; case cudaErrorInvalidMemcpyDirection : return "cudaErrorInvalidMemcpyDirection" ; case cudaErrorAddressOfConstant : return "cudaErrorAddressOfConstant" ; case cudaErrorTextureFetchFailed : return "cudaErrorTextureFetchFailed" ; case cudaErrorTextureNotBound : return "cudaErrorTextureNotBound" ; case cudaErrorSynchronizationError : return "cudaErrorSynchronizationError" ; case cudaErrorInvalidFilterSetting : return "cudaErrorInvalidFilterSetting" ; case cudaErrorInvalidNormSetting : return "cudaErrorInvalidNormSetting" ; case cudaErrorMixedDeviceExecution : return "cudaErrorMixedDeviceExecution" ; case cudaErrorCudartUnloading : return "cudaErrorCudartUnloading" ; case cudaErrorUnknown : return "cudaErrorUnknown" ; case cudaErrorNotYetImplemented : return "cudaErrorNotYetImplemented" ; case cudaErrorMemoryValueTooLarge : return "cudaErrorMemoryValueTooLarge" ; case cudaErrorInvalidResourceHandle : return "cudaErrorInvalidResourceHandle" ; case cudaErrorNotReady : return "cudaErrorNotReady" ; case cudaErrorInsufficientDriver : return "cudaErrorInsufficientDriver" ; case cudaErrorSetOnActiveProcess : return "cudaErrorSetOnActiveProcess" ; case cudaErrorInvalidSurface : return "cudaErrorInvalidSurface" ; case cudaErrorNoDevice : return "cudaErrorNoDevice" ; case cudaErrorECCUncorrectable : return "cudaErrorECCUncorrectable" ; case cudaErrorSharedObjectSymbolNotFound : return "cudaErrorSharedObjectSymbolNotFound" ; case cudaErrorSharedObjectInitFailed : return "cudaErrorSharedObjectInitFailed" ; case cudaErrorUnsupportedLimit : return "cudaErrorUnsupportedLimit" ; case cudaErrorDuplicateVariableName : return "cudaErrorDuplicateVariableName" ; case cudaErrorDuplicateTextureName : return "cudaErrorDuplicateTextureName" ; case cudaErrorDuplicateSurfaceName : return "cudaErrorDuplicateSurfaceName" ; case cudaErrorDevicesUnavailable : return "cudaErrorDevicesUnavailable" ; case cudaErrorInvalidKernelImage : return "cudaErrorInvalidKernelImage" ; case cudaErrorNoKernelImageForDevice : return "cudaErrorNoKernelImageForDevice" ; case cudaErrorIncompatibleDriverContext : return "cudaErrorIncompatibleDriverContext" ; case cudaErrorPeerAccessAlreadyEnabled : return "cudaErrorPeerAccessAlreadyEnabled" ; case cudaErrorPeerAccessNotEnabled : return "cudaErrorPeerAccessNotEnabled" ; case cudaErrorDeviceAlreadyInUse : return "cudaErrorDeviceAlreadyInUse" ; case cudaErrorProfilerDisabled : return "cudaErrorProfilerDisabled" ; case cudaErrorProfilerNotInitialized : return "cudaErrorProfilerNotInitialized" ; case cudaErrorProfilerAlreadyStarted : return "cudaErrorProfilerAlreadyStarted" ; case cudaErrorProfilerAlreadyStopped : return "cudaErrorProfilerAlreadyStopped" ; case cudaErrorAssert : return "cudaErrorAssert" ; case cudaErrorTooManyPeers : return "cudaErrorTooManyPeers" ; case cudaErrorHostMemoryAlreadyRegistered : return "cudaErrorHostMemoryAlreadyRegistered" ; case cudaErrorHostMemoryNotRegistered : return "cudaErrorHostMemoryNotRegistered" ; case cudaErrorOperatingSystem : return "cudaErrorOperatingSystem" ; case cudaErrorPeerAccessUnsupported : return "cudaErrorPeerAccessUnsupported" ; case cudaErrorLaunchMaxDepthExceeded : return "cudaErrorLaunchMaxDepthExceeded" ; case cudaErrorLaunchFileScopedTex : return "cudaErrorLaunchFileScopedTex" ; case cudaErrorLaunchFileScopedSurf : return "cudaErrorLaunchFileScopedSurf" ; case cudaErrorSyncDepthExceeded : return "cudaErrorSyncDepthExceeded" ; case cudaErrorLaunchPendingCountExceeded : return "cudaErrorLaunchPendingCountExceeded" ; case cudaErrorNotPermitted : return "cudaErrorNotPermitted" ; case cudaErrorNotSupported : return "cudaErrorNotSupported" ; case cudaErrorHardwareStackError : return "cudaErrorHardwareStackError" ; case cudaErrorIllegalInstruction : return "cudaErrorIllegalInstruction" ; case cudaErrorMisalignedAddress : return "cudaErrorMisalignedAddress" ; case cudaErrorInvalidAddressSpace : return "cudaErrorInvalidAddressSpace" ; case cudaErrorInvalidPc : return "cudaErrorInvalidPc" ; case cudaErrorIllegalAddress : return "cudaErrorIllegalAddress" ; case cudaErrorInvalidPtx : return "cudaErrorInvalidPtx" ; case cudaErrorInvalidGraphicsContext : return "cudaErrorInvalidGraphicsContext" ; case cudaErrorNvlinkUncorrectable : return "cudaErrorNvlinkUncorrectable" ; case cudaErrorJitCompilerNotFound : return "cudaErrorJitCompilerNotFound" ; case cudaErrorCooperativeLaunchTooLarge : return "cudaErrorCooperativeLaunchTooLarge" ; case cudaErrorSystemNotReady : return "cudaErrorSystemNotReady" ; case cudaErrorIllegalState : return "cudaErrorIllegalState" ; case cudaErrorStartupFailure : return "cudaErrorStartupFailure" ; case cudaErrorStreamCaptureUnsupported : return "cudaErrorStreamCaptureUnsupported" ; case cudaErrorStreamCaptureInvalidated : return "cudaErrorStreamCaptureInvalidated" ; case cudaErrorStreamCaptureMerge : return "cudaErrorStreamCaptureMerge" ; case cudaErrorStreamCaptureUnmatched : return "cudaErrorStreamCaptureUnmatched" ; case cudaErrorStreamCaptureUnjoined : return "cudaErrorStreamCaptureUnjoined" ; case cudaErrorStreamCaptureIsolation : return "cudaErrorStreamCaptureIsolation" ; case cudaErrorStreamCaptureImplicit : return "cudaErrorStreamCaptureImplicit" ; case cudaErrorCapturedEvent : return "cudaErrorCapturedEvent" ; case jcudaInternalError : return "jcudaInternalError" ; } if ( error >= cudaErrorApiFailureBase ) { return stringFor ( error - cudaErrorApiFailureBase ) ; } return "INVALID cudaError: " + error ;
public class Strands { /** * Disables the current strand for scheduling purposes unless the * permit is available . * If the permit is available then it is consumed and the call returns * immediately ; otherwise * the current strand becomes disabled for scheduling * purposes and lies dormant until one of three things happens : * < ul > * < li > Some other strand invokes { @ link # unpark unpark } with the * current strand as the target ; or * < li > Some other strand interrupts * the current strand ; or * < li > The call spuriously ( that is , for no reason ) returns . * < / ul > * This method does < em > not < / em > report which of these caused the * method to return . Callers should re - check the conditions which caused * the strand to park in the first place . Callers may also determine , * for example , the interrupt status of the strand upon return . * @ param blocker the synchronization object responsible for this strand parking */ public static void park ( Object blocker ) { } }
try { Strand . park ( blocker ) ; } catch ( SuspendExecution e ) { throw RuntimeSuspendExecution . of ( e ) ; }
public class GraphPath { /** * Remove the path ' s elements before the * specified one which is starting * at the specified point . The specified element will * not be removed . * < p > This function removes until the < i > first occurence < / i > * of the given object . * @ param obj is the segment to remove * @ param pt is the point on which the segment was connected * as its first point . * @ return < code > true < / code > on success , otherwise < code > false < / code > */ @ Override public boolean removeBefore ( ST obj , PT pt ) { } }
return removeUntil ( indexOf ( obj , pt ) , false ) ;
public class SshConnector { /** * See { @ link connect ( SshTransport , String ) } for full details . This method * optionally allows you to specify a context to use . Normally you would * reused an { @ link SshConnector } instead of calling this method directly . * @ param transport * SshTransport * @ param username * String * @ param context * SshContext * @ return SshClient * @ throws SshException */ public SshClient connect ( SshTransport transport , String username , SshContext context ) throws SshException { } }
return connect ( transport , username , false , context ) ;
public class GreenPepperXmlRpcClient { /** * { @ inheritDoc } */ @ SuppressWarnings ( "unchecked" ) public Set < Reference > getReferences ( Specification specification , String identifier ) throws GreenPepperServerException { } }
Vector params = CollectionUtil . toVector ( specification . marshallize ( ) ) ; log . debug ( "Retrieving Specification " + specification . getName ( ) + " References" ) ; Vector < Object > referencesParams = ( Vector < Object > ) execute ( XmlRpcMethodName . getSpecificationReferences , params , identifier ) ; return XmlRpcDataMarshaller . toReferencesList ( referencesParams ) ;
public class VpnSitesInner { /** * Deletes a VpnSite . * @ param resourceGroupName The resource group name of the VpnSite . * @ param vpnSiteName The name of the VpnSite being deleted . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws ErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void beginDelete ( String resourceGroupName , String vpnSiteName ) { } }
beginDeleteWithServiceResponseAsync ( resourceGroupName , vpnSiteName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class KeyProvider { /** * Gets a asymmetric encryption private key from the key store * @ param alias key alias * @ param password key password * @ return the private key */ public PrivateKey getPrivateKey ( String alias , String password ) { } }
Key key = getKey ( alias , password ) ; if ( key instanceof PrivateKey ) { return ( PrivateKey ) key ; } else { throw new IllegalStateException ( format ( "Key with alias '%s' was not a private key, but was: %s" , alias , key . getClass ( ) . getSimpleName ( ) ) ) ; }
public class AbstractXCodeMojo { /** * Calls a shell script in order to zip a folder . We have to call a shell script as Java cannot * zip symbolic links . * @ param rootDir * the directory where the zip command shall be executed * @ param zipSubFolder * the subfolder to be zipped * @ param zipFileName * the name of the zipFile ( will be located in the rootDir ) * @ param archiveFolder * an optional folder name if the zipSubFolder folder shall be placed inside the zip into * a parent folder * @ return the zip file * @ throws MojoExecutionException */ protected File zipSubfolder ( File rootDir , String zipSubFolder , String zipFileName , String archiveFolder ) throws MojoExecutionException { } }
int resultCode = 0 ; try { File scriptDirectory = new File ( project . getBuild ( ) . getDirectory ( ) , "scripts" ) . getCanonicalFile ( ) ; scriptDirectory . deleteOnExit ( ) ; if ( archiveFolder != null ) { resultCode = ScriptRunner . copyAndExecuteScript ( System . out , "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh" , scriptDirectory , rootDir . getCanonicalPath ( ) , zipSubFolder , zipFileName , archiveFolder ) ; } else { resultCode = ScriptRunner . copyAndExecuteScript ( System . out , "/com/sap/prd/mobile/ios/mios/zip-subfolder.sh" , scriptDirectory , rootDir . getCanonicalPath ( ) , zipSubFolder , zipFileName ) ; } } catch ( Exception ex ) { throw new MojoExecutionException ( "Cannot create zip file " + zipFileName + ". Check log for details." , ex ) ; } if ( resultCode != 0 ) { throw new MojoExecutionException ( "Cannot create zip file " + zipFileName + ". Check log for details." ) ; } getLog ( ) . info ( "Zip file '" + zipFileName + "' created." ) ; return new File ( rootDir , zipFileName ) ;
public class MultiLineLabel { /** * Called when the label has changed in some meaningful way and we ' d accordingly like to * re - layout the label , update our component ' s size , and repaint everything to suit . */ protected void layoutLabel ( ) { } }
Graphics2D gfx = ( Graphics2D ) getGraphics ( ) ; if ( gfx != null ) { // re - layout the label _label . layout ( gfx ) ; gfx . dispose ( ) ; // note that we ' re no longer dirty _dirty = false ; }
public class Clock { /** * Adds the given TimeSection to the list of areas . * Areas in the Medusa library usually are more eye - catching * than Sections . * @ param AREA */ public void addArea ( final TimeSection AREA ) { } }
if ( null == AREA ) return ; areas . add ( AREA ) ; Collections . sort ( areas , new TimeSectionComparator ( ) ) ; fireUpdateEvent ( SECTION_EVENT ) ;
public class ExpressionReader { /** * Increments the mark over white spaces */ public void skipWhitespaces ( ) { } }
for ( int i = mark ; i < chars . length ; i ++ ) { if ( Character . isWhitespace ( chars [ i ] ) ) { mark ++ ; } else { break ; } }
public class ParentsArray { /** * Whether the directed graph ( including an implicit wall node ) denoted by this parents array is * fully connected . If a singly - headed directed graph is connected it must also be acyclic . */ public static boolean isConnectedAndAcyclic ( int [ ] parents ) { } }
int numVisited = 0 ; // 1 - indexed array indicating whether each node ( including the wall at position 0 ) has been visited . boolean [ ] visited = new boolean [ parents . length + 1 ] ; Arrays . fill ( visited , false ) ; // Visit the nodes reachable from the wall in a pre - order traversal . IntStack stack = new IntStack ( ) ; stack . push ( - 1 ) ; while ( stack . size ( ) > 0 ) { // Pop off the current node from the stack . int cur = stack . pop ( ) ; if ( visited [ cur + 1 ] == true ) { continue ; } // Mark it as visited . visited [ cur + 1 ] = true ; numVisited ++ ; // Push the current node ' s unvisited children onto the stack . for ( int i = 0 ; i < parents . length ; i ++ ) { if ( parents [ i ] == cur && visited [ i + 1 ] == false ) { stack . push ( i ) ; } } } return numVisited == parents . length + 1 ;
public class MaybeLens { /** * Given a lens and a default < code > S < / code > , lift < code > S < / code > into { @ link Maybe } . * Note that this lens is NOT lawful , since " putting back what you got changes nothing " fails for any value * < code > B < / code > where < code > S < / code > is { @ link Maybe # nothing ( ) } . * @ param lens the lens * @ param defaultS the S to use if { @ link Maybe # nothing ( ) } is given * @ param < S > the type of the " larger " value for reading * @ param < T > the type of the " larger " value for putting * @ param < A > the type of the " smaller " value that is read * @ param < B > the type of the " smaller " update value * @ return the lens with S lifted */ public static < S , T , A , B > Lens < Maybe < S > , T , A , B > liftS ( Lens < S , T , A , B > lens , S defaultS ) { } }
return lens . mapS ( m -> m . orElse ( defaultS ) ) ;
public class ValueAnimator { /** * The type evaluator to be used when calculating the animated values of this animation . * The system will automatically assign a float or int evaluator based on the type * of < code > startValue < / code > and < code > endValue < / code > in the constructor . But if these values * are not one of these primitive types , or if different evaluation is desired ( such as is * necessary with int values that represent colors ) , a custom evaluator needs to be assigned . * For example , when running an animation on color values , the { @ link ArgbEvaluator } * should be used to get correct RGB color interpolation . * < p > If this ValueAnimator has only one set of values being animated between , this evaluator * will be used for that set . If there are several sets of values being animated , which is * the case if PropertyValuesHOlder objects were set on the ValueAnimator , then the evaluator * is assigned just to the first PropertyValuesHolder object . < / p > * @ param value the evaluator to be used this animation */ public void setEvaluator ( TypeEvaluator value ) { } }
if ( value != null && mValues != null && mValues . length > 0 ) { mValues [ 0 ] . setEvaluator ( value ) ; }
public class QueryLimitOverride { /** * Iterates over the list of overrides and return the first that matches or * the default if no match is found . * NOTE : The set of expressions is not sorted so if more than one regex * matches the string , the result is indeterministic . * If the metric is null or empty , the default limit is returned . * @ param metric The string to match * @ return The matched or default limit . */ public synchronized long getByteLimit ( final String metric ) { } }
if ( metric == null || metric . isEmpty ( ) ) { return default_byte_limit ; } for ( final QueryLimitOverrideItem item : overrides . values ( ) ) { if ( item . matches ( metric ) ) { return item . getByteLimit ( ) ; } } return default_byte_limit ;
public class HerokuAPI { /** * List all apps for a team . * @ param team The name or id of the team . * @ return a list of apps */ public Range < Invoice > listTeamInvoices ( String team ) { } }
return connection . execute ( new TeamInvoiceList ( team ) , apiKey ) ;
public class AbstractRegionPainter { /** * Get the paint to use for a focus ring . * @ param s the shape to paint . * @ param focusType the focus type . * @ param useToolBarFocus whether we should use the colors for a toolbar control . * @ return the paint to use to paint the focus ring . */ public Paint getFocusPaint ( Shape s , FocusType focusType , boolean useToolBarFocus ) { } }
if ( focusType == FocusType . OUTER_FOCUS ) { return useToolBarFocus ? outerToolBarFocus : outerFocus ; } else { return useToolBarFocus ? innerToolBarFocus : innerFocus ; }
public class GraknConsole { /** * Invocation from bash script ' . / grakn console ' */ public static void main ( String [ ] args ) { } }
try { GraknConsole console = new GraknConsole ( Arrays . copyOfRange ( args , 1 , args . length ) , System . out , System . err ) ; console . run ( ) ; System . exit ( 0 ) ; } catch ( GraknConsoleException e ) { System . err . println ( e . getMessage ( ) ) ; System . err . println ( "Cause: " + e . getCause ( ) . getClass ( ) . getName ( ) ) ; System . err . println ( e . getCause ( ) . getMessage ( ) ) ; System . exit ( 1 ) ; } catch ( GraknException e ) { // TODO : don ' t do if - checks . Use different catch - clauses by class if ( e . getMessage ( ) . startsWith ( Status . Code . UNAVAILABLE . name ( ) ) ) { System . err . println ( ErrorMessage . COULD_NOT_CONNECT . getMessage ( ) ) ; } else { e . printStackTrace ( System . err ) ; } System . exit ( 1 ) ; } catch ( Exception e ) { e . printStackTrace ( System . err ) ; System . exit ( 1 ) ; }
public class UpdateInstanceRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateInstanceRequest updateInstanceRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateInstanceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateInstanceRequest . getInstanceId ( ) , INSTANCEID_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getLayerIds ( ) , LAYERIDS_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getInstanceType ( ) , INSTANCETYPE_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getAutoScalingType ( ) , AUTOSCALINGTYPE_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getHostname ( ) , HOSTNAME_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getOs ( ) , OS_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getAmiId ( ) , AMIID_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getSshKeyName ( ) , SSHKEYNAME_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getArchitecture ( ) , ARCHITECTURE_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getInstallUpdatesOnBoot ( ) , INSTALLUPDATESONBOOT_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getEbsOptimized ( ) , EBSOPTIMIZED_BINDING ) ; protocolMarshaller . marshall ( updateInstanceRequest . getAgentVersion ( ) , AGENTVERSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class FluentCloseableIterable { /** * Returns a fluent iterable that applies { @ code function } to each element of this * fluent iterable . * < p > The returned fluent iterable ' s iterator supports { @ code remove ( ) } if this iterable ' s * iterator does . After a successful { @ code remove ( ) } call , this fluent iterable no longer * contains the corresponding element . */ public final < E > FluentCloseableIterable < E > transform ( Function < ? super T , ? extends E > function ) { } }
return from ( CloseableIterables . transform ( this , function ) ) ;
public class HypergraphSorter { /** * Turns a bit vector into a 3 - hyperedge . * @ param bv a bit vector . * @ param seed the seed for the hash function . * @ param numVertices the number of vertices in the underlying hypergraph . * @ param e an array to store the resulting edge . * @ see # bitVectorToEdge ( BitVector , long , int , int , int [ ] ) */ public static void bitVectorToEdge ( final BitVector bv , final long seed , final int numVertices , final int e [ ] ) { } }
bitVectorToEdge ( bv , seed , numVertices , ( int ) ( numVertices * 0xAAAAAAABL >>> 33 ) , e ) ; // Fast division by 3
public class AdminLinkProviderForUserRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( AdminLinkProviderForUserRequest adminLinkProviderForUserRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( adminLinkProviderForUserRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( adminLinkProviderForUserRequest . getUserPoolId ( ) , USERPOOLID_BINDING ) ; protocolMarshaller . marshall ( adminLinkProviderForUserRequest . getDestinationUser ( ) , DESTINATIONUSER_BINDING ) ; protocolMarshaller . marshall ( adminLinkProviderForUserRequest . getSourceUser ( ) , SOURCEUSER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class InfluxUtil { /** * Validation function , to check if an iterable is sorted with ascending * timestamps . * @ param tscIterable An iterable type . * @ return True iff the iterable is sorted , false otherwise . */ static boolean isSorted ( Iterable < ? extends TimeSeriesCollection > tscIterable ) { } }
final Iterator < ? extends TimeSeriesCollection > iter = tscIterable . iterator ( ) ; if ( ! iter . hasNext ( ) ) return true ; // Empty collection is ordered . DateTime timestamp = iter . next ( ) . getTimestamp ( ) ; while ( iter . hasNext ( ) ) { final DateTime nextTimestamp = iter . next ( ) . getTimestamp ( ) ; if ( ! nextTimestamp . isAfter ( timestamp ) ) return false ; timestamp = nextTimestamp ; } return true ;
public class RecycleManager { /** * Get all recycled widgets */ public List < Widget > getRecycledWidgets ( ) { } }
List < Widget > widgets = new ArrayList < > ( ) ; for ( Integer recycledIndex : recycledWidgets . keySet ( ) ) { widgets . addAll ( recycledWidgets . get ( recycledIndex ) ) ; } return widgets ;
public class ToStream { /** * If this method is called , the serializer is used as a * DTDHandler , which changes behavior how the serializer * handles document entities . * @ see org . xml . sax . DTDHandler # notationDecl ( java . lang . String , java . lang . String , java . lang . String ) */ public void notationDecl ( String name , String pubID , String sysID ) throws SAXException { } }
// TODO Auto - generated method stub try { DTDprolog ( ) ; m_writer . write ( "<!NOTATION " ) ; m_writer . write ( name ) ; if ( pubID != null ) { m_writer . write ( " PUBLIC \"" ) ; m_writer . write ( pubID ) ; } else { m_writer . write ( " SYSTEM \"" ) ; m_writer . write ( sysID ) ; } m_writer . write ( "\" >" ) ; m_writer . write ( m_lineSep , 0 , m_lineSepLen ) ; } catch ( IOException e ) { // TODO Auto - generated catch block e . printStackTrace ( ) ; }
public class Quaternion { /** * Performs a great circle interpolation between this quaternion * and the quaternion parameter and places the result into this * quaternion . * @ param q1 the other quaternion * @ param alpha the alpha interpolation parameter */ public final void interpolate ( Quaternion q1 , double alpha ) { } }
// From " Advanced Animation and Rendering Techniques " // by Watt and Watt pg . 364 , function as implemented appeared to be // incorrect . Fails to choose the same quaternion for the double // covering . Resulting in change of direction for rotations . // Fixed function to negate the first quaternion in the case that the // dot product of q1 and this is negative . Second case was not needed . double dot , s1 , s2 , om , sinom ; dot = this . x * q1 . x + this . y * q1 . y + this . z * q1 . z + this . w * q1 . w ; if ( dot < 0 ) { // negate quaternion q1 . x = - q1 . x ; q1 . y = - q1 . y ; q1 . z = - q1 . z ; q1 . w = - q1 . w ; dot = - dot ; } if ( ( 1.0 - dot ) > EPS ) { om = Math . acos ( dot ) ; sinom = Math . sin ( om ) ; s1 = Math . sin ( ( 1.0 - alpha ) * om ) / sinom ; s2 = Math . sin ( alpha * om ) / sinom ; } else { s1 = 1.0 - alpha ; s2 = alpha ; } this . w = ( s1 * this . w + s2 * q1 . w ) ; this . x = ( s1 * this . x + s2 * q1 . x ) ; this . y = ( s1 * this . y + s2 * q1 . y ) ; this . z = ( s1 * this . z + s2 * q1 . z ) ;
public class BatchUnparsedResponse { /** * Reads an HTTP response line ( ISO - 8859-1 encoding ) . * @ return The line that was read , including CRLF . */ private String readRawLine ( ) throws IOException { } }
int b = inputStream . read ( ) ; if ( b == - 1 ) { return null ; } else { StringBuilder buffer = new StringBuilder ( ) ; for ( ; b != - 1 ; b = inputStream . read ( ) ) { buffer . append ( ( char ) b ) ; if ( b == '\n' ) { break ; } } return buffer . toString ( ) ; }
public class JdbcTemplateTool { /** * 获取总行数 * get count * @ param sql * @ param params * @ return */ public int count ( String sql , Object [ ] params ) { } }
int rowCount = 0 ; try { Map < String , Object > resultMap = null ; if ( params == null || params . length == 0 ) { resultMap = getProxy ( ) . queryForMap ( sql ) ; } else { resultMap = getProxy ( ) . queryForMap ( sql , params ) ; } Iterator < Map . Entry < String , Object > > it = resultMap . entrySet ( ) . iterator ( ) ; if ( it . hasNext ( ) ) { Map . Entry < String , Object > entry = it . next ( ) ; rowCount = ( ( Long ) entry . getValue ( ) ) . intValue ( ) ; } } catch ( EmptyResultDataAccessException e ) { } return rowCount ;
public class Years { /** * / * [ deutsch ] * < p > Interpretiert das kanonische ISO - 8601 - Format & quot ; PnY & quot ; mit optionalem vorangehenden Minus - Zeichen . < / p > * @ param period the formatted string to be parsed * @ return parsed instance * @ throws ParseException if given argument cannot be parsed */ public static Years < CalendarUnit > parseGregorian ( String period ) throws ParseException { } }
int amount = SingleUnitTimeSpan . parsePeriod ( period , 'Y' ) ; return Years . ofGregorian ( amount ) ;
public class ManagedBeanOBase { /** * Creates the bean instance using either the ManagedObjectFactory or constructor . */ private void createInstance ( ) throws InvocationTargetException { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "createInstance" ) ; ManagedObjectFactory < ? > ejbManagedObjectFactory = home . beanMetaData . ivEnterpriseBeanFactory ; if ( ejbManagedObjectFactory != null ) { createInstanceUsingMOF ( ejbManagedObjectFactory ) ; } else { createInstanceUsingConstructor ( ) ; } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "createInstance" ) ;